TelegramPWA/dist/7768.f44562ed129e56f88168.js
Alexander Zinchuk c30d0cd144 [Build]
2024-08-29 15:54:32 +02:00

2 lines
430 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[7768],{83134:(e,t,a)=>{a.r(t),a.d(t,{LockScreen:()=>ld,Main:()=>rd});var s=a(13439),n=a(31481),o=a(82393),i=(a(48544),a(42347)),r=a(23174),c=a(89925),d=a(85982),l=a(46275),u=a(62076),m=a(14487),h=a(87894),p=a(60343),g=a(47985),y=a(37836),f=a(4875),I=a(59589),A=a(46205),v=a(32989),b=a(29807),w=a(22986),S=a(97312),C=a(26129),E=a(43503),M=a(76023);const k=32*M.$,P=45.5*M.$,T=26.5*M.$,x=16*M.$,N=16.125*M.$;var B=a(16350),U=a(26149),F=a(43874);function R(e,t){return t-((0,b.nTw)(e).isLeftColumnShown&&!(0,F.Ny)()?e.leftColumnWidth||((a=E.A.get().width)>n.gQx?Math.min(Math.max(.25*a,x),.33*a):a>n.j7z?Math.min(Math.max(.33*a,x),.4*a):T):0);var a}function L(e,t,a){const s=(0,b.nZ4)(e,t.chatId),n=t.reactions||{results:[],areTags:s},o=(0,b.VF$)(e,t.chatId),i=(0,I.AK)(n.results,a);let{recentReactions:r=[]}=n;return r.length&&(r=r.filter((t=>{let{isOwn:a,peerId:s}=t;return!a&&s!==e.currentUserId}))),a.forEach((t=>{const{currentUserId:a}=e;r.unshift({peerId:o?.id||a,reaction:t,addedDate:Math.floor(Date.now()/1e3),isOwn:!0})})),(0,U.r3)(e,t.chatId,t.id,{reactions:{...n,results:i,recentReactions:r}})}function J(e,t,a){return(0,B.wi)(e,t,a,!0)}const O=350;function D(e,t,a,s,n,o,i,r){const c=r?.reactions;if(c&&(0,w.T)(n,c))return e;if(e=(0,A.r3)(e,a,s,{reactions:n}),!i)return e;const{reaction:d,isOwn:l,isUnread:u}=n.recentReactions?.[0]??{};if((0,b.xYJ)(e,"reactionEffects")&&r&&d&&u&&!l){const e=(0,p.bj)(r);t.startActiveReaction({containerId:e,reaction:d,tabId:(0,m.g0)()})}const h=o.unreadReactions?.includes(s),g=(0,I.pU)(e,n);if(g&&!h){e=J(e,a,{unreadReactionsCount:(o?.unreadReactionsCount||0)+1,unreadReactions:[...o?.unreadReactions||[],s].sort(((e,t)=>t-e))});const t=(0,b.O5q)(e,a,s);if(!o||!t)return e;(0,y.aj)((()=>{(0,S.Oq)({chat:o,message:t,isReaction:!0})}))}return!g&&h&&(e=J(e,a,{unreadReactionsCount:(o?.unreadReactionsCount||1)-1,unreadReactions:o?.unreadReactions?.filter((e=>e!==s))})),e}function V(e,t,a,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=n?(0,b.Jl6)(e,t,a):(0,b.O5q)(e,t,a);if(o&&s.content&&!(0,p.iL)(a)){const{photo:e,video:t,sticker:a,document:n}=(0,I.r_)(o);var i,r;if(e&&s.content.photo)(i=s.content.photo).blobUrl??(i.blobUrl=e.blobUrl),(r=s.content.photo).thumbnail??(r.thumbnail=e.thumbnail);else if(t&&s.content.video){var c;(c=s.content.video).blobUrl??(c.blobUrl=t.blobUrl)}else if(a&&s.content.sticker){var d;(d=s.content.sticker).isPreloadedGlobally??(d.isPreloadedGlobally=a.isPreloadedGlobally)}else if(n&&s.content.document){var l;(l=s.content.document).previewBlobUrl??(l.previewBlobUrl=n.previewBlobUrl)}}const u=o?{...o,...s}:s;return n?(0,A.Eg)(e,t,a,u):(0,A.r3)(e,t,a,u)}function G(e,t,a,s){const{chatId:n}=a,o=(0,C.Q)(a),{threadInfo:i}=(0,b.Tac)(e,a)||{};if(!i&&o?.replyToMsgId){const i=(0,b.O5q)(e,n,o.replyToMsgId);i?e=(0,A.Ww)(e,i,n,a.id,s):t.loadMessage({chatId:n,messageId:o.replyToMsgId,threadUpdate:{isDeleting:s,lastMessageId:a.id}})}return e}function j(e,t,a){const{id:s,chatId:n}=a,o=(0,b.QP5)(e,a),{threadInfo:i}=(0,b.Tac)(e,a)||{},c=(0,b.hds)(e,n),d=c?.unreadCount&&!(0,b.gCU)(e,n,r.l3);e=G(e,t,a);const{threadId:l}=i??{threadId:o};return l&&(e=(0,A.d4)(e,n,l,[s]),Object.values(e.byTabId).forEach((t=>{let{id:a}=t;if((0,b.haw)(e,n,l,a)){const t=(0,b.RjD)(e,n,l),o=(0,A.fg)(e,n,l,s,a),i=(0,b.rA3)(o,n,l,a);t&&!i.includes(t)||(e=o)}})),i&&(e=(0,A.ew)(e,n,l,"threadInfo",{...i,lastMessageId:a.id}),(0,I.Nb)(a)||(0,I._P)(a)||(e=(0,A.eA)(e,n,l,{messagesCount:(i.messagesCount||0)+1})))),d||(e=(0,A.d4)(e,n,r.l3,[s]),Object.values(e.byTabId).forEach((t=>{let{id:a}=t;if((0,b.haw)(e,n,r.l3,a)){const t=(0,b.RjD)(e,n,r.l3),o=(0,A.fg)(e,n,r.l3,s,a),i=(0,b.rA3)(o,n,r.l3,a);t&&!i.includes(t)||(e=o)}}))),e}function q(e,t,a){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{chats:n}=e,o=n.byId[t],i=(0,b.ZZX)(e,t),r=o?.isForum?(0,b.nkm)(e,a):void 0;r&&(e=(0,A.Tw)(e,t,r.id,{lastMessageId:a.id}));const c=(0,b.QP5)(e,a);return c&&(e=(0,A.yK)(e,c,a.id,"saved")),!i||s||i===a.id||i===a.previousLocalId||a.id>i?(0,A.yK)(e,t,a.id):e}function z(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.l3;const s=(0,b.zeq)(e,t),n=(0,b.gCU)(e,t,a);if(!s||!n)return;let o=n.length;for(;o--;){const e=s[n[o]];if(e&&!e.isDeleting)return e}}function H(e,t,a,n){if(t){const o=(0,b.hds)(e,t);if(!o)return;const i=new Set;i.add(r.l3),a.forEach((a=>{e=(0,A.r3)(e,t,a,{isDeleting:!0}),o.topics?.[a]&&(e=(0,A.do)(e,t,a));const s=(0,b.O5q)(e,t,a);if(!s)return;s.content.action?.photo&&(e=(0,A.so)(e,t,s.content.action.photo.id,!0)),e=G(e,n,s,!0);const r=(0,b.L_2)(e,s);r&&i.add(r)})),n.requestChatUpdate({chatId:t});const c=new Set(a);return i.forEach((a=>{const s=(0,b.Vw0)(e,t,a);if(!s?.lastMessageId||!c.has(s.lastMessageId))return;const n=z(e,t,a);n&&(a===r.l3&&(e=q(e,t,n,!0)),e=(0,A.eA)(e,t,a,{lastMessageId:n.id}),o.isForum&&(e=(0,A.Tw)(e,t,Number(a),{lastMessageId:n.id})))})),(0,s.UF)(e),void setTimeout((()=>{e=(0,s.mS)(),e=(0,A.AH)(e,t,a),(0,s.UF)(e)}),O)}const o=[];a.forEach((t=>{const a=(0,b.Egn)(e,t);if(a){o.push(a);const i=z(e=(0,A.r3)(e,a,t,{isDeleting:!0}),a);i&&(e=q(e,a,i,!0));const r=(0,b.O5q)(e,a,t);if((0,b.nZ4)(e,a)&&r){const t=(0,b.L_2)(e,r);if((0,I.cG)(a,t,e.currentUserId)){const s=z(e,a,t);n.requestSavedDialogUpdate({chatId:String(t)}),s&&(e=(0,A.yK)(e,a,s.id,"saved"))}}r?.content.action?.photo&&(e=(0,A.so)(e,a,r.content.action.photo.id,!0)),setTimeout((()=>{e=(0,s.mS)(),e=(0,A.AH)(e,a,[t]),(0,s.UF)(e)}),O)}})),(0,s.UF)(e),(0,h.Am)(o).forEach((e=>{n.requestChatUpdate({chatId:e})}))}(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"newMessage":{const{chatId:n,id:o,message:i,shouldForceReply:r,wasDrafted:c}=a;e=j(e=V(e,n,o,i),t,i);const d=(0,b.O5q)(e,n,o),l=(0,C.Q)(d),u=(0,C.W)(d),m=(0,b.hds)(e,n);m?.isForum&&l?.isForumTopic&&!(0,b.nkm)(e,d)&&l.replyToMsgId&&t.loadTopicById({chatId:n,topicId:l.replyToMsgId});const h=(0,I.Nb)(i);if(Object.values(e.byTabId).forEach((a=>{let{id:l}=a;h&&c&&(e=q(e,n,d));const m=(0,b.L_2)(e,d);if(e=(0,A.PK)(e,d,n,m,l),(0,b.fo$)(e,n,i,l)){if(h&&i.isOutgoing&&!i.content?.action&&!u?.storyId&&!i.content?.storyData){const a=(0,b.Xf0)(e,l);a&&t.focusMessage({chatId:n,threadId:a.threadId,messageId:i.id,noHighlight:!0,isResizingContainer:!0,tabId:l})}h||setTimeout((()=>{e=(0,s.mS)(),r&&t.updateDraftReplyInfo({replyToMsgId:o,tabId:l}),e=q(e,n,d),(0,s.UF)(e)}),O)}else e=q(e,n,d)})),(0,s.UF)(e),(0,b.mJZ)(e,n)||t.loadTopChats(),(0,b.nZ4)(e,n)&&!h){const a=(0,b.QP5)(e,d);a&&!(0,b.mJZ)(e,a,"saved")&&t.requestSavedDialogUpdate({chatId:a})}break}case"updateChatLastMessage":{const{id:t,lastMessage:n}=a;e=q(e,t,n,!0),e=(0,A.Kc)(e,[n]),(0,s.UF)(e);break}case"updateStartEmojiInteraction":Object.values(e.byTabId).forEach((t=>{let{id:s}=t;const{chatId:n}=(0,b.Xf0)(e,s)||{};if(n!==a.id)return;const o=(0,b.O5q)(e,n,a.messageId);if(!o)return;if((0,I.P5)(o)!==a.emoji)return;const i=(0,b.nTw)(e,s);e=(0,v.w)(e,{activeEmojiInteractions:[...i.activeEmojiInteractions||[],{id:Math.random(),animatedEffect:a.emoji,messageId:a.messageId}]},s)})),(0,s.UF)(e);break;case"newScheduledMessage":{const{chatId:t,id:n,message:o}=a;e=V(e,t,n,o,!0);const i=(0,b.K3w)(e,t,r.l3)||[];e=(0,A.ew)(e,t,r.l3,"scheduledIds",(0,h.Am)([...i,n]));const c=(0,b.L_2)(e,o);if(c!==r.l3){const a=(0,b.K3w)(e,t,c)||[];e=(0,A.ew)(e,t,c,"scheduledIds",(0,h.Am)([...a,n]))}(0,s.UF)(e);break}case"updateMessage":{const{chatId:n,id:o,message:i}=a,r=(0,b.O5q)(e,n,o),c=(0,b.hds)(e,n);e=V(e,n,o,i);const d=(0,b.O5q)(e,n,o);i.reactions&&c&&(e=D(e,t,n,o,i.reactions,c,d.isOutgoing,r)),i.content?.text?.text!==r?.content?.text?.text&&(e=(0,A.gt)(e,n,o)),(0,s.UF)(e);break}case"updateScheduledMessage":{const{chatId:t,id:n,message:o}=a,i=(0,b.Jl6)(e,t,n);if(!i)return;e=V(e,t,n,o,!0);const c=Object.keys((0,b.yFI)(e,t)||{}).map(Number).sort(((e,t)=>t-e));e=(0,A.ew)(e,t,r.l3,"scheduledIds",c);const d=(0,b.L_2)(e,i);if(d!==r.l3){const a=(0,b.K3w)(e,t,d)||[];e=(0,A.ew)(e,t,d,"scheduledIds",a.sort(((e,t)=>t-e)))}(0,s.UF)(e);break}case"updateQuickReplyMessage":{const{id:t,message:n}=a;e=(0,A.QN)(e,t,n),(0,s.UF)(e);break}case"deleteQuickReplyMessages":{const{messageIds:t}=a;e=(0,A.v)(e,t),(0,s.UF)(e);break}case"updateQuickReplies":{const{quickReplies:t}=a,n=(0,h.dU)(t,"id");e=(0,A.xA)(e,n),(0,s.UF)(e);break}case"deleteQuickReply":e=(0,A.hj)(e,a.quickReplyId),(0,s.UF)(e);break;case"updateMessageSendSucceeded":{const{chatId:n,localId:o,message:i}=a;e=j(e,t,i);const c=(0,b.O5q)(e,n,o);e=(0,A.AH)(e,n,[o]),i.isScheduled&&(e=(0,A.XA)(e,n,[o])),e=(0,A.r3)(e,n,i.id,{...c,...i,previousLocalId:o}),e={...e,fileUploads:{byMessageKey:(0,h.cJ)(e.fileUploads.byMessageKey,[(0,p.bj)(i)])}};const d=(0,b.O5q)(e,n,i.id);e=q(e,n,d);const l=(0,b.Tac)(e,i);if(Object.values(e.byTabId).forEach((a=>{let{id:s}=a;const{chatId:o,threadId:c}=(0,b.Xf0)(e,s)||{};o===n&&(l?.threadInfo?.threadId||r.l3)===c&&t.markMessageListRead({maxId:i.id,tabId:s})})),l?.threadInfo?.threadId&&(e=(0,A.ew)(e,n,l.threadInfo.threadId,"threadInfo",{...l.threadInfo,lastMessageId:i.id,lastReadInboxMessageId:i.id})),e=(0,A.wi)(e,n,{lastReadInboxMessageId:i.id}),(0,b.nZ4)(e,n)){const a=(0,b.QP5)(e,d);a&&!(0,b.mJZ)(e,a,"saved")&&t.requestSavedDialogUpdate({chatId:a})}(0,s.UF)(e);break}case"updateScheduledMessageSendSucceeded":{const{chatId:t,localId:n,message:o}=a,i=(0,b.K3w)(e,t,r.l3)||[];e=(0,A.ew)(e,t,r.l3,"scheduledIds",[...i,o.id]);const c=(0,b.L_2)(e,o);if(c!==r.l3){const a=(0,b.K3w)(e,t,c)||[];e=(0,A.ew)(e,t,c,"scheduledIds",[...a,o.id])}const d=(0,b.Jl6)(e,t,n);e=(0,A.XA)(e,t,[n]),e=(0,A.Eg)(e,t,o.id,{...d,...o,previousLocalId:n}),(0,s.UF)(e);break}case"updatePinnedIds":{const{chatId:t,isPinned:n,messageIds:o}=a,i=(0,h._E)((0,b.zeq)(e,t),o),c={[r.l3]:o};Object.values(i).forEach((a=>{const s=(0,b.L_2)(e,a);if(e=(0,A.r3)(e,t,a.id,{isPinned:n}),s===r.l3)return;const o=c[s]||[];o.push(a.id),c[s]=o})),Object.entries(c).forEach((a=>{let[s,o]=a;const i=(0,b.fcC)(e,t,r.l3)||[],c=n?(0,h.Am)(i.concat(o)).sort(((e,t)=>t-e)):i.filter((e=>!o.includes(e)));e=(0,A.ew)(e,t,Number(s),"pinnedIds",c)})),(0,s.UF)(e);break}case"updateThreadInfos":{const{threadInfoUpdates:n}=a;e=(0,A.Ng)(e,n),n.forEach((a=>{const{chatId:s,threadId:n}=a;if(!s||!n)return;const o=(0,b.hds)(e,s),i=(0,b.Vw0)(e,s,n);if(o?.isForum&&a.lastReadInboxMessageId!==i?.lastReadInboxMessageId&&t.loadTopicById({chatId:s,topicId:Number(n)}),!o?.isForum){const t=o?.lastReadInboxMessageId,i=a.lastReadInboxMessageId||t;t&&i&&(e=(0,A.eA)(e,s,n,{lastReadInboxMessageId:Math.max(i,t)}))}})),(0,s.UF)(e);break}case"resetMessages":{const{id:n}=a,o=(0,b.zeq)(e,n);if(o&&!(0,I.L8)(n)){const a=(0,m.g0)();e=(0,A.AH)(e,n,Object.keys(o).map(Number)),(0,s.UF)(e),t.loadFullChat({chatId:n,force:!0}),t.loadViewportMessages({chatId:n,threadId:r.l3,tabId:a})}break}case"deleteMessages":{const{ids:s,chatId:n}=a;H(e,n,s,t);break}case"deleteScheduledMessages":{const{ids:t,chatId:n}=a;!function(e,t,a,n){e&&(t.forEach((t=>{n=(0,A.Eg)(n,e,t,{isDeleting:!0})})),(0,s.UF)(n),setTimeout((()=>{n=(0,s.mS)(),n=(0,A.XA)(n,e,t);const a=(0,b.yFI)(n,e);n=(0,A.ew)(n,e,r.l3,"scheduledIds",Object.keys(a||{}).map(Number)),(0,s.UF)(n)}),O))}(n,t,0,e);break}case"deleteHistory":{const{chatId:o}=a,i=e.messages.byChatId[o];if(o===n.zv8&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>({...e,isDeleted:!0})))},(0,s.UF)(e)),i){const a=Object.keys(i.byId).map(Number);H(e=(0,s.mS)(),o,a,t)}else t.requestChatUpdate({chatId:o});e=(0,s.mS)(),e=(0,A.SJ)(e,o),(0,s.UF)(e);break}case"deleteSavedHistory":{const{chatId:n}=a,o=e.currentUserId;e=(0,A.SJ)(e,n,"saved"),(0,s.UF)(e),function(e,t,a,s){const n=(0,b.zeq)(e,t);if(!n)return;const o=Object.values(n).filter((t=>(0,b.L_2)(e,t)===a)).map((e=>e.id));o.length&&H(e,t,o,s)}(e=(0,s.mS)(),o,n,t);break}case"updateCommonBoxMessages":{const{ids:t,messageUpdate:n}=a;t.forEach((t=>{const a=(0,b.Egn)(e,t);a&&(e=(0,A.r3)(e,a,t,n))})),(0,s.UF)(e);break}case"updateChannelMessages":{const{channelId:t,ids:n,messageUpdate:o}=a;n.forEach((a=>{e=(0,A.r3)(e,t,a,o)})),(0,s.UF)(e);break}case"updateMessagePoll":{const{pollId:t,pollUpdate:n}=a,o=(0,b.zg4)(e,t);if(o?.content.poll){const t=o.content.poll.results;let a=t;n.results?.results&&(t.results&&n.results.isMin?t.results&&(a={...n.results,results:n.results.results.map((e=>({...e,isChosen:t.results.find((t=>t.option===e.option))?.isChosen}))),isMin:void 0}):a=n.results);const i={...o.content.poll,...n,results:a};e=(0,A.r3)(e,o.chatId,o.id,{content:{...o.content,poll:i}}),(0,s.UF)(e)}break}case"updateMessagePollVote":{const{pollId:t,peerId:n,options:o}=a,i=(0,b.zg4)(e,t);if(!i||!i.content.poll||!i.content.poll.results)break;const{poll:r}=i.content,c=(0,b.VF$)(e,i.chatId),{recentVoterIds:d,totalVoters:l,results:u}=r.results,m=d?[...d]:[],h=l?l+1:1,p=u?[...u]:[];m.push(n),o.forEach((t=>{const a=p.findIndex((e=>e.option===t)),s=p[a],o=s?{...s}:{option:t,votersCount:0};o.votersCount+=1,c?.id!==n&&n!==e.currentUserId||(o.isChosen=!0),a?p[a]=o:p.push(o)})),e=(0,A.r3)(e,i.chatId,i.id,{content:{...i.content,poll:{...r,results:{...r.results,recentVoterIds:m,totalVoters:h,results:p}}}}),(0,s.UF)(e);break}case"updateServiceNotification":{const{message:s}=a;(0,b.dqr)(e)&&t.createServiceNotification({message:s});break}case"updateMessageReactions":{const{chatId:n,id:o,reactions:i}=a,r=(0,b.O5q)(e,n,o),c=(0,b.hds)(e,a.chatId);if(!c||!r)return;e=D(e,t,n,o,i,c,r.isOutgoing,r),(0,s.UF)(e);break}case"updateMessageExtendedMedia":{const{chatId:t,id:n,extendedMedia:o,isBought:i}=a,r=(0,b.O5q)(e,t,n);if(!(0,b.hds)(e,a.chatId)||!r)return;if(r.content.invoice){const a=o[0];if("mediaType"in a&&"extendedMediaPreview"===a.mediaType){if(!r.content.invoice)return;e=(0,A.r3)(e,t,n,{content:{...r.content,invoice:{...r.content.invoice,extendedMedia:a}}}),(0,s.UF)(e)}else{const o=a;e=(0,A.r3)(e,t,n,{content:{...o}}),(0,s.UF)(e)}}if(r.content.paidMedia){const a=i?{isBought:i,extendedMedia:o}:{extendedMedia:o,isBought:void 0};e=(0,A.r3)(e,t,n,{content:{...r.content,paidMedia:{...r.content.paidMedia,...a}}}),(0,s.UF)(e)}break}case"updateTranscribedAudio":{const{transcriptionId:t,text:n,isPending:o}=a;e={...e,transcriptions:{...e.transcriptions,[t]:{...e.transcriptions[t]||{},transcriptionId:t,text:n,isPending:o}}},(0,s.UF)(e);break}case"updateMessageSendFailed":{const{chatId:n,localId:o,error:i}=a;i.match(/CHAT_SEND_.+?FORBIDDEN/)&&Object.values(e.byTabId).forEach((e=>{let{id:a}=e;t.showAllowedMessageTypesNotification({chatId:n,tabId:a})})),e=(0,A.r3)(e,n,o,{sendingState:"messageSendingStateFailed"}),(0,s.UF)(e);break}case"updateMessageTranslations":{const{chatId:t,messageIds:n,toLanguageCode:o,translations:i}=a;e=(0,A.rm)(e,t,n,o,i),(0,s.UF)(e);break}}}));const _=new Map,W=(0,y.sg)((e=>e()),500,!1);async function K(e){let{global:t,chatId:a,threadId:n,draft:o,isLocalOnly:i,noLocalTimeUpdate:r}=e;const c=(0,b.hds)(t,a),d=(0,b.mBe)(t,a);if(!c||d&&(0,I.PL)(d))return;const l=(0,b.OEv)(t,a,n,o?.replyInfo),u=o?{...o,replyInfo:l,date:Math.floor(Date.now()/1e3),isLocal:!0}:void 0;t=(0,A.ew)(t,a,n,"draft",u),r||(t=(0,A.wi)(t,a,{draftDate:u?.date})),(0,s.UF)(t),i||(await(0,f.px)("saveDraft",{chat:c,draft:u})&&u&&(u.isLocal=!1),t=(0,s.mS)(),t=(0,A.ew)(t,a,n,"draft",u),t=(0,A.wi)(t,a,{draftDate:u?.date}),(0,s.UF)(t))}async function $(e,t,a,o,i){let d=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=arguments.length>6&&void 0!==arguments[6]&&arguments[6],u=arguments.length>7?arguments[7]:void 0;for(var p=arguments.length,g=new Array(p>8?p-8:0),y=8;y<p;y++)g[y-8]=arguments[y];let[v=(0,m.g0)()]=g;const w=t.id;let S,C=n.yo2;switch(i){case c.TN.Backwards:o?(S=-1,C+=1):S=void 0;break;case c.TN.Around:S=-(Math.round(n.yo2/2)+1);break;case c.TN.Forwards:S=-(n.yo2+1),o&&(C+=1)}const E=(e=(0,s.mS)()).currentUserId,M=(0,I.cG)(w,a,E),k=M?String(a):w,P=await(0,f.px)("fetchMessages",{chat:(0,b.hds)(e,k),offsetId:o,addOffset:S,limit:C,threadId:a,isSavedDialog:M});if(!P)return;const{messages:T,users:x,chats:N,count:B}=P;e=(0,s.mS)();const U=w===n.zv8?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],F=[].concat(T,U),R=(0,h.dU)(F,"id"),L=Object.keys(R).map(Number);if(a!==r.l3&&!(0,I.cG)(w,a,e.currentUserId)){const t=(0,b.dU3)(e,w,a);L[0]&&t!==L[0]||t===a||L.unshift(Number(a))}e=(0,A.o4)(e,w,R),e=d?(0,A.E0)(e,w,a,L):(0,A.d4)(e,w,a,L),e=(0,A.g1)(e,(0,h.dU)(x,"id")),e=(0,A.Nl)(e,(0,h.dU)(N,"id"));let J=(0,b.gCU)(e,w,a);const O=o?(0,b.Lzh)(e,w,a,o):void 0;if(d&&J&&O&&(O.length&&!(0,h.h8)(J,O)||(e=(0,A.d4)(e,w,a,O),J=(0,b.gCU)(e,w,a),e=(0,A.qK)(e,w,a,O),d=!1)),!l){const t=d&&O?O:J;if(t){const{newViewportIds:s}=X(t,o,i);e=(0,A.s3)(e,w,a,s,v)}}B&&(e=(0,A.eA)(e,t.id,a,{messagesCount:B})),(0,s.UF)(e),u?.()}function X(e,t,a){const{length:s}=e,o=t?function(e,t){return t<e[0]?0:t>e[e.length-1]?e.length-1:e.findIndex(((a,s)=>a===t||a<t&&e[s+1]>t))}(e,t):-1,i=a===c.TN.Backwards?o:o+1||s,r=a===c.TN.Around?Math.round(n.yo2/2):n.yo2,d=i-r,l=i+r-1,u=e.slice(Math.max(0,d),l+1);let m,h;switch(a){case c.TN.Backwards:m=i>=0,h=d>=0;break;case c.TN.Forwards:m=i<s,h=l<=s-1;break;case c.TN.Around:default:m=u.length>0,h=u.length===n.yo2}return{newViewportIds:u,areSomeLocal:m,areAllLocal:h}}async function Q(e,t){let a;const n=t.attachment?(t,o)=>{_.has(o)||(a=o,_.set(o,n)),e=(0,s.mS)(),e=(0,A.mR)(e,o,t),(0,s.UF)(e)}:void 0;(t.replyInfo||o.pz)&&await(0,y.P_)(),await(0,f.px)("sendMessage",t,n),n&&a&&(e=(0,s.mS)(),e=(0,A.mR)(e,a,void 0),(0,s.UF)(e),_.delete(a))}async function Z(e,t,a){const n=(0,b.hds)(e,t);if(!n)return;const o=await(0,f.px)("fetchUnreadMentions",{chat:n,offsetId:a});if(!o)return;const{messages:i,chats:r,users:c}=o,d=(0,h.dU)(i,"id"),l=Object.keys(d).map(Number);e=(0,s.mS)(),e=(0,A.o4)(e,n.id,d),e=(0,A.g1)(e,(0,h.dU)(c,"id")),e=(0,A.Nl)(e,(0,h.dU)(r,"id")),e=(0,A.We)(e,t,n,l),(0,s.UF)(e)}(0,s.aJ)("loadViewportMessages",((e,t,a)=>{const{direction:n=c.TN.Around,isBudgetPreload:o=!1,shouldForceRender:i=!1,onLoaded:r,onError:d,tabId:l=(0,m.g0)()}=a||{};let{chatId:u,threadId:h}=a||{};if(!u||!h){const t=(0,b.Xf0)(e,l);if(!t)return void d?.();u=t.chatId,h=t.threadId}const g=(0,b.hds)(e,u);if(!g||g.isRestricted)return void d?.();const f=(0,b.rA3)(e,u,h,l),I=(0,b.gCU)(e,u,h);if(f&&f.length&&n!==c.TN.Around){const a=n===c.TN.Backwards?f[0]:f[f.length-1];if((0,p.iL)(a))return;if(a===h&&n===c.TN.Backwards)return;const s=Boolean(I&&!I.includes(a)),i=s?(0,b.Lzh)(e,u,h,a):I,{newViewportIds:d,areSomeLocal:v,areAllLocal:w}=X(i,a,n);if(v&&(e=(0,A.s3)(e,u,h,d,l)),(0,y.aj)((()=>{!async function(e,t,a,s,n,o,i,r,c,d){for(var l=arguments.length,u=new Array(l>10?l-10:0),h=10;h<l;h++)u[h-10]=arguments[h];let[p=(0,m.g0)()]=u;a||await $(e,o,i,c,r,s,n,d,p),n||t.loadViewportMessages({chatId:o.id,threadId:i,direction:r,isBudgetPreload:!0,onLoaded:d,tabId:p})}(e,t,w,s,o,g,h,n,a,r,l)})),o)return}else{const t=(0,b.kdX)(e,u,l)||(0,b.EHH)(e,u,h),a=Boolean(t&&I&&!I.includes(t)),s=(a?(0,b.Lzh)(e,u,h,t):I)||[],{newViewportIds:n,areSomeLocal:i,areAllLocal:d}=X(s,t,c.TN.Around);i&&(e=(0,A.s3)(e,u,h,n,l)),d?r?.():(0,y.aj)((()=>{$(e,g,h,t,c.TN.Around,a,o,r,l)}))}(0,s.UF)(e,{forceOnHeavyAnimation:i})})),(0,s.aJ)("loadMessage",(async(e,t,a)=>{const{chatId:n,messageId:o,replyOriginForId:i,threadUpdate:c}=a,d=(0,b.hds)(e,n);if(!d)return;const l=await async function(e,t,a,n){const o=await(0,f.px)("fetchMessage",{chat:t,messageId:a});if(o){if(o!==r.K1)return e=(0,s.mS)(),e=(0,A.r3)(e,t.id,a,o.message),e=(0,A.g1)(e,(0,h.dU)(o.users,"id")),(0,s.UF)(e),o.message;if(n){e=(0,s.mS)();const a=(0,b.O5q)(e,t.id,n);e=(0,A.r3)(e,t.id,n,{...a,replyInfo:void 0}),(0,s.UF)(e)}}}(e,d,o,i);if(l&&c){const{lastMessageId:t,isDeleting:a}=c;e=(0,s.mS)(),e=(0,A.Ww)(e,l,n,t,a),(0,s.UF)(e)}})),(0,s.aJ)("sendMessage",((e,t,a)=>{const{messageList:s,tabId:o=(0,m.g0)()}=a,{storyId:i,peerId:c}=(0,b.V9I)(e,o),d=Boolean(i&&c);if(!s&&!d)return;let{chatId:l,threadId:u,type:p}=s||{};if(d&&(l=c,u=r.l3,p="thread"),a=(0,h.cJ)(a,["tabId"]),"scheduled"===p&&!a.scheduledAt)return(0,v.w)(e,{contentToBeScheduled:a},o);const g=(0,b.hds)(e,l),y=(0,b.GA4)(e,l,u),f=(0,b.nTw)(e,o).forwardMessages?.messageIds?.length,I=f||d?void 0:y?.replyInfo,A=d?{type:"story",peerId:c,storyId:i}:void 0,w=(0,b.OEv)(e,l,u,I),S=A||w,C=(0,b.ZZX)(e,l),E={...a,chat:g,replyInfo:S,noWebPage:(0,b.rQx)(e,l,u),sendAs:(0,b.VF$)(e,l),lastMessageId:C};d||t.clearWebPagePreview({tabId:o});const M=!a.attachments||a.attachments.length<=1,k=!M&&a.shouldGroupMessages;if(M){const{attachments:t,...a}=E;Q(e,{...a,attachment:t?t[0]:void 0,wasDrafted:Boolean(y)})}else if(k){const{text:t,entities:a,attachments:s,...o}=E,i=function(e){return e.reduce(((e,t,a,s)=>0===a?(e.push([t]),e):(ae(t)===ae(s[a-1])?e[e.length-1].push(t):e.push([t]),e)),[])}(s);let r=!1;i.forEach(((s,c)=>{const d=(0,h.lD)(s,n.ynd);for(let n=0;n<d.length;n++){const l=`${Date.now()}${c}${n}`,u=0===n&&0===c,m=n===d.length-1&&c===i.length-1;if(s[0].quick&&!s[0].shouldSendAsFile){const[s,...i]=d[n];Q(e,{...o,text:u&&!r?t:void 0,entities:u&&!r?a:void 0,attachment:s,groupedId:i.length>0?l:void 0,wasDrafted:Boolean(y)}),r=!0,i.forEach((t=>{Q(e,{...o,attachment:t,groupedId:l})}))}else{const s=d[n].slice(0,-1),i=d[n][d[n].length-1];s.forEach((t=>{Q(e,{...o,attachment:t,groupedId:l})})),Q(e,{...o,text:m&&!r?t:void 0,entities:m&&!r?a:void 0,attachment:i,groupedId:s.length>0?l:void 0,wasDrafted:Boolean(y)}),r=!0}}}))}else{const{text:t,entities:a,attachments:s,replyInfo:n,...o}=E;t&&Q(e,{...o,text:t,entities:a,replyInfo:n,wasDrafted:Boolean(y)}),s?.forEach((t=>{Q(e,{...o,attachment:t})}))}})),(0,s.aJ)("sendInviteMessages",(async(e,t,a)=>{const{chatId:s,userIds:n,tabId:o=(0,m.g0)()}=a,i=(0,b.AWZ)(e,s);if(!i?.inviteLink)return;const r=[];return await Promise.all(n.map((t=>{const a=(0,b.hds)(e,t);if(!a)return;const s=(0,I.Yg)((0,b.mBe)(e,t));return s&&r.push(s),Q(e,{chat:a,text:i.inviteLink})}))),t.showNotification({message:(0,g.yE)("Conversation.ShareLinkTooltip.Chat.One",r.join(", ")),tabId:o})})),(0,s.aJ)("editMessage",((e,t,a)=>{const{messageList:n,text:o,entities:i,attachments:r,tabId:c=(0,m.g0)()}=a;if(!n)return;let d;const l=r?(t,a)=>{_.has(a)||(d=a,_.set(a,l)),e=(0,s.mS)(),e=(0,A.mR)(e,a,t),(0,s.UF)(e)}:void 0,{chatId:u,threadId:h,type:p}=n,g=(0,b.hds)(e,u),y=(0,b.KLw)(e,u,h,p);g&&y&&(t.setEditingId({messageId:void 0,tabId:c}),(async()=>{await(0,f.px)("editMessage",{chat:g,message:y,attachment:r?r[0]:void 0,text:o,entities:i,noWebPage:(0,b.rQx)(e,u,h)},l),l&&d&&(e=(0,s.mS)(),e=(0,A.mR)(e,d,void 0),(0,s.UF)(e),_.delete(d))})())})),(0,s.aJ)("cancelUploadMedia",((e,t,a)=>{const{chatId:s,messageId:n}=a,o=(0,b.O5q)(e,s,n);if(!o)return;const i=o&&_.get((0,p.bj)(o));i&&(0,f.om)(i),(0,I.Nb)(o)&&t.apiUpdate({"@type":"deleteMessages",ids:[n],chatId:s})})),(0,s.aJ)("saveDraft",((e,t,a)=>{const{chatId:s,threadId:n,text:o}=a;if(!o)return;const i=(0,b.GA4)(e,s,n);K({global:e,chatId:s,threadId:n,draft:{text:o,replyInfo:i?.replyInfo,effectId:i?.effectId}})})),(0,s.aJ)("clearDraft",((e,t,a)=>{const{chatId:s,threadId:n=r.l3,isLocalOnly:o,shouldKeepReply:i}=a,c=(0,b.GA4)(e,s,n);if(!c)return;const d=c.replyInfo;K({global:e,chatId:s,threadId:n,draft:i&&d?{replyInfo:d}:void 0,isLocalOnly:o})})),(0,s.aJ)("updateDraftReplyInfo",((e,t,a)=>{const{tabId:s=(0,m.g0)(),...n}=a,o=(0,b.Xf0)(e,s);if(!o)return;const{chatId:i,threadId:r}=o,c=(0,b.GA4)(e,i,r),d={type:"message",...c?.replyInfo,...n};d.replyToMsgId&&K({global:e,chatId:i,threadId:r,draft:{...c,replyInfo:d},isLocalOnly:!0,noLocalTimeUpdate:!0})})),(0,s.aJ)("resetDraftReplyInfo",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.Xf0)(e,s);if(!n)return;const{chatId:o,threadId:i}=n,r=(0,b.GA4)(e,o,i),c=r?.text?{...r,replyInfo:void 0}:void 0;K({global:e,chatId:o,threadId:i,draft:c,isLocalOnly:Boolean(c)})})),(0,s.aJ)("saveEffectInDraft",((e,t,a)=>{const{chatId:s,threadId:n,effectId:o}=a;K({global:e,chatId:s,threadId:n,draft:{...(0,b.GA4)(e,s,n),effectId:o},isLocalOnly:!0,noLocalTimeUpdate:!0})})),(0,s.aJ)("toggleMessageWebPage",((e,t,a)=>{const{chatId:s,threadId:n,noWebPage:o}=a;return(0,A.ew)(e,s,n,"noWebPage",o)})),(0,s.aJ)("pinMessage",((e,t,a)=>{const{messageId:s,isUnpin:n,isOneSide:o,isSilent:i,tabId:r=(0,m.g0)()}=a,c=(0,b.meB)(e,r);c&&(0,f.px)("pinMessage",{chat:c,messageId:s,isUnpin:n,isOneSide:o,isSilent:i})})),(0,s.aJ)("unpinAllMessages",(async(e,t,a)=>{const{chatId:n,threadId:o}=a,i=(0,b.hds)(e,n);if(!i)return;await(0,f.px)("unpinAllMessages",{chat:i,threadId:o}),e=(0,s.mS)();const c=(0,b.fcC)(e,n,o);c?.forEach((t=>{e=(0,A.r3)(e,n,t,{isPinned:!1})})),e=(0,A.ew)(e,i.id,r.l3,"pinnedIds",[]),(0,s.UF)(e)})),(0,s.aJ)("deleteMessages",((e,t,a)=>{const{messageIds:s,shouldDeleteForAll:n,tabId:o=(0,m.g0)()}=a,i=(0,b.Xf0)(e,o);if(!i)return;const{chatId:r,threadId:c}=i,d=(0,b.hds)(e,r),l=s.filter((t=>{const a=(0,b.O5q)(e,r,t);return a&&!(0,I.Nb)(a)}));if(!l.length&&s.length)return void H(e,(0,I.WX)(d)?r:void 0,s,t);(0,f.px)("deleteMessages",{chat:d,messageIds:l,shouldDeleteForAll:n});const u=(0,b.Ys6)(e,r,c);u&&s.includes(u)&&t.setEditingId({messageId:void 0,tabId:o})})),(0,s.aJ)("deleteScheduledMessages",((e,t,a)=>{const{messageIds:s,tabId:n=(0,m.g0)()}=a,o=(0,b.Xf0)(e,n);if(!o)return;const{chatId:i}=o,r=(0,b.hds)(e,i);(0,f.px)("deleteScheduledMessages",{chat:r,messageIds:s});const c=(0,b.VlN)(e,i);c&&s.includes(c)&&t.setEditingId({messageId:void 0,tabId:n})})),(0,s.aJ)("deleteHistory",(async(e,t,a)=>{const{chatId:n,shouldDeleteForAll:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n);if(!r)return;await(0,f.px)("deleteHistory",{chat:r,shouldDeleteForAll:o}),e=(0,s.mS)();const c=(0,b.Xf0)(e,i);c&&c.chatId===n&&t.openChat({id:void 0,tabId:i});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)),a=e.pinnedChatIds?.filter((e=>e!==n)),s={...e,includedChatIds:t,pinnedChatIds:a};(0,f.px)("editChatFolder",{id:e.id,folderUpdate:s})}}))})),(0,s.aJ)("deleteSavedHistory",(async(e,t,a)=>{const{chatId:n,tabId:o=(0,m.g0)()}=a,i=(0,b.hds)(e,n);if(!i)return;await(0,f.px)("deleteSavedHistory",{chat:i}),e=(0,s.mS)();const r=(0,b.Xf0)(e,o);r&&r.threadId===n&&t.openChat({id:void 0,tabId:o})})),(0,s.aJ)("reportMessages",(async(e,t,a)=>{const{messageIds:s,reason:n,description:o,tabId:i=(0,m.g0)()}=a,r=(0,b.Xf0)(e,i);if(!r)return;const{chatId:c}=r,d=(0,b.hds)(e,c),l=await(0,f.px)("reportMessages",{peer:d,messageIds:s,reason:n,description:o});t.showNotification({message:l?(0,g.yE)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:i})})),(0,s.aJ)("sendMessageAction",(async(e,t,a)=>{const{action:s,chatId:n,threadId:o}=a;if("connectionStateReady"!==e.connectionState)return;if((0,b.nZ4)(e,n))return;const i=(0,b.hds)(e,n);if(!i)return;const r=(0,b.mBe)(e,n);r&&((0,I.tv)(r)||(0,I.PL)(r))||await(0,f.px)("sendMessageAction",{peer:i,threadId:o,action:s})})),(0,s.aJ)("markMessageListRead",((e,t,a)=>{const{maxId:s,tabId:o=(0,m.g0)()}=a,i=(0,b.Xf0)(e,o);if(!i)return;const{chatId:c,threadId:d}=i,l=(0,b.hds)(e,c);if(!l||(0,I.cG)(c,d,e.currentUserId))return;W((()=>{(0,f.px)("markMessageListRead",{chat:l,threadId:d,maxId:s})})),c===n.zv8&&(e={...e,serviceNotifications:e.serviceNotifications.map((e=>e.isUnread&&e.id<=s?{...e,isUnread:!1}:e))});const u=(0,b.rA3)(e,c,d,o),h=(0,b.RjD)(e,c,d);if(d!==r.l3&&!l.isForum)return(0,A.eA)(e,c,d,{lastReadInboxMessageId:s});if(!u||!h||!l.unreadCount)return e;const p=function(e,t,a){if(0===e.length||t<e[0]||a>e[e.length-1])return;let s=0;for(let n=0,o=e.length;n<o&&(e[n]>=t&&e[n]<=a&&s++,!(e[n]>=a));n++);return s}(u,h,s);if(!p)return e;if(l.isForum&&l.topics?.[d]){const t=l.topics[d];e=(0,A.eA)(e,c,d,{lastReadInboxMessageId:s});const a=Math.max(0,t.unreadCount-p);return 0===a&&(e=(0,A.wi)(e,c,{unreadCount:Math.max(0,l.unreadCount-1)})),(0,A.Tw)(e,c,Number(d),{unreadCount:a})}return(0,A.wi)(e,c,{lastReadInboxMessageId:s,unreadCount:Math.max(0,l.unreadCount-p)})})),(0,s.aJ)("markMessagesRead",((e,t,a)=>{const{messageIds:s,tabId:n=(0,m.g0)(),shouldFetchUnreadReactions:o}=a,i=(0,b.meB)(e,n);i&&(0,f.px)("markMessagesRead",{chat:i,messageIds:s}).then((()=>{o&&t.fetchUnreadReactions({chatId:i.id})}))})),(0,s.aJ)("loadWebPagePreview",(async(e,t,a)=>{const{text:n,tabId:o=(0,m.g0)()}=a,i=await(0,f.px)("fetchWebPagePreview",{text:n});e=(0,s.mS)(),e=(0,v.w)(e,{webPagePreview:i},o),(0,s.UF)(e)})),(0,s.aJ)("clearWebPagePreview",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};if((0,b.nTw)(e,s).webPagePreview)return(0,v.w)(e,{webPagePreview:void 0},s)})),(0,s.aJ)("sendPollVote",((e,t,a)=>{const{chatId:s,messageId:n,options:o}=a,i=(0,b.hds)(e,s);i&&(0,f.px)("sendPollVote",{chat:i,messageId:n,options:o})})),(0,s.aJ)("cancelPollVote",((e,t,a)=>{const{chatId:s,messageId:n}=a,o=(0,b.hds)(e,s);o&&(0,f.px)("sendPollVote",{chat:o,messageId:n,options:[]})})),(0,s.aJ)("closePoll",((e,t,a)=>{const{chatId:s,messageId:n}=a,o=(0,b.hds)(e,s),i=(0,b.O5q)(e,s,n)?.content.poll;o&&i&&(0,f.px)("closePoll",{chat:o,messageId:n,poll:i})})),(0,s.aJ)("loadPollOptionResults",(async(e,t,a)=>{const{chat:n,messageId:o,option:i,offset:r,limit:c,shouldResetVoters:d,tabId:l=(0,m.g0)()}=a,u=await(0,f.px)("loadPollOptionResults",{chat:n,messageId:o,option:i,offset:r,limit:c});if(!u)return;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(u.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(u.chats,"id"));const p=(0,b.nTw)(e,l),{pollResults:g}=p,{voters:y}=p.pollResults;e=(0,v.w)(e,{pollResults:{...g,voters:{...y,[i]:(0,h.Am)([...!d&&y?.[i]?y[i]:[],...u.votes.map((e=>e.peerId))])},offsets:{...g.offsets?g.offsets:{},[i]:u.nextOffset||""}}},l),(0,s.UF)(e)})),(0,s.aJ)("loadExtendedMedia",((e,t,a)=>{const{chatId:s,ids:n}=a,o=(0,b.hds)(e,s);o&&(0,f.px)("fetchExtendedMedia",{chat:o,ids:n})})),(0,s.aJ)("forwardMessages",((e,t,a)=>{const{isSilent:n,scheduledAt:o,tabId:i=(0,m.g0)()}=a,{fromChatId:c,messageIds:d,toChatId:l,withMyScore:u,noAuthors:p,noCaptions:g,toThreadId:A=r.l3}=(0,b.nTw)(e,i).forwardMessages,w=(0,b.g29)(e),S=A===r.l3,C=c?(0,b.hds)(e,c):void 0,E=l?(0,b.hds)(e,l):void 0,M=c&&d?d.sort(((e,t)=>e-t)).map((t=>(0,b.O5q)(e,c,t))).filter(Boolean):void 0;if(!C||!E||!M||A&&!S&&!E.isForum)return;const k=(0,b.VF$)(e,l),P=(0,b.GA4)(e,l,A||r.l3),T=(0,b.ZZX)(e,E.id),[x,N]=(0,h.jB)(M,(e=>!(0,I.u7)(e)));x.length&&(async()=>{await(0,y.P_)(),(0,f.px)("forwardMessages",{fromChat:C,toChat:E,toThreadId:A,messages:x,isSilent:n,scheduledAt:o,sendAs:k,withMyScore:u,noAuthors:p,noCaptions:g,isCurrentUserPremium:w,wasDrafted:Boolean(P),lastMessageId:T})})(),N.forEach((t=>{const{text:a,entities:s}=t.content.text||{},{sticker:i,poll:r}=t.content,c=(0,b.OEv)(e,E.id,A);Q(e,{chat:E,replyInfo:c,text:a,entities:s,sticker:i,poll:r,isSilent:n,scheduledAt:o,sendAs:k,lastMessageId:T})})),e=(0,s.mS)(),e=(0,v.w)(e,{forwardMessages:{},isShareMessageModalShown:!1},i),(0,s.UF)(e)})),(0,s.aJ)("loadScheduledHistory",(async(e,t,a)=>{const{chatId:n}=a,o=(0,b.hds)(e,n);if(!o)return;const i=await(0,f.px)("fetchScheduledHistory",{chat:o});if(!i)return;const{messages:c}=i,d=(0,h.dU)(c,"id"),l=Object.keys(d).map(Number).sort(((e,t)=>t-e));if(e=(0,s.mS)(),e=(0,A.Ff)(e,o.id,d),e=(0,A.ew)(e,o.id,r.l3,"scheduledIds",l),o?.isForum){const t={};c.forEach((a=>{const s=(0,b.L_2)(e,a),n=t[s]||[];n.push(a.id),t[s]=n})),Object.entries(t).forEach((t=>{let[a,s]=t;e=(0,A.ew)(e,o.id,Number(a),"scheduledIds",s)}))}(0,s.UF)(e)})),(0,s.aJ)("sendScheduledMessages",((e,t,a)=>{const{chatId:s,id:n}=a,o=(0,b.hds)(e,s);o&&(0,f.px)("sendScheduledMessages",{chat:o,ids:[n]})})),(0,s.aJ)("rescheduleMessage",((e,t,a)=>{const{chatId:s,messageId:n,scheduledAt:o}=a,i=(0,b.hds)(e,s),r=i&&(0,b.Jl6)(e,i.id,n);i&&r&&(0,f.px)("rescheduleMessage",{chat:i,message:r,scheduledAt:o})})),(0,s.aJ)("transcribeAudio",(async(e,t,a)=>{const{messageId:n,chatId:o}=a,i=(0,b.hds)(e,o);if(!i)return;e=(0,A.r3)(e,o,n,{transcriptionId:""}),(0,s.UF)(e);const r=await(0,f.px)("transcribeAudio",{chat:i,messageId:n});e=(0,s.mS)(),e=(0,A.r3)(e,o,n,{transcriptionId:r,isTranscriptionError:!r}),(0,s.UF)(e)})),(0,s.aJ)("loadCustomEmojis",(async(e,t,a)=>{const{ids:n,ignoreCache:o}=a,i=o?n:(0,h.Am)(n.filter((t=>!e.customEmojis.byId[t]))),r=await(0,f.px)("fetchCustomEmoji",{documentId:i});r&&(e=(0,s.mS)(),e={...e,customEmojis:{...e.customEmojis,byId:{...e.customEmojis.byId,...(0,h.dU)(r,"id")}}},(0,s.UF)(e))})),(0,s.aJ)("loadPinnedMessages",(async(e,t,a)=>{const{chatId:n,threadId:o}=a,i=(0,b.hds)(e,n);if(!i||(0,I.cG)(n,o,e.currentUserId))return;const r=await(0,f.px)("fetchPinnedMessages",{chat:i,threadId:o});if(!r)return;const{messages:c,chats:d,users:l}=r,u=(0,h.dU)(c,"id"),m=Object.keys(u).map(Number).sort(((e,t)=>t-e));e=(0,s.mS)(),e=(0,A.o4)(e,i.id,u),e=(0,A.gz)(e,i.id,o,m),e=(0,A.g1)(e,(0,h.dU)(l,"id")),e=(0,A.Nl)(e,(0,h.dU)(d,"id")),(0,s.UF)(e)})),(0,s.aJ)("loadSeenBy",(async(e,t,a)=>{const{chatId:n,messageId:o}=a,i=(0,b.hds)(e,n);if(!i)return;const r=await(0,f.px)("fetchSeenBy",{chat:i,messageId:o});r&&(e=(0,s.mS)(),e=(0,A.r3)(e,n,o,{seenByDates:r}),(0,s.UF)(e))})),(0,s.aJ)("saveDefaultSendAs",((e,t,a)=>{const{chatId:s,sendAsId:n}=a,o=(0,b.hds)(e,s),i=(0,b.hds)(e,n)||(0,b.mBe)(e,n);if(o&&i)return(0,f.px)("saveDefaultSendAs",{sendAs:i,chat:o}),(0,A.lt)(e,s,{sendAsId:n})})),(0,s.aJ)("loadSendAs",(async(e,t,a)=>{const{chatId:n}=a,o=(0,b.hds)(e,n);if(!o)return;const i=await(0,f.px)("fetchSendAs",{chat:o});if(!i)return e=(0,s.mS)(),e=(0,A.wi)(e,n,{sendAsPeerIds:[]}),void(0,s.UF)(e);e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(i.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(i.chats,"id")),e=(0,A.wi)(e,n,{sendAsPeerIds:i.sendAs}),(0,s.UF)(e)})),(0,s.aJ)("loadSponsoredMessages",(async(e,t,a)=>{const{chatId:n}=a,o=(0,b.hds)(e,n);if(!o)return;const i=await(0,f.px)("fetchSponsoredMessages",{chat:o});i&&(e=(0,s.mS)(),e=(0,A.EK)(e,n,i.messages[0]),e=(0,A.g1)(e,(0,h.dU)(i.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(i.chats,"id")),(0,s.UF)(e))})),(0,s.aJ)("viewSponsoredMessage",((e,t,a)=>{const{chatId:s}=a,n=(0,b.hds)(e,s),o=(0,b.v8U)(e,s);n&&o&&(0,f.px)("viewSponsoredMessage",{chat:n,random:o.randomId})})),(0,s.aJ)("clickSponsoredMessage",((e,t,a)=>{const{chatId:s}=a,n=(0,b.hds)(e,s),o=(0,b.v8U)(e,s);n&&o&&(0,f.px)("clickSponsoredMessage",{chat:n,random:o.randomId})})),(0,s.aJ)("reportSponsoredMessage",(async(e,t,a)=>{const{chatId:n,randomId:o,option:i="",tabId:r=(0,m.g0)()}=a,c=(0,b.hds)(e,n);if(!c)return;const d=await(0,f.px)("reportSponsoredMessage",{chat:c,randomId:o,option:i});if(d){if("premiumRequired"===d.type)return t.openPremiumModal({initialSection:"no_ads",tabId:r}),void t.closeReportAdModal({tabId:r});if("reported"===d.type||"hidden"===d.type)return t.showNotification({message:(0,g.yE)("reported"===d.type?"AdReported":"AdHidden"),tabId:r}),t.closeReportAdModal({tabId:r}),e=(0,s.mS)(),e=(0,A.It)(e,n),void(0,s.UF)(e);if("selectOption"===d.type){e=(0,s.mS)();const t=(0,b.nTw)(e,r).reportAdModal?.sections,a=t?.[t.length-1]?.options.find((e=>e.option===i)),c={title:d.title,options:d.options,subtitle:a?.text};e=(0,v.w)(e,{reportAdModal:{chatId:n,randomId:o,sections:t?[...t,c]:[c]}},r),(0,s.UF)(e)}}})),(0,s.aJ)("hideSponsoredMessages",(async(e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};(0,b.g29)(e)?await(0,f.px)("toggleSponsoredMessages",{enabled:!1})&&(e=(0,s.mS)(),e=(0,A.we)(e,e.currentUserId,{areAdsEnabled:!1}),(0,s.UF)(e),t.showNotification({message:(0,g.yE)("AdHidden"),tabId:n})):t.openPremiumModal({initialSection:"no_ads",tabId:n})})),(0,s.aJ)("fetchUnreadMentions",(async(e,t,a)=>{const{chatId:s,offsetId:n}=a;await Z(e,s,n)})),(0,s.aJ)("markMentionsRead",((e,t,a)=>{const{messageIds:n,tabId:o=(0,m.g0)()}=a,i=(0,b.meB)(e,o);i&&(e=(0,A.pW)(e,i.id,i,n,!0),(0,s.UF)(e),t.markMessagesRead({messageIds:n,tabId:o}))})),(0,s.aJ)("focusNextMention",(async(e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};let o=(0,b.meB)(e,n);if(o){if(!o.unreadMentions){await Z(e,o.id),e=(0,s.mS)();const t=o.id;if(o=(0,b.meB)(e,n),!o?.unreadMentions||t!==o.id)return}t.focusMessage({chatId:o.id,messageId:o.unreadMentions[0],tabId:n})}})),(0,s.aJ)("readAllMentions",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.meB)(e,s);if(n)return(0,f.px)("readAllMentions",{chat:n}),(0,A.wi)(e,n.id,{unreadMentionsCount:void 0,unreadMentions:void 0})})),(0,s.aJ)("openUrl",((e,t,a)=>{const{url:s,shouldSkipModal:o,ignoreDeepLinks:i,tabId:r=(0,m.g0)()}=a,c=(0,u.T)(s);if(!i&&(0,l.z)(c))return t.closeStoryViewer({tabId:r}),t.closePaymentModal({tabId:r}),void t.openTelegramLink({url:s,tabId:r});const{appConfig:d,config:h}=e;if(d){const e=new URL(c);if(h?.autologinToken&&d.autologinDomains.includes(e.hostname))return e.searchParams.set("autologin_token",h.autologinToken),void window.open(e.href,"_blank","noopener");if(d.urlAuthDomains.includes(e.hostname))return t.closeStoryViewer({tabId:r}),void t.requestLinkUrlAuth({url:s,tabId:r})}c.match(n.H_r)||o?window.open(c,"_blank","noopener"):t.toggleSafeLinkModal({url:c,tabId:r})})),(0,s.aJ)("openChatOrTopicWithReplyInDraft",((e,t,a)=>{const{chatId:n,topicId:o,tabId:i=(0,m.g0)()}=a;e=(0,s.mS)();const c=(0,b.nTw)(e,i).replyingMessage;e=(0,v.w)(e,{isShareMessageModalShown:!1,replyingMessage:{}},i),(0,s.UF)(e);const d=(0,b.meB)(e,i),l=(0,b.Xf0)(e,i)?.threadId;if(!d||!l)return;const u=o||r.l3,h=d.id,p={type:"message",replyToMsgId:c.messageId,replyToTopId:c.toThreadId,replyToPeerId:h,quoteText:c.quoteText},y=c.messageId?p:(0,b.GA4)(e,h,l)?.replyInfo;if(!y)return;if(!(0,b.Vz3)(e,n,h,y))return void t.showNotification({message:(0,g.yE)("Chat.SendNotAllowedText"),tabId:i});if(!y.replyToPeerId&&n===d.id)return;const f=y?.replyToPeerId?y.replyToPeerId===n?void 0:y.replyToPeerId:h;!function(e,t,a,s){const n=(0,b.GA4)(e,s,t);a.replyToMsgId&&K({global:e,chatId:s,threadId:t,draft:{...n,replyInfo:a},isLocalOnly:!0,noLocalTimeUpdate:!0})}(e,u,{...y,replyToPeerId:f,type:"message"},n),t.openThread({chatId:n,threadId:u,tabId:i}),t.closeMediaViewer({tabId:i}),t.exitMessageSelectMode({tabId:i}),t.clearDraft({chatId:h,threadId:l})})),(0,s.aJ)("setForwardChatOrTopic",(async(e,t,a)=>{const{chatId:n,topicId:o,tabId:i=(0,m.g0)()}=a,c=(0,b.mBe)(e,n);(0,b.lC)(e,i)&&c&&!await async function(e,t,a){let s=(0,b.vGo)(e,a);if(!s){const{accessHash:e}=t,n=await(0,f.px)("fetchFullUser",{id:a,accessHash:e});s=n?.fullInfo}return Boolean(!s?.noVoiceMessages)}(e,c,n)?t.showDialog({data:{message:(0,g.yE)("VoiceMessagesRestrictedByPrivacy",(0,I.Yg)(c))},tabId:i}):(e=(0,s.mS)(),(0,b.DI)(e,n,i)?(e=(0,v.w)(e,{forwardMessages:{...(0,b.nTw)(e,i).forwardMessages,toChatId:n,toThreadId:o},isShareMessageModalShown:!1},i),(0,s.UF)(e),t.openThread({chatId:n,threadId:o||r.l3,tabId:i}),t.closeMediaViewer({tabId:i}),t.exitMessageSelectMode({tabId:i})):t.showAllowedMessageTypesNotification({chatId:n,tabId:i}))})),(0,s.aJ)("forwardToSavedMessages",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,v.w)(e,{forwardMessages:{...(0,b.nTw)(e,n).forwardMessages,toChatId:e.currentUserId}},n),(0,s.UF)(e),t.exitMessageSelectMode({tabId:n}),t.forwardMessages({isSilent:!0,tabId:n})})),(0,s.aJ)("forwardStory",((e,t,a)=>{const{toChatId:n,tabId:o=(0,m.g0)()}=a||{},{fromChatId:i,storyId:r}=(0,b.nTw)(e,o).forwardMessages,c=i?(0,b.hds)(e,i):void 0,d=n?(0,b.hds)(e,n):void 0,l=i&&r?(0,b.Msb)(e,i,r):void 0;if(!c||!d||!l||"isDeleted"in l)return;const u=(0,b.ZZX)(e,n),{text:h,entities:p}=l.content.text||{};Q(e,{chat:d,text:h,entities:p,story:l,lastMessageId:u}),e=(0,s.mS)(),e=(0,v.w)(e,{forwardMessages:{},isShareMessageModalShown:!1},o),(0,s.UF)(e)})),(0,s.aJ)("requestMessageTranslation",((e,t,a)=>{const{chatId:s,id:n,toLanguageCode:o=(0,b.Qq_)(e),tabId:i=(0,m.g0)()}=a;return e=(0,A._B)(e,s,n,o,i),(0,A.qp)(e,{translationLanguage:o})})),(0,s.aJ)("showOriginalMessage",((e,t,a)=>{const{chatId:s,id:n,tabId:o=(0,m.g0)()}=a;return(0,A.xG)(e,s,n,o)})),(0,s.aJ)("markMessagesTranslationPending",((e,t,a)=>{const{chatId:s,messageIds:n,toLanguageCode:o=(0,b.wmb)(e)}=a;return n.forEach((t=>{e=(0,A.oe)(e,s,t,o,{isPending:!0})})),e})),(0,s.aJ)("translateMessages",((e,t,a)=>{const{chatId:s,messageIds:n,toLanguageCode:o=(0,b.wmb)(e)}=a,i=(0,b.hds)(e,s);if(i)return t.markMessagesTranslationPending({chatId:s,messageIds:n,toLanguageCode:o}),(0,f.px)("translateText",{chat:i,messageIds:n,toLanguageCode:o}),e}));let Y,ee={};function te(){Y&&(clearTimeout(Y),Y=void 0);const{loadMessageViews:e}=(0,s.ko)();Object.entries(ee).forEach((t=>{let[a,s]=t;e({chatId:a,ids:Array.from(s),shouldIncrement:!0})})),ee={}}function ae(e){const{shouldSendAsFile:t,mimeType:a}=e;return n.IH3.has(a)?"audio":t?"file":a===n.Vz3?"gif":n.gex.has(a)||n.fNs.has(a)?"media":e.voice?"voice":"file"}(0,s.aJ)("scheduleForViewsIncrement",((e,t,a)=>{const{ids:s,chatId:n}=a;Y||setTimeout(te,1e3),ee[n]||(ee[n]=new Set),s.forEach((e=>{ee[n].add(e)}))})),(0,s.aJ)("loadMessageViews",(async(e,t,a)=>{const{chatId:n,ids:o,shouldIncrement:i}=a,r=(0,b.hds)(e,n);if(!r)return;const c=await(0,f.px)("fetchMessageViews",{chat:r,ids:o,shouldIncrement:i});c&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(c.chats,"id")),c.viewsInfo.forEach((t=>{e=(0,A.r3)(e,n,t.id,{viewsCount:t.views,forwardsCount:t.forwards}),t.threadInfo&&(e=(0,A.eA)(e,n,t.id,t.threadInfo))})),(0,s.UF)(e))})),(0,s.aJ)("loadFactChecks",(async(e,t,a)=>{const{chatId:n,ids:o}=a,i=(0,b.hds)(e,n);if(!i)return;const r=await(0,f.px)("fetchFactChecks",{chat:i,ids:o});r&&(e=(0,s.mS)(),r.forEach(((t,a)=>{e=(0,A.r3)(e,n,o[a],{factCheck:t})})),(0,s.UF)(e))})),(0,s.aJ)("loadOutboxReadDate",(async(e,t,a)=>{const{chatId:n,messageId:o}=a,i=(0,b.hds)(e,n);if(i)try{const t=await(0,f.px)("fetchOutboxReadDate",{chat:i,messageId:o});t?.date&&(e=(0,s.mS)(),e=(0,A.r3)(e,n,o,{readDate:t.date}),(0,s.UF)(e))}catch(t){const{message:a}=t;if("USER_PRIVACY_RESTRICTED"===a||"YOUR_PRIVACY_RESTRICTED"===a){if(e=(0,s.mS)(),!(0,b.mBe)(e,n))return;const t=(0,b.K0y)(e,n);if(!t)return;const i="USER_PRIVACY_RESTRICTED"===a?{isReadDateRestricted:!0}:{isReadDateRestrictedByMe:!0};e=(0,A.wW)(e,{[n]:{...t,...i}}),e=(0,A.r3)(e,n,o,{readDate:void 0}),(0,s.UF)(e)}}})),(0,s.aJ)("loadQuickReplies",(async e=>{const t=await(0,f.px)("fetchQuickReplies");t&&(e=(0,s.mS)(),e=(0,A.CK)(e,(0,h.dU)(t.users,"id")),e=(0,A.h7)(e,(0,h.dU)(t.chats,"id")),e=(0,A.tM)(e,(0,h.dU)(t.messages,"id")),e=(0,A.xA)(e,t.quickReplies),(0,s.UF)(e))})),(0,s.aJ)("sendQuickReply",((e,t,a)=>{const{chatId:s,quickReplyId:n}=a,o=(0,b.hds)(e,s);return o?((0,f.px)("sendQuickReply",{chat:o,shortcutId:n}),e):e})),(0,s.aJ)("copyMessageLink",(async(e,t,a)=>{const{chatId:s,messageId:n,shouldIncludeThread:o,shouldIncludeGrouped:i,tabId:r=(0,m.g0)()}=a,c=(0,b.hds)(e,s);if(!c)return void t.showNotification({message:(0,g.yE)("ErrorOccurred"),tabId:r});const l=()=>t.showNotification({message:(0,g.yE)("ErrorOccurred"),tabId:r});if(!(0,I.WX)(c)&&!(0,I.Vs)(c))return void l();const u=(0,f.px)("exportMessageLink",{chat:c,id:n,shouldIncludeThread:o,shouldIncludeGrouped:i});await(0,d.LD)(u,(()=>t.showNotification({message:(0,g.yE)("LinkCopied"),tabId:r})),l)}));var se=a(529),ne=a(64520);const oe=(0,y.nF)((e=>e()),500,!1);async function ie(e,t){const a=await(0,f.px)("fetchRecentStickers",{hash:t});a&&(e=(0,s.mS)(),e={...e,stickers:{...e.stickers,recent:a}},(0,s.UF)(e))}async function re(e,t,a){let n;try{n=await(0,f.px)("fetchStickers",{stickerSetInfo:a})}catch(n){if("STICKERSET_INVALID"===n.message)return void Object.values(e.byTabId).forEach((n=>{let{id:o}=n;t.showNotification({message:(0,g.yE)("StickerPack.ErrorNotFound"),tabId:o}),"shortName"in a&&(0,b.nTw)(e,o).openedStickerSetShortName===a.shortName&&(e=(0,v.w)(e,{openedStickerSetShortName:void 0},o),(0,s.UF)(e))}))}if(e=(0,s.mS)(),!n)return;const{set:o,stickers:i,packs:r}=n,c=(e=(0,A.v9)(e,o.id,{...o,stickers:i,packs:r})).stickers.forEmoji.emoji;c&&r[c]&&(e=(0,A.Pc)(e)),(0,s.UF)(e)}async function ce(e,t,a,n){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,m.g0)()]=i;const d=await(0,f.px)("searchGifs",{query:t,offset:n,username:a});d&&(e=(0,s.mS)(),e=(0,A.tT)(e,!n,d.gifs,d.nextOffset,c),(0,s.UF)(e))}(0,s.aJ)("loadStickerSets",(async(e,t)=>{const[a,n]=await Promise.all([(0,f.px)("fetchStickerSets",{hash:e.stickers.added.hash}),(0,f.px)("fetchCustomEmojiSets",{hash:e.customEmojis.added.hash})]);n&&a&&(e=(0,s.mS)(),e=(0,A.Mk)(e,"added",a.hash,a.sets),e=(0,A.E2)(e,n.hash,n.sets),(0,s.UF)(e),t.loadCustomEmojis({ids:e.recentCustomEmojis}))})),(0,s.aJ)("loadAddedStickers",(async(e,t)=>{const{added:{setIds:a=[]},setsById:s}=e.stickers,{added:{setIds:n=[]}}=e.customEmojis,o=[...a,...n];if(o.length)for(let e=0;e<o.length;e++){const a=o[e];s[a]?.stickers||(t.loadStickers({stickerSetInfo:{id:a,accessHash:s[a].accessHash}}),e%10==0&&e>0&&await(0,y.v7)(200))}})),(0,s.aJ)("loadRecentStickers",(e=>{const{hash:t}=e.stickers.recent||{};ie(e,t)})),(0,s.aJ)("loadFavoriteStickers",(async e=>{const{hash:t}=e.stickers.favorite||{},a=await(0,f.px)("fetchFavoriteStickers",{hash:t});a&&(e=(0,s.mS)(),e={...e,stickers:{...e.stickers,favorite:a}},(0,s.UF)(e))})),(0,s.aJ)("loadPremiumStickers",(async e=>{const{hash:t}=e.stickers.premium||{},a=await(0,f.px)("fetchStickersForEmoji",{emoji:"⭐️⭐️",hash:t});a&&(e=(0,s.mS)(),e={...e,stickers:{...e.stickers,premium:{hash:a.hash,stickers:a.stickers}}},(0,s.UF)(e))})),(0,s.aJ)("loadGreetingStickers",(async e=>{const{hash:t}=e.stickers.greeting||{},a=await(0,f.px)("fetchStickersForEmoji",{emoji:"👋⭐️",hash:t});a&&(e=(0,s.mS)(),e={...e,stickers:{...e.stickers,greeting:{hash:a.hash,stickers:a.stickers.filter((e=>"👋"===e.emoji))}}},(0,s.UF)(e))})),(0,s.aJ)("loadFeaturedStickers",(async e=>{const{hash:t}=e.stickers.featured||{},a=await(0,f.px)("fetchFeaturedStickers",{hash:t});a&&(e=(0,s.mS)(),e=(0,A.Mk)(e,"featured",a.hash,a.sets),(0,s.UF)(e))})),(0,s.aJ)("loadPremiumGifts",(async e=>{const t=await(0,f.px)("fetchPremiumGifts");if(!t)return;const{set:a,stickers:n}=t;e=(0,s.mS)(),e={...e,premiumGifts:{...a,stickers:n}},(0,s.UF)(e)})),(0,s.aJ)("loadDefaultTopicIcons",(async e=>{const t=await(0,f.px)("fetchDefaultTopicIcons");if(!t)return;e=(0,s.mS)();const{set:a,stickers:n}=t,o={...a,stickers:n};e=(0,A.v9)(e,o.id,o),e={...e,defaultTopicIconsId:o.id},(0,s.UF)(e)})),(0,s.aJ)("loadDefaultStatusIcons",(async e=>{const t=await(0,f.px)("fetchDefaultStatusEmojis");if(!t)return;e=(0,s.mS)();const{set:a,stickers:n}=t,o={...a,stickers:n};e=(0,A.v9)(e,o.id,o),e={...e,defaultStatusIconsId:o.id},(0,s.UF)(e)})),(0,s.aJ)("loadStickers",((e,t,a)=>{const{stickerSetInfo:s}=a,n=(0,b.ycM)(e,s);n&&n.count===n?.stickers?.length||re(e,t,s)})),(0,s.aJ)("loadAnimatedEmojis",(async e=>{const[t,a]=await Promise.all([(0,f.px)("fetchAnimatedEmojis"),(0,f.px)("fetchAnimatedEmojiEffects")]);t&&a&&(e=(0,s.mS)(),e=(0,A.$n)(e,{...t.set,stickers:t.stickers}),e={...e,animatedEmojiEffects:{...a.set,stickers:a.stickers}},(0,s.UF)(e))})),(0,s.aJ)("loadBirthdayNumbersStickers",(async e=>{const t=await(0,f.px)("fetchStickers",{stickerSetInfo:{shortName:n.OVC}});t&&(e=(0,s.mS)(),e={...e,birthdayNumbers:{...t.set,stickers:t.stickers}},(0,s.UF)(e))})),(0,s.aJ)("loadGenericEmojiEffects",(async e=>{const t=await(0,f.px)("fetchGenericEmojiEffects");if(!t)return;e=(0,s.mS)();const{set:a,stickers:n}=t;e={...e,genericEmojiEffects:{...a,stickers:n}},(0,s.UF)(e)})),(0,s.aJ)("loadSavedGifs",(async e=>{const{hash:t}=e.gifs.saved,a=await(0,f.px)("fetchSavedGifs",{hash:t});a&&(e=(0,s.mS)(),e={...e,gifs:{...e.gifs,saved:a}},(0,s.UF)(e))})),(0,s.aJ)("saveGif",(async(e,t,a)=>{const{gif:n,shouldUnsave:o,tabId:i=(0,m.g0)()}=a,r=e.gifs.saved.gifs?.length,c=(0,ne.d)(e,"savedGifs"),d=(0,ne.B)(e,"savedGifs"),l=(0,b.g29)(e);if(!o&&r&&r>=c&&t.showNotification({title:g.yE("LimitReachedFavoriteGifs",c.toString()),message:l?g.yE("LimitReachedFavoriteGifsSubtitlePremium"):g.yE("LimitReachedFavoriteGifsSubtitle",d.toString()),...!l&&{action:{action:"openPremiumModal",payload:{tabId:i}}},className:"bold-link",tabId:i}),!await(0,f.px)("saveGif",{gif:n,shouldUnsave:o}))return;e=(0,s.mS)();const u=e.gifs.saved.gifs?.filter((e=>{let{id:t}=e;return t!==n.id}))||[],h=o?u:[n,...u];e={...e,gifs:{...e.gifs,saved:{...e.gifs.saved,gifs:h}}},(0,s.UF)(e)})),(0,s.aJ)("faveSticker",((e,t,a)=>{const{sticker:s,tabId:n=(0,m.g0)()}=a,o=e.stickers.favorite.stickers.length,i=(0,ne.d)(e,"stickersFaved"),r=(0,ne.B)(e,"stickersFaved"),c=(0,b.g29)(e);o>=i&&t.showNotification({title:g.yE("LimitReachedFavoriteStickers",i.toString()),message:c?g.yE("LimitReachedFavoriteStickersSubtitlePremium"):g.yE("LimitReachedFavoriteStickersSubtitle",r.toString()),...!c&&{action:{action:"openPremiumModal",payload:{tabId:n}}},className:"bold-link",tabId:n}),s&&(0,f.px)("faveSticker",{sticker:s})})),(0,s.aJ)("unfaveSticker",((e,t,a)=>{const{sticker:n}=a;n&&(e=(0,s.mS)(),e={...e,stickers:{...e.stickers,favorite:{...e.stickers.favorite,stickers:e.stickers.favorite.stickers.filter((e=>{let{id:t}=e;return t!==n.id}))}}},(0,s.UF)(e),(0,f.px)("faveSticker",{sticker:n,unfave:!0}))})),(0,s.aJ)("removeRecentSticker",(async(e,t,a)=>{const{sticker:n}=a;await(0,f.px)("removeRecentSticker",{sticker:n})&&ie((0,s.mS)())})),(0,s.aJ)("clearRecentStickers",(async e=>{await(0,f.px)("clearRecentStickers")&&(e=(0,s.mS)(),e={...e,stickers:{...e.stickers,recent:{stickers:[]}}},(0,s.UF)(e))})),(0,s.aJ)("toggleStickerSet",((e,t,a)=>{const{stickerSetId:s}=a,n=(0,b.ycM)(e,s);if(!n)return;const{accessHash:o,installedDate:i,isArchived:r}=n,c=!r&&Boolean(i);(0,f.px)(c?"uninstallStickerSet":"installStickerSet",{stickerSetId:s,accessHash:o})})),(0,s.aJ)("loadEmojiKeywords",(async(e,t,a)=>{const{language:n}=a;let o=e.emojiKeywords[n];if(o?.isLoading)return;e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{...o,isLoading:!0}}},(0,s.UF)(e);const i=await(0,f.px)("fetchEmojiKeywords",{language:n,fromVersion:o?o.version:0});if(o=(e=(0,s.mS)()).emojiKeywords[n],!i)return e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{...o,isLoading:!1}}},void(0,s.UF)(e);e={...e,emojiKeywords:{...e.emojiKeywords,[n]:{isLoading:!1,version:i.version,keywords:{...o?.keywords,...i.keywords}}}},(0,s.UF)(e)})),(0,s.aJ)("setStickerSearchQuery",((e,t,a)=>{const{query:n,tabId:o=(0,m.g0)()}=a;n&&oe((async()=>{const t=await(0,f.px)("searchStickers",{query:n});if(!t)return;e=(0,s.mS)();const{setsById:a,added:i}=e.stickers,r=t.sets.map((e=>{let{id:t}=e;return t}));i.setIds&&i.setIds.forEach((e=>{if(!r.includes(e)){const{title:t}=a[e]||{};t&&(0,se.A)(t,n)&&r.unshift(e)}})),e=(0,A.Mk)(e,"search",t.hash,t.sets),e=(0,A.bG)(e,t.hash,r,o),(0,s.UF)(e)}))})),(0,s.aJ)("setGifSearchQuery",((e,t,a)=>{const{query:n,tabId:o=(0,m.g0)()}=a;"string"==typeof n&&oe((()=>{ce(e=(0,s.mS)(),n,e.config?.gifSearchUsername,void 0,o)}))})),(0,s.aJ)("searchMoreGifs",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{},{query:o,offset:i}=(0,b.nTw)(e,n).gifSearch;"string"==typeof o&&oe((()=>{ce(e=(0,s.mS)(),o,e.config?.gifSearchUsername,i,n)}))})),(0,s.aJ)("loadStickersForEmoji",((e,t,a)=>{const{emoji:n}=a,{hash:o}=e.stickers.forEmoji;oe((async()=>{e=(0,s.mS)(),e={...e,stickers:{...e.stickers,forEmoji:{...e.stickers.forEmoji,emoji:n}}},(0,s.UF)(e);const t=await(0,f.px)("fetchStickersForEmoji",{emoji:n,hash:o});e=(0,s.mS)(),t&&e.stickers.forEmoji.emoji===n&&(e=(0,A.f_)(e,n,t.stickers,t.hash),(0,s.UF)(e))}))})),(0,s.aJ)("clearStickersForEmoji",(e=>({...e,stickers:{...e.stickers,forEmoji:{}}}))),(0,s.aJ)("loadCustomEmojiForEmoji",((e,t,a)=>{const{emoji:s}=a;return(0,A.G4)(e,s)})),(0,s.aJ)("clearCustomEmojiForEmoji",(e=>({...e,customEmojis:{...e.customEmojis,forEmoji:{}}}))),(0,s.aJ)("loadFeaturedEmojiStickers",(async e=>{const t=await(0,f.px)("fetchFeaturedEmojiStickers");t&&(e=(0,s.mS)(),e={...e,customEmojis:{...e.customEmojis,featuredIds:t.sets.map((e=>{let{id:t}=e;return t})),byId:{...e.customEmojis.byId,...(0,h.dU)(t.sets.flatMap((e=>e.stickers||[])),"id")}},stickers:{...e.stickers,setsById:{...e.stickers.setsById,...(0,h.dU)(t.sets,"id")}}},(0,s.UF)(e))})),(0,s.aJ)("openStickerSet",(async(e,t,a)=>{const{stickerSetInfo:n,tabId:o=(0,m.g0)()}=a;(0,b.ycM)(e,n)||await re(e,t,n),e=(0,s.mS)();const i=(0,b.ycM)(e,n);i?.shortName&&(e=(0,v.w)(e,{openedStickerSetShortName:i.shortName},o),(0,s.UF)(e))})),(0,s.aJ)("loadRecentEmojiStatuses",(async e=>{const t=await(0,f.px)("fetchRecentEmojiStatuses");t&&(e=(0,s.mS)(),e=(0,A.T3)(e,t.hash,t.emojiStatuses),(0,s.UF)(e))}));var de=a(17663),le=a(62214);const ue=(0,y.nF)((e=>e()),500,!1);async function me(e,t,a){if(!(0,le.YE)(t)&&!(0,le.WX)(t))return;const s=(0,b.O5q)(e,t.id,a);if(s)return s;const n=await(0,f.px)("fetchMessage",{chat:t,messageId:a});return"MESSAGE_DELETED"===n?void 0:n?.message}(0,s.aJ)("setGlobalSearchQuery",((e,t,a)=>{const{query:n,tabId:o=(0,m.g0)()}=a,{chatId:i}=(0,b.nTw)(e,o).globalSearch;n&&!i&&ue((async()=>{const t=await(0,f.px)("searchChats",{query:n});e=(0,s.mS)();const a=(0,b.xT4)(e,o);if(!t||!a||n!==a)return e=(0,A.Rg)(e,{chats:!1},o),void(0,s.UF)(e);const{accountResultIds:i,globalResultIds:r,users:c,chats:d}=t;e=(0,A.Nl)(e,(0,h.dU)(d,"id")),e=(0,A.g1)(e,(0,h.dU)(c,"id")),e=(0,A.Rg)(e,{chats:!1},o),e=(0,A.b8)(e,{localResults:{peerIds:i},globalResults:{...(0,b.nTw)(e,o).globalSearch.globalResults,peerIds:r}},o),(0,s.UF)(e)}))})),(0,s.aJ)("setGlobalSearchDate",((e,t,a)=>{const{date:n,tabId:o=(0,m.g0)()}=a,i=n?(0,de.TI)(n):n;e=(0,A.b8)(e,{minDate:n,maxDate:i,query:"",resultsByType:{...(0,b.nTw)(e,o).globalSearch.resultsByType,text:{totalCount:void 0,foundIds:[],nextOffsetId:0}}},o),(0,s.UF)(e),t.searchMessagesGlobal({type:"text",tabId:o})})),(0,s.aJ)("searchMessagesGlobal",((e,t,a)=>{const{type:o,tabId:i=(0,m.g0)()}=a,{query:r,resultsByType:c,chatId:d}=(0,b.nTw)(e,i).globalSearch,u=c?.[o]?.nextOffsetId,p=c?.[o]?.nextOffsetRate,g=c?.[o]?.nextOffsetPeerId;if(c?.[o]?.totalCount&&c[o].totalCount>=c[o].foundIds.length)return;const y=d?(0,b.hds)(e,d):void 0;!async function(e,t){const{query:a="",type:o,offsetRate:i,offsetId:r,offsetPeer:c,chat:d,maxDate:u,minDate:p,tabId:g=(0,m.g0)()}=t;let y,I;if(d){const e=(0,f.px)("searchMessagesInChat",{chat:d,query:a,type:o,limit:n.wAs,offsetId:r,minDate:p,maxDate:u}),t=d.isForum?(0,f.px)("fetchTopics",{chat:d,query:a,limit:n.mH$}):void 0,[s,i]=await Promise.all([e,t]);if(s){const{messages:e,users:t,totalCount:a,nextOffsetId:n}=s,{topics:o,count:r}=i||{};y={topics:o,totalTopicsCount:r,messages:e,users:t,chats:[],totalCount:a,nextOffsetId:n}}}else if(y=await(0,f.px)("searchMessagesGlobal",{query:a,offsetRate:i,offsetId:r,offsetPeer:c,limit:n.wAs,type:o,maxDate:u,minDate:p}),(0,l.z)(a)){const t=(0,l.v)(a);"publicMessageLink"===t?.type?I=await async function(e,t){const{username:a,messageId:s}=t,n=(0,b.qn$)(e,a);if(n)return me(e,n,s);const{chat:o}=await(0,f.px)("getChatByUsername",a)??{};return o?me(e,o,s):void 0}(e,t):"privateMessageLink"===t?.type&&(I=await function(e,t){const{channelId:a,messageId:s}=t,n=(0,le.QE)(a),o=(0,b.hds)(e,n);if(o)return me(e,o,s)}(e,t))}e=(0,s.mS)();const v=(0,b.xT4)(e,g);if(!y||""!==a&&a!==v)return e=(0,A.Rg)(e,{messages:!1},g),void(0,s.UF)(e);I&&(y.totalCount=y.messages.unshift(I));const{messages:w,users:S,chats:C,userStatusesById:E,totalCount:M,nextOffsetRate:k,nextOffsetId:P,nextOffsetPeerId:T}=y;C.length&&(e=(0,A.Nl)(e,(0,h.dU)(C,"id"))),S.length&&(e=(0,A.g1)(e,(0,h.dU)(S,"id"))),E&&(e=(0,A.d2)(e,E)),w.length&&(e=(0,A.Kc)(e,w)),e=(0,A.Hy)(e,w,M,o,k,P,T,g),y.topics&&(e=(0,A.mI)(e,d.id,y.totalTopicsCount,y.topics));const x=y.topics?.map((e=>{let{id:t}=e;return t})).sort(((e,t)=>t-e));e=(0,A.b8)(e,{foundTopicIds:x},g),(0,s.UF)(e)}(e,{query:r,type:o,offsetRate:p,offsetId:u,offsetPeer:g?(0,b.hds)(e,g):void 0,chat:y,tabId:i})})),(0,s.aJ)("searchPopularBotApps",(async(e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{},o=(0,b.nTw)(e,n).globalSearch.popularBotApps,i=o?.nextOffset;if(o?.peerIds&&!i)return;e=(0,A.Rg)(e,{botApps:!0},n),(0,s.UF)(e);const r=await(0,f.px)("fetchPopularAppBots",{offset:i});if(e=(0,s.mS)(),!r)return e=(0,A.Rg)(e,{botApps:!1},n),void(0,s.UF)(e);e=(0,A.g1)(e,(0,h.dU)(r.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(r.chats,"id"));const c=r.users.map((e=>{let{id:t}=e;return t}));e=(0,A.b8)(e,{popularBotApps:{peerIds:[...o?.peerIds||[],...c],nextOffset:r.nextOffset}},n),e=(0,A.Rg)(e,{botApps:!1},n),(0,s.UF)(e)}));var he=a(57309);async function pe(e,t,a,o,i){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6?arguments[6]:void 0;for(var d=arguments.length,l=new Array(d>7?d-7:0),u=7;u<d;u++)l[u-7]=arguments[u];let[p=(0,m.g0)()]=l;const g=c?e.currentUserId:t.id,y=await(0,f.px)("searchMessagesInChat",{chat:t,type:o,limit:2*n.Um,threadId:a,offsetId:i,isSavedDialog:c});if(!y)return;const{chats:I,users:v,messages:w,totalCount:S,nextOffsetId:C}=y,E=(0,h.dU)(w,"id"),M=Object.keys(E).map(Number);e=(0,s.mS)(),(0,b.BU_)(e,p)&&(e=(0,A.Nl)(e,(0,h.dU)(I,"id")),e=(0,A.g1)(e,(0,h.dU)(v,"id")),e=(0,A.o4)(e,g,E),e=(0,A.jU)(e,g,a,o,M,S,C,p),(0,s.UF)(e),r||pe(e,t,a,o,C,!0,c,p))}(0,s.aJ)("performMiddleSearch",(async(e,t,a)=>{const{query:o,chatId:i,threadId:c=r.l3,tabId:d=(0,m.g0)()}=a||{};if(!i)return;const l=e.currentUserId,u=(0,I.cG)(i,c,l),p=u?String(c):i,g=p?(0,b.hds)(e,p):void 0;let y=(0,b.TCk)(e,d);if(!g)return;y||(e=(0,A.$R)(e,p,c,{},d),(0,s.UF)(e),e=(0,s.mS)()),y=(0,b.TCk)(e,d);const{results:v,savedTag:w,type:S,isHashtag:C}=y,E=v?.nextOffsetId,M=v?.nextOffsetRate,k=v?.nextOffsetPeerId,P=k?(0,b.hds)(e,k):void 0;if((C||!w)&&!o)return e=(0,A.$R)(e,p,c,{fetchingQuery:void 0},d),void(0,s.UF)(e);let T;if(e=(0,A.$R)(e,p,c,{fetchingQuery:o},d),(0,s.UF)(e),"chat"===S&&(T=await(0,f.px)("searchMessagesInChat",{chat:g,type:"text",query:C?`#${o}`:o,threadId:c,limit:n.gXr,offsetId:E,isSavedDialog:u,savedTag:w})),"myChats"===S&&(T=await(0,f.px)("searchMessagesGlobal",{type:"text",query:C?`#${o}`:o,limit:n.gXr,offsetId:E,offsetRate:M,offsetPeer:P})),"channels"===S&&(T=await(0,f.px)("searchHashtagPosts",{hashtag:o,limit:n.gXr,offsetId:E,offsetPeer:P,offsetRate:M})),!T)return;const{chats:x,users:N,userStatusesById:B,messages:U,totalCount:F,nextOffsetId:R,nextOffsetRate:L,nextOffsetPeerId:J}=T,O=U.map(he.D);e=(0,s.mS)(),y=(0,b.TCk)(e,d);const D=y?.savedTag&&!(0,I.a0)(w,y.savedTag),V=y?.fetchingQuery&&y.fetchingQuery!==o;if(!y||V||D)return;const G=u?l:g.id;e=(0,A.Nl)(e,(0,h.dU)(x,"id")),e=(0,A.g1)(e,(0,h.dU)(N,"id")),e=(0,A.d2)(e,B),e=(0,A.Kc)(e,U),e=(0,A.$R)(e,G,c,{fetchingQuery:void 0},d),e=(0,A.Vm)(e,G,c,{foundIds:O,totalCount:F,nextOffsetId:R,nextOffsetRate:L,nextOffsetPeerId:J,query:o||""},d),(0,s.UF)(e)})),(0,s.aJ)("searchHashtag",((e,t,a)=>{const{hashtag:s,tabId:n=(0,m.g0)()}=a,o=(0,b.Xf0)(e,n);if(!o)return;const i=s.replace(/^#/,"");t.updateMiddleSearch({chatId:o.chatId,threadId:o.threadId,update:{isHashtag:!0,requestedQuery:i},tabId:n})})),(0,s.aJ)("searchSharedMediaMessages",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n,threadId:o}=(0,b.Xf0)(e,s)||{};if(!n||!o)return;const i=(0,I.cG)(n,o,e.currentUserId),r=i?String(o):n,c=(0,b.hds)(e,r),d=(0,b.BU_)(e,s);if(!c||!d)return;const{currentType:l,resultsByType:u}=d,h=l&&u&&u[l],p=h?.nextOffsetId;l&&pe(e,c,o,l,p,void 0,i,s)})),(0,s.aJ)("searchChatMediaMessages",((e,t,a)=>{const{chatId:o,threadId:i,currentMediaMessageId:r,limit:d,direction:l,tabId:u=(0,m.g0)()}=a;if(!o||!i||!r)return;const p=(0,I.cG)(o,i,e.currentUserId),g=p?String(i):o,y=(0,b.hds)(e,g);if(!y)return;let v=(0,b.CuV)(e,u);(v||(e=(0,A.tX)(e,o,i,u),(0,s.UF)(e),v=(0,b.CuV)(e,u),v))&&async function(e,t,a,o,i,r,d){let l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:n.laV;for(var u=arguments.length,p=new Array(u>8?u-8:0),g=8;g<u;g++)p[g-8]=arguments[g];let[y=(0,m.g0)()]=p;const{isSynced:v}=e;if(!v||i.isLoading)return;let b=function(e,t){if((0,h.OX)(t,e.currentSegment.foundIds))return e.currentSegment;const a=e.segments.findIndex((e=>(0,h.OX)(t,e.foundIds)));if(-1===a)return void(e.currentSegment&&e.currentSegment.foundIds.length&&e.segments.push(e.currentSegment));const s=e.segments.splice(a,1)[0];return e.segments.push(e.currentSegment),s}(i,o);if(void 0===r&&(r=function(e,t){if(!t)return c.TN.Around;const a=t.foundIds.length,s=t.foundIds.indexOf(e);if(-1===s)return c.TN.Around;if(t.loadingState.areAllItemsLoadedBackwards&&t.loadingState.areAllItemsLoadedForwards)return;const n=9>Math.floor(a/2)?0:9,o=a-1;if(s<=n){if(t.loadingState.areAllItemsLoadedBackwards)return;return c.TN.Backwards}if(s>=o-n){if(t.loadingState.areAllItemsLoadedForwards)return;return c.TN.Forwards}}(o,b)),void 0===r)return;const w=function(e,t,a){return a?e===c.TN.Backwards?a.foundIds[0]:e===c.TN.Forwards?a.foundIds[a.foundIds.length-1]:t:t}(r,o,b),S=function(e,t){return e===c.TN.Backwards?0:e===c.TN.Forwards?-(t+1):-(Math.round(t/2)+1)}(r,l),C=d?e.currentUserId:t.id;e=(0,A.lw)(e,C,a,!0,y),(0,s.UF)(e);const E=await(0,f.px)("searchMessagesInChat",{chat:t,type:"media",limit:l,threadId:a,offsetId:w,isSavedDialog:d,addOffset:S});if(e=(0,s.mS)(),!E)return e=(0,A.lw)(e,C,a,!1,y),void(0,s.UF)(e);const{chats:M,users:k,messages:P}=E,T=(0,h.dU)(P,"id"),x=Object.keys(T).map(Number);e=(0,A.Nl)(e,(0,h.dU)(M,"id")),e=(0,A.g1)(e,(0,h.dU)(k,"id")),e=(0,A.o4)(e,C,T);const N=function(e,t,a,s){let n=Boolean(s?.loadingState.areAllItemsLoadedForwards),o=Boolean(s?.loadingState.areAllItemsLoadedBackwards);return a<t&&(e===c.TN.Forwards?n=!0:e===c.TN.Backwards&&(o=!0)),{areAllItemsLoadedForwards:n,areAllItemsLoadedBackwards:o}}(r,l,x.length,b),B=(0,I.Wm)(T,x,!1);b=(0,A.ol)(B,N,b),e=(0,A.Qb)(e,C,a,b,i,y),e=(0,A.lw)(e,C,a,!1,y),(0,s.UF)(e)}(e,y,i,r,v,l,p,d,u)})),(0,s.aJ)("searchMessagesByDate",(async(e,t,a)=>{const{timestamp:s,tabId:n=(0,m.g0)()}=a,{chatId:o}=(0,b.Xf0)(e,n)||{};if(!o)return;const i=(0,b.hds)(e,o);if(!i)return;const r=await(0,f.px)("findFirstMessageIdAfterDate",{chat:i,timestamp:s});r&&t.focusMessage({chatId:i.id,messageId:r,tabId:n})})),(0,s.aJ)("checkPublicLink",(async(e,t,a)=>{const{username:n,tabId:o=(0,m.g0)()}=a,{chatId:i}=(0,b.Xf0)(e,o)||{};if(!i)return;if((0,b.nTw)(e,o).management.progress===c.TD.InProgress)return;e=(0,A.H6)(e,i,{isUsernameAvailable:void 0,checkedUsername:void 0},o),(0,s.UF)(e);const{result:r,error:d}=await(0,f.px)("checkChatUsername",{username:n});e=(0,s.mS)(),e=(0,A.nH)(e,!0===r?c.TD.Complete:c.TD.Error,o),e=(0,A.H6)(e,i,{isUsernameAvailable:!0===r,checkedUsername:n,error:d},o),(0,s.UF)(e),void 0===r&&t.openLimitReachedModal({limit:"channelsPublic",tabId:o})})),(0,s.aJ)("updatePublicLink",(async(e,t,a)=>{const{username:n,shouldDisableUsernames:o,tabId:r=(0,m.g0)()}=a,{chatId:d}=(0,b.Xf0)(e,r)||{};if(!d)return;const l=await(0,i.Jm)(e,t,d,r);if(!l)return;e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.InProgress,r),(0,s.UF)(e);const u=await(0,f.px)("setChatUsername",{chat:l,username:n});o&&await(0,f.px)("deactivateAllUsernames",{chat:l}),e=(0,s.mS)(),e=(0,A.nH)(e,u?c.TD.Complete:c.TD.Error,r),e=(0,A.H6)(e,l.id,{isUsernameAvailable:void 0,checkedUsername:void 0,error:void 0},r),(0,s.UF)(e)})),(0,s.aJ)("updatePrivateLink",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n}=(0,b.Xf0)(e,s)||{},o=n&&(0,b.hds)(e,n);n&&o&&(0,f.px)("updatePrivateLink",{chat:o})})),(0,s.aJ)("setEditingExportedInvite",((e,t,a)=>{const{chatId:n,invite:o,tabId:i=(0,m.g0)()}=a;e=(0,A.H6)(e,n,{editingInvite:o},i),(0,s.UF)(e)})),(0,s.aJ)("setOpenedInviteInfo",((e,t,a)=>{const{chatId:n,invite:o,tabId:i=(0,m.g0)()}=a,r=o?{inviteInfo:{invite:o}}:{inviteInfo:void 0};e=(0,A.H6)(e,n,r,i),(0,s.UF)(e)})),(0,s.aJ)("loadExportedChatInvites",(async(e,t,a)=>{const{chatId:n,adminId:o,isRevoked:i,limit:r,tabId:c=(0,m.g0)()}=a,d=(0,b.hds)(e,n),l=(0,b.mBe)(e,o||e.currentUserId);if(!d||!l)return;const u=await(0,f.px)("fetchExportedChatInvites",{peer:d,admin:l,isRevoked:i,limit:r});if(!u)return;e=(0,s.mS)();const{invites:p,users:g}=u;e=(0,A.g1)(e,(0,h.dU)(g,"id"));const y=i?{revokedInvites:p}:{invites:p};e=(0,A.H6)(e,n,y,c),(0,s.UF)(e)})),(0,s.aJ)("editExportedChatInvite",(async(e,t,a)=>{const{chatId:n,link:o,isRevoked:i,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l,tabId:u=(0,m.g0)()}=a,p=(0,b.hds)(e,n);if(!p)return;const g=await(0,f.px)("editExportedChatInvite",{peer:p,link:o,isRevoked:i,expireDate:r,usageLimit:c,isRequestNeeded:d,title:l});if(!g)return;const{oldInvite:y,newInvite:I,users:v}=g;e=(0,s.mS)();const{management:w}=(0,b.nTw)(e,u),S=(w.byChatId[n].invites||[]).filter((e=>e.link!==y.link)),C=[...w.byChatId[n].revokedInvites||[]];I.isRevoked?C.unshift(I):S.push(I),e=(0,A.g1)(e,(0,h.dU)(v,"id")),e=(0,A.H6)(e,n,{invites:S,revokedInvites:C},u),(0,s.UF)(e)})),(0,s.aJ)("exportChatInvite",(async(e,t,a)=>{const{chatId:n,expireDate:o,usageLimit:i,isRequestNeeded:r,title:c,tabId:d=(0,m.g0)()}=a,l=(0,b.hds)(e,n);if(!l)return;const u=await(0,f.px)("exportChatInvite",{peer:l,expireDate:o,usageLimit:i,isRequestNeeded:r,title:c});if(!u)return;e=(0,s.mS)();const h=(0,b.nTw)(e,d).management.byChatId[n].invites||[];e=(0,A.H6)(e,n,{invites:[...h,u]},d),(0,s.UF)(e)})),(0,s.aJ)("deleteExportedChatInvite",(async(e,t,a)=>{const{chatId:n,link:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n);if(!r)return;if(!await(0,f.px)("deleteExportedChatInvite",{peer:r,link:o}))return;e=(0,s.mS)();const c=(0,b.nTw)(e,i).management.byChatId[n];e=(0,A.H6)(e,n,{invites:c?.invites?.filter((e=>e.link!==o)),revokedInvites:c?.revokedInvites?.filter((e=>e.link!==o))},i),(0,s.UF)(e)})),(0,s.aJ)("deleteRevokedExportedChatInvites",(async(e,t,a)=>{const{chatId:n,adminId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n),c=(0,b.mBe)(e,o||e.currentUserId);r&&c&&await(0,f.px)("deleteRevokedExportedChatInvites",{peer:r,admin:c})&&(e=(0,s.mS)(),e=(0,A.H6)(e,n,{revokedInvites:[]},i),(0,s.UF)(e))})),(0,s.aJ)("loadChatInviteImporters",(async(e,t,a)=>{const{chatId:n,link:o,offsetDate:i,offsetUserId:r,limit:c,tabId:d=(0,m.g0)()}=a,l=(0,b.hds)(e,n),u=r?(0,b.mBe)(e,r):void 0;if(!l||r&&!u)return;const h=await(0,f.px)("fetchChatInviteImporters",{peer:l,link:o,offsetDate:i,offsetUser:u,limit:c});if(!h)return;const{importers:p,users:g}=h;e=(0,s.mS)();const y=(0,b.nTw)(e,d).management.byChatId[n]?.inviteInfo;y?.invite&&y.invite.link===o&&(e=(0,A.H6)(e,n,{inviteInfo:{...y,importers:p}},d),e=(0,A.g1)(e,g),(0,s.UF)(e))})),(0,s.aJ)("loadChatInviteRequesters",(async(e,t,a)=>{const{chatId:n,link:o,offsetDate:i,offsetUserId:r,limit:c,tabId:d=(0,m.g0)()}=a,l=(0,b.hds)(e,n),u=r?(0,b.mBe)(e,r):void 0;if(!l||r&&!u)return;const h=await(0,f.px)("fetchChatInviteImporters",{peer:l,link:o,offsetDate:i,offsetUser:u,limit:c,isRequested:!0});if(!h)return;const{importers:p,users:g}=h;e=(0,s.mS)();const y=(0,b.nTw)(e,d).management.byChatId[n]?.inviteInfo;y?.invite&&y.invite.link===o&&(e=(0,A.H6)(e,n,{inviteInfo:{...y,requesters:p}},d),e=(0,A.g1)(e,g),(0,s.UF)(e))})),(0,s.aJ)("loadChatJoinRequests",(async(e,t,a)=>{const{chatId:n,offsetDate:o=0,offsetUserId:i,limit:r=0}=a,c=(0,b.hds)(e,n),d=i?(0,b.mBe)(e,i):void 0;if(!c||i&&!d)return;const l=await(0,f.px)("fetchChatInviteImporters",{peer:c,offsetDate:o,offsetUser:d,limit:r,isRequested:!0});if(!l)return;const{importers:u,users:m}=l;e=(0,s.mS)(),e=(0,A.wi)(e,n,{joinRequests:u}),e=(0,A.g1)(e,m),(0,s.UF)(e)})),(0,s.aJ)("hideChatJoinRequest",(async(e,t,a)=>{const{chatId:n,userId:o,isApproved:i}=a,r=(0,b.hds)(e,n),c=(0,b.mBe)(e,o);if(!r||!c)return;if(!await(0,f.px)("hideChatJoinRequest",{peer:r,user:c,isApproved:i}))return;e=(0,s.mS)();const d=(0,b.hds)(e,n);d&&(e=(0,A.wi)(e,n,{joinRequests:d.joinRequests?.filter((e=>e.userId!==o))}),(0,s.UF)(e))})),(0,s.aJ)("hideAllChatJoinRequests",(async(e,t,a)=>{const{chatId:n,isApproved:o,link:i}=a,r=(0,b.hds)(e,n);r&&await(0,f.px)("hideAllChatJoinRequests",{peer:r,isApproved:o,link:i})&&(e=(0,s.mS)(),(0,b.hds)(e,n)&&(e=(0,A.wi)(e,n,{joinRequests:[]}),e=(0,A.lt)(e,n,{recentRequesterIds:[],requestsPending:0}),(0,s.UF)(e)))})),(0,s.aJ)("hideChatReportPanel",(async(e,t,a)=>{const{chatId:n}=a,o=(0,b.hds)(e,n);o&&await(0,f.px)("hideChatReportPanel",o)&&(e=(0,s.mS)(),e=(0,A.wi)(e,n,{settings:void 0}),(0,s.UF)(e))})),(0,s.aJ)("uploadContactProfilePhoto",(async(e,t,a)=>{const{userId:n,file:o,isSuggest:i,tabId:r=(0,m.g0)()}=a,d=(0,b.mBe)(e,n);if(!d)return;e=(0,A.nH)(e,c.TD.InProgress,r),(0,s.UF)(e);const l=await(0,f.px)("uploadContactProfilePhoto",{user:d,file:o,isSuggest:i});if(!l)return e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.Error,r),void(0,s.UF)(e);e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(l.users,"id")),(0,s.UF)(e);const{id:u,accessHash:p}=d;if(!await(0,f.px)("fetchFullUser",{id:u,accessHash:p}))return e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.Error,r),void(0,s.UF)(e);t.loadMoreProfilePhotos({peerId:n,shouldInvalidateCache:!0}),e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.Complete,r),(0,s.UF)(e),o&&!i&&t.showNotification({message:g.yE("UserInfo.SetCustomPhoto.SuccessPhotoText",(0,I.u0)(d)),tabId:r})})),(0,s.aJ)("resetManagementError",((e,t,a)=>{const{chatId:s,tabId:n=(0,m.g0)()}=a||{};return(0,A.H6)(e,s,{error:void 0},n)}));var ge=a(37932),ye=a(49763);let fe,Ie;function Ae(e,t,a){const s=e.currentUserId,o=(0,I.cG)(t,a,s),i=o?String(a):t,r=(0,b.hds)(e,i);return(0,f.px)("fetchMessages",{chat:r,threadId:a,offsetId:o?void 0:r.lastReadInboxMessageId,addOffset:-(Math.round(n.yo2/2)+1),limit:n.yo2,isSavedDialog:o})}(0,s.aJ)("sync",((e,t)=>{n.Oig&&console.log(">>> START SYNC"),fe&&clearTimeout(fe),e=(0,s.mS)(),e={...e,isSyncing:!0},(0,s.UF)(e),fe=window.setTimeout((()=>{e=(0,s.mS)(),e={...e,isSyncing:!1},(0,s.UF)(e),fe=void 0}),15e3);const{loadAllChats:a,preloadTopChatMessages:o,loadAllStories:i,loadAllHiddenStories:c}=t;(0,ye.Ts)(),a({listType:"active",shouldReplace:!0,onReplace:async()=>{await async function(e,t){let a=!1;e=(0,s.mS)();let o=!1;const i=Object.keys(e.messages.byChatId).reduce(((t,a)=>(t[a]=Object.keys(e.messages.byChatId[a].threadsById).reduce(((t,s)=>(t[Number(s)]=(0,h.Oy)({draft:(0,b.GA4)(e,a,Number(s)),editingId:(0,b.Ys6)(e,a,Number(s)),editingDraft:(0,b.U0A)(e,a,Number(s))}),t)),{}),t)),{}),c=Object.entries(e.chats.lastMessageIds.all||{}).map((t=>{let[a,s]=t;return(0,b.O5q)(e,a,Number(s))})).filter(Boolean),d=Object.values(e.chats.lastMessageIds.saved||{}).map((t=>(0,b.O5q)(e,e.currentUserId,Number(t)))).filter(Boolean);for(const{id:i}of Object.values(e.byTabId)){e=(0,s.mS)();const{chatId:c,threadId:d}=(0,b.Xf0)(e,i)||{},l=d||r.l3,u=c&&d?(0,b.Vw0)(e,c,d):void 0,m=c?e.chats.byId[c]:void 0;if(c&&m){const[t,d]=await Promise.all([Ae(e,c,l),l===r.l3||(0,I.cG)(m.id,l,e.currentUserId)?void 0:(0,f.px)("fetchDiscussionMessage",{chat:m,messageId:Number(l)})]);e=(0,s.mS)();const{chatId:p}=(0,b.Xf0)(e,i)||{};if(t&&p===c){const s=(0,b.zeq)(e,c),i=c===n.zv8?e.serviceNotifications.filter((e=>{let{isDeleted:t}=e;return!t})).map((e=>{let{message:t}=e;return t})):[],p=m.isForum&&m.topics?Object.values(m.topics).map((e=>{let{lastMessageId:t}=e;return s[t]})).filter(Boolean):[],g=t.messages.map((e=>{let{id:t}=e;return t})),y=(0,h.Up)(e.messages.byChatId[c].threadsById,g),f=((!t.messages.length||t.messages.some((e=>{let{id:t}=e;return t===d?.firstMessageId})))&&d?.topMessages||[]).concat(t.messages,i),I=f.concat(p),w=(0,h.dU)(I,"id"),S=(0,h.Am)(f.map((e=>{let{id:t}=e;return t})));o||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:a}=t;e=(0,v.w)(e,{tabThreads:{}},a)})),o=!0),e=(0,A.o4)(e,c,w),e=(0,A.d4)(e,c,l,S),Object.entries(y).forEach((t=>{let[a,s]=t;s?.threadInfo&&(e=(0,A.eA)(e,c,a,s.threadInfo))})),u&&!u.isCommentsInfo&&l!==r.l3&&(e=(0,A.eA)(e,c,l,{...(0,h.Up)(u,["fromChannelId","fromMessageId"])})),Object.values(e.byTabId).forEach((t=>{let{id:a}=t;const{chatId:s,threadId:n}=(0,b.Xf0)(e,a)||{};s===c&&n===l&&(e=(0,A.s3)(e,c,l,S,a))})),e=(0,A.h7)(e,(0,h.dU)(t.chats,"id")),e=(0,A.CK)(e,(0,h.dU)(t.users,"id")),a=!0}}(0,s.UF)(e),m?.isForum&&(t.loadTopics({chatId:c,force:!0}),d&&d!==r.l3&&t.loadTopicById({chatId:c,topicId:Number(d),shouldCloseChatOnError:!0}))}e=(0,s.mS)(),a||(e={...e,messages:{...e.messages,byChatId:{}}},Object.values(e.byTabId).forEach((t=>{let{id:a}=t;e=(0,v.w)(e,{tabThreads:{}},a)}))),Object.keys(i).forEach((t=>{const a=i[t];Object.keys(a).forEach((a=>{e=(0,A.e4)(e,t,Number(a),i[t][Number(a)])}))})),e=(0,A.Kc)(e,c),e=(0,A.Kc)(e,d),(0,s.UF)(e),Object.values(e.byTabId).forEach((a=>{let{id:s}=a;const{chatId:n,messageId:o}=(0,b.nTw)(e,s).audioPlayer;n&&o&&!(0,b.O5q)(e,n,o)&&t.closeAudioPlayer({tabId:s})}))}(e,t),e=(0,s.mS)(),e={...e,isSyncing:!1,isSynced:!0,isFetchingDifference:!1},(0,s.UF)(e),n.Oig&&console.log(">>> FINISH SYNC"),a({listType:"archived",shouldReplace:!0}),a({listType:"saved",shouldReplace:!0}),o(),i(),c()}})})),(0,ge.DW)((e=>{const{connectionState:t,authState:a,isSynced:n}=e,{isMasterTab:o}=(0,b.nTw)(e);!o||n||Ie?.connectionState===t&&Ie?.authState===a||"connectionStateReady"===t&&"authorizationStateReady"===a&&(0,s.ko)().sync(),Ie=e})),(0,s.aJ)("reportPeer",(async(e,t,a)=>{const{chatId:s,reason:n,description:o,tabId:i=(0,m.g0)()}=a;if(!s)return;const r=(0,b.hds)(e,s);if(!r)return;const c=await(0,f.px)("reportPeer",{peer:r,reason:n,description:o});t.showNotification({message:c?(0,g.yE)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:i})})),(0,s.aJ)("reportProfilePhoto",(async(e,t,a)=>{const{chatId:s,reason:n,description:o,photo:i,tabId:r=(0,m.g0)()}=a;if(!s)return;const c=(0,b.hds)(e,s);if(!c||!i)return;const d=await(0,f.px)("reportProfilePhoto",{peer:c,photo:i,reason:n,description:o});t.showNotification({message:d?(0,g.yE)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,s.aJ)("loadAuthorizations",(async e=>{const t=await(0,f.px)("fetchAuthorizations");t&&(e=(0,s.mS)(),e={...e,activeSessions:{byHash:t.authorizations,orderedHashes:Object.keys(t.authorizations),ttlDays:t.ttlDays}},(0,s.UF)(e))})),(0,s.aJ)("terminateAuthorization",(async(e,t,a)=>{const{hash:n}=a;if(!await(0,f.px)("terminateAuthorization",n))return;e=(0,s.mS)();const{[n]:o,...i}=e.activeSessions.byHash;e={...e,activeSessions:{byHash:i,orderedHashes:e.activeSessions.orderedHashes.filter((e=>e!==n))}},(0,s.UF)(e)})),(0,s.aJ)("terminateAllAuthorizations",(async e=>{if(!await(0,f.px)("terminateAllAuthorizations"))return;const t=(e=(0,s.mS)()).activeSessions.orderedHashes.find((t=>e.activeSessions.byHash[t].isCurrent));if(!t)return;const a=e.activeSessions.byHash[t];e={...e,activeSessions:{byHash:{[t]:a},orderedHashes:[t]}},(0,s.UF)(e)})),(0,s.aJ)("changeSessionSettings",(async(e,t,a)=>{const{hash:n,areCallsEnabled:o,areSecretChatsEnabled:i,isConfirmed:r}=a;await(0,f.px)("changeSessionSettings",{hash:n,areCallsEnabled:o,areSecretChatsEnabled:i,isConfirmed:r})&&(e=(0,s.mS)(),e={...e,activeSessions:{...e.activeSessions,byHash:{...e.activeSessions.byHash,[n]:{...e.activeSessions.byHash[n],...void 0!==o?{areCallsEnabled:o}:void 0,...void 0!==i?{areSecretChatsEnabled:i}:void 0,...r&&{isUnconfirmed:void 0}}}}},(0,s.UF)(e))})),(0,s.aJ)("changeSessionTtl",(async(e,t,a)=>{const{days:n}=a;await(0,f.px)("changeSessionTtl",{days:n})&&(e=(0,s.mS)(),e={...e,activeSessions:{...e.activeSessions,ttlDays:n}},(0,s.UF)(e))})),(0,s.aJ)("loadWebAuthorizations",(async e=>{const t=await(0,f.px)("fetchWebAuthorizations");if(!t)return;const{users:a,webAuthorizations:n}=t;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(a,"id")),e={...e,activeWebSessions:{byHash:n,orderedHashes:Object.keys(n)}},(0,s.UF)(e)})),(0,s.aJ)("terminateWebAuthorization",(async(e,t,a)=>{const{hash:n}=a;if(!await(0,f.px)("terminateWebAuthorization",n))return;e=(0,s.mS)();const{[n]:o,...i}=e.activeWebSessions.byHash;e={...e,activeWebSessions:{byHash:i,orderedHashes:e.activeWebSessions.orderedHashes.filter((e=>e!==n))}},(0,s.UF)(e)})),(0,s.aJ)("terminateAllWebAuthorizations",(async e=>{await(0,f.px)("terminateAllWebAuthorizations")&&(e=(0,s.mS)(),e={...e,activeWebSessions:{byHash:{},orderedHashes:[]}},(0,s.UF)(e))}));var ve=a(80140);const be=(0,y.nF)((e=>e()),500,!1);(0,s.aJ)("loadFullUser",(async(e,t,a)=>{const{userId:n,withPhotos:o}=a,i=(0,b.mBe)(e,n);if(!i)return;const{id:r,accessHash:c}=i,d=await(0,f.px)("fetchFullUser",{id:r,accessHash:c});if(!d?.user)return;e=(0,s.mS)();const l=(0,b.vGo)(e,n),{user:u,fullInfo:m}=d,p=i.avatarPhotoId!==u.avatarPhotoId||l?.profilePhoto?.id!==m?.profilePhoto?.id||l?.fallbackPhoto?.id!==m?.fallbackPhoto?.id||l?.personalPhoto?.id!==m?.personalPhoto?.id;e=(0,A.TK)(e,n,d.user),e=(0,A.we)(e,n,d.fullInfo),e=(0,A.CK)(e,(0,h.dU)(d.users,"id")),e=(0,A.h7)(e,(0,h.dU)(d.chats,"id")),(0,s.UF)(e),(o||i.profilePhotos?.count&&p)&&t.loadMoreProfilePhotos({peerId:n,shouldInvalidateCache:!0})})),(0,s.aJ)("loadUser",(async(e,t,a)=>{const{userId:n}=a,o=(0,b.mBe)(e,n);if(!o)return;const i=await(0,f.px)("fetchUsers",{users:[o]});if(!i)return;const{users:r,userStatusesById:c}=i;e=(0,s.mS)(),e=(0,A.CK)(e,(0,h.dU)(r,"id")),e=(0,A.wW)(e,{...e.users.statusesById,...c}),(0,s.UF)(e)})),(0,s.aJ)("loadTopUsers",(async e=>{const{topPeers:{lastRequestedAt:t}}=e;if(t&&!((0,ve.Fm)()-t>60))return;const a=await(0,f.px)("fetchTopUsers");if(!a)return;const{ids:n,users:o}=a;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(o,"id")),e={...e,topPeers:{...e.topPeers,userIds:n,lastRequestedAt:(0,ve.Fm)()}},(0,s.UF)(e)})),(0,s.aJ)("loadContactList",(async e=>{const t=await(0,f.px)("fetchContactList");if(!t)return;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(t.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(t.chats,"id")),e=(0,A.d2)(e,t.userStatusesById);const a=e=>e.lastName||e.firstName||"",n=new Intl.Collator("en-US"),o=t.users.sort(((e,t)=>n.compare(a(e),a(t)))).filter((e=>!e.isSelf));e={...e,contactList:{userIds:o.map((e=>e.id))}},(0,s.UF)(e)})),(0,s.aJ)("loadCurrentUser",(()=>{(0,f.px)("fetchCurrentUser")})),(0,s.aJ)("loadCommonChats",(async(e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{},{chatId:o}=(0,b.Xf0)(e,n)||{},i=o?(0,b.mBe)(e,o):void 0;if(!i||(0,I.tv)(i)||i.commonChats?.isFullyLoaded)return;const r=i.commonChats?.maxId,c=await(0,f.px)("fetchCommonChats",i.id,i.accessHash,r);if(!c)return;const{chats:d,chatIds:l,isFullyLoaded:u}=c;e=(0,s.mS)(),d.length&&(e=(0,A.Nl)(e,(0,h.dU)(d,"id"))),e=(0,A.TK)(e,i.id,{commonChats:{maxId:l.length?l[l.length-1]:"0",ids:(0,h.Am)((i.commonChats?.ids||[]).concat(l)),isFullyLoaded:u}}),(0,s.UF)(e)})),(0,s.aJ)("updateContact",(async(e,t,a)=>{const{userId:n,isMuted:o=!1,firstName:i,lastName:r,shouldSharePhoneNumber:d,tabId:l=(0,m.g0)()}=a,u=(0,b.mBe)(e,n);if(!u)return;let h;if(t.updateChatMutedState({chatId:n,isMuted:o}),e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.InProgress,l),(0,s.UF)(e),!u.isContact&&u.phoneNumber)h=await(0,f.px)("importContact",{phone:u.phoneNumber,firstName:i,lastName:r});else{const{id:e,accessHash:t}=u;h=await(0,f.px)("updateContact",{id:e,accessHash:t,phoneNumber:"",firstName:i,lastName:r,shouldSharePhoneNumber:d})}h&&(t.loadChatSettings({chatId:n}),t.loadPeerStories({peerId:n}),e=(0,s.mS)(),e=(0,A.TK)(e,u.id,{firstName:i,lastName:r}),(0,s.UF)(e)),e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.Complete,l),e=(0,A.BO)(e,l),(0,s.UF)(e)})),(0,s.aJ)("deleteContact",(async(e,t,a)=>{const{userId:s}=a,n=(0,b.mBe)(e,s);if(!n)return;const{id:o,accessHash:i}=n;await(0,f.px)("deleteContact",{id:o,accessHash:i})})),(0,s.aJ)("loadMoreProfilePhotos",(async(e,t,a)=>{const{peerId:n,shouldInvalidateCache:o,isPreload:i}=a,r=(0,I.L8)(n),c=r?(0,b.mBe)(e,n):void 0,d=r?void 0:(0,b.hds)(e,n),l=c||d;if(!l?.avatarPhotoId)return;if(l.profilePhotos&&!o&&(i||!l.profilePhotos.nextOffset))return;e=(0,A.Tq)(e,n,!0),(0,s.UF)(e),e=(0,s.mS)();let u=(0,b.vGo)(e,n),m=(0,b.AWZ)(e,n);if(c&&!u){const{id:e,accessHash:t}=c,a=await(0,f.px)("fetchFullUser",{id:e,accessHash:t});if(!a?.user)return;u=a.fullInfo}if(d&&!m){const e=await(0,f.px)("fetchFullChat",d);if(!e?.fullInfo)return;m=e.fullInfo}const p=u||m;if(!p)return;const g=l.profilePhotos?.nextOffset,y=!g||i||o?10:void 0,v=await(0,f.px)("fetchProfilePhotos",{peer:l,offset:g,limit:y});if(!v||!v.photos)return;e=(0,s.mS)();const{photos:w,users:S,count:C,nextOffsetId:E}=v;e=(0,A.g1)(e,(0,h.dU)(S,"id")),e=(0,A.LZ)(e,n,{newPhotos:w,count:C,nextOffset:E,fullInfo:p,shouldInvalidateCache:o}),(0,s.UF)(e)})),(0,s.aJ)("setUserSearchQuery",((e,t,a)=>{const{query:n,tabId:o=(0,m.g0)()}=a;n&&be((async()=>{const t=await(0,f.px)("searchChats",{query:n});e=(0,s.mS)();const a=(0,b.nTw)(e,o).userSearch.query;if(!t||!a||n!==a)return e=(0,A.Z0)(e,!1,o),void(0,s.UF)(e);const{users:i,chats:r,accountResultIds:c,globalResultIds:d}=t;e=(0,A.g1)(e,(0,h.dU)(i,"id")),e=(0,A.Nl)(e,(0,h.dU)(r,"id"));const l=c.filter(I.L8),u=d.filter(I.L8);e=(0,A.Z0)(e,!1,o),e=(0,A.BF)(e,{localUserIds:l,globalUserIds:u},o),(0,s.UF)(e)}))})),(0,s.aJ)("importContact",(async(e,t,a)=>{const{phoneNumber:n,firstName:o,lastName:i,tabId:r=(0,m.g0)()}=a,c=await(0,f.px)("importContact",{phone:n,firstName:o,lastName:i});c?(t.openChat({id:c,tabId:r}),e=(0,s.mS)(),e=(0,A.BO)(e,r),(0,s.UF)(e)):t.showNotification({message:g.yE("Contacts.PhoneNumber.NotRegistred"),tabId:r})})),(0,s.aJ)("reportSpam",((e,t,a)=>{const{chatId:s}=a,n=(0,b.PVB)(e,s);n&&(0,f.px)("reportSpam",n)})),(0,s.aJ)("setEmojiStatus",((e,t,a)=>{const{emojiStatus:s,expires:n}=a;(0,f.px)("updateEmojiStatus",s,n)})),(0,s.aJ)("saveCloseFriends",(async(e,t,a)=>{const{userIds:n}=a;await(0,f.px)("saveCloseFriends",n)&&(e=(0,s.mS)(),e.contactList?.userIds.forEach((t=>{const{isCloseFriend:a}=e.users.byId[t]||{};a&&!n.includes(t)&&(e=(0,A.TK)(e,t,{isCloseFriend:void 0}))})),n.forEach((t=>{e=(0,A.TK)(e,t,{isCloseFriend:!0})})),(0,s.UF)(e))}));const we=o.pz||o.Ni;class Se{constructor(e,t){var a,s,n,o;this.features=e,this.onFail=t,a=this,n=void 0,(s="symbol"==typeof(o=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var s=a.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(s="preOpened"))?o:o+"")in a?Object.defineProperty(a,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[s]=n}preOpenIfNeeded(){we&&(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(!we){const t=window.open(e,void 0,this.features);t?t.focus():this.onFail?.()}}cancelPreOpen(){this.preOpened?.close(),this.preOpened=void 0}}var Ce=a(33204),Ee=a(59852);function Me(e,t,a){for(var s=arguments.length,n=new Array(s>3?s-3:0),o=3;o<s;o++)n[o-3]=arguments[o];let[i=(0,m.g0)()]=n;const r=(0,b.nTw)(e,i);return(0,v.w)(e,{inlineBots:{...r.inlineBots,byUsername:{...r.inlineBots.byUsername,[t]:a}}},i)}function ke(e,t){for(var a=arguments.length,s=new Array(a>2?a-2:0),n=2;n<a;n++)s[n-2]=arguments[n];let[o=(0,m.g0)()]=s;return(0,v.w)(e,{inlineBots:{...(0,b.nTw)(e,o).inlineBots,isLoading:t}},o)}const Pe=(0,y.sg)((e=>e()),500,!1);let Te,xe;function Ne(e,t,a,n){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[c=(0,m.g0)()]=i;if("request"===n.type){e=(0,s.mS)();const t=(0,b.nTw)(e,c);if(!t.urlAuth)return;const{domain:a,bot:o,shouldRequestWriteAccess:i}=n;return e=(0,v.w)(e,{urlAuth:{...t.urlAuth,request:{domain:a,botId:o.id,shouldRequestWriteAccess:i}}},c),void(0,s.UF)(e)}const d="accepted"===n.type?n.url:a;window.open(d,"_blank","noopener"),t.closeUrlAuthModal({tabId:c})}async function Be(e,t,a,s,n){await(0,f.px)("sendMessage",{chat:e,replyInfo:a,text:t,sendAs:s,lastMessageId:n})}async function Ue(e,t,a,s,n){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];for(var i=arguments.length,r=new Array(i>6?i-6:0),c=6;c<i;c++)r[c-6]=arguments[c];let[d=(0,m.g0)()]=r;const{showDialog:l,showNotification:u,openUrl:h,openGame:p}=t;o&&(xe||(xe=new Se("popup,width=800,height=600",(()=>{u({message:"Allow browser to open popup window",tabId:d})}))),xe.preOpenIfNeeded());const g=await(0,f.px)("answerCallbackButton",{chatId:a.id,accessHash:a.accessHash,messageId:s,data:n,isGame:o});if(!g)return;const{message:y,alert:I,url:A}=g;I?l({data:{message:y||"Error"},tabId:d}):y?u({message:y,tabId:d}):A&&(o?A.includes("https://prizes.gamee.com/")?xe.open(A):(xe.cancelPreOpen(),p({url:A,chatId:a.id,messageId:s,tabId:d})):h({url:A,tabId:d}))}(0,s.aJ)("clickBotInlineButton",((e,t,a)=>{const{messageId:s,button:n,tabId:o=(0,m.g0)()}=a;switch(n.type){case"command":t.sendBotCommand({command:n.text,tabId:o});break;case"url":{const{url:e}=n;t.openUrl({url:e,tabId:o});break}case"callback":{const a=(0,b.meB)(e,o);if(!a)return;Ue(e,t,a,s,n.data,void 0,o);break}case"requestPoll":t.openPollModal({isQuiz:n.isQuiz,tabId:o});break;case"requestPhone":{const a=e.currentUserId?(0,b.mBe)(e,e.currentUserId):void 0;if(!a)return;t.showDialog({data:{phoneNumber:a.phoneNumber,firstName:a.firstName||"",lastName:a.lastName||"",userId:a.id},tabId:o});break}case"receipt":{const a=(0,b.meB)(e,o);if(!a)return;const{receiptMessageId:s}=n;t.getReceipt({chatId:a.id,messageId:s,tabId:o});break}case"buy":{const a=(0,b.meB)(e,o);if(!a)return;t.openInvoice({type:"message",chatId:a.id,messageId:s,tabId:o});break}case"game":{const a=(0,b.meB)(e,o);if(!a)return;Ue(e,t,a,s,void 0,!0,o);break}case"switchBotInline":{const{query:e,isSamePeer:a}=n;t.switchBotInline({query:e,isSamePeer:a,messageId:s,tabId:o});break}case"userProfile":{const{userId:e}=n;t.openChatWithInfo({id:e,tabId:o});break}case"simpleWebView":{const{url:a}=n,{chatId:i}=(0,b.Xf0)(e,o)||{};if(!i)return;const r=(0,b.O5q)(e,i,s);if(!r?.senderId)return;const c=(0,Ee.A)();t.requestSimpleWebView({url:a,botId:r?.senderId,theme:c,buttonText:n.text,tabId:o});break}case"webView":{const{url:a}=n,i=(0,b.meB)(e,o);if(!i)return;const r=(0,b.O5q)(e,i.id,s);if(!r)return;const c=r.viaBotId||r.senderId;if(!c)return;const d=(0,Ee.A)();t.requestWebView({url:a,botId:c,peerId:i.id,theme:d,buttonText:n.text,tabId:o});break}case"urlAuth":{const{url:a}=n,i=(0,b.meB)(e,o);if(!i)return;t.requestBotUrlAuth({chatId:i.id,messageId:s,buttonId:n.buttonId,url:a,tabId:o});break}}})),(0,s.aJ)("sendBotCommand",((e,t,a)=>{const{command:s,chatId:n,tabId:o=(0,m.g0)()}=a,i=n?(0,b.hds)(e,n):(0,b.meB)(e,o),r=(0,b.Xf0)(e,o);if(!i||!r)return;const{threadId:c}=r;t.resetDraftReplyInfo({tabId:o}),t.clearWebPagePreview({tabId:o});const d=(0,b.ZZX)(e,i.id);Be(i,s,(0,b.GA4)(e,i.id,c)?.replyInfo,(0,b.VF$)(e,i.id),d)})),(0,s.aJ)("restartBot",(async(e,t,a)=>{const{chatId:n,tabId:o=(0,m.g0)()}=a,{currentUserId:i}=e,r=(0,b.meB)(e,o),c=i&&(0,b.yps)(e,n);if(!i||!r||!c)return;const d=(0,b.ZZX)(e,r.id);await(0,f.px)("unblockUser",{user:c})&&(e=(0,s.mS)(),e=(0,A.OW)(e,c.id),(0,s.UF)(e),Be(r,"/start",void 0,(0,b.VF$)(e,n),d))})),(0,s.aJ)("loadTopInlineBots",(async e=>{const{lastRequestedAt:t}=e.topInlineBots;if(t&&(0,ve.Fm)()-t<60)return;const a=await(0,f.px)("fetchTopInlineBots");if(!a)return;const{ids:n,users:o}=a;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(o,"id")),e={...e,topInlineBots:{...e.topInlineBots,userIds:n,lastRequestedAt:(0,ve.Fm)()}},(0,s.UF)(e)})),(0,s.aJ)("loadTopBotApps",(async e=>{const{lastRequestedAt:t}=e.topBotApps;if(t&&(0,ve.Fm)()-t<60)return;const a=await(0,f.px)("fetchTopBotApps");if(!a)return;const{ids:n,users:o}=a;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(o,"id")),e={...e,topBotApps:{...e.topBotApps,userIds:n,lastRequestedAt:(0,ve.Fm)()}},(0,s.UF)(e)})),(0,s.aJ)("queryInlineBot",(async(e,t,a)=>{const{chatId:n,username:o,query:i,offset:r,tabId:c=(0,m.g0)()}=a;let d=(0,b.nTw)(e,c).inlineBots.byUsername[o];if(!1!==d){if(void 0===d){const{user:t,chat:a}=await(0,f.px)("fetchInlineBot",{username:o})||{};if(e=(0,s.mS)(),!t||!a)return e=Me(e,o,!1,c),void(0,s.UF)(e);e=(0,A.g1)(e,{[t.id]:t}),e=(0,A.Nl)(e,{[a.id]:a}),d={id:t.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=Me(e,o,d,c),(0,s.UF)(e)}(i!==d.query||d.canLoadMore)&&Pe((()=>{!async function(e,t){let{username:a,inlineBotData:n,chatId:o,query:i,offset:r}=t;for(var c=arguments.length,d=new Array(c>2?c-2:0),l=2;l<c;l++)d[l-2]=arguments[l];let[u=(0,m.g0)()]=d;e=(0,s.mS)();const h=(0,b.mBe)(e,n.id),p=(0,b.hds)(e,o);if(!h||!p)return;const g=n.query!==i;e=Me(e=ke(e,!0,u),a,{...n,query:i,...g&&{offset:void 0,results:[]}},u),(0,s.UF)(e);const y=await(0,f.px)("fetchInlineBotResults",{bot:h,chat:p,query:i,offset:g?void 0:r});e=(0,s.mS)();const I=(0,b.nTw)(e,u).inlineBots.byUsername[a];if(e=ke(e,!1,u),!y||!I||i!==I.query)return void(0,s.UF)(e);const A=new Set((I.results||[]).map((e=>e.id))),v=y.results.filter((e=>!A.has(e.id)));e=Me(e,a,{...I,help:y.help,cacheTime:Date.now()+1e3*y.cacheTime,...v.length&&{isGallery:y.isGallery},...y.switchPm&&{switchPm:y.switchPm},...y.switchWebview&&{switchWebview:y.switchWebview},canLoadMore:y.results.length>0&&Boolean(y.nextOffset),results:""===I.offset||I.offset===y.nextOffset?y.results:(I.results||[]).concat(v),offset:v.length?y.nextOffset:""},u),(0,s.UF)(e)}(e,{username:o,inlineBotData:d,chatId:n,query:i,offset:r},c)}))}})),(0,s.aJ)("switchBotInline",((e,t,a)=>{const{query:s,isSamePeer:n,messageId:o,filter:i,tabId:r=(0,m.g0)()}=a;let{botId:c}=a;const d=(0,b.meB)(e,r);if(!d)return;if(!c&&o){const t=(0,b.O5q)(e,d.id,o);if(!t)return;c=t.viaBotId||t.senderId}if(!c)return;const l=(0,b.mBe)(e,c);l&&t.openChatWithDraft({text:{text:`@${l.usernames[0].username} ${s}`},chatId:n?d.id:void 0,filter:i,tabId:r})})),(0,s.aJ)("sendInlineBotResult",((e,t,a)=>{const{id:s,queryId:n,isSilent:o,scheduledAt:i,messageList:r,tabId:c=(0,m.g0)()}=a;if(!s)return;const{chatId:d,threadId:l}=r,u=(0,b.hds)(e,d),h=(0,b.GA4)(e,d,l)?.replyInfo,p=(0,b.OEv)(e,d,l,h);t.resetDraftReplyInfo({tabId:c}),t.clearWebPagePreview({tabId:c}),(0,f.px)("sendInlineBotResult",{chat:u,resultId:s,queryId:n,replyInfo:p,sendAs:(0,b.VF$)(e,d),isSilent:o,scheduleDate:i})})),(0,s.aJ)("resetInlineBot",((e,t,a)=>{const{username:n,force:o,tabId:i=(0,m.g0)()}=a;let r=(0,b.nTw)(e,i).inlineBots.byUsername[n];r&&(!o&&Date.now()<r.cacheTime||(r={id:r.id,query:"",offset:"",switchPm:void 0,canLoadMore:!0,results:[],cacheTime:0},e=Me(e,n,r,i),(0,s.UF)(e)))})),(0,s.aJ)("resetAllInlineBots",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s).inlineBots.byUsername;Object.keys(n).forEach((e=>{t.resetInlineBot({username:e,tabId:s})}))})),(0,s.aJ)("startBot",(async(e,t,a)=>{const{botId:s,param:n}=a,o=(0,b.mBe)(e,s);if(!o)return;let i=(0,b.vGo)(e,s);if(!i){const e=await(0,f.px)("fetchFullUser",{id:o.id,accessHash:o.accessHash});i=e?.fullInfo}i?.isBlocked&&await(0,f.px)("unblockUser",{user:o}),await(0,f.px)("startBot",{bot:o,startParam:n})})),(0,s.aJ)("sharePhoneWithBot",(async(e,t,a)=>{const{botId:n}=a,o=(0,b.mBe)(e,n);if(!o)return;let i=(0,b.vGo)(e,n);if(!i){const e=await(0,f.px)("fetchFullUser",{id:o.id,accessHash:o.accessHash});i=e?.fullInfo}i?.isBlocked&&await(0,f.px)("unblockUser",{user:o}),e=(0,s.mS)();const r=(0,b.hds)(e,n),c=(0,b.mBe)(e,e.currentUserId);if(!r)return;const d=(0,b.ZZX)(e,r.id);await(0,f.px)("sendMessage",{chat:r,contact:{mediaType:"contact",firstName:c.firstName||"",lastName:c.lastName||"",phoneNumber:c.phoneNumber||"",userId:c.id},lastMessageId:d})})),(0,s.aJ)("requestSimpleWebView",(async(e,t,a)=>{const{url:n,botId:o,theme:i,buttonText:r,isFromSideMenu:c,isFromSwitchWebView:d,startParam:l,tabId:u=(0,m.g0)()}=a,h=(0,b.mBe)(e,o);if(!h)return;if(!(0,b.nTL)(e,o))return e=(0,v.w)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestSimpleWebView",payload:a}}},u),void(0,s.UF)(e);const p=await(0,f.px)("requestSimpleWebView",{url:n,bot:h,theme:i,startParam:l,isFromSideMenu:c,isFromSwitchWebView:d});p&&(e=(0,s.mS)(),e=(0,v.w)(e,{webApp:{url:p,botId:o,buttonText:r}},u),(0,s.UF)(e))})),(0,s.aJ)("requestWebView",(async(e,t,a)=>{const{url:n,botId:o,peerId:i,theme:c,isSilent:d,buttonText:l,isFromBotMenu:u,startParam:h,tabId:p=(0,m.g0)()}=a,g=(0,b.mBe)(e,o);if(!g)return;const y=(0,b.PVB)(e,i);if(!y)return;if(!(0,b.nTL)(e,o))return e=(0,v.w)(e,{botTrustRequest:{botId:o,type:"webApp",onConfirm:{action:"requestWebView",payload:a}}},p),void(0,s.UF)(e);const I=(0,b.Xf0)(e,p),{chatId:A,threadId:w=r.l3}=I||{},S=A?(0,b.GA4)(e,A,w)?.replyInfo:void 0,C=A?(0,b.OEv)(e,A,w,S):void 0,E=A?(0,b.VF$)(e,A):void 0,M=await(0,f.px)("requestWebView",{url:n,bot:g,peer:y,theme:c,isSilent:d,replyInfo:C,isFromBotMenu:u,startParam:h,sendAs:E});if(!M)return;const{url:k,queryId:P}=M;e=(0,s.mS)(),e=(0,v.w)(e,{webApp:{url:k,botId:o,queryId:P,replyInfo:C,buttonText:l}},p),(0,s.UF)(e)})),(0,s.aJ)("requestMainWebView",(async(e,t,a)=>{const{botId:n,peerId:o,theme:i,startParam:r,shouldMarkBotTrusted:c,tabId:d=(0,m.g0)()}=a,l=(0,b.mBe)(e,n);if(!l)return;const u=(0,b.PVB)(e,o);if(!u)return;if(!(0,b.nTL)(e,n)){if(!c)return e=(0,v.w)(e,{botTrustRequest:{botId:n,type:"webApp",onConfirm:{action:"requestMainWebView",payload:a}}},d),void(0,s.UF)(e);t.markBotTrusted({botId:n,isWriteAllowed:!0,tabId:d})}const h=await(0,f.px)("requestMainWebView",{bot:l,peer:u,theme:i,startParam:r});if(!h)return;const{url:p,queryId:g}=h;e=(0,s.mS)(),e=(0,v.w)(e,{webApp:{url:p,botId:n,queryId:g,buttonText:""}},d),(0,s.UF)(e)})),(0,s.aJ)("loadPreviewMedias",(async(e,t,a)=>{const{botId:n}=a,o=(0,b.mBe)(e,n);if(!o)return;const i=await(0,f.px)("fetchPreviewMedias",{bot:o});e=(0,s.mS)(),i&&(e={...e,users:{...e.users,previewMediaByBotId:{...e.users.previewMediaByBotId,[n]:i}}},(0,s.UF)(e))})),(0,s.aJ)("requestAppWebView",(async(e,t,a)=>{const{botId:n,appName:o,startApp:i,theme:r,isWriteAllowed:c,isFromConfirm:d,tabId:l=(0,m.g0)()}=a,u=(0,b.mBe)(e,n);if(!u)return;const p=Boolean(e.attachMenu.bots[u.id]);if(u.isAttachBot&&!d&&!p){const t=await(0,f.px)("loadAttachBot",{bot:u});if(t){const n=t.bot;if(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(t.users,"id")),(0,s.UF)(e),n.isDisclaimerNeeded||n.isForAttachMenu||n.isForSideMenu)return e=(0,v.w)(e,{requestedAttachBotInstall:{bot:n,onConfirm:{action:"requestAppWebView",payload:{...a,isFromConfirm:!0}}}},l),void(0,s.UF)(e)}}const y=await(0,f.px)("fetchBotApp",{bot:u,appName:o});if(e=(0,s.mS)(),!y)return void t.showNotification({message:(0,g.yE)("lng_username_app_not_found"),tabId:l});if(y.isInactive||!(0,b.nTL)(e,n))return e=(0,v.w)(e,{botTrustRequest:{botId:n,shouldRequestWriteAccess:y.shouldRequestWriteAccess,type:"botApp",onConfirm:{action:"requestAppWebView",payload:a}}},l),void(0,s.UF)(e);const I=(0,b.meB)(e,l),w=await(0,f.px)("requestAppWebView",{peer:I||u,app:y,startParam:i,isWriteAllowed:c,theme:r});e=(0,s.mS)(),w&&(e=(0,v.w)(e,{webApp:{url:w,botId:n,buttonText:""}},l),(0,s.UF)(e))})),(0,s.aJ)("prolongWebView",(async(e,t,a)=>{const{botId:s,peerId:n,isSilent:o,replyInfo:i,queryId:r,tabId:c=(0,m.g0)()}=a,d=(0,b.mBe)(e,s);if(!d)return;const l=(0,b.hds)(e,n);if(!l)return;const u=(0,b.VF$)(e,n);await(0,f.px)("prolongWebView",{bot:d,peer:l,isSilent:o,replyInfo:i,queryId:r,sendAs:u})||t.closeWebApp({tabId:c})})),(0,s.aJ)("sendWebViewData",((e,t,a)=>{const{bot:s,data:n,buttonText:o}=a;(0,f.px)("sendWebViewData",{bot:s,data:n,buttonText:o})})),(0,s.aJ)("closeWebApp",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{webApp:void 0},s)})),(0,s.aJ)("setWebAppPaymentSlug",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a,n=(0,b.nTw)(e,s);if(n.webApp?.url)return(0,v.w)(e,{webApp:{...n.webApp,slug:a.slug}},s)})),(0,s.aJ)("cancelBotTrustRequest",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{botTrustRequest:void 0},s)})),(0,s.aJ)("markBotTrusted",((e,t,a)=>{const{botId:n,isWriteAllowed:o,tabId:i=(0,m.g0)()}=a,{trustedBotIds:r}=e,c=new Set(r);c.add(n),e={...e,trustedBotIds:Array.from(c)};const d=(0,b.nTw)(e,i);if(d.botTrustRequest?.onConfirm){const{action:e,payload:a}=d.botTrustRequest.onConfirm;t[e]({...a,isWriteAllowed:o})}e=(0,v.w)(e,{botTrustRequest:void 0},i),(0,s.UF)(e)})),(0,s.aJ)("loadAttachBots",(async e=>{await async function(e,t){const a=await(0,f.px)("loadAttachBots",{hash:void 0});if(a)return e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(a.users,"id")),e={...e,attachMenu:{hash:a.hash,bots:a.bots}},(0,s.UF)(e),a}(e),(0,Ce.A)({action:"loadAttachBots",payload:void 0},n.npx)})),(0,s.aJ)("toggleAttachBot",(async(e,t,a)=>{const{botId:s,isWriteAllowed:n,isEnabled:o}=a,i=(0,b.mBe)(e,s);i&&await(0,f.px)("toggleAttachBot",{bot:i,isWriteAllowed:n,isEnabled:o})})),(0,s.aJ)("callAttachBot",((e,t,a)=>{const{bot:s,startParam:n,isFromConfirm:o,tabId:i=(0,m.g0)()}=a,c="isFromSideMenu"in a&&a.isFromSideMenu,d=!s,l=!d&&!e.attachMenu.bots[s.id]||s?.isInactive||s?.isDisclaimerNeeded;if(!o&&l)return(0,v.w)(e,{requestedAttachBotInstall:{bot:s,onConfirm:{action:"callAttachBot",payload:{...a,isFromConfirm:!0}}}},i);const u=(0,Ee.A)();if(c&&t.requestSimpleWebView({botId:s.id,buttonText:"",isFromSideMenu:!0,startParam:n,theme:u,tabId:i}),"chatId"in a){const{chatId:e,threadId:o=r.l3,url:c}=a;t.openThread({chatId:e,threadId:o,tabId:i}),t.requestWebView({url:c,peerId:e,botId:d?e:s.id,theme:u,buttonText:"",isFromBotMenu:d,startParam:n,tabId:i})}})),(0,s.aJ)("confirmAttachBotInstall",(async(e,t,a)=>{const{isWriteAllowed:n,tabId:o=(0,m.g0)()}=a,{requestedAttachBotInstall:i}=(0,b.nTw)(e,o),{bot:r,onConfirm:c}=i;e=(0,v.w)(e,{requestedAttachBotInstall:void 0},o),(0,s.UF)(e);const d=(0,b.mBe)(e,r.id);if(d&&(t.markBotTrusted({botId:r.id,isWriteAllowed:n,tabId:o}),await(0,f.px)("toggleAttachBot",{bot:d,isWriteAllowed:n,isEnabled:!0}),c)){const{action:e,payload:a}=c;t[e](a)}})),(0,s.aJ)("cancelAttachBotInstall",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{requestedAttachBotInstall:void 0},s)})),(0,s.aJ)("requestAttachBotInChat",((e,t,a)=>{const{bot:n,filter:o,startParam:i,tabId:r=(0,m.g0)()}=a,c=(0,b.Xf0)(e,r)?.chatId,d=n.attachMenuPeerTypes?.filter((e=>"self"!==e&&o.includes(e)));d?.length?(e=(0,v.w)(e,{requestedAttachBotInChat:{bot:n,filter:d,startParam:i}},r),(0,s.UF)(e)):t.callAttachBot({chatId:c||n.id,bot:n,startParam:i,tabId:r})})),(0,s.aJ)("cancelAttachBotInChat",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{requestedAttachBotInChat:void 0},s)})),(0,s.aJ)("requestBotUrlAuth",(async(e,t,a)=>{const{chatId:n,buttonId:o,messageId:i,url:r,tabId:c=(0,m.g0)()}=a,d=(0,b.hds)(e,n);if(!d)return;const l=await(0,f.px)("requestBotUrlAuth",{chat:d,buttonId:o,messageId:i});l&&(e=(0,s.mS)(),e=(0,v.w)(e,{urlAuth:{url:r,button:{buttonId:o,messageId:i,chatId:d.id}}},c),(0,s.UF)(e),Ne(e,t,r,l,c))})),(0,s.aJ)("acceptBotUrlAuth",(async(e,t,a)=>{const{isWriteAllowed:n,tabId:o=(0,m.g0)()}=a,i=(0,b.nTw)(e,o);if(!i.urlAuth?.button)return;const{button:r,url:c}=i.urlAuth,{chatId:d,messageId:l,buttonId:u}=r,h=(0,b.hds)(e,d);if(!h)return;const p=await(0,f.px)("acceptBotUrlAuth",{chat:h,messageId:l,buttonId:u,isWriteAllowed:n});p&&Ne(e=(0,s.mS)(),t,c,p,o)})),(0,s.aJ)("requestLinkUrlAuth",(async(e,t,a)=>{const{url:n,tabId:o=(0,m.g0)()}=a,i=await(0,f.px)("requestLinkUrlAuth",{url:n});i&&(e=(0,s.mS)(),e=(0,v.w)(e,{urlAuth:{url:n}},o),(0,s.UF)(e),Ne(e,t,n,i,o))})),(0,s.aJ)("acceptLinkUrlAuth",(async(e,t,a)=>{const{isWriteAllowed:n,tabId:o=(0,m.g0)()}=a,i=(0,b.nTw)(e,o);if(!i.urlAuth?.url)return;const{url:r}=i.urlAuth,c=await(0,f.px)("acceptLinkUrlAuth",{url:r,isWriteAllowed:n});c&&Ne(e=(0,s.mS)(),t,r,c,o)})),(0,s.aJ)("closeUrlAuthModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{urlAuth:void 0},s)})),(0,s.aJ)("setBotInfo",(async(e,t,a)=>{const{bot:n,name:o,description:i,tabId:r=(0,m.g0)()}=a;let{langCode:d}=a;d||(d=e.settings.byKey.language);const{currentUserId:l}=e;l&&n&&(e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.InProgress,r),(0,s.UF)(e),(o||i)&&await(0,f.px)("setBotInfo",{bot:n,langCode:d,name:o,about:i})&&(e=(0,s.mS)(),e=(0,A.TK)(e,n.id,{firstName:o}),e=(0,A.we)(e,n.id,{bio:i}),(0,s.UF)(e)),e=(0,s.mS)(),e=(0,A.nH)(e,c.TD.Complete,r),(0,s.UF)(e))})),(0,s.aJ)("startBotFatherConversation",(async(e,t,a)=>{const{param:s,tabId:o=(0,m.g0)()}=a;if(!Te){const t=await(0,i.A$)(e,n.aFH);if(!t)return;Te=t.id}s&&t.startBot({botId:Te,param:s}),t.openChat({id:Te,tabId:o})})),a(26943),(0,s.aJ)("loadPasswordInfo",(async e=>{const t=await(0,f.px)("getPasswordInfo");t&&(e=(0,s.mS)(),e=(0,A.qp)(e,{hasPassword:t.hasPassword}),e=(0,A.ke)(e,{hint:t.hint}),(0,s.UF)(e))})),(0,s.aJ)("checkPassword",(async(e,t,a)=>{const{currentPassword:n,onSuccess:o}=a;e=(0,A.ke)(e,{isLoading:!0,error:void 0}),(0,s.UF)(e);const i=await(0,f.px)("checkPassword",n);e=(0,s.mS)(),e=(0,A.ke)(e,{isLoading:!1}),(0,s.UF)(e),i&&o()})),(0,s.aJ)("clearPassword",(async(e,t,a)=>{const{currentPassword:n,onSuccess:o}=a;e=(0,A.ke)(e,{isLoading:!0,error:void 0}),(0,s.UF)(e);const i=await(0,f.px)("clearPassword",n);e=(0,s.mS)(),e=(0,A.ke)(e,{isLoading:!1}),(0,s.UF)(e),i&&o()})),(0,s.aJ)("updatePassword",(async(e,t,a)=>{const{currentPassword:n,password:o,hint:i,email:r,onSuccess:c}=a;e=(0,A.ke)(e,{isLoading:!0,error:void 0}),(0,s.UF)(e);const d=await(0,f.px)("updatePassword",n,o,i,r);e=(0,s.mS)(),e=(0,A.ke)(e,{isLoading:!1}),(0,s.UF)(e),d&&c()})),(0,s.aJ)("updateRecoveryEmail",(async(e,t,a)=>{const{currentPassword:n,email:o,onSuccess:i}=a;e=(0,A.ke)(e,{isLoading:!0,error:void 0}),(0,s.UF)(e);const r=await(0,f.px)("updateRecoveryEmail",n,o);e=(0,s.mS)(),e=(0,A.ke)(e,{isLoading:!1,waitingEmailCodeLength:void 0}),(0,s.UF)(e),r&&i()})),(0,s.aJ)("provideTwoFaEmailCode",((e,t,a)=>{const{code:s}=a;(0,f.px)("provideRecoveryEmailCode",s)})),(0,s.aJ)("clearTwoFaError",(e=>(0,A.ke)(e,{error:void 0})));const Fe={missing_payment_information:{field:"cardNumber",message:"Incorrect card number"},invalid_number:{field:"cardNumber",message:"Incorrect card number"},number:{field:"cardNumber",message:"Incorrect card number"},exp_year:{field:"expiry",message:"Incorrect year"},exp_month:{field:"expiry",message:"Incorrect month"},invalid_expiry_year:{field:"expiry",message:"Incorrect year"},invalid_expiry_month:{field:"expiry",message:"Incorrect month"},cvc:{field:"cvv",message:"Incorrect CVV"},invalid_cvc:{field:"cvv",message:"Incorrect CVV"}};var Re=a(86046);(0,s.aJ)("validateRequestedInfo",((e,t,a)=>{const{requestInfo:n,saveInfo:o,tabId:i=(0,m.g0)()}=a,r=(0,b.aF2)(e,i);if(!r)return;const d=(0,Re.jA)(e,r);d&&async function(e,t,a,n){for(var o=arguments.length,i=new Array(o>4?o-4:0),r=4;r<o;r++)i[r-4]=arguments[r];let[d=(0,m.g0)()]=i;const l=await(0,f.px)("validateRequestedInfo",{inputInvoice:t,requestInfo:a,shouldSave:n});if(!l)return;const{id:u,shippingOptions:h}=l;e=(0,s.mS)(),e=(0,A.bb)(e,u,d),h?.length?(e=(0,A.oF)(e,h,d),e=(0,A.ET)(e,c.tn.Shipping,d)):e=(0,A.ET)(e,c.tn.Checkout,d),(0,s.UF)(e)}(e,d,n,o,i)})),(0,s.aJ)("openInvoice",(async(e,t,a)=>{const{tabId:n=(0,m.g0)(),...o}=a,i=(0,Re.jA)(e,o);if(!i)return;const r=await async function(e,t){for(var a=arguments.length,n=new Array(a>2?a-2:0),o=2;o<a;o++)n[o-2]=arguments[o];let[i=(0,m.g0)()]=n;const r=(0,Ee.A)(),d=await(0,f.px)("getPaymentForm",t,r);if(!d)return;const{form:l,invoice:u,users:p}=d;return e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(p,"id")),e=(0,A.HX)(e,l,i),e=(0,A.ET)(e,c.tn.Checkout,i),(0,s.UF)(e),{form:l,invoice:u}}(e,i,n);if(!r)return;const{form:d,invoice:l}=r;e=(0,s.mS)(),e=(0,A.Qk)(e,l,n),e=(0,A._$)(e,{inputInvoice:a,isPaymentModalOpen:"regular"===d.type,isExtendedMedia:a.isExtendedMedia,status:void 0},n),"stars"===d.type&&(e=(0,v.w)(e,{isStarPaymentModalOpen:!0},n)),(0,s.UF)(e)})),(0,s.aJ)("getReceipt",(async(e,t,a)=>{const{chatId:n,messageId:o,tabId:i=(0,m.g0)()}=a,r=n&&(0,b.hds)(e,n);if(!o||!r)return;const c=await(0,f.px)("getReceipt",r,o);c&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),e="stars"===c.receipt.type?(0,A.Me)(e,c.receipt,i):(0,A.lE)(e,c.receipt,i),(0,s.UF)(e))})),(0,s.aJ)("clearPaymentError",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,v.w)(e,{payment:{...(0,b.nTw)(e,n).payment,error:void 0}},n),(0,s.UF)(e)})),(0,s.aJ)("clearReceipt",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{payment:{...(0,b.nTw)(e,s).payment,receipt:void 0}},s)})),(0,s.aJ)("sendCredentialsInfo",((e,t,a)=>{const{credentials:o,tabId:i=(0,m.g0)()}=a,{nativeProvider:r}=(0,b.nTw)(e,i).payment,{data:d}=o;if("stripe"===r){const t=(0,b.EGt)(e,i);if(!t)return;!async function(e,t,a){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];let[r=(0,m.g0)()]=o;const d=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}),l=await fetch(`https://api.stripe.com/v1/tokens${d}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:`Bearer ${a}`}}),u=await l.json();if(u.error){const t=function(e){const{message:t,code:a,param:s}=e,{field:n,message:o}=s?Fe[s]:Fe[a];return{field:n,message:o,description:t}}(u.error);return e=(0,s.mS)(),e=(0,v.w)(e,{payment:{...(0,b.nTw)(e,r).payment,status:"failed",error:{...t}}},r),void(0,s.UF)(e)}e=(0,s.mS)(),e=(0,A.yQ)(e,{type:u.type,id:u.id},r),e=(0,A.ET)(e,c.tn.Checkout,r),(0,s.UF)(e)}(e,d,t,i)}else if("smartglocal"===r){const t=(0,b.Kt9)(e,i);if(!t)return;!async function(e,t,a){for(var o=arguments.length,i=new Array(o>3?o-3:0),r=3;r<o;r++)i[r-3]=arguments[r];let[d=(0,m.g0)()]=i;const l={card:{number:t.cardNumber.replace(/\D+/g,""),expiration_month:t.expiryMonth,expiration_year:t.expiryYear,security_code:t.cvv.replace(/\D+/g,"")}},u=(0,b.nTw)(e,d).payment.nativeParams?.tokenizeUrl;let h;h=n.qKY?"https://tgb-playground.smart-glocal.com/cds/v1/tokenize/card":"https://tgb.smart-glocal.com/cds/v1/tokenize/card",u?.startsWith("https://")&&u.endsWith(".smart-glocal.com/cds/v1/tokenize/card")&&(h=u);const p=await fetch(h,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-PUBLIC-TOKEN":a},body:JSON.stringify(l)}),g=await p.json();if("ok"!==g.status){const t={description:"payment error"};return e=(0,s.mS)(),e=(0,v.w)(e,{payment:{...(0,b.nTw)(e,d).payment,status:"failed",error:{...t}}},d),void(0,s.UF)(e)}e=(0,s.mS)(),e=(0,A.M)(e,{type:"card",token:g.data.token},d),e=(0,A.ET)(e,c.tn.Checkout,d),(0,s.UF)(e)}(e,d,t,i)}})),(0,s.aJ)("sendPaymentForm",(async(e,t,a)=>{const{shippingOptionId:n,saveCredentials:o,savedCredentialId:i,tipAmount:r,tabId:c=(0,m.g0)()}=a,d=(0,b.aF2)(e,c),l=(0,b._5q)(e,c),u=(0,b.PGw)(e,c),{nativeProvider:h,temporaryPassword:p}=(0,b.nTw)(e,c).payment;if(!d||!l)return;const g=(0,Re.jA)(e,d);if(!g)return;e=(0,A._$)(e,{status:"pending"},c),(0,s.UF)(e);const y={save:o,data:"stripe"===h?(0,b.e7$)(e,c):(0,b.G4m)(e,c)};await(0,f.px)("sendPaymentForm",{inputInvoice:g,formId:l,credentials:y,requestedInfoId:u,shippingOptionId:n,savedCredentialId:i,temporaryPassword:p?.value,tipAmount:r})&&(e=(0,s.mS)(),e=(0,A._$)(e,{status:"paid"},c),e=(0,A.cY)(e,c),(0,s.UF)(e),t.apiUpdate({"@type":"updatePaymentStateCompleted",inputInvoice:d}),"stars"===d.type&&t.requestConfetti({withStars:!0,tabId:c}))})),(0,s.aJ)("sendStarPaymentForm",(async(e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};if(!(0,b.nTw)(e,n).isStarPaymentModalOpen)return;const o=(0,b.aF2)(e,n),i=(0,b._5q)(e,n);if(!o||!i)return;const r=(0,Re.jA)(e,o);r&&await(0,f.px)("sendStarPaymentForm",{inputInvoice:r,formId:i})&&(e=(0,s.mS)(),e=(0,A._$)(e,{status:"paid"},n),e=(0,A.cY)(e,n),(0,s.UF)(e),t.apiUpdate({"@type":"updatePaymentStateCompleted",inputInvoice:o}),t.loadStarStatus())})),(0,s.aJ)("setSmartGlocalCardInfo",((e,t,a)=>{const{tabId:s=(0,m.g0)(),type:n,token:o}=a;return(0,A.M)(e,{type:n,token:o},s)})),(0,s.aJ)("setPaymentStep",((e,t,a)=>{const{step:s,tabId:n=(0,m.g0)()}=a;return(0,A.ET)(e,s??c.tn.Checkout,n)})),(0,s.aJ)("closePremiumModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);if(n.premiumModal)return(0,v.w)(e,{premiumModal:{promo:n.premiumModal.promo,isOpen:!1}},s)})),(0,s.aJ)("openPremiumModal",(async(e,t,a)=>{const{initialSection:n,fromUserId:o,isSuccess:i,isGift:r,monthsAmount:c,toUserId:d,tabId:l=(0,m.g0)()}=a||{};t.loadPremiumStickers();const u=await(0,f.px)("fetchPremiumPromo");u&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(u.users,"id")),e=(0,v.w)(e,{premiumModal:{promo:u.promo,initialSection:n,isOpen:!0,fromUserId:o,toUserId:d,isGift:r,monthsAmount:c,isSuccess:i}},l),(0,s.UF)(e),t.closeReactionPicker({tabId:l}))})),(0,s.aJ)("openGiveawayModal",(async(e,t,a)=>{const{chatId:n,prepaidGiveaway:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n);if(!r)return;const c=await(0,f.px)("getPremiumGiftCodeOptions",{chat:r});if(!c)return;e=(0,s.mS)();const d=Boolean(n);e=(0,v.w)(e,{giveawayModal:{chatId:n,gifts:c,isOpen:d,prepaidGiveaway:o}},i),(0,s.UF)(e)})),(0,s.aJ)("closeGiveawayModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{giveawayModal:void 0},s)})),(0,s.aJ)("openPremiumGiftingModal",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,s.mS)(),e=(0,v.w)(e,{giftingModal:{isOpen:!0}},n),(0,s.UF)(e)})),(0,s.aJ)("closePremiumGiftingModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{giftingModal:void 0},s)})),(0,s.aJ)("openStarsGiftingModal",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,s.mS)(),e=(0,v.w)(e,{starsGiftingModal:{isOpen:!0}},n),(0,s.UF)(e)})),(0,s.aJ)("closeStarsGiftingModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{starsGiftingModal:void 0},s)})),(0,s.aJ)("openStarsTransactionFromGift",((e,t,a)=>{const{chatId:s,messageId:n,tabId:o=(0,m.g0)()}=a||{},i=(0,b.O5q)(e,s,n);if(!i)return;const r=(0,Re.M6)(i);return r?(0,A.V5)(e,r,o):void 0})),(0,s.aJ)("openPremiumGiftModal",(async(e,t,a)=>{const{forUserIds:n,tabId:o=(0,m.g0)()}=a||{},i=await(0,f.px)("fetchPremiumPromo");if(!i)return;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(i.users,"id"));const r=await(0,f.px)("getPremiumGiftCodeOptions",{});e=(0,v.w)(e,{giftModal:{isOpen:!0,forUserIds:n,gifts:r}},o),(0,s.UF)(e)})),(0,s.aJ)("closePremiumGiftModal",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,v.w)(e,{giftModal:{isOpen:!1}},n),(0,s.UF)(e)})),(0,s.aJ)("openStarsGiftModal",(async(e,t,a)=>{const{forUserId:n,tabId:o=(0,m.g0)()}=a||{},i=await(0,f.px)("getStarsGiftOptions",{});e=(0,v.w)(e,{starsGiftModal:{isOpen:!0,forUserId:n,starsGiftOptions:i}},o),(0,s.UF)(e)})),(0,s.aJ)("closeStarsGiftModal",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,v.w)(e,{starsGiftModal:{isOpen:!1}},n),(0,s.UF)(e)})),(0,s.aJ)("validatePaymentPassword",(async(e,t,a)=>{const{password:n,tabId:o=(0,m.g0)()}=a,i=await(0,f.px)("fetchTemporaryPaymentPassword",n);e=(0,s.mS)(),e=i?"error"in i?(0,A._$)(e,{error:{message:i.error,field:"password"}},o):(0,A._$)(e,{temporaryPassword:i,step:c.tn.Checkout},o):(0,A._$)(e,{error:{message:"Unknown Error",field:"password"}},o),(0,s.UF)(e)})),(0,s.aJ)("openBoostModal",(async(e,t,a)=>{const{chatId:n,tabId:o=(0,m.g0)()}=a,i=(0,b.hds)(e,n);if(!i||!(0,I.WX)(i)&&!(0,I.Vs)(i))return;e=(0,v.w)(e,{boostModal:{chatId:n}},o),(0,s.UF)(e);const r=await(0,f.px)("fetchBoostStatus",{chat:i});if(!r)return void t.closeBoostModal({tabId:o});e=(0,s.mS)(),e=(0,v.w)(e,{boostModal:{chatId:n,boostStatus:r}},o),(0,s.UF)(e);const c=await(0,f.px)("fetchMyBoosts");if(!c)return;e=(0,s.mS)();const d=(0,b.nTw)(e,o);d.boostModal&&(e=(0,A.Nl)(e,(0,h.dU)(c.chats,"id")),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),e=(0,v.w)(e,{boostModal:{...d.boostModal,myBoosts:c.boosts}},o),(0,s.UF)(e))})),(0,s.aJ)("openBoostStatistics",(async(e,t,a)=>{const{chatId:n,tabId:o=(0,m.g0)()}=a,i=(0,b.hds)(e,n);if(!i)return;e=(0,v.w)(e,{boostStatistics:{chatId:n}},o),(0,s.UF)(e);const[r,c,d]=await Promise.all([(0,f.px)("fetchBoostList",{chat:i}),(0,f.px)("fetchBoostList",{chat:i,isGifts:!0}),(0,f.px)("fetchBoostStatus",{chat:i})]);if(e=(0,s.mS)(),!r||!c||!d)return e=(0,v.w)(e,{boostStatistics:void 0},o),void(0,s.UF)(e);const l=[...r.users,...c.users];e=(0,A.g1)(e,(0,h.dU)(l,"id")),e=(0,v.w)(e,{boostStatistics:{chatId:n,boostStatus:d,nextOffset:r.nextOffset,boosts:{count:r.count,list:r.boostList},giftedBoosts:{count:c?.count,list:c?.boostList}}},o),(0,s.UF)(e)})),(0,s.aJ)("openMonetizationStatistics",((e,t,a)=>{const{chatId:n,tabId:o=(0,m.g0)()}=a;(0,b.hds)(e,n)&&(e=(0,v.w)(e,{monetizationStatistics:{chatId:n}},o),(0,s.UF)(e))})),(0,s.aJ)("loadMoreBoosters",(async(e,t,a)=>{const{isGifts:n,tabId:o=(0,m.g0)()}=a||{};let i=(0,b.nTw)(e,o);if(!i.boostStatistics)return;const r=(0,b.hds)(e,i.boostStatistics.chatId);if(!r)return;e=(0,v.w)(e,{boostStatistics:{...i.boostStatistics,isLoadingBoosters:!0}},o),(0,s.UF)(e);const c=await(0,f.px)("fetchBoostList",{chat:r,offset:i.boostStatistics.nextOffset,isGifts:n});if(!c)return;if(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),i=(0,b.nTw)(e,o),!i.boostStatistics)return;const d=(n?i.boostStatistics.giftedBoosts?.list||[]:i.boostStatistics.boosts?.list||[]).concat(c.boostList);e=(0,v.w)(e,{boostStatistics:{...i.boostStatistics,nextOffset:c.nextOffset,isLoadingBoosters:!1,[n?"giftedBoosts":"boosts"]:{count:c.count,list:d}}},o),(0,s.UF)(e)})),(0,s.aJ)("applyBoost",(async(e,t,a)=>{const{chatId:n,slots:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n);if(!r)return;const c=(0,b.AWZ)(e,n),d=c?.boostsApplied||0,l=o.length;let u=(0,b.nTw)(e,i);const p=u.boostModal?.boostStatus;if(p){const t=p.nextLevelBoosts?p.nextLevelBoosts-p.currentLevelBoosts:1,a=p.boosts+l,n=p.nextLevelBoosts&&a>=p.nextLevelBoosts,o=n?p.nextLevelBoosts:p.currentLevelBoosts,r=n?p.nextLevelBoosts+t:p.nextLevelBoosts;e=(0,v.w)(e,{boostModal:{...u.boostModal,boostStatus:{...p,level:n?p.level+1:p.level,currentLevelBoosts:o,nextLevelBoosts:r,hasMyBoost:!0,boosts:a}}},i),(0,s.UF)(e)}e=(0,s.mS)(),u=(0,b.nTw)(e,i);const g=u.boostModal?.myBoosts;if(g){const t=Math.floor(Date.now()/1e3),a=g.map((e=>o.includes(e.slot)?{...e,chatId:n,date:t,cooldownUntil:t+86400}:e));e=(0,v.w)(e,{boostModal:{...u.boostModal,myBoosts:a}},i),(0,s.UF)(e)}const y=await(0,f.px)("applyBoost",{slots:o,chat:r});if(e=(0,s.mS)(),y)u=(0,b.nTw)(e,i),e=(0,A.g1)(e,(0,h.dU)(y.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(y.chats,"id")),c&&(e=(0,A.lt)(e,n,{boostsApplied:d+o.length})),u.boostModal&&(e=(0,v.w)(e,{boostModal:{...u.boostModal,myBoosts:y.boosts}},i)),(0,s.UF)(e);else{const t=(0,b.nTw)(e,i).boostModal;t&&(e=(0,v.w)(e,{boostModal:{...t,boostStatus:p,myBoosts:g}},i),(0,s.UF)(e))}})),(0,s.aJ)("checkGiftCode",(async(e,t,a)=>{const{slug:n,message:o,tabId:i=(0,m.g0)()}=a,r=await(0,f.px)("checkGiftCode",{slug:n});r?(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(r.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(r.chats,"id")),e=(0,v.w)(e,{giftCodeModal:{slug:n,info:r.code,message:o}},i),(0,s.UF)(e)):t.showNotification({message:g.yE("lng_gift_link_expired"),tabId:i})})),(0,s.aJ)("applyGiftCode",(async(e,t,a)=>{const{slug:s,tabId:n=(0,m.g0)()}=a;await(0,f.px)("applyGiftCode",{slug:s})&&(t.requestConfetti({withStars:!0,tabId:n}),t.closeGiftCodeModal({tabId:n}))})),(0,s.aJ)("launchPrepaidGiveaway",(async(e,t,a)=>{const{chatId:s,giveawayId:n,paymentPurpose:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,s);if(!r)return;const c=o?.additionalChannelIds?.map((t=>(0,b.hds)(e,t))).filter(Boolean);await(0,f.px)("launchPrepaidGiveaway",{chat:r,giveawayId:n,paymentPurpose:{type:"giveaway",chat:r,areWinnersVisible:o?.areWinnersVisible,additionalChannels:c,countries:o?.countries,prizeDescription:o.prizeDescription,untilDate:o.untilDate,currency:o.currency,amount:o.amount}})&&t.openBoostStatistics({chatId:s,tabId:i})})),(0,s.aJ)("loadStarStatus",(async e=>{const t=e.stars,a=!t?.topupOptions,[n,o]=await Promise.all([(0,f.px)("fetchStarsStatus"),a?(0,f.px)("fetchStarsTopupOptions"):void 0]);!n||a&&!o||(e=(0,s.mS)(),e=(0,A.Nl)(e,(0,h.dU)(n.chats,"id")),e=(0,A.g1)(e,(0,h.dU)(n.users,"id")),e={...e,stars:{...t,balance:n.balance,topupOptions:o||t.topupOptions,history:{all:void 0,inbound:void 0,outbound:void 0}}},n.history&&(e=(0,A.Ps)(e,"all",n.history,n.nextOffset)),(0,s.UF)(e))})),(0,s.aJ)("loadStarsTransactions",(async(e,t,a)=>{const{type:n}=a,o=e.stars?.history[n],i=o?.nextOffset;if(o&&!i)return;const r=await(0,f.px)("fetchStarsTransactions",{isInbound:"inbound"===n||void 0,isOutbound:"outbound"===n||void 0,offset:i||""});r&&(e=(0,s.mS)(),e=(0,A.Nl)(e,(0,h.dU)(r.chats,"id")),e=(0,A.g1)(e,(0,h.dU)(r.users,"id")),e=(0,A.L_)(e,r.balance),r.history&&(e=(0,A.Ps)(e,n,r.history,r.nextOffset)),(0,s.UF)(e))}));var Le=a(58554);let Je=0;(0,s.aJ)("loadAvailableReactions",(async e=>{const t=await(0,f.px)("fetchAvailableReactions");t&&(t.forEach((e=>{e.aroundAnimation&&Le.hd(`sticker${e.aroundAnimation.id}`,r.qZ.BlobUrl),e.centerIcon&&Le.hd(`sticker${e.centerIcon.id}`,r.qZ.BlobUrl),e.appearAnimation&&Le.hd(`sticker${e.appearAnimation.id}`,r.qZ.BlobUrl),e.selectAnimation&&Le.hd((0,I.mr)(e.selectAnimation,"full"),r.qZ.BlobUrl)})),e=(0,s.mS)(),e={...e,reactions:{...e.reactions,availableReactions:t}},(0,s.UF)(e),(0,Ce.A)({action:"loadAvailableReactions",payload:void 0},n.npx))})),(0,s.aJ)("loadAvailableEffects",(async e=>{const t=await(0,f.px)("fetchAvailableEffects");if(!t)return;const{effects:a,emojis:n,stickers:o}=t,i=[],r=(0,h.dU)(a,"id");for(const e of a)if(e.effectAnimationId){const t={emoticon:e.emoticon};i.push(t)}e=(0,s.mS)(),e={...e,availableEffectById:r,stickers:{...e.stickers,effect:{stickers:o,emojis:n}},reactions:{...e.reactions,effectReactions:i}},(0,s.UF)(e)})),(0,s.aJ)("interactWithAnimatedEmoji",((e,t,a)=>{const{emoji:s,x:n,y:o,startSize:i,isReversed:r,tabId:c=(0,m.g0)()}=a,d={id:Je++,animatedEffect:s,x:R(e,n)+40*Math.random()-20,y:o+40*Math.random()-20,startSize:i,isReversed:r};return(0,v.w)(e,{activeEmojiInteractions:[...(0,b.nTw)(e,c).activeEmojiInteractions||[],d]},c)})),(0,s.aJ)("sendEmojiInteraction",((e,t,a)=>{const{messageId:s,chatId:n,emoji:o,interactions:i}=a;if("connectionStateReady"!==e.connectionState)return;const r=(0,b.hds)(e,n);r&&o&&!(0,b.nZ4)(e,n)&&(0,f.px)("sendEmojiInteraction",{chat:r,messageId:s,emoticon:o,timestamps:i})})),(0,s.aJ)("sendDefaultReaction",((e,t,a)=>{const{chatId:s,messageId:n,tabId:o=(0,m.g0)()}=a,i=(0,b.nTJ)(e,s),r=(0,b.O5q)(e,s,n);i&&r&&!(0,I.Nb)(r)&&t.toggleReaction({chatId:s,messageId:n,reaction:i,tabId:o})})),(0,s.aJ)("toggleReaction",(async(e,t,a)=>{const{chatId:n,reaction:o,shouldAddToRecent:i,tabId:r=(0,m.g0)()}=a;let{messageId:c}=a;const d=(0,b.hds)(e,n);let l=(0,b.O5q)(e,n,c);if(!d||!l)return;const u=(0,b.nZ4)(e,n),h=Boolean(l.groupedId)&&!l.isInAlbum,g=h?(0,b.D_S)(e,n,l.groupedId)[0]:void 0;l=h&&(0,b.O5q)(e,n,g)||l,c=l?.id||c;const y=(0,I.uC)(l),A=y.some((e=>(0,I.a0)(e,o))),v=A?y.filter((e=>!(0,I.a0)(e,o))):[...y,o],w=(0,b.cO5)(e),S=v.slice(-w),C=(0,p.bj)(l);(0,b.xYJ)(e,"reactionEffects")&&(A?t.stopActiveReaction({containerId:C,reaction:o,tabId:r}):t.startActiveReaction({containerId:C,reaction:o,tabId:r})),e=L(e,l,S),(0,s.UF)(e);try{await(0,f.px)("sendReaction",{chat:d,messageId:c,reactions:S,shouldAddToRecent:i}),u&&t.loadSavedReactionTags()}catch(t){e=L(e=(0,s.mS)(),l,y),(0,s.UF)(e)}})),(0,s.aJ)("startActiveReaction",((e,t,a)=>{const{containerId:s,reaction:n,tabId:o=(0,m.g0)()}=a,i=(0,b.nTw)(e,o);if(!(0,b.xYJ)(e,"reactionEffects"))return;const r=i.activeReactions[s]||[];if(r.some((e=>(0,I.a0)(e,n))))return;const c=r.concat(n);return(0,v.w)(e,{activeReactions:{...i.activeReactions,[s]:c}},o)})),(0,s.aJ)("stopActiveReaction",((e,t,a)=>{const{containerId:s,reaction:n,tabId:o=(0,m.g0)()}=a,i=(0,b.nTw)(e,o),r=i.activeReactions[s]||[],c=n?r.filter((e=>!(0,I.a0)(e,n))):[],d=c.length?{...i.activeReactions,[s]:c}:(0,h.cJ)(i.activeReactions,[s]);return(0,v.w)(e,{activeReactions:d},o)})),(0,s.aJ)("setDefaultReaction",(async(e,t,a)=>{const{reaction:n}=a;await(0,f.px)("setDefaultReaction",{reaction:n})&&((e=(0,s.mS)()).config?(e={...e,config:{...e.config,defaultReaction:n}},(0,s.UF)(e)):t.loadConfig())})),(0,s.aJ)("stopActiveEmojiInteraction",((e,t,a)=>{const{id:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{activeEmojiInteractions:(0,b.nTw)(e,n).activeEmojiInteractions?.filter((e=>e.id!==s))},n)})),(0,s.aJ)("loadReactors",(async(e,t,a)=>{const{chatId:n,messageId:o,reaction:i}=a,r=(0,b.hds)(e,n),c=(0,b.O5q)(e,n,o);if(!r||!c)return;const d=c.reactors?.nextOffset,l=await(0,f.px)("fetchMessageReactionsList",{reaction:i,chat:r,messageId:o,offset:d});l&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(l.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(l.chats,"id")),e=(0,A.r3)(e,n,o,{reactors:l}),(0,s.UF)(e))})),(0,s.aJ)("loadMessageReactions",((e,t,a)=>{const{ids:s,chatId:n}=a,o=(0,b.hds)(e,n);o&&"connectionStateReady"===e.connectionState&&(0,f.px)("fetchMessageReactions",{ids:s,chat:o})})),(0,s.aJ)("sendWatchingEmojiInteraction",((e,t,a)=>{const{chatId:s,emoticon:n,x:o,y:i,startSize:r,isReversed:c,id:d,tabId:l=(0,m.g0)()}=a,u=(0,b.hds)(e,s),h=(0,b.nTw)(e,l);if(u&&h.activeEmojiInteractions?.some((e=>e.id===d))&&!(0,b.nZ4)(e,s))return"connectionStateReady"===e.connectionState&&(0,f.px)("sendWatchingEmojiInteraction",{chat:u,emoticon:n}),(0,v.w)(e,{activeEmojiInteractions:h.activeEmojiInteractions.map((t=>t.id===d?{...t,x:R(e,o),y:i,startSize:r,isReversed:c}:t))},l)})),(0,s.aJ)("fetchUnreadReactions",(async(e,t,a)=>{const{chatId:n,offsetId:o}=a,i=(0,b.hds)(e,n);if(!i)return;const r=await(0,f.px)("fetchUnreadReactions",{chat:i,offsetId:o,addOffset:o?-1:void 0});if(!r||!r.messages.length)return e=J(e=(0,s.mS)(),n,{unreadReactionsCount:0}),void(0,s.UF)(e);const{messages:c,chats:d,users:l}=r,u=(0,h.dU)(c,"id"),m=Object.keys(u).map(Number);e=(0,s.mS)(),e=(0,A.o4)(e,i.id,u),e=(0,A.g1)(e,(0,h.dU)(l,"id")),e=J(e=(0,A.Nl)(e,(0,h.dU)(d,"id")),n,{unreadReactions:(0,h.Am)([...i.unreadReactions||[],...m]).sort(((e,t)=>t-e))}),(0,s.UF)(e)})),(0,s.aJ)("animateUnreadReaction",((e,t,a)=>{const{messageIds:n,tabId:o=(0,m.g0)()}=a,i=(0,b.meB)(e,o);if(!i)return;if(!i.unreadReactionsCount)return J(e,i.id,{unreadReactions:[]});const r=Math.max(i.unreadReactionsCount-n.length,0),c=(i.unreadReactions||[]).filter((e=>!n.includes(e)));e=J(e,i.id,{unreadReactions:c,unreadReactionsCount:r}),(0,s.UF)(e),t.markMessagesRead({messageIds:n,shouldFetchUnreadReactions:!0,tabId:o}),(0,b.xYJ)(e,"reactionEffects")&&(e=(0,s.mS)(),n.forEach((a=>{const s=(0,b.O5q)(e,i.id,a);if(!s)return;const{reaction:n,isOwn:o,isUnread:r}=s.reactions?.recentReactions?.[0]??{};if(n&&r&&!o){const e=(0,p.bj)(s);t.startActiveReaction({containerId:e,reaction:n,tabId:(0,m.g0)()})}})))})),(0,s.aJ)("focusNextReaction",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.meB)(e,s);if(!n?.unreadReactions)return n?.unreadReactionsCount?(0,A.wi)(e,n.id,{unreadReactionsCount:0}):void 0;t.focusMessage({chatId:n.id,messageId:n.unreadReactions[0],tabId:s,scrollTargetPosition:"end"}),t.markMessagesRead({messageIds:[n.unreadReactions[0]],tabId:s})})),(0,s.aJ)("readAllReactions",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.meB)(e,s);if(n)return(0,f.px)("readAllReactions",{chat:n}),J(e,n.id,{unreadReactionsCount:void 0,unreadReactions:void 0})})),(0,s.aJ)("loadTopReactions",(async e=>{const t=await(0,f.px)("fetchTopReactions",{hash:e.reactions.hash.topReactions});t&&(e=(0,s.mS)(),e={...e,reactions:{...e.reactions,topReactions:t.reactions,hash:{...e.reactions.hash,topReactions:t.hash}}},(0,s.UF)(e))})),(0,s.aJ)("loadRecentReactions",(async e=>{const t=await(0,f.px)("fetchRecentReactions",{hash:e.reactions.hash.recentReactions});t&&(e=(0,s.mS)(),e={...e,reactions:{...e.reactions,recentReactions:t.reactions,hash:{...e.reactions.hash,recentReactions:t.hash}}},(0,s.UF)(e))})),(0,s.aJ)("clearRecentReactions",(async e=>{await(0,f.px)("clearRecentReactions")&&(e=(0,s.mS)(),e={...e,reactions:{...e.reactions,recentReactions:[]}},(0,s.UF)(e))})),(0,s.aJ)("loadDefaultTagReactions",(async e=>{const t=await(0,f.px)("fetchDefaultTagReactions",{hash:e.reactions.hash.defaultTags});t&&(e=(0,s.mS)(),e={...e,reactions:{...e.reactions,defaultTags:t.reactions,hash:{...e.reactions.hash,defaultTags:t.hash}}},(0,s.UF)(e))})),(0,s.aJ)("loadSavedReactionTags",(async e=>{const{hash:t}=e.savedReactionTags||{},a=await(0,f.px)("fetchSavedReactionTags",{hash:t});if(!a)return;e=(0,s.mS)();const n=(0,h.pA)(a.tags,(e=>[(0,I.Jj)(e.reaction),e]));e={...e,savedReactionTags:{hash:a.hash,byKey:n}},(0,s.UF)(e)})),(0,s.aJ)("editSavedReactionTag",(async(e,t,a)=>{const{reaction:n,title:o}=a;if(!await(0,f.px)("updateSavedReactionTag",{reaction:n,title:o}))return;e=(0,s.mS)();const i=e.savedReactionTags?.byKey;if(!i)return;const r=(0,I.Jj)(n),c={...i[r],title:o};e={...e,savedReactionTags:{...e.savedReactionTags,byKey:{...i,[r]:c}}},(0,s.UF)(e)})),(0,s.aJ)("loadStatistics",(async(e,t,a)=>{const{chatId:n,isGroup:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n),c=(0,b.AWZ)(e,n);if(!r||!c)return;const d=await(0,f.px)(o?"fetchGroupStatistics":"fetchChannelStatistics",{chat:r,dcId:c.statisticsDcId});if(!d)return;e=(0,s.mS)();const{stats:l,users:u}=d;e=(0,A.g1)(e,(0,h.dU)(u,"id")),e=(0,A.n8)(e,n,l,i),(0,s.UF)(e)})),(0,s.aJ)("loadChannelMonetizationStatistics",(async(e,t,a)=>{const{chatId:n,tabId:o=(0,m.g0)()}=a,i=(0,b.hds)(e,n),r=(0,b.AWZ)(e,n);if(!i||!r)return;const c=r.statisticsDcId,d=await(0,f.px)("fetchChannelMonetizationStatistics",{chat:i,dcId:c});d&&(e=(0,s.mS)(),e=(0,A.$r)(e,d,o),(0,s.UF)(e))})),(0,s.aJ)("loadMessageStatistics",(async(e,t,a)=>{const{chatId:n,messageId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n),c=(0,b.AWZ)(e,n);if(!r||!c)return;const d=c.statisticsDcId;let l=await(0,f.px)("fetchMessageStatistics",{chat:r,messageId:o,dcId:d});l||(l={}),e=(0,s.mS)();const{viewsCount:u,forwardsCount:h,reactions:p}=(0,b.zeq)(e,n)[o]||{};l.viewsCount=u,l.forwardsCount=h,l.reactionsCount=p?.results?p?.results.reduce(((e,t)=>e+t.count),0):void 0,e=(0,A.gJ)(e,l,i),(0,s.UF)(e),t.loadMessagePublicForwards({chatId:n,messageId:o,tabId:i})})),(0,s.aJ)("loadMessagePublicForwards",(async(e,t,a)=>{const{chatId:n,messageId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n),c=(0,b.AWZ)(e,n);if(!r||!c)return;const d=c.statisticsDcId,l=(0,b.nTw)(e,i).statistics.currentMessage||{};if(l?.publicForwards&&!l.nextOffset)return;const u=await(0,f.px)("fetchMessagePublicForwards",{chat:r,messageId:o,dcId:d,offset:l.nextOffset}),{forwards:h,nextOffset:p,count:g}=u||{},y=l.publicForwardsData?.length&&h?.length&&(0,w.T)(l.publicForwardsData[l.publicForwardsData.length-1],h[0]);e=(0,s.mS)(),e=(0,A.gJ)(e,{...l,publicForwards:g||h?.length,publicForwardsData:(l.publicForwardsData||[]).concat(y?h.slice(1):h||[]),nextOffset:p},i),(0,s.UF)(e)})),(0,s.aJ)("loadStatisticsAsyncGraph",(async(e,t,a)=>{const{chatId:n,token:o,name:i,isPercentage:r,tabId:c=(0,m.g0)()}=a,d=(0,b.AWZ)(e,n);if(!d)return;const l=d.statisticsDcId,u=await(0,f.px)("fetchStatisticsAsyncGraph",{token:o,dcId:l,isPercentage:r});u&&(e=(0,s.mS)(),e=(0,A.Ro)(e,n,i,u,c),(0,s.UF)(e))})),(0,s.aJ)("loadStoryStatistics",(async(e,t,a)=>{const{chatId:n,storyId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n),c=(0,b.AWZ)(e,n);if(!r||!c)return;const d=c.statisticsDcId;let l=await(0,f.px)("fetchStoryStatistics",{chat:r,storyId:o,dcId:d});l||(l={}),e=(0,s.mS)();const u=(0,b.Msb)(e,n,o),{forwardsCount:h=0,viewsCount:p=0,reactionsCount:g=0}=u&&"views"in u&&u.views?u.views:{};l.viewsCount=p,l.forwardsCount=h,l.reactionsCount=g,e=(0,s.mS)(),e=(0,A.KX)(e,l,i),(0,s.UF)(e),t.loadStoryPublicForwards({chatId:n,storyId:o,tabId:i})})),(0,s.aJ)("loadStoryPublicForwards",(async(e,t,a)=>{const{chatId:n,storyId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.hds)(e,n),c=(0,b.AWZ)(e,n);if(!r||!c)return;const d=c.statisticsDcId,l=(0,b.nTw)(e,i).statistics.currentStory||{};if(l?.publicForwards&&!l.nextOffset)return;const{publicForwards:u,users:p,chats:g,count:y,nextOffset:I}=await(0,f.px)("fetchStoryPublicForwards",{chat:r,storyId:o,dcId:d,offset:l.nextOffset})||{};e=(0,s.mS)(),g&&(e=(0,A.Nl)(e,(0,h.dU)(g,"id"))),p&&(e=(0,A.g1)(e,(0,h.dU)(p,"id"))),e=(0,A.KX)(e,{...l,publicForwards:y||u?.length,publicForwardsData:(l.publicForwardsData||[]).concat(u||[]),nextOffset:I},i),(0,s.UF)(e)})),(0,s.aJ)("loadAllStories",(async e=>{let t=0;for(;e.stories.hasNext;){if(t++>=100)return void(n.Oig&&console.error("`actions/loadAllStories`: Infinite loop detected"));e=(0,s.mS)();const{stateHash:a,hasNext:o}=e.stories;if(a&&!o)return;const i=await(0,f.px)("fetchAllStories",{isFirstRequest:!a,stateHash:a});if(!i)return;(e=(0,s.mS)()).stories.stateHash=i.state,"peerStories"in i&&(e=(0,A.g1)(e,(0,h.dU)(i.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(i.chats,"id")),e=(0,A.Ni)(e,i.peerStories),e=(0,A.Gz)(e,i.peerStories),(e=(0,A.qs)(e,i.stealthMode)).stories.hasNext=i.hasMore),(0,s.UF)(e)}})),(0,s.aJ)("loadAllHiddenStories",(async e=>{let t=0;for(;e.stories.hasNextInArchive;){if(t++>=100)return void(n.Oig&&console.error("`actions/loadAllHiddenStories`: Infinite loop detected"));e=(0,s.mS)();const{archiveStateHash:a,hasNextInArchive:o}=e.stories;if(a&&!o)return;const i=await(0,f.px)("fetchAllStories",{isFirstRequest:!a,stateHash:a,isHidden:!0});if(!i)return;(e=(0,s.mS)()).stories.archiveStateHash=i.state,"peerStories"in i&&(e=(0,A.g1)(e,(0,h.dU)(i.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(i.chats,"id")),e=(0,A.Ni)(e,i.peerStories),e=(0,A.Gz)(e,i.peerStories),(e=(0,A.qs)(e,i.stealthMode)).stories.hasNextInArchive=i.hasMore),(0,s.UF)(e)}})),(0,s.aJ)("loadPeerSkippedStories",(async(e,t,a)=>{const{peerId:n}=a,o=(0,b.PVB)(e,n),i=(0,b._bp)(e,n);if(!o||!i)return;const r=Object.values(i.byId).reduce(((e,t)=>("content"in t||e.push(t.id),e)),[]);if(0===r.length)return;const c=await(0,f.px)("fetchPeerStoriesByIds",{peer:o,ids:r});c&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(c.chats,"id")),e=(0,A.K4)(e,n,c.stories,c.pinnedIds),(0,s.UF)(e))})),(0,s.aJ)("viewStory",(async(e,t,a)=>{const{peerId:n,storyId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.PVB)(e,n),c=(0,b.Msb)(e,n,o);if(!r||!c||!("content"in c))return;e=(0,A.SY)(e,n,o,i),(0,s.UF)(e);const d=(0,ve.Fm)();c.expireDate<d&&c.isInProfile&&(0,f.px)("viewStory",{peer:r,storyId:o}),(e.stories.byPeerId[n].lastReadId||0)<c.id&&await(0,f.px)("markStoryRead",{peer:r,storyId:o})&&(e=(0,s.mS)(),e=(0,A.Ah)(e,n,o),(0,s.UF)(e))})),(0,s.aJ)("deleteStory",(async(e,t,a)=>{const{peerId:n,storyId:o}=a,i=(0,b.PVB)(e,n);i&&await(0,f.px)("deleteStory",{peer:i,storyId:o})&&(e=(0,s.mS)(),e=(0,A.ON)(e,n,o),(0,s.UF)(e))})),(0,s.aJ)("toggleStoryInProfile",(async(e,t,a)=>{const{peerId:n,storyId:o,isInProfile:i}=a,r=(0,b.PVB)(e,n);if(!r)return;const c=(0,b.Msb)(e,n,o),d=c&&"content"in c?c.isInProfile:void 0;e=(0,A.Xz)(e,n,o,{isInProfile:i}),e=(0,A.Kp)(e,n,o,i),(0,s.UF)(e);const l=await(0,f.px)("toggleStoryInProfile",{peer:r,storyId:o,isInProfile:i});l?.length||(e=(0,s.mS)(),e=(0,A.Xz)(e,n,o,{isInProfile:d}),e=(0,A.Kp)(e,n,o,d),(0,s.UF)(e))})),(0,s.aJ)("toggleStoryPinnedToTop",(async(e,t,a)=>{const{peerId:n,storyId:o}=a,i=(0,b.PVB)(e,n),r=(0,b._bp)(e,n);if(!i||!r)return;const c=(0,b.gVx)(e,n)?.map((e=>e.id))||[],d=c.includes(o)?c.filter((e=>e!==o)):[...c,o];e={...(0,s.mS)(),stories:{...(0,s.mS)().stories,byPeerId:{...(0,s.mS)().stories.byPeerId,[n]:{...r,pinnedIds:d.sort(((e,t)=>t-e))}}}},(0,s.UF)(e),await(0,f.px)("toggleStoryPinnedToTop",{peer:i,storyIds:d})||(e=(0,s.mS)(),e={...e,stories:{...e.stories,byPeerId:{...e.stories.byPeerId,[n]:{...r,pinnedIds:c}}}},(0,s.UF)(e))})),(0,s.aJ)("loadPeerStories",(async(e,t,a)=>{const{peerId:n}=a,o=(0,b.PVB)(e,n);if(!o)return;const i=await(0,f.px)("fetchPeerStories",{peer:o});i&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(i.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(i.chats,"id")),e=(0,A.K4)(e,n,i.stories),i.lastReadStoryId&&(e=(0,A.Ah)(e,n,i.lastReadStoryId)),(0,s.UF)(e))})),(0,s.aJ)("loadPeerProfileStories",(async(e,t,a)=>{const{peerId:n,offsetId:o}=a,i=(0,b.PVB)(e,n),r=(0,b._bp)(e,n);if(!i||r?.isFullyLoaded)return;const c=await(0,f.px)("fetchPeerProfileStories",{peer:i,offsetId:o});c&&(e=(0,s.mS)(),0===Object.values(c.stories).length&&(e=(0,A.XS)(e,n,!0)),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(c.chats,"id")),e=(0,A.K4)(e,n,c.stories,c.pinnedIds),(0,s.UF)(e))})),(0,s.aJ)("loadStoriesArchive",(async(e,t,a)=>{const{peerId:n,offsetId:o}=a,i=(0,b.PVB)(e,n),r=(0,b._bp)(e,n);if(!i||r?.isArchiveFullyLoaded)return;const c=await(0,f.px)("fetchStoriesArchive",{peer:i,offsetId:o});c&&(e=(0,s.mS)(),0===Object.values(c.stories).length&&(e=(0,A.XS)(e,n,!0,!0)),e=(0,A.g1)(e,(0,h.dU)(c.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(c.chats,"id")),e=(0,A.K4)(e,n,c.stories,void 0,!0),(0,s.UF)(e))})),(0,s.aJ)("loadPeerStoriesByIds",(async(e,t,a)=>{const{peerId:n,storyIds:o}=a,i=(0,b.PVB)(e,n);if(!i)return;const r=await(0,f.px)("fetchPeerStoriesByIds",{peer:i,ids:o});r&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(r.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(r.chats,"id")),e=(0,A.K4)(e,n,r.stories),(0,s.UF)(e))})),(0,s.aJ)("loadStoryViews",(async(e,t,a)=>{const{peerId:n,storyId:o}=a,i=(0,b.PVB)(e,n);if(!i)return;const r=await(0,f.px)("fetchStoriesViews",{peer:i,storyIds:[o]});r&&(e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(r.users,"id")),e=(0,A.ZC)(e,n,o,r.views),(0,s.UF)(e))})),(0,s.aJ)("loadStoryViewList",(async(e,t,a)=>{const{peerId:n,storyId:o,offset:i,areReactionsFirst:r,areJustContacts:c,query:d,limit:l,tabId:u=(0,m.g0)()}=a,p=(0,b.PVB)(e,n);if(!p)return;e=(0,A.dx)(e,!0,u),(0,s.UF)(e);const g=await(0,f.px)("fetchStoryViewList",{peer:p,storyId:o,offset:i,areReactionsFirst:r,areJustContacts:c,limit:l,query:d});if(!g)return e=(0,s.mS)(),e=(0,A.dx)(e,!1,u),void(0,s.UF)(e);e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(g.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(g.chats,"id")),e=(0,A.X5)(e,o,g.views,g.nextOffset,u),(0,s.UF)(e)})),(0,s.aJ)("reportStory",(async(e,t,a)=>{const{peerId:s,storyId:n,reason:o,description:i,tabId:r=(0,m.g0)()}=a,c=(0,b.PVB)(e,s);if(!c)return;const d=await(0,f.px)("reportStory",{peer:c,storyId:n,reason:o,description:i});t.showNotification({message:d?(0,g.yE)("ReportPeer.AlertSuccess"):"An error occurred while submitting your report. Please, try again later.",tabId:r})})),(0,s.aJ)("editStoryPrivacy",((e,t,a)=>{const{peerId:s,storyId:n,privacy:o}=a,i=(0,b.PVB)(e,s);if(!i)return;const r=[...o.allowUserIds,...o.allowChatIds],c=[...o.blockUserIds,...o.blockChatIds],d=(0,I.wT)(e,{visibility:o.visibility,isUnspecified:o.isUnspecified,allowedIds:r,blockedIds:c});(0,f.px)("editStoryPrivacy",{peer:i,id:n,privacy:d})})),(0,s.aJ)("toggleStoriesHidden",(async(e,t,a)=>{const{peerId:n,isHidden:o}=a,i=(0,b.PVB)(e,n);i&&await(0,f.px)("toggleStoriesHidden",{peer:i,isHidden:o})&&(e=(0,s.mS)(),e=(0,A.VW)(e,n,o),(0,s.UF)(e))})),(0,s.aJ)("loadStoriesMaxIds",(async(e,t,a)=>{const{peerIds:n}=a,o=n.map((t=>(0,b.PVB)(e,t))).filter(Boolean);if(!o.length)return;const i=await(0,f.px)("fetchStoriesMaxIds",{peers:o});if(!i)return;const r=[];e=(0,s.mS)(),i.forEach(((t,a)=>{const s=o[a];e=(0,A.kT)(e,s.id,{maxStoryId:t,hasStories:0!==t}),0!==t&&r.push(s.id)})),(0,s.UF)(e),r?.forEach((e=>t.loadPeerStories({peerId:e})))})),(0,s.aJ)("sendStoryReaction",(async(e,t,a)=>{const{peerId:n,storyId:o,containerId:i,reaction:r,shouldAddToRecent:c,tabId:d=(0,m.g0)()}=a,l=(0,b.PVB)(e,n);if(!l)return;const u=(0,b.Msb)(e,n,o);if(!u||!("content"in u))return;const h=u.sentReaction;e=(0,A.k3)(e,n,o,r),(0,s.UF)(e),r?t.startActiveReaction({containerId:i,reaction:r,tabId:d}):t.stopActiveReaction({containerId:i,tabId:d});const p=await(0,f.px)("sendStoryReaction",{peer:l,storyId:o,reaction:r,shouldAddToRecent:c});e=(0,s.mS)(),p||(e=(0,A.k3)(e,n,o,h)),(0,s.UF)(e)})),(0,s.aJ)("activateStealthMode",((e,t,a)=>{const{isForPast:s=!0,isForFuture:n=!0}=a||{};(0,f.px)("activateStealthMode",{isForPast:s||!0,isForFuture:n||!0})})),a(88742);var Oe=a(66414);(0,s.aJ)("processOpenChatOrThread",((e,t,a)=>{const{chatId:s,threadId:n=r.l3,type:o="thread",shouldReplaceHistory:i=!1,shouldReplaceLast:c=!1,noForumTopicPanel:d,tabId:l=(0,m.g0)()}=a,u=(0,b.Xf0)(e,l),h=(0,b.nTw)(e,l);if(h.premiumModal?.promo&&h.premiumModal?.isOpen&&(e=(0,v.w)(e,{premiumModal:{...h.premiumModal,isOpen:!1}},l)),t.hideEffectInComposer({tabId:l}),u&&u.chatId===s&&u.threadId===n&&u.type===o||(s&&(e=(0,A.n4)(e,s,n,"replyStack",[],l),e=(0,v.w)(e,{activeReactions:{},shouldPreventComposerAnimation:!0},l),e=(0,A._5)(e,s,n,l)),e=(0,A.T4)(e,l),e=(0,v.w)(e,{isStatisticsShown:!1,boostStatistics:void 0,contentToBeScheduled:void 0,...s!==(0,b.nTw)(e,l).forwardMessages.toChatId&&{forwardMessages:{},isShareMessageModalShown:!1}},l)),s){const a=(0,b.hds)(e,s);a?.isForum&&!d?t.openForumPanel({chatId:s,tabId:l}):s!==(0,b.nTw)(e,l).forumPanelChatId&&t.closeForumPanel({tabId:l})}return t.updatePageTitle({tabId:l}),(0,A.MN)(e,s,n,o,i,c,l)})),(0,s.aJ)("openChatInNewTab",((e,t,a)=>{const{chatId:s,threadId:n=r.l3}=a,i=(0,Oe.dk)(s,"thread",n);o.cp?window.electron.openNewWindow(i):window.open(i,"_blank")})),(0,s.aJ)("openPreviousChat",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return t.updatePageTitle({tabId:s}),(0,A.MN)(e,void 0,void 0,void 0,void 0,void 0,s)})),(0,s.aJ)("openChatWithInfo",((e,t,a)=>{const{profileTab:n,forceScrollProfileTab:o=!1,tabId:i=(0,m.g0)()}=a;e=(0,v.w)(e,{...(0,b.nTw)(e,i),isChatInfoShown:!0,nextProfileTab:n,forceScrollProfileTab:o},i),e={...e,lastIsChatInfoShown:!0},(0,s.UF)(e),t.openChat({...a,tabId:i})})),(0,s.aJ)("openThreadWithInfo",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a;e=(0,v.w)(e,{...(0,b.nTw)(e,n),isChatInfoShown:!0},n),e={...e,lastIsChatInfoShown:!0},(0,s.UF)(e),t.openThread({...a,tabId:n})})),(0,s.aJ)("openChatWithDraft",((e,t,a)=>{const{chatId:s,text:n,threadId:o=r.l3,files:i,filter:c,tabId:d=(0,m.g0)()}=a;return s&&t.openThread({chatId:s,threadId:o,tabId:d}),(0,v.w)(e,{requestedDraft:{chatId:s,text:n,files:i,filter:c}},d)})),(0,s.aJ)("resetChatCreation",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{chatCreation:void 0},s)})),(0,s.aJ)("setNewChatMembersDialogState",((e,t,a)=>{const{newChatMembersProgress:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{newChatMembersProgress:s},n)})),(0,s.aJ)("openNextChat",((e,t,a)=>{const{targetIndexDelta:s,orderedIds:n,tabId:o=(0,m.g0)()}=a,{chatId:i}=(0,b.Xf0)(e,o)||{};if(!i)return void t.openChat({id:n[0],tabId:o});const r=n.indexOf(i);if(-1===r)return;const c=n[r+s];t.openChat({id:c,shouldReplaceHistory:!0,tabId:o})})),(0,s.aJ)("closeDeleteChatFolderModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{deleteFolderDialogModal:void 0},s)})),(0,s.aJ)("closeChatlistModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{chatlistModal:void 0},s)})),(0,s.aJ)("requestChatTranslation",((e,t,a)=>{const{chatId:s,toLanguageCode:n,tabId:o=(0,m.g0)()}=a;return(0,A.lc)(e,s,n,o)}));var De=a(80539),Ve=a(3544),Ge=a(49086);const je=n.qke+n.xB5;let qe;function ze(e,t,a){const{type:s,threadId:n}=(0,b.Xf0)(e)||{},o=g.yE,i=(0,b.hds)(e,t),r="scheduled"===s?(0,b.yFI)(e,t):(0,b.zeq)(e,t);if(!i||!r||!n)return;const c=a.map((e=>r[e])).filter((t=>(0,b.Plp)(e,t,n).canCopy)).sort(((e,t)=>e.id-t.id)),l=[],u=[];c.forEach((t=>{const a=(0,I.WX)(i)?i:(0,b.Y7C)(e,t),s=`> ${a?(0,I.qg)(o,a):t.forwardInfo?.hiddenUserName||""}:`;l.push(s),l.push(`${function(e,t){const a=(0,Ve.Su)(t),s=a?`${a} `:"",n=(0,Ge.V)({message:t,shouldRenderAsHtml:!0})?.join("");return`${s}${(0,Ve.oL)(e,t,n,!0)}`}(o,t)}\n`),u.push(s),u.push(`${(0,Ve.dS)(o,t,!1,0,!0)}\n`)})),(0,d.A)(l.join("\n"),u.join("\n"))}(0,s.aJ)("setScrollOffset",((e,t,a)=>{const{chatId:s,threadId:n,scrollOffset:o,tabId:i=(0,m.g0)()}=a;return e=(0,A.ew)(e,s,n,"lastScrollOffset",o),(0,A.n4)(e,s,n,"scrollOffset",o,i)})),(0,s.aJ)("setEditingId",((e,t,a)=>{const{messageId:s,tabId:n=(0,m.g0)()}=a,o=(0,b.Xf0)(e,n);if(!o)return;const{chatId:i,threadId:r,type:c}=o,d="scheduled"===c?"editingScheduledId":"editingId";return(0,A.ew)(e,i,r,d,s)})),(0,s.aJ)("setEditingDraft",((e,t,a)=>{const{text:s,chatId:n,threadId:o,type:i}=a,r="scheduled"===i?"editingScheduledDraft":"editingDraft";return(0,A.ew)(e,n,o,r,s)})),(0,s.aJ)("editLastMessage",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n,threadId:o}=(0,b.Xf0)(e,s)||{};if(!n||!o)return;const i=(0,b.zeq)(e,n),r=(0,b.rA3)(e,n,o,s);if(!i||!r)return;const c=(0,h.Uk)(r,(t=>Boolean(i[t]&&(0,b.Plp)(e,i[t],o).canEdit)));return c?(0,A.ew)(e,n,o,"editingId",c):void 0})),(0,s.aJ)("replyToNextMessage",((e,t,a)=>{const{targetIndexDelta:s,tabId:n=(0,m.g0)()}=a,{chatId:o,threadId:i}=(0,b.Xf0)(e,n)||{};if(!o||!i)return;const c=(0,b.zeq)(e,o),d=(0,b.rA3)(e,o,i,n);if(!c||!d)return;const l=(0,b.GA4)(e,o,i)?.replyInfo;let u;if((0,b.haw)(e,o,i,n)&&l?.replyToMsgId){const e=Object.keys(c),t=e.indexOf(l.replyToMsgId.toString())+s;u=t<=e.length+1&&t>=0?Number(e[t]):void 0}else if(i===r.l3)u=(0,b.ZZX)(e,o);else{const t=(0,b.Vw0)(e,o,i);u=t?.lastMessageId}t.updateDraftReplyInfo({replyToMsgId:u,replyToPeerId:void 0,quoteText:void 0,tabId:n}),t.focusMessage({chatId:o,threadId:i,messageId:u,tabId:n})})),(0,s.aJ)("openAudioPlayer",((e,t,a)=>{const{chatId:s,threadId:n,messageId:o,origin:i,volume:r,playbackRate:c,isMuted:d,tabId:l=(0,m.g0)()}=a,u=(0,b.nTw)(e,l);return(0,v.w)(e,{audioPlayer:{chatId:s,threadId:n,messageId:o,origin:i??u.audioPlayer.origin,volume:r??u.audioPlayer.volume,playbackRate:c||u.audioPlayer.playbackRate||e.audioPlayer.lastPlaybackRate,isPlaybackRateActive:void 0===u.audioPlayer.isPlaybackRateActive?e.audioPlayer.isLastPlaybackRateActive:u.audioPlayer.isPlaybackRateActive,isMuted:d||u.audioPlayer.isMuted}},l)})),(0,s.aJ)("setAudioPlayerVolume",((e,t,a)=>{const{volume:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{audioPlayer:{...(0,b.nTw)(e,n).audioPlayer,volume:s,isMuted:!1}},n)})),(0,s.aJ)("setAudioPlayerPlaybackRate",((e,t,a)=>{const{playbackRate:s,isPlaybackRateActive:n,tabId:o=(0,m.g0)()}=a;return e={...e,audioPlayer:{...e.audioPlayer,lastPlaybackRate:s,isLastPlaybackRateActive:n}},(0,v.w)(e,{audioPlayer:{...(0,b.nTw)(e,o).audioPlayer,playbackRate:s,isPlaybackRateActive:n}},o)})),(0,s.aJ)("setAudioPlayerMuted",((e,t,a)=>{const{isMuted:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{audioPlayer:{...(0,b.nTw)(e,n).audioPlayer,isMuted:s}},n)})),(0,s.aJ)("setAudioPlayerOrigin",((e,t,a)=>{const{origin:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{audioPlayer:{...(0,b.nTw)(e,n).audioPlayer,origin:s}},n)})),(0,s.aJ)("closeAudioPlayer",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);return(0,v.w)(e,{audioPlayer:{volume:n.audioPlayer.volume,playbackRate:n.audioPlayer.playbackRate,isPlaybackRateActive:n.audioPlayer.isPlaybackRateActive,isMuted:n.audioPlayer.isMuted}},s)})),(0,s.aJ)("openPollResults",((e,t,a)=>{const{chatId:n,messageId:o,tabId:i=(0,m.g0)()}=a,r=(0,b.gjV)(e,(0,F.Ny)(),i),c=(0,b.nTw)(e,i);if(r){if(n!==c.pollResults.chatId||o!==c.pollResults.messageId)return(0,v.w)(e,{pollResults:{chatId:n,messageId:o,voters:{}}},i)}else window.setTimeout((()=>{e=(0,s.mS)(),e=(0,v.w)(e,{pollResults:{chatId:n,messageId:o,voters:{}}},i),(0,s.UF)(e)}),450)})),(0,s.aJ)("closePollResults",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{pollResults:{}},s)})),(0,s.aJ)("focusLastMessage",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.Xf0)(e,s);if(!n)return;const{chatId:o,threadId:i,type:c}=n,d=(0,I.cG)(o,i,e.currentUserId);let l;if(i===r.l3)if("pinned"===c){const t=(0,b.fcC)(e,o,r.l3);if(!t?.length)return;l=t[t.length-1]}else{l=(0,b.ZZX)(e,o);const t=(0,b.zeq)(e,o),a=Object.values(t).reverse()[0];l&&(0,I.CV)(a)&&a.id>l&&(l=a.id)}else if(d)l=(0,b.ZZX)(e,String(i),"saved");else{const t=(0,b.Vw0)(e,o,i);l=t?.lastMessageId}l&&t.focusMessage({chatId:o,threadId:i,messageListType:c,messageId:l,noHighlight:!0,noForumTopicPanel:!0,tabId:s})})),(0,s.aJ)("focusNextReply",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{},o=(0,b.Xf0)(e,n);if(!o)return;const{chatId:i,threadId:r}=o,c=(0,b.jp_)(e,i,r,n);if(c&&0!==c.length){const a=c.pop();e=(0,A.n4)(e,i,r,"replyStack",[...c],n),(0,s.UF)(e),t.focusMessage({chatId:i,threadId:r,messageId:a,tabId:n,noForumTopicPanel:!0})}else t.focusLastMessage({tabId:n})})),(0,s.aJ)("focusMessage",((e,t,a)=>{const{chatId:n,threadId:o=r.l3,messageListType:i="thread",noHighlight:d,groupedId:l,groupedChatId:u,replyMessageId:p,isResizingContainer:y,shouldReplaceHistory:f,noForumTopicPanel:I,quote:v,scrollTargetPosition:w,tabId:S=(0,m.g0)()}=a;let{messageId:C}=a;if(!(0,b.hds)(e,n))return void t.showNotification({message:(0,g.yE)("Conversation.ErrorInaccessibleMessage"),tabId:S});if(void 0!==l){const t=(0,b.VC8)(e,u,l);t?.length&&([C]=(0,h.oE)(t))}const E=(0,b.Xf0)(e,S),M=!E||n!==E.chatId||o!==E.threadId||i!==E.type;if(qe&&(clearTimeout(qe),qe=void 0),qe=window.setTimeout((()=>{e=(0,s.mS)(),e=(0,A.kV)({global:e},S),e=(0,A.Xb)(e,void 0,S),(0,s.UF)(e)}),d?je:1500),e=(0,A.kV)({global:e,chatId:n,messageId:C,threadId:o,noHighlight:d,isResizingContainer:y,quote:v,scrollTargetPosition:w},S),e=(0,A.Xb)(e,void 0,S),p){const t=(0,b.jp_)(e,n,o,S)||[];e=(0,A.n4)(e,n,o,"replyStack",[...t,p],S)}M&&(e=(0,A.Xb)(e,c.CC.Static,S));const k=(0,b.rA3)(e,n,o,S);if(k&&k.includes(C))return(0,s.UF)(e,{forceOnHeavyAnimation:!0}),void t.openThread({chatId:n,threadId:o,type:i,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:S});if(M&&(e=(0,A.n4)(e,n,o,"viewportIds",void 0,S)),k&&!M){const t=C>k[0]?c.CC.Down:c.CC.Up;e=(0,A.Xb)(e,t,S)}(0,s.UF)(e,{forceOnHeavyAnimation:!0}),t.openThread({chatId:n,threadId:o,type:i,shouldReplaceHistory:f,noForumTopicPanel:I,tabId:S}),t.loadViewportMessages({chatId:n,threadId:o,tabId:S,shouldForceRender:!0})})),(0,s.aJ)("setShouldPreventComposerAnimation",((e,t,a)=>{const{shouldPreventComposerAnimation:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{shouldPreventComposerAnimation:s},n)})),(0,s.aJ)("openReplyMenu",((e,t,a)=>{const{fromChatId:s,messageId:n,quoteText:o,tabId:i=(0,m.g0)()}=a;return(0,v.w)(e,{replyingMessage:{fromChatId:s,messageId:n,quoteText:o},isShareMessageModalShown:!0},i)})),(0,s.aJ)("openForwardMenu",((e,t,a)=>{const{fromChatId:s,messageIds:n,storyId:o,groupedId:i,withMyScore:r,tabId:c=(0,m.g0)()}=a;let d;return i&&(d=(0,b.D_S)(e,s,i)),(0,v.w)(e,{forwardMessages:{fromChatId:s,messageIds:d||n,storyId:o,withMyScore:r},isShareMessageModalShown:!0},c)})),(0,s.aJ)("changeRecipient",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{forwardMessages:{...(0,b.nTw)(e,s).forwardMessages,toChatId:void 0,noAuthors:!1,noCaptions:!1},isShareMessageModalShown:!0},s)})),(0,s.aJ)("setForwardNoAuthors",((e,t,a)=>{const{noAuthors:s,tabId:n=(0,m.g0)()}=a,o=(0,b.nTw)(e,n);return(0,v.w)(e,{forwardMessages:{...o.forwardMessages,noAuthors:s,noCaptions:s&&o.forwardMessages.noCaptions}},n)})),(0,s.aJ)("setForwardNoCaptions",((e,t,a)=>{const{noCaptions:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{forwardMessages:{...(0,b.nTw)(e,n).forwardMessages,noCaptions:s,noAuthors:s}},n)})),(0,s.aJ)("exitForwardMode",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,v.w)(e,{isShareMessageModalShown:!1,forwardMessages:{},replyingMessage:{}},n),(0,s.UF)(e)})),(0,s.aJ)("openForwardMenuForSelectedMessages",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);if(!n.selectedMessages)return;const{chatId:o,messageIds:i}=n.selectedMessages;t.openForwardMenu({fromChatId:o,messageIds:i,tabId:s})})),(0,s.aJ)("cancelMediaDownload",((e,t,a)=>{const{media:s,tabId:n=(0,m.g0)()}=a,o=(0,I.VO)(s,"download");if(o)return(0,A.Iw)(e,[o],n)})),(0,s.aJ)("cancelMediaHashDownloads",((e,t,a)=>{const{mediaHashes:s,tabId:n=(0,m.g0)()}=a;return(0,A.Iw)(e,s,n)})),(0,s.aJ)("downloadMedia",((e,t,a)=>{const{media:s,tabId:n=(0,m.g0)()}=a,o=(0,I.VO)(s,"download");if(!o)return;const i={size:"size"in s?s.size:0,format:(0,I.Cz)(s,"download"),filename:(0,I.sd)(s)};return(0,A.iR)(e,o,i,n)})),(0,s.aJ)("downloadSelectedMessages",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);if(!n.selectedMessages)return;const{chatId:o,messageIds:i}=n.selectedMessages,{threadId:r}=(0,b.Xf0)(e,s)||{},c=(0,b.zeq)(e,o);c&&r&&i.map((e=>c[e])).filter((t=>(0,b.Plp)(e,t,r).canDownload)).forEach((e=>{const a=(0,I.ed)(e);a&&t.downloadMedia({media:a,tabId:s})}))})),(0,s.aJ)("enterMessageSelectMode",((e,t,a)=>{const{messageId:s,tabId:n=(0,m.g0)()}=a||{},o=(0,b.meB)(e,n);return o?(0,A.l3)(e,o.id,s,n):e})),(0,s.aJ)("toggleMessageSelection",((e,t,a)=>{const{messageId:n,groupedId:i,childMessageIds:r,withShift:c,tabId:d=(0,m.g0)()}=a,l=(0,b.Xf0)(e,d);if(!l)return;const{chatId:u,threadId:h,type:p}=l;e=(0,A.yr)(e,u,h,p,n,i,r,c,d),(0,s.UF)(e),e.shouldShowContextMenuHint&&(t.disableContextMenuHint(),t.showNotification({message:`To **edit** or **reply**, close this menu. Then ${o.TF?"long tap":"right click"} on a message.`,tabId:d}))})),(0,s.aJ)("disableContextMenuHint",(e=>{if(e.shouldShowContextMenuHint)return{...e,shouldShowContextMenuHint:!1}})),(0,s.aJ)("exitMessageSelectMode",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,A.T4)(e,s)})),(0,s.aJ)("openPollModal",((e,t,a)=>{const{isQuiz:s,tabId:n=(0,m.g0)()}=a||{};return(0,v.w)(e,{pollModal:{isOpen:!0,isQuiz:s}},n)})),(0,s.aJ)("closePollModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{pollModal:{isOpen:!1}},s)})),(0,s.aJ)("checkVersionNotification",((e,t)=>{if(n.cOD&&Date.now()>Number(n.cOD)+2592e5)return;const a="10.9.10".split(".").slice(0,2).join("."),{serviceNotifications:s}=e;if(s.find((e=>{let{version:t}=e;return t===a})))return;const o={chatId:n.zv8,date:(0,ve.Fm)(),content:{text:(0,De.Ay)("**Telegram Web A Digest**\n\nMany new features and useful optimizations have been added in recent months. Here is a brief overview of what's been happening in Web A since August.\n\n**September November** \n\n✏ __General__\n• [Reply Revolution](https://telegram.org/blog/reply-revolution#reply-revolution)  the app learned to quote specific parts of any message, making your responses 100% precise.\n• Also, [Quote Formatting](https://telegram.org/blog/reply-revolution#quote-formatting) have arrived.\n\n📣 __Channels__\n• Channels added [boosts](https://telegram.org/blog/channel-stories#stories-for-channels) and [giveaways.](https://telegram.org/blog/giveaways#free-telegram-premium) \n• Users also got an option to reassign their boosts between channels.\n\n🌄 __Stories__\n• Numerous improvements have been made to the animations flow, ensuring the stories bar expands more smoothly. Additionally, a package of optimizations has been added to enhance the performance of stories on mobile devices.\n• Stories have been introduced for [channels,](https://telegram.org/blog/channel-stories#stories-for-channels) and the story viewer has been updated with new gestures to expand and reply.\n\n⚙ __Settings__\n• The app has added an option, 'Who can find me by phone number,' along with a setting under 'Privacy and Security' to manage the visibility of your bio.\n\n✨ __Extra__\n• Some further improvements have been made to the Mini Apps area.\n• New security notifications have been added to the chat list to alert you when your account is logged into from a new device.\n• New design for code blocks formatting.\n\n**December February**\n\n✏ __General__\n• [Saved Messages 2.0](https://telegram.org/blog/new-saved-messages-and-9-more#saved-messages-2-0)  including tags, My Notes, Replies and forwards from hidden authors.\n• [One-Time Voice Messages](https://telegram.org/blog/new-saved-messages-and-9-more#one-time-voice-and-video-messages) including both listening and recording. Added support for viewing One-Time Video Messages.\n• [Read-Time in Private Chats](https://telegram.org/blog/new-saved-messages-and-9-more#read-time-in-private-chats)\n• You can now replace media when editing messages.\n• The app learned to [preserve the selected mode](https://telegram.org/blog/similar-channels#improvements-for-topics) for topics in groups.\n• Whenever you create a small group, Web A suggests a name for it based on users' name you have added.\n\n📣 __Channels__ \n• Added [custom channel reactions.](https://telegram.org/blog/similar-channels#custom-reactions-for-channels)\n• Implemented [channel stories stats.](https://telegram.org/blog/similar-channels#story-stats-for-channels)\n• Channel emoji statuses.\n• [Similar Channels.](https://telegram.org/blog/similar-channels#similar-channels)\n\n👥 __Groups__\n• [9 new features for groups.](https://telegram.org/blog/february2024)\n\n🤖 __Bots__\n• Edit your bots info right from their profile.\n\n🌄 __Stories__\n• Added support for [forwarded stories](https://telegram.org/blog/posts-in-stories-and-more#view-reposts-and-more) and [channel posts in stories.](https://telegram.org/blog/posts-in-stories-and-more#share-posts-in-stories)\n\n✨ __Extra__\n• Giveaway Improvements: displaying winners list and additional prizes.\n\n**March**\n\n📣 __Channels__ \n• Admins will soon be able to launch giveaways in their channels.\n\n✨ __Extra__\n• Added support for Emoji v15.1.\n• Some design enhancements for shared contacts, links preview and more.\n",!0)},isOutgoing:!1};t.createServiceNotification({message:o,version:a})})),(0,s.aJ)("createServiceNotification",((e,t,a)=>{const{message:o,version:i}=a,{serviceNotifications:r}=e,c=Math.max((0,b.ZZX)(e,n.zv8)||0,...r.map((e=>{let{id:t}=e;return t}))),d=(r.length+1)/1e3,l=Math.floor(c)+d;o.previousLocalId=o.id,o.id=l;const u={id:l,message:o,version:i,isUnread:!0};e={...e,serviceNotifications:[...r.slice(-1e3),u]},(0,s.UF)(e),t.apiUpdate({"@type":"newMessage",id:o.id,chatId:o.chatId,message:o})})),(0,s.aJ)("openReactorListModal",((e,t,a)=>{const{chatId:s,messageId:n,tabId:o=(0,m.g0)()}=a;return(0,v.w)(e,{reactorModal:{chatId:s,messageId:n}},o)})),(0,s.aJ)("closeReactorListModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{reactorModal:void 0},s)})),(0,s.aJ)("openSeenByModal",((e,t,a)=>{const{chatId:s,messageId:n,tabId:o=(0,m.g0)()}=a;return(0,v.w)(e,{seenByModal:{chatId:s,messageId:n}},o)})),(0,s.aJ)("closeSeenByModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{seenByModal:void 0},s)})),(0,s.aJ)("openPrivacySettingsNoticeModal",((e,t,a)=>{const{chatId:s,isReadDate:n,tabId:o=(0,m.g0)()}=a;return(0,v.w)(e,{privacySettingsNoticeModal:{chatId:s,isReadDate:n}},o)})),(0,s.aJ)("closePrivacySettingsNoticeModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{privacySettingsNoticeModal:void 0},s)})),(0,s.aJ)("openChatLanguageModal",((e,t,a)=>{const{chatId:s,messageId:n,tabId:o=(0,m.g0)()}=a,i=n?(0,b.Rny)(e,s,n,o):(0,b.qZq)(e,s,o);return(0,v.w)(e,{chatLanguageModal:{chatId:s,messageId:n,activeLanguage:i}},o)})),(0,s.aJ)("closeChatLanguageModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{chatLanguageModal:void 0},s)})),(0,s.aJ)("copySelectedMessages",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);if(!n.selectedMessages)return;const{chatId:o,messageIds:i}=n.selectedMessages;ze(e,o,i)})),(0,s.aJ)("copyMessagesByIds",((e,t,a)=>{const{messageIds:s,tabId:n=(0,m.g0)()}=a,o=(0,b.meB)(e,n);s&&0!==s.length&&o&&ze(e,o.id,s)})),(0,s.aJ)("openOneTimeMediaModal",((e,t,a)=>{const{message:n,tabId:o=(0,m.g0)()}=a;e=(0,v.w)(e,{oneTimeMediaModal:{message:n}},o),(0,s.UF)(e)})),(0,s.aJ)("closeOneTimeMediaModal",((e,t,a)=>{const{tabId:n=(0,m.g0)()}=a||{};e=(0,v.w)(e,{oneTimeMediaModal:void 0},n),(0,s.UF)(e)})),(0,s.aJ)("closeReportAdModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{reportAdModal:void 0},s)})),(0,s.aJ)("openPreviousReportAdModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s).reportAdModal;if(n){if(1!==n.sections.length)return(0,v.w)(e,{reportAdModal:{...n,sections:n.sections.slice(0,-1)}},s);t.closeReportAdModal({tabId:s})}})),(0,s.aJ)("openDeleteMessageModal",((e,t,a)=>{const{message:n,isSchedule:o,album:i,tabId:r=(0,m.g0)()}=a;e=(0,s.mS)(),e=(0,v.w)(e,{deleteMessageModal:{isSchedule:o,album:i,message:n}},r),(0,s.UF)(e)})),(0,s.aJ)("closeDeleteMessageModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{deleteMessageModal:void 0},s)})),(0,s.aJ)("setGlobalSearchQuery",((e,t,a)=>{const{query:s,tabId:n=(0,m.g0)()}=a,{chatId:o,currentContent:i}=(0,b.nTw)(e,n).globalSearch,r=s&&i!==c.$C.BotApps?{chats:!o,messages:!0}:void 0;return(0,A.b8)(e,{globalResults:{},localResults:{},resultsByType:void 0,fetchingStatus:r,query:s},n)})),(0,s.aJ)("setGlobalSearchClosing",((e,t,a)=>{const{tabId:s=(0,m.g0)(),isClosing:n}=a||{};return(0,A.b8)(e,{isClosing:n},s)})),(0,s.aJ)("addRecentlyFoundChatId",((e,t,a)=>{const{id:s}=a,{recentlyFoundChatIds:n}=e;if(!n)return{...e,recentlyFoundChatIds:[s]};const o=n.filter((e=>e!==s));return o.unshift(s),o.length>10&&o.pop(),{...e,recentlyFoundChatIds:o}})),(0,s.aJ)("clearRecentlyFoundChats",(e=>({...e,recentlyFoundChatIds:void 0}))),(0,s.aJ)("setGlobalSearchContent",((e,t,a)=>{const{content:s,tabId:n=(0,m.g0)()}=a;return(0,A.GQ)(e,s,n)})),(0,s.aJ)("setGlobalSearchChatId",((e,t,a)=>{const{id:s,tabId:n=(0,m.g0)()}=a;return(0,A.b8)(e,{chatId:s,query:void 0,resultsByType:void 0},n)})),(0,s.aJ)("openMiddleSearch",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n,threadId:o}=(0,b.Xf0)(e,s)||{};if(n&&o)return(0,A.$R)(e,n,o,{},s)})),(0,s.aJ)("closeMiddleSearch",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n,threadId:o}=(0,b.Xf0)(e,s)||{};if(n&&o)return(0,A._5)(e,n,o,s)})),(0,s.aJ)("updateMiddleSearch",((e,t,a)=>{const{update:s,tabId:n=(0,m.g0)()}=a;let o,i;if(a.chatId)o=a.chatId,i=a.threadId||r.l3;else{const t=(0,b.Xf0)(e,n);if(!t)return;o=t.chatId,i=t.threadId}return(0,A.$R)(e,o,i,s,n)})),(0,s.aJ)("resetMiddleSearch",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n,threadId:o}=(0,b.Xf0)(e,s)||{};if(n&&o)return(0,A.zd)(e,n,o,s)})),(0,s.aJ)("setSharedMediaSearchType",((e,t,a)=>{const{mediaType:s,tabId:n=(0,m.g0)()}=a,{chatId:o,threadId:i}=(0,b.Xf0)(e,n)||{};if(o&&i)return(0,A.Tu)(e,o,i,s,n)})),(0,s.aJ)("setStickerSearchQuery",((e,t,a)=>{const{query:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{stickerSearch:{query:s,resultIds:void 0}},n)})),(0,s.aJ)("setGifSearchQuery",((e,t,a)=>{const{query:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{gifSearch:{query:s,offset:void 0,results:void 0}},n)})),(0,s.aJ)("setUserSearchQuery",((e,t,a)=>{const{query:s,tabId:n=(0,m.g0)()}=a;return(0,A.BF)(e,{globalUserIds:void 0,localUserIds:void 0,fetchingStatus:Boolean(s),query:s},n)})),(0,s.aJ)("openAddContactDialog",((e,t,a)=>{const{userId:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{newContact:{userId:s}},n)})),(0,s.aJ)("openNewContactDialog",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{newContact:{isByPhoneNumber:!0}},s)})),(0,s.aJ)("closeNewContactDialog",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,A.BO)(e,s)})),a(11117);var He=a(14235);const _e=/^\d+\.\d+(\.\d+)?$/;var We=a(99375),Ke=a(13376);function $e(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 Xe(e){o.cp?window.electron.setWindowTitle(e):document.title!==e&&(document.title=e)}const Qe=(0,y.sg)(Xe,200,!1);let Ze,Ye;(0,s.aJ)("toggleChatInfo",((e,t,a)=>{const{force:s,tabId:n=(0,m.g0)()}=a||{},o=void 0!==s?s:!(0,b.nTw)(e,n).isChatInfoShown;return e=(0,v.w)(e,{isChatInfoShown:o},n),{...e,lastIsChatInfoShown:o}})),(0,s.aJ)("setLeftColumnWidth",((e,t,a)=>{const{leftColumnWidth:s}=a;return{...e,leftColumnWidth:s}})),(0,s.aJ)("resetLeftColumnWidth",(e=>({...e,leftColumnWidth:void 0}))),(0,s.aJ)("toggleManagement",((e,t,a)=>{const{force:s,tabId:n=(0,m.g0)()}=a||{},{chatId:o}=(0,b.Xf0)(e,n)||{};if(!o)return;const i=(0,b.nTw)(e,n);return(0,v.w)(e,{management:{byChatId:{...i.management.byChatId,[o]:{...i.management.byChatId[o],isActive:void 0!==s?s:!(i.management.byChatId[o]||{}).isActive}}}},n)})),(0,s.aJ)("requestNextManagementScreen",((e,t,a)=>{const{screen:s,tabId:n=(0,m.g0)()}=a||{},{chatId:o}=(0,b.Xf0)(e,n)||{};if(!o)return;const i=(0,b.nTw)(e,n);return(0,v.w)(e,{management:{byChatId:{...i.management.byChatId,[o]:{...i.management.byChatId[o],isActive:!0,nextScreen:s}}}},n)})),(0,s.aJ)("closeManagement",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n}=(0,b.Xf0)(e,s)||{};if(!n)return;const o=(0,b.nTw)(e,s);return(0,v.w)(e,{management:{byChatId:{...o.management.byChatId,[n]:{...o.management.byChatId[n],isActive:!1}}}},s)})),(0,s.aJ)("processOpenChatOrThread",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a;if((0,F.Ny)()||(0,F.Bb)())return(0,v.w)(e,{isLeftColumnShown:0===(0,b.nTw)(e,s).messageLists.length},s)})),(0,s.aJ)("resetNextProfileTab",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{chatId:n}=(0,b.Xf0)(e,s)||{};if(n)return(0,v.w)(e,{nextProfileTab:void 0,forceScrollProfileTab:!1},s)})),(0,s.aJ)("toggleStatistics",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);return(0,v.w)(e,{isStatisticsShown:!n.isStatisticsShown,statistics:{...n.statistics,currentMessageId:void 0,currentStoryId:void 0}},s)})),(0,s.aJ)("toggleMessageStatistics",((e,t,a)=>{const{tabId:s=(0,m.g0)(),messageId:n}=a||{};return(0,v.w)(e,{statistics:{...(0,b.nTw)(e,s).statistics,currentMessageId:n,currentStoryId:void 0}},s)})),(0,s.aJ)("toggleStoryStatistics",((e,t,a)=>{const{tabId:s=(0,m.g0)(),storyId:n}=a||{};return(0,v.w)(e,{statistics:{...(0,b.nTw)(e,s).statistics,currentStoryId:n,currentMessageId:void 0}},s)})),(0,s.aJ)("toggleLeftColumn",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{isLeftColumnShown:!(0,b.nTw)(e,s).isLeftColumnShown},s)})),(0,s.aJ)("addRecentEmoji",((e,t,a)=>{const{emoji:s}=a,{recentEmojis:n}=e;if(!n)return{...e,recentEmojis:[s]};const o=n.filter((e=>e!==s));return o.unshift(s),o.length>32&&o.pop(),{...e,recentEmojis:o}})),(0,s.aJ)("addRecentSticker",((e,t,a)=>{const{sticker:s}=a,{recent:n}=e.stickers;if(!n)return{...e,stickers:{...e.stickers,recent:{hash:"0",stickers:[s]}}};const o=n.stickers.filter((e=>e.id!==s.id));return o.unshift(s),{...e,stickers:{...e.stickers,recent:{...n,stickers:o}}}})),(0,s.aJ)("addRecentCustomEmoji",((e,t,a)=>{const{documentId:s}=a,{recentCustomEmojis:n}=e;if(!n)return{...e,recentCustomEmojis:[s]};const o=n.filter((e=>e!==s));return o.unshift(s),o.length>32&&o.pop(),{...e,recentCustomEmojis:o}})),(0,s.aJ)("clearRecentCustomEmoji",(e=>({...e,recentCustomEmojis:[]}))),(0,s.aJ)("reorderStickerSets",((e,t,a)=>{const{order:s,isCustomEmoji:n}=a;return{...e,stickers:{...e.stickers,added:{setIds:n?e.stickers.added.setIds:s}},customEmojis:{...e.customEmojis,added:{setIds:n?s:e.customEmojis.added.setIds}}}})),(0,s.aJ)("showNotification",((e,t,a)=>{const{tabId:s=(0,m.g0)(),...n}=a;n.localId=(0,He.A)();const o=[...(0,b.nTw)(e,s).notifications],i=o.findIndex((e=>e.message===n.message));return-1!==i&&o.splice(i,1),o.push(n),(0,v.w)(e,{notifications:o},s)})),(0,s.aJ)("showAllowedMessageTypesNotification",((e,t,a)=>{const{chatId:s,tabId:n=(0,m.g0)()}=a,o=(0,b.hds)(e,s);if(!o)return;const i=(0,b.AWZ)(e,s),{canSendPlainText:r,canSendPhotos:c,canSendVideos:d,canSendDocuments:l,canSendAudios:u,canSendStickers:p,canSendRoundVideos:y,canSendVoices:f}=(0,I.Q_)(o,i),A=(0,h.oE)([r?"Chat.SendAllowedContentTypeText":void 0,c?"Chat.SendAllowedContentTypePhoto":void 0,d?"Chat.SendAllowedContentTypeVideo":void 0,f?"Chat.SendAllowedContentTypeVoiceMessage":void 0,y?"Chat.SendAllowedContentTypeVideoMessage":void 0,l?"Chat.SendAllowedContentTypeFile":void 0,u?"Chat.SendAllowedContentTypeMusic":void 0,p?"Chat.SendAllowedContentTypeSticker":void 0]).map((e=>g.yE(e)));if(!A.length)return void t.showNotification({message:g.yE("Chat.SendNotAllowedText"),tabId:n});const v=g.yE("AutoDownloadSettings.LastDelimeter"),w=A.join(", ").replace(/,([^,]*)$/,`${v}$1`);t.showNotification({message:g.yE("Chat.SendAllowedContentText",w),tabId:n})})),(0,s.aJ)("dismissNotification",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a,n=(0,b.nTw)(e,s).notifications.filter((e=>{let{localId:t}=e;return t!==a.localId}));return(0,v.w)(e,{notifications:n},s)})),(0,s.aJ)("showDialog",((e,t,a)=>{const{data:s,tabId:n=(0,m.g0)()}=a;if("message"in s&&s.hasErrorKey&&!(0,We.Ay)(s))return e;const o=[...(0,b.nTw)(e,n).dialogs];if("message"in s){const e=o.findIndex((e=>e.message===s.message));-1!==e&&o.splice(e,1)}return o.push(s),(0,v.w)(e,{dialogs:o},n)})),(0,s.aJ)("dismissDialog",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=[...(0,b.nTw)(e,s).dialogs];return n.pop(),(0,v.w)(e,{dialogs:n},s)})),(0,s.aJ)("toggleSafeLinkModal",((e,t,a)=>{const{url:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{safeLinkModalUrl:s},n)})),(0,s.aJ)("openHistoryCalendar",((e,t,a)=>{const{selectedAt:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{historyCalendarSelectedAt:s},n)})),(0,s.aJ)("closeHistoryCalendar",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{historyCalendarSelectedAt:void 0},s)})),(0,s.aJ)("openGame",((e,t,a)=>{const{url:n,chatId:o,messageId:i,tabId:r=(0,m.g0)()}=a,c=(0,b.O5q)(e,o,i);if(!c)return;const d=c.viaBotId||c.senderId;if(d){if(!(0,b.nTL)(e,d))return e=(0,v.w)(e,{botTrustRequest:{botId:d,type:"game",onConfirm:{action:"openGame",payload:a}}},r),void(0,s.UF)(e);e=(0,v.w)(e,{openedGame:{url:n,chatId:o,messageId:i}},r),(0,s.UF)(e)}})),(0,s.aJ)("closeGame",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{openedGame:void 0},s)})),(0,s.aJ)("requestConfetti",((e,t,a)=>{const{tabId:s=(0,m.g0)(),...n}=a;if((0,b.PKK)(e))return(0,v.w)(e,{confetti:{lastConfettiTime:Date.now(),...n}},s)})),(0,s.aJ)("updateAttachmentSettings",((e,t,a)=>{const{shouldCompress:s,shouldSendGrouped:n,isInvertedMedia:o}=a;return{...e,attachmentSettings:{shouldCompress:s??e.attachmentSettings.shouldCompress,shouldSendGrouped:n??e.attachmentSettings.shouldSendGrouped,isInvertedMedia:o}}})),(0,s.aJ)("requestEffectInComposer",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a;return(0,v.w)(e,{shouldPlayEffectInComposer:!0},s)})),(0,s.aJ)("hideEffectInComposer",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a;return(0,v.w)(e,{shouldPlayEffectInComposer:void 0},s)})),(0,s.aJ)("setReactionEffect",((e,t,a)=>{const{chatId:s,threadId:n,reaction:o,tabId:i=(0,m.g0)()}=a,r=o&&"emoticon"in o&&o.emoticon;if(!r)return;const c=Object.values(e.availableEffectById).find((e=>e.effectAnimationId&&e.emoticon===r)),d=c?.id,l=(0,b.g29)(e);!c?.isPremium||l?d&&(t.requestEffectInComposer({tabId:i}),t.saveEffectInDraft({chatId:s,threadId:n,effectId:d})):t.openPremiumModal({initialSection:"effects",tabId:i})})),(0,s.aJ)("openLimitReachedModal",((e,t,a)=>{const{limit:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{limitReachedModal:{limit:s}},n)})),(0,s.aJ)("closeLimitReachedModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{limitReachedModal:void 0},s)})),(0,s.aJ)("closeStickerSetModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{openedStickerSetShortName:void 0},s)})),(0,s.aJ)("openCustomEmojiSets",((e,t,a)=>{const{setIds:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{openedCustomEmojiSetIds:s},n)})),(0,s.aJ)("closeCustomEmojiSets",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{openedCustomEmojiSetIds:void 0},s)})),(0,s.aJ)("updateLastRenderedCustomEmojis",((e,t,a)=>{const{ids:s}=a,{lastRendered:o}=e.customEmojis;return{...e,customEmojis:{...e.customEmojis,lastRendered:(0,h.Am)([...o,...s]).slice(0,n.GW0)}}})),(0,s.aJ)("openCreateTopicPanel",((e,t,a)=>{const{chatId:s,tabId:n=(0,m.g0)()}=a;return(0,b.meB)(e,n)||t.openChat({id:s,tabId:n}),(0,v.w)(e,{createTopicPanel:{chatId:s}},n)})),(0,s.aJ)("closeCreateTopicPanel",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{createTopicPanel:void 0},s)})),(0,s.aJ)("openEditTopicPanel",((e,t,a)=>{const{chatId:s,topicId:n,tabId:o=(0,m.g0)()}=a;return(0,b.meB)(e,o)||t.openChat({id:s,tabId:o}),(0,v.w)(e,{editTopicPanel:{chatId:s,topicId:n}},o)})),(0,s.aJ)("closeEditTopicPanel",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{editTopicPanel:void 0},s)})),(0,s.aJ)("updateArchiveSettings",((e,t,a)=>{const{archiveSettings:s}=e,{isHidden:n=s.isHidden,isMinimized:o=s.isMinimized}=a;return{...e,archiveSettings:{isHidden:n,isMinimized:o}}})),(0,s.aJ)("openMapModal",((e,t,a)=>{const{geoPoint:s,zoom:n,tabId:o=(0,m.g0)()}=a;return(0,v.w)(e,{mapModal:{point:s,zoom:n}},o)})),(0,s.aJ)("closeMapModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{mapModal:void 0},s)})),(0,s.aJ)("checkAppVersion",(e=>{fetch(`version.txt?${Date.now()}`).then((e=>e.text())).then((t=>{(function(e,t,a){const s=e.trim();return!!_e.test(s)&&s!==t})(t=t.trim(),"10.9.10")&&(e=(0,s.mS)(),e={...e,isAppUpdateAvailable:!0},(0,s.UF)(e))})).catch((e=>{n.Oig&&console.error("[checkAppVersion failed] ",e)}))})),(0,s.aJ)("setIsElectronUpdateAvailable",((e,t,a)=>{e=(0,s.mS)(),e={...e,isElectronUpdateAvailable:Boolean(a)},(0,s.UF)(e)})),(0,s.aJ)("afterHangUp",(e=>{(0,b.nTw)(e,(0,m.g0)()).multitabNextAction&&(0,m.I)()})),(0,s.aJ)("onTabFocusChange",((e,t,a)=>{const{isBlurred:s,tabId:n=(0,m.g0)()}=a;return s?(Ze&&clearInterval(Ze),Ze=window.setInterval((()=>{t.updatePageTitle({tabId:n})}),500)):(clearInterval(Ze),Ze=void 0),e=(0,v.w)(e,{isBlurred:s},n),{...e,initialUnreadNotifications:s?(0,ye.vp)():void 0}})),(0,s.aJ)("updatePageTitle",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{canDisplayChatInTitle:i}=e.settings.byKey,r=e.currentUserId;if(document.title.includes(n.LaL))return $e(!1),void Xe(`${n.j0M} ${n.LaL}`);if(e.initialUnreadNotifications&&Math.round(Date.now()/1e3)%2==0){const t=(0,ye.vp)()-e.initialUnreadNotifications;if(t>0)return Xe(`${t} notification${t>1?"s":""}`),void $e(!0)}$e(!1);const c=(0,b.Xf0)(e,s);if(c&&i&&!e.passcode.isScreenLocked){const{chatId:t,threadId:a}=c,s=(0,b.hds)(e,t);if(s){const e=(0,I.Js)(g.yE,s,t===r);return s.isForum&&s.topics?.[a]?void Qe(`${e} ${s.topics[a].title}`):void Qe(e)}}Xe(o.cp?"":n.j0M)})),(0,s.aJ)("closeInviteViaLinkModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a??{};return(0,v.w)(e,{inviteViaLinkModal:void 0},s)})),(0,s.aJ)("closeCollectibleInfoModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a??{};return(0,v.w)(e,{collectibleInfoModal:void 0},s)})),(0,s.aJ)("setShouldCloseRightColumn",((e,t,a)=>{const{value:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{shouldCloseRightColumn:s},n)})),(0,s.aJ)("refreshLangPackFromCache",((e,t,a)=>{(0,Ke.K1)(a.langCode)})),(0,s.aJ)("processPremiumFloodWait",((e,t,a)=>{const{isUpload:s}=a,{bandwidthPremiumDownloadSpeedup:n,bandwidthPremiumUploadSpeedup:o,bandwidthPremiumNotifyPeriod:i}=e.appConfig||{},{lastPremiumBandwithNotificationDate:r}=e.settings;if(n&&o&&i&&!(r&&Date.now()<r+1e3*i))return Object.values(e.byTabId).filter((e=>!e.isBlurred)).map((e=>e.id)).forEach((e=>{t.showNotification({title:g.yE(s?"UploadSpeedLimited":"DownloadSpeedLimited"),message:g.yE(s?"UploadSpeedLimitedMessage":"DownloadSpeedLimitedMessage",s?o:n),duration:6e3,tabId:e})})),{...e,settings:{...e.settings,lastPremiumBandwithNotificationDate:Date.now()}}}));let et,tt=0;(0,ge.DW)((e=>{const{updatePageTitle:t,updateIsOnline:a}=(0,s.ko)(),n=e.passcode.isScreenLocked!==Ye,o=Object.values(e.byTabId).filter((e=>e.isBlurred)).length,i=(0,b.nTw)(e,(0,m.g0)()).isMasterTab;n&&t(),o!==tt&&i&&(et&&clearTimeout(et),et=window.setTimeout((()=>{e=(0,s.mS)();const t=Object.values(e.byTabId).filter((e=>e.isBlurred)).length;a(t!==(0,m.gb)().length)}),100)),Ye=e.passcode.isScreenLocked,tt=o})),(0,s.aJ)("closePaymentModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s).payment.status||"cancelled",o=(0,b.nTw)(e,s).starsBalanceModal?.originPayment;return e=(0,A.GS)(e,s),e=(0,A.cY)(e,s),e=(0,v.w)(e,{payment:{...(0,b.nTw)(e,s).payment,status:n},...o&&{starsBalanceModal:void 0}},s),o&&(e=(0,A._$)(e,o,s),e=(0,v.w)(e,{isStarPaymentModalOpen:!0},s)),e})),(0,s.aJ)("addPaymentError",((e,t,a)=>{const{error:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{payment:{...(0,b.nTw)(e,n).payment,status:"failed",error:s}},n)})),(0,s.aJ)("closeGiftCodeModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{giftCodeModal:void 0},s)})),(0,s.aJ)("openStarsBalanceModal",((e,t,a)=>{const{originPayment:s,tabId:n=(0,m.g0)()}=a||{};return e=(0,A.GS)(e,n),(0,v.w)(e,{starsBalanceModal:{originPayment:s}},n)})),(0,s.aJ)("closeStarsBalanceModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{starsBalanceModal:void 0},s)})),(0,s.aJ)("openStarsTransactionModal",((e,t,a)=>{const{transaction:s,tabId:n=(0,m.g0)()}=a;return(0,A.V5)(e,s,n)})),(0,s.aJ)("closeStarsTransactionModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{starsTransactionModal:void 0},s)}));var at=a(12859);(0,s.aJ)("openMediaViewer",((e,t,a)=>{const{chatId:s,threadId:n=r.l3,messageId:o,mediaIndex:i,isAvatarView:c,origin:d,withDynamicLoading:l,standaloneMedia:u,tabId:h=(0,m.g0)()}=a,p=(0,b.nTw)(e,h);return(0,v.w)(e,{mediaViewer:{...p.mediaViewer,chatId:s,threadId:n,messageId:o,mediaIndex:i||0,isAvatarView:c,origin:d,standaloneMedia:u,isHidden:!1,withDynamicLoading:l},forwardMessages:{},isShareMessageModalShown:!1},h)})),(0,s.aJ)("closeMediaViewer",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{volume:n,isMuted:o,playbackRate:i,isHidden:r}=(0,b.nTw)(e,s).mediaViewer;return(0,v.w)(e,{mediaViewer:{volume:n,isMuted:o,isHidden:r,playbackRate:i}},s)})),(0,s.aJ)("setMediaViewerVolume",((e,t,a)=>{const{volume:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{mediaViewer:{...(0,b.nTw)(e,n).mediaViewer,volume:s,isMuted:!1}},n)})),(0,s.aJ)("setMediaViewerPlaybackRate",((e,t,a)=>{const{playbackRate:s,tabId:n=(0,m.g0)()}=a;return e={...e,mediaViewer:{...e.mediaViewer,lastPlaybackRate:s}},(0,v.w)(e,{mediaViewer:{...(0,b.nTw)(e,n).mediaViewer,playbackRate:s}},n)})),(0,s.aJ)("setMediaViewerMuted",((e,t,a)=>{const{isMuted:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{mediaViewer:{...(0,b.nTw)(e,n).mediaViewer,isMuted:s}},n)})),(0,s.aJ)("setMediaViewerHidden",((e,t,a)=>{const{isHidden:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{mediaViewer:{...(0,b.nTw)(e,n).mediaViewer,isHidden:s}},n)}));var st=a(70934),nt=a(57751),ot=a(42385),it=a(20714);let rt=!1;(0,y.yu)((()=>{const e=(0,s.mS)();e.isInited&&e.passcode.hasPasscode&&!rt&&1===Object.keys(e.byTabId).length&&(0,nt.rE)()})),(0,s.aJ)("setPasscode",(async(e,t,a)=>{const{passcode:n,tabId:o=(0,m.g0)()}=a;e=(0,A.Vg)(e,{isLoading:!0}),(0,s.UF)(e),await(0,st.IG)(n);const i=JSON.stringify({...(0,nt.CX)(),userId:e.currentUserId});e=(0,s.mS)();const r=(0,ot.Mm)((0,A.Vg)(e,{hasPasscode:!0,error:void 0,isLoading:!1}));try{await(0,st.yp)(i,r),(0,m.ZQ)(),e=(0,s.mS)(),e=(0,A.Vg)(e,{hasPasscode:!0,error:void 0,isLoading:!1}),(0,s.UF)(e),(0,ot.Bo)(!0)}catch(a){(0,st.m)(),e=(0,s.mS)(),e=(0,A.Vg)(e,{isLoading:!1}),(0,s.UF)(e),t.showNotification({message:"Failed to set passcode",tabId:o}),t.requestNextSettingsScreen({screen:c.VS.PasscodeDisabled,tabId:o})}})),(0,s.aJ)("clearPasscode",(e=>((0,st.WN)(),(0,A.XQ)(e)))),(0,s.aJ)("unlockScreen",((e,t,a)=>{const n=Object.values(e.byTabId),{sessionJson:o,globalJson:i}=a,r=JSON.parse(o);(0,nt.AA)(r,r.userId);const c=e;(e=JSON.parse(i)).byTabId=c.byTabId,(0,ot.e)(e,(0,h.mg)(it.HB)),e=(0,A.Vg)(e,{isScreenLocked:!1,error:void 0,invalidAttemptsCount:0}),(0,s.UF)(e),(0,m.ZQ)(),n.forEach((e=>{let{id:a,isMasterTab:s}=e;return t.init({tabId:a,isMasterTab:s})})),t.initApi()})),(0,s.aJ)("logInvalidUnlockAttempt",(e=>{const t=(e.passcode?.invalidAttemptsCount??0)+1;return(0,A.Vg)(e,{invalidAttemptsCount:t,timeoutUntil:t>=5?Date.now()+15e3:void 0})})),(0,s.aJ)("resetInvalidUnlockAttempts",(e=>(0,A.Vg)(e,{invalidAttemptsCount:0,timeoutUntil:void 0}))),(0,s.aJ)("setPasscodeError",((e,t,a)=>{const{error:s}=a;return(0,A.Vg)(e,{error:s})})),(0,s.aJ)("clearPasscodeError",(e=>(0,A.Vg)(e,{error:void 0}))),(0,s.aJ)("skipLockOnUnload",(()=>{rt=!0})),(0,s.aJ)("processOpenChatOrThread",((e,t,a)=>{const{chatId:s,tabId:n=(0,m.g0)()}=a;return s?(0,v.w)(e,{reactionPicker:{chatId:s,messageId:void 0,position:void 0}},n):(0,v.w)(e,{reactionPicker:void 0},n)})),(0,s.aJ)("openMessageReactionPicker",((e,t,a)=>{const{chatId:s,messageId:n,position:o,tabId:i=(0,m.g0)()}=a;return(0,v.w)(e,{reactionPicker:{chatId:s,messageId:n,position:o}},i)})),(0,s.aJ)("openStoryReactionPicker",((e,t,a)=>{const{peerId:s,storyId:n,position:o,sendAsMessage:i,tabId:r=(0,m.g0)()}=a;return(0,v.w)(e,{reactionPicker:{storyPeerId:s,storyId:n,sendAsMessage:i,position:o}},r)})),(0,s.aJ)("openEffectPicker",((e,t,a)=>{const{position:s,chatId:n,tabId:o=(0,m.g0)()}=a;return(0,v.w)(e,{reactionPicker:{position:s,chatId:n,isForEffects:!0}},o)})),(0,s.aJ)("closeReactionPicker",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);return(0,v.w)(e,{reactionPicker:{...n.reactionPicker,messageId:void 0,position:void 0,storyId:void 0,storyPeerId:void 0,isForEffects:void 0}},s)})),(0,s.aJ)("openStoryViewer",(async(e,t,a)=>{const{peerId:n,storyId:o,isSinglePeer:i,isSingleStory:r,isPrivate:c,isArchive:d,origin:l,tabId:u=(0,m.g0)()}=a,p=(0,b.PVB)(e,n);if(!p)return;const g=(0,b.nTw)(e,u),y=(0,b._bp)(e,n);if(o&&(!y||!y.byId[o])){const t=await(0,f.px)("fetchPeerStoriesByIds",{peer:p,ids:[o]});if(!t)return;e=(0,s.mS)(),e=(0,A.g1)(e,(0,h.dU)(t.users,"id")),e=(0,A.Nl)(e,(0,h.dU)(t.chats,"id")),e=(0,A.K4)(e,n,t.stories)}const I=g.storyViewer.storyList||(0,b.R3Q)(e,n,o,r,i,c,d);e=(0,v.w)(e,{storyViewer:{...g.storyViewer,peerId:n,storyId:o||(0,b._$$)(e,n)||(0,b.dNJ)(e,n),isSinglePeer:i,isPrivate:c,isArchive:d,isSingleStory:r,viewModal:void 0,origin:l,storyList:I}},u),(0,s.UF)(e)})),(0,s.aJ)("openStoryViewerByUsername",(async(e,t,a)=>{const{username:s,storyId:n,origin:o,tabId:r=(0,m.g0)()}=a,c=await(0,i.A$)(e,s);c&&t.openStoryViewer({peerId:c.id,storyId:n,isSinglePeer:!0,isSingleStory:!0,origin:o,tabId:r})})),(0,s.aJ)("closeStoryViewer",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},{isMuted:n,isRibbonShown:o,isArchivedRibbonShown:i,storyId:r}=(0,b.nTw)(e,s).storyViewer;return r?e=(0,v.w)(e,{storyViewer:{isMuted:n,isRibbonShown:o,isArchivedRibbonShown:i,lastViewedByPeerIds:void 0,storyList:void 0}},s):e})),(0,s.aJ)("setStoryViewerMuted",((e,t,a)=>{const{isMuted:s,tabId:n=(0,m.g0)()}=a;return(0,v.w)(e,{storyViewer:{...(0,b.nTw)(e,n).storyViewer,isMuted:s}},n)})),(0,s.aJ)("toggleStoryRibbon",((e,t,a)=>{const{isShown:s,isArchived:n,tabId:o=(0,m.g0)()}=a,i=e.stories.orderedPeerIds[n?"archived":"active"];return i?.length?(0,v.w)(e,{storyViewer:{...(0,b.nTw)(e,o).storyViewer,[n?"isArchivedRibbonShown":"isRibbonShown"]:s}},o):e})),(0,s.aJ)("openPreviousStory",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s),{peerId:o,storyId:i,isSinglePeer:r,isSingleStory:c,storyList:d}=n.storyViewer;if(c||!d)return void t.closeStoryViewer({tabId:s});if(!o||!i)return;const l=(0,b.PVB)(e,o);if(!(0,b._bp)(e,o)||!l)return;const{peerIds:u,storyIdsByPeerId:h}=d,p=(h[o]??[]).indexOf(i);let g,y;if(p>0)g=p-1,y=o;else{const e=u.indexOf(o)-1;if(r||e<0)return;y=u[e],g=(h?.[y]?.length||1)-1}const f=h?.[y]?.[g];return f?(0,v.w)(e,{storyViewer:{...n.storyViewer,peerId:y,storyId:f}},s):void 0})),(0,s.aJ)("openNextStory",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s),{peerId:o,storyId:i,isSinglePeer:r,isSingleStory:c,storyList:d}=n.storyViewer;if(c||!d)return void t.closeStoryViewer({tabId:s});if(!o||!i)return;const l=(0,b.PVB)(e,o);if(!(0,b._bp)(e,o)||!l)return;const{peerIds:u,storyIdsByPeerId:h}=d,p=h[o]??[],g=p.indexOf(i);let y,f;if(g<p.length-1)y=g+1,f=o;else{const e=u.indexOf(o)+1;if(r||e>u.length-1)return void t.closeStoryViewer({tabId:s});f=u[e],y=0}const I=h?.[f]?.[y];return I?(0,v.w)(e,{storyViewer:{...n.storyViewer,peerId:f,storyId:I}},s):void 0})),(0,s.aJ)("openStoryViewModal",((e,t,a)=>{const{storyId:s,tabId:n=(0,m.g0)()}=a,o=(0,b.nTw)(e,n);return(0,v.w)(e,{storyViewer:{...o.storyViewer,viewModal:{storyId:s,nextOffset:"",isLoading:!0}}},n)})),(0,s.aJ)("closeStoryViewModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);return(0,v.w)(e,{storyViewer:(0,h.cJ)(n.storyViewer,["viewModal"])},s)})),(0,s.aJ)("copyStoryLink",(async(e,t,a)=>{const{peerId:s,storyId:n,tabId:o=(0,m.g0)()}=a,i=(0,b.PVB)(e,s);if(!i)return;const r=await(0,f.px)("fetchStoryLink",{peer:i,storyId:n});r&&((0,d.eM)(r),t.showNotification({message:g.yE("LinkCopied"),tabId:o}))})),(0,s.aJ)("sendMessage",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a,{storyId:n,peerId:o}=(0,b.V9I)(e,s);if(!Boolean(n&&o))return;const{gif:i,sticker:r,isReaction:c}=a;let d;d=i?"Story.Tooltip.GifSent":r?"Story.Tooltip.StickerSent":c?"Story.Tooltip.ReactionSent":"Story.Tooltip.MessageSent",t.showNotification({message:g.yE(d),actionText:g.yE("Story.ToastViewInChat"),action:[{action:"closeStoryViewer",payload:void 0},{action:"openChat",payload:{id:o}}],tabId:s})})),(0,s.aJ)("openStoryPrivacyEditor",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);return(0,v.w)(e,{storyViewer:{...n.storyViewer,isPrivacyModalOpen:!0}},s)})),(0,s.aJ)("closeStoryPrivacyEditor",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{},n=(0,b.nTw)(e,s);return(0,v.w)(e,{storyViewer:{...n.storyViewer,isPrivacyModalOpen:!1}},s)})),(0,s.aJ)("toggleStealthModal",((e,t,a)=>{const{isOpen:s,tabId:n=(0,m.g0)()}=a||{},o=(0,b.nTw)(e,n);return(0,v.w)(e,{storyViewer:{...o.storyViewer,isStealthModalOpen:s}},n)})),(0,s.aJ)("clearStoryViews",((e,t,a)=>{const{isLoading:s,tabId:n=(0,m.g0)()}=a||{},o=(0,b.nTw)(e,n);return o.storyViewer.viewModal?(0,v.w)(e,{storyViewer:{...o.storyViewer,viewModal:{...o.storyViewer.viewModal,views:void 0,isLoading:s,nextOffset:""}}},n):e})),(0,s.aJ)("updateStoryView",((e,t,a)=>{const{userId:s,isUserBlocked:n,areStoriesBlocked:o,tabId:i=(0,m.g0)()}=a,r=(0,b.nTw)(e,i),{viewModal:c}=r.storyViewer;if(!c?.storyId)return;const d=c?.views?.map((e=>e.peerId===s?{...e,isUserBlocked:n||void 0,areStoriesBlocked:o||void 0}:e));return(0,v.w)(e,{storyViewer:{...r.storyViewer,viewModal:{...c,views:d}}},i)})),(0,s.aJ)("closeBoostModal",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{boostModal:void 0},s)})),(0,s.aJ)("closeBoostStatistics",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{boostStatistics:void 0},s)})),(0,s.aJ)("closeMonetizationStatistics",((e,t,a)=>{const{tabId:s=(0,m.g0)()}=a||{};return(0,v.w)(e,{monetizationStatistics:void 0},s)})),a(4990),(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"updateChat":{const{isForum:n,lastReadOutboxMessageId:o}=(0,b.hds)(e,a.id)||{};a.chat.lastReadOutboxMessageId&&o&&a.chat.lastReadOutboxMessageId<o&&(a={...a,chat:(0,h.cJ)(a.chat,["lastReadInboxMessageId"])});const i=(0,b.hds)(e,a.id);return e=(0,A.wi)(e,a.id,a.chat),i?.areStoriesHidden!==a.chat.areStoriesHidden&&(e=(0,A.VW)(e,a.id,a.chat.areStoriesHidden||!1)),(0,s.UF)(e),a.noTopChatsRequest||(0,b.mJZ)(e,a.id)||t.loadTopChats(),a.chat.id&&(0,S.Kz)({chatId:a.chat.id,lastReadInboxMessageId:a.chat.lastReadInboxMessageId}),void Object.values(e.byTabId).forEach((s=>{let{id:o}=s;const{chatId:i}=(0,b.Xf0)(e,o)||{},r=a;i===r.id&&"isForum"in r.chat&&n!==r.chat.isForum&&(n&&t.closeForumPanel({tabId:o}),t.openChat({id:i,tabId:o}))}))}case"updateChatJoin":{const n=(0,b.P4G)(e,a.id),o=(0,b.hds)(e,a.id);if(e=(0,A.wi)(e,a.id,{isNotJoined:!1}),(0,s.UF)(e),o&&t.requestChatUpdate({chatId:o.id}),t.loadFullChat({chatId:a.id,force:!0}),!n)return;return e=(0,s.mS)(),e=(0,A.wx)(e,n,[a.id]),void(0,s.UF)(e)}case"updateChatLeave":{e=(0,A.CX)(e,a.id);const t=(0,b.hds)(e,a.id);if(t&&(0,I.WX)(t)){const s=(0,b.zeq)(e,a.id),n=Object.keys(s).map(Number).filter(p.iL);e=(0,A.AH)(e,t.id,n)}return e}case"updateChatInbox":return(0,A.wi)(e,a.id,a.chat);case"updateChatTypingStatus":{const{id:t,threadId:n=r.l3,typingStatus:o}=a;return e=(0,A.ew)(e,t,n,"typingStatus",o),(0,s.UF)(e),void setTimeout((()=>{e=(0,s.mS)();const a=(0,b.C5H)(e,t,n,"typingStatus");o&&a&&o.timestamp===a.timestamp&&(e=(0,A.ew)(e,t,n,"typingStatus",void 0),(0,s.UF)(e))}),6e3)}case"newMessage":{const{message:t}=a;if(t.senderId===e.currentUserId&&!t.isFromScheduled)return;const n=(0,b.hds)(e,a.chatId);if(!n)return;const o=Boolean(a.message.id&&a.message.hasUnreadMention);e=(0,A.wi)(e,a.chatId,{unreadCount:n.unreadCount?n.unreadCount+1:1}),o&&(e=(0,A.We)(e,a.chatId,n,[a.message.id],!0));const i=n.isForum?(0,b.nkm)(e,t):void 0;return i&&(e=(0,A.Tw)(e,a.chatId,i.id,{unreadCount:i.unreadCount?i.unreadCount+1:1})),(0,s.UF)(e),void(0,S.Oq)({chat:n,message:t})}case"updateCommonBoxMessages":case"updateChannelMessages":{const{ids:t,messageUpdate:s}=a;return t.forEach((t=>{const n="channelId"in a?a.channelId:(0,b.Egn)(e,t),o=(0,b.hds)(e,n);s.reactions&&o?.unreadReactionsCount&&!(0,I.pU)(e,s.reactions)&&(e=J(e,n,{unreadReactionsCount:Math.max(o.unreadReactionsCount-1,0)||void 0,unreadReactions:o.unreadReactions?.filter((e=>e!==t))})),!s.hasUnreadMention&&o?.unreadMentionsCount&&(e=(0,A.pW)(e,n,o,[t],!0))})),e}case"updateChatFullInfo":return(0,A.lt)(e,a.id,a.fullInfo);case"updatePinnedChatIds":{const{ids:t,folderId:s}=a,o=s===n._E9?"archived":"active";return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,[o]:t.length?t:void 0}}}}case"updatePinnedSavedDialogIds":{const{ids:t}=a;return{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,saved:t.length?t:void 0}}}}case"updateChatPinned":{const{id:t,isPinned:s}=a,o=(0,b.P4G)(e,t);if(!o)return;const{[o]:i}=e.chats.orderedPinnedIds;let r=i||[];if(s){if(!r.includes(t)){if("active"===o&&r.length>=n.FZw){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,[o]:r.length?r:void 0}}}}case"updateSavedDialogPinned":{const{id:t,isPinned:s}=a,{saved:n}=e.chats.orderedPinnedIds;let o=n||[];return s?o.includes(t)||(o=[t,...o]):o=o.filter((e=>e!==t)),{...e,chats:{...e.chats,orderedPinnedIds:{...e.chats.orderedPinnedIds,saved:o.length?o:void 0}}}}case"updateChatListType":{const{id:t,folderId:s}=a;return(0,A.Kr)(e,t,s)}case"updateChatFolder":{const{id:t,folder:s}=a,{byId:n,orderedIds:o}=e.chatFolders,i=void 0===s;Object.values(e.byTabId).forEach((a=>{let{id:s}=a;const o=(0,b.nTw)(e,s);Object.values(n)[o.activeChatFolder-1]?.id===t&&(e=(0,v.w)(e,{activeChatFolder:0},s))}));const r=i?(0,h.cJ)(n,[t]):{...n,[t]:s},c=i?o?.filter((e=>e!==t)):o?.includes(t)?o:[...o||[],t];return{...e,chatFolders:{...e.chatFolders,byId:r,orderedIds:c,invites:(0,h.cJ)(e.chatFolders.invites,[t])}}}case"updateChatFoldersOrder":{const{orderedIds:t}=a;return{...e,chatFolders:{...e.chatFolders,orderedIds:t}}}case"updateRecommendedChatFolders":{const{folders:t}=a;return{...e,chatFolders:{...e.chatFolders,recommended:t}}}case"updateChatMembers":{const t=(0,b.AWZ)(e,a.id),{replacedMembers:s,addedMember:n,deletedMemberId:o}=a;if(!t)return;let i=!1,r=t?.members?[...t.members]:[];if(s)r=s,i=!0;else if(n)r.length&&r.some((e=>e.userId===n.userId))||(r.push(n),i=!0);else if(r.length&&o){const e=r.findIndex((e=>e.userId===o));e>-1&&(r.slice(e,1),i=!0)}if(i){const t=r.filter((e=>{let{isOwner:t,isAdmin:a}=e;return t||a}));return e=(0,A.wi)(e,a.id,{membersCount:r.length}),e=(0,A.lt)(e,a.id,{members:r,adminMembersById:(0,h.dU)(t,"userId")})}return}case"draftMessage":{const{chatId:t,threadId:s,draft:n}=a;if(!e.chats.byId[t])return;return e=(0,A.ew)(e,t,s||r.l3,"draft",n),e=(0,A.wi)(e,t,{draftDate:n?.date})}case"showInvite":{const{data:s}=a;return void Object.values(e.byTabId).forEach((e=>{let{id:a}=e;t.showDialog({data:s,tabId:a})}))}case"updatePendingJoinRequests":{const{chatId:n,requestsPending:o,recentRequesterIds:i}=a;if(!e.chats.byId[n])return;return e=(0,A.lt)(e,n,{requestsPending:o,recentRequesterIds:i}),(0,s.UF)(e),void t.loadChatJoinRequests({chatId:n})}case"updatePinnedTopic":{const{chatId:t,topicId:n,isPinned:o}=a;if(!e.chats.byId[t])return;return e=(0,A.Tw)(e,t,n,{isPinned:o}),void(0,s.UF)(e)}case"updatePinnedTopicsOrder":{const{chatId:t,order:n}=a;if(!e.chats.byId[t])return;return e=(0,A.wi)(e,t,{orderedPinnedTopicIds:n}),void(0,s.UF)(e)}case"updateTopic":{const{chatId:s,topicId:n}=a,o=(0,b.hds)(e,s);if(!o?.isForum)return;return void t.loadTopicById({chatId:s,topicId:n})}case"updateTopics":{const{chatId:s}=a,n=(0,b.hds)(e,s);if(!n?.isForum)return;return void t.loadTopics({chatId:s,force:!0})}case"updateViewForumAsMessages":{const{chatId:t,isEnabled:n}=a,o=(0,b.hds)(e,t);if(!o?.isForum)return;e=(0,A.wi)(e,t,{isForumAsMessages:n}),(0,s.UF)(e);break}case"updateNewProfilePhoto":{const{peerId:n,photo:o}=a;e=(0,A.wi)(e,n,{avatarPhotoId:o.id}),(0,s.UF)(e),t.loadMoreProfilePhotos({peerId:n,shouldInvalidateCache:!0});break}case"updateDeleteProfilePhoto":{const{peerId:n,photoId:o}=a,i=(0,b.PVB)(e,n);if(!i)return;e=o&&i.avatarPhotoId!==o?(0,A.so)(e,n,o):(0,A.wi)(e,n,{avatarPhotoId:void 0,profilePhotos:void 0}),(0,s.UF)(e),t.loadMoreProfilePhotos({peerId:n,shouldInvalidateCache:!0});break}}}));const ct=(0,y.nF)((function(){let e=(0,s.mS)();e=(0,A.wW)(e,{...e.users.statusesById,...dt}),(0,s.UF)(e),dt={}}),3e3,!0);let dt={};(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"deleteContact":return(0,A.MO)(e,a.id);case"updateUser":{Object.values(e.byTabId).forEach((s=>{let{id:n}=s;(0,b.nZ4)(e,a.id)&&a.user.isPremium!==(0,b.g29)(e)&&(a.user.isPremium&&e.byTabId[n].premiumModal&&t.openPremiumModal({isSuccess:!0,tabId:n}),e={...e,translations:{byChatId:{}}})}));const s=(0,b.mBe)(e,a.id);return e=(0,A.TK)(e,a.id,a.user),a.fullInfo&&(e=(0,A.we)(e,a.id,a.fullInfo)),s?.areStoriesHidden!==a.user.areStoriesHidden&&(e=(0,A.VW)(e,a.id,a.user.areStoriesHidden||!1)),e}case"updateRequestUserUpdate":t.loadFullUser({userId:a.id});break;case"updateUserEmojiStatus":return(0,A.TK)(e,a.userId,{emojiStatus:a.emojiStatus});case"updateUserStatus":return s=a.userId,n=a.status,dt[s]=n,void ct();case"updateUserFullInfo":{const{id:t,fullInfo:s}=a;return(0,A.we)(e,t,s)}case"updateBotMenuButton":{const{botId:t,button:s}=a,n=(0,b.vGo)(e,t);if(!n?.botInfo)return;return(0,A.we)(e,t,{botInfo:{...n.botInfo,menuButton:s}})}}var s,n})),(0,s.aJ)("apiUpdate",((e,t,a)=>{if("updateStickerSet"===a["@type"])return(0,A.v9)(e,a.id,a.stickerSet)})),(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"updatePeerBlocked":return a.isBlocked?(0,A.P6)(e,a.id):a.isBlockedFromStories?e:(0,A.OW)(e,a.id);case"updateResetContactList":e={...e,contactList:{userIds:[]}},(0,s.UF)(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 s=a.isCustomEmoji?e.customEmojis.added.setIds:e.stickers.added.setIds;if(!s)return e;const n=[a.id,...s.filter((e=>e!==a.id))];t.reorderStickerSets({order:n,isCustomEmoji:a.isCustomEmoji});break}case"updateStickerSets":t.loadStickerSets();break;case"updateStickerSetsOrder":{const s=a.order.filter((t=>Boolean(e.stickers.setsById[t])));t.reorderStickerSets({order:s,isCustomEmoji:a.isCustomEmoji});break}case"updateSavedGifs":t.loadSavedGifs();break;case"updatePrivacy":e={...e,settings:{...e.settings,privacy:{...e.settings.privacy,[a.key]:a.rules}}},(0,s.UF)(e);break;case"updatePaymentVerificationNeeded":Object.values(e.byTabId).forEach((t=>{let{id:s}=t;e=(0,A._t)(e,a.url,s),e=(0,A.ET)(e,c.tn.ConfirmPayment,s)})),(0,s.UF)(e);break;case"updateWebViewResultSent":Object.values(e.byTabId).forEach((e=>{e.webApp?.queryId===a.queryId&&(t.resetDraftReplyInfo({tabId:e.id}),t.closeWebApp({tabId:e.id}))}));break;case"updateStory":e=(0,A.K4)(e,a.peerId,{[a.story.id]:a.story}),e=(0,A.Gz)(e,{[a.peerId]:(0,b._bp)(e,a.peerId)}),(0,s.UF)(e);break;case"deleteStory":e=(0,A.ON)(e,a.peerId,a.storyId),(0,s.UF)(e);break;case"updateReadStories":e=(0,A.Ah)(e,a.peerId,a.lastReadId),(0,s.UF)(e);break;case"updateSentStoryReaction":{const{peerId:t,storyId:n,reaction:o}=a;if(!(0,b.Msb)(e,t,n))return e;e=(0,A.Xz)(e,t,n,{sentReaction:o}),(0,s.UF)(e);break}case"updateStealthMode":e=(0,A.qs)(e,a.stealthMode),(0,s.UF)(e);break;case"updateAttachMenuBots":t.loadAttachBots();break;case"updatePremiumFloodWait":t.processPremiumFloodWait({isUpload:a.isUpload})}})),(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"updateNotifySettings":return(0,A.i0)(e,a.peerType,a.isSilent,a.shouldShowPreviews);case"updateNotifyExceptions":{const{chatId:t,isMuted:n,isSilent:o,shouldShowPreviews:i}=a;e.chats.byId[t]&&(e=(0,A.wi)(e,t,{isMuted:n})),e=(0,A.m1)(e,t,{isMuted:n,isSilent:o,shouldShowPreviews:i}),(0,s.UF)(e);break}case"updateTopicNotifyExceptions":{const{chatId:t,topicId:n,isMuted:o}=a;e=(0,A.Tw)(e,t,n,{isMuted:o}),(0,s.UF)(e);break}}})),(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"updateTwoFaStateWaitCode":return{...e,twoFaSettings:{...e.twoFaSettings,isLoading:!1,waitingEmailCodeLength:a.length}};case"updateTwoFaError":return{...e,twoFaSettings:{...e.twoFaSettings,error:a.message}}}}));var lt=a(80840),ut=a(71331);(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"updateGroupCall":{if("discarded"===a.call.connectionState)return e.groupCalls.activeGroupCallId?void("leaveGroupCall"in t&&t.leaveGroupCall({shouldRemove:!0,tabId:(0,m.g0)()})):(0,lt.um)(e,a.call.id);const s=(0,ut.Ip)(e,a.call.id),n=s?.chatId;return n&&(e=(0,A.wi)(e,n,{isCallNotEmpty:s.participantsCount>0||Boolean(s.participants?.length)})),(0,lt.h9)(e,a.call.id,(0,h.cJ)(a.call,["connectionState"]),void 0,a.call.participantsCount)}case"updateGroupCallChatId":return(0,b.hds)(e,a.chatId)&&(e=(0,A.lt)(e,a.chatId,{groupCallId:a.call.id})),e;case"updateGroupCallParticipants":{const{groupCallId:t,participants:n,nextOffset:o}=a,{currentUserId:i}=e;e=(0,s.mS)(),n.forEach((a=>{a.id&&(e=(0,lt.c5)(e,t,a.id,a,Boolean(o)||i===a.id))})),o&&(e=(0,lt.h9)(e,t,{nextOffset:o}));const r=(0,ut.Ip)(e,t),c=r?.chatId;return c&&(e=(0,A.wi)(e,c,{isCallNotEmpty:r.participantsCount>0||Boolean(r.participants?.length)})),e}case"updatePhoneCall":{if(!o.OL)return;const{phoneCall:n,currentUserId:i}=e,{call:r}=a;if(n)return"discarded"===r.state?(t.playGroupCallSound({sound:"end"}),"hangUp"in t&&t.hangUp({tabId:(0,m.g0)()}),{...e,...r.needRating&&{ratingPhoneCall:r}}):void 0;if(r?.adminId!==i&&"requested"===r.state)return(0,y.aj)((()=>{e=(0,s.mS)(),(0,S.DJ)({call:r,user:(0,ut.uu)(e)})})),(0,at.JD)(),(0,at.re)(e,t,r.isVideo,(0,m.g0)()),e={...e,phoneCall:r},(0,v.w)(e,{isCallPanelVisible:!1},(0,m.g0)())}}}));var mt=a(17142);(0,s.aJ)("apiUpdate",((e,t,a)=>{switch(a["@type"]){case"updatePaymentStateCompleted":Object.values(e.byTabId).forEach((n=>{let{id:o}=n;const{inputInvoice:i,invoice:r}=(0,b.nTw)(e,o).payment;if((0,w.T)(i,a.inputInvoice)){if(r){const{amount:e,currency:a,title:s}=r;t.showNotification({tabId:o,message:g.yE("PaymentInfoHint",[(0,mt.A)(e,a,g.Yw().code),s])})}if("giftcode"===i?.type){if(!i.userIds)return;const t=(0,b.nTw)(e,o).giftModal;t&&t.isOpen&&(0,w.T)(i.userIds,t.forUserIds)&&(e=(0,v.w)(e,{giftModal:{...t,isCompleted:!0}},o),e=(0,A.cY)(e,o))}if("starsgift"===i?.type){if(!i.userId)return;const t=(0,b.nTw)(e,o).starsGiftModal;t&&t.isOpen&&(0,w.T)(i.userId,t.forUserId)&&(e=(0,v.w)(e,{starsGiftModal:{...t,isCompleted:!0}},o),e=(0,A.cY)(e,o))}if("stars"===i?.type){if(!i.stars)return;const t=(0,b.nTw)(e,o).starsGiftModal;t&&t.isOpen&&(e=(0,v.w)(e,{starsGiftModal:{...t,isCompleted:!0}},o),e=(0,A.cY)(e,o))}(0,s.UF)(e)}}));break;case"updateStarsBalance":if(!e.stars)return;e=(0,A.L_)(e,a.balance),(0,s.UF)(e),t.loadStarStatus()}}));var ht=a(84051),pt=a(51401),gt=a(31791),yt=a(66644),ft=a(87357),It=a(25903),At=a(55148),vt=a(80089),bt=a(32625),wt=a(14737),St=a(30857),Ct=a(32706),Et=a(17712);const Mt=document.querySelector('meta[name="viewport"]'),kt=Mt?.getAttribute("content")||"";function Pt(e){e.preventDefault()}var Tt=a(34201),xt=a(35297),Nt=a(61157),Bt=a(60138),Ut=a(90423),Ft=a(80464);const Rt=e=>{const{isActive:t}=e,a=(0,Ft.A)(vt.ar.Calls,"ActiveCallHeader",!t);return a?ht.Ay.createElement(a,null):void 0},Lt=e=>{const{groupCallId:t}=e,a=(0,Ft.A)(vt.ar.Calls,"GroupCall",!t);return a?ht.Ay.createElement(a,e):void 0},Jt=e=>{const{isActive:t}=e,a=(0,Ft.A)(vt.ar.Calls,"PhoneCall",!t);return a?ht.Ay.createElement(a,null):void 0},Ot=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Calls,"RatePhoneCallModal",!t);return a?ht.Ay.createElement(a,e):void 0},Dt=e=>{const{customEmojiSetIds:t}=e,a=(0,Ft.A)(vt.ar.Extra,"CustomEmojiSetsModal",!t);return a?ht.Ay.createElement(a,e):void 0},Vt=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"DeleteMessageModal",!t);return a?ht.Ay.createElement(a,e):void 0},Gt=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StickerSetModal",!t);return a?ht.Ay.createElement(a,e):void 0};var jt=a(26120),qt=a(14242),zt=a(74984);const Ht=(0,ht.ph)((e=>{let{isForAppBadge:t}=e;(0,zt.ic)();const a=(0,ye.vp)();if((0,ht.vJ)((()=>{t&&(0,jt.q)(a)}),[t,a]),!t&&a)return ht.Ay.createElement("div",{className:"unread-count active"},(0,qt.Vw)(a))}));var _t=a(11778),Wt=a(55994),Kt=a(31880),$t=a(2178),Xt=a(41257),Qt=a(41036),Zt=a(52745);const Yt=e=>{const t=(0,Ft.A)(vt.ar.Extra,"ArchivedChats");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)};var ea=a(11462),ta=a(59030),aa=a(64493),sa=a(9168),na=a(24433);const oa=e=>{let{isShown:t,onNewPrivateChat:a,onNewChannel:s,onNewGroup:n}=e;const[o,i]=(0,ht.J0)(!1);(0,ht.vJ)((()=>{t||i(!1)}),[t]);const r=(0,ta.A)(),c=(0,ft.A)("NewChatButton",t&&"revealed",o&&"menu-is-open"),d=(0,ht.hb)((()=>{i(!o)}),[o]),l=(0,ht.hb)((()=>{i(!1)}),[]),u=(0,ht.Kr)((()=>ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement(na.A,{icon:"channel",onClick:s},r("NewChannel")),ht.Ay.createElement(na.A,{icon:"group",onClick:n},r("NewGroup")),ht.Ay.createElement(na.A,{icon:"user",onClick:a},r("NewMessageTitle")))),[r,s,n,a]);return ht.Ay.createElement("div",{className:c,dir:r.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{round:!0,color:"primary",className:o?"active":"",onClick:d,ariaLabel:r(o?"Close":"NewMessageTitle"),tabIndex:-1},ht.Ay.createElement("i",{className:"icon icon-new-chat-filled"}),ht.Ay.createElement("i",{className:"icon icon-close"})),ht.Ay.createElement(sa.A,{isOpen:o,positionX:r.isRtl?"left":"right",positionY:"bottom",autoClose:!0,onClose:l},u))},ia=e=>{const t=(0,Ft.A)(vt.ar.Extra,"LeftSearch");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)};var ra=a(50442),ca=a(79824),da=a(26072),la=a(75343),ua=a(24680),ma=a(62830);const ha=(0,ht.ph)((0,s.EK)((e=>{const{chatFolders:{byId:t,orderedIds:a,invites:s},chats:{listIds:{archived:n}},stories:{orderedPeerIds:{archived:o}},activeSessions:{byHash:i},currentUserId:r,archiveSettings:c}=e,{shouldSkipHistoryAnimations:d,activeChatFolder:l}=(0,b.nTw)(e),{storyViewer:{isRibbonShown:u}}=(0,b.nTw)(e);return{chatFoldersById:t,folderInvitesById:s,orderedFolderIds:a,activeChatFolder:l,currentUserId:r,shouldSkipHistoryAnimations:d,hasArchivedChats:Boolean(n?.length),hasArchivedStories:Boolean(o?.length),maxFolders:(0,ne.d)(e,"dialogFilters"),maxFolderInvites:(0,ne.d)(e,"chatlistInvites"),maxChatLists:(0,ne.d)(e,"chatlistJoined"),archiveSettings:c,isStoryRibbonShown:u,sessions:i}}))((e=>{let{foldersDispatch:t,onSettingsScreenSelect:a,onLeftColumnContentChange:i,chatFoldersById:r,orderedFolderIds:c,activeChatFolder:d,currentUserId:l,isForumPanelOpen:u,shouldSkipHistoryAnimations:m,maxFolders:h,maxChatLists:p,shouldHideFolderTabs:g,folderInvitesById:y,maxFolderInvites:f,hasArchivedChats:I,hasArchivedStories:A,archiveSettings:v,isStoryRibbonShown:w,sessions:S}=e;const{loadChatFolders:C,setActiveChatFolder:E,openChat:M,openShareChatFolderModal:k,openDeleteChatFolderModal:P,openEditChatFolder:T,openLimitReachedModal:x}=(0,s.ko)(),N=(0,ht.li)(null),B=(0,ta.A)();(0,ht.vJ)((()=>{C()}),[]);const{shouldRender:U,transitionClassNames:F,isClosing:R}=(0,Tt.A)(w,void 0,void 0,""),L=(0,ht.Kr)((()=>({id:n.DSF,title:c?.[0]===n.DSF?B("FilterAllChatsShort"):B("FilterAllChats"),includedChatIds:ca.p,excludedChatIds:ca.p})),[c,B]),J=(0,ht.Kr)((()=>c?c.map((e=>e===n.DSF?L:r[e]||{})).filter(Boolean):void 0),[r,L,c]),O=J?.findIndex((e=>e.id===n.DSF)),D=O===d,V=0===d,G=(0,zt.ic)(),j=(0,ht.Kr)((()=>{if(J&&J.length)return J.map(((e,t)=>{const{id:a,title:o}=e,i=a!==n.DSF&&t>h-1,c=[];return(0,b.w5O)((0,s.mS)(),a)&&c.push({title:B("ChatList.ContextMenuShare"),icon:"link",handler:()=>{Object.values(r).reduce(((e,t)=>e+(t.isChatList?1:0)),0)>=p&&!e.isChatList?x({limit:"chatlistJoined"}):y[a]?.length>=f?x({limit:"chatlistInvites"}):k({folderId:a})}}),a!==n.DSF&&(c.push({title:B("FilterEdit"),icon:"edit",handler:()=>{T({folderId:a})}}),c.push({title:B("FilterDeleteItem"),icon:"delete",destructive:!0,handler:()=>{P({folderId:a})}})),{id:a,title:o,badgeCount:G[a]?.chatsCount,isBadgeActive:Boolean(G[a]?.notificationsCount),isBlocked:i,contextActions:c?.length?c:void 0}}))}),[J,h,G,B,r,p,y,f]),q=(0,Et.A)((e=>{E({activeChatFolder:e},{forceOnHeavyAnimation:!0})}));(0,ht.vJ)((()=>{j?.length&&d>=j.length&&E({activeChatFolder:0})}),[d,j,E]),(0,ht.vJ)((()=>{if(o.TF&&j?.length&&!u)return(0,ra.wJ)(N.current,{selectorToPreventScroll:".chat-list",onSwipe:(e,t)=>t===ra.ez.Left?(E({activeChatFolder:Math.min(d+1,j.length-1)},{forceOnHeavyAnimation:!0}),!0):t===ra.ez.Right&&(E({activeChatFolder:Math.max(0,d-1)},{forceOnHeavyAnimation:!0}),!0)})}),[d,j,u,E]);const z=(0,ht.li)();z.current=!V,(0,ht.vJ)((()=>z.current?(0,_t.A)((()=>{z.current&&E({activeChatFolder:0})})):void 0),[d,E]),(0,da.A)({isActive:!V,onBack:()=>E({activeChatFolder:0},{forceOnHeavyAnimation:!0})}),(0,ht.vJ)((()=>{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 M({id:l,shouldReplaceHistory:!0});const a=Number(t)-1;if(a>j.length-1)return;E({activeChatFolder:a},{forceOnHeavyAnimation:!0}),e.preventDefault()}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}}),[l,j,M,E]);const{shouldRender:H,transitionClassNames:_}=(0,Tt.A)(!c,void 0,!0);function W(e){const s=Object.values(r).find((e=>{let{id:t}=e;return t===j[d].id})),n=s&&!D;return ht.Ay.createElement(ma.A,{folderType:n?"folder":"all",folderId:n?s.id:void 0,isActive:e,isForumPanelOpen:u,foldersDispatch:t,onSettingsScreenSelect:a,onLeftColumnContentChange:i,canDisplayArchive:(I||A)&&!v.isHidden,archiveSettings:v,sessions:S})}const K=j&&j.length>1;return ht.Ay.createElement("div",{className:(0,ft.A)("ChatFolders",K&&g&&"ChatFolders--tabs-hidden",U&&"with-story-ribbon",F)},U&&ht.Ay.createElement(la.A,{isClosing:R}),K?ht.Ay.createElement(ua.A,{contextRootElementSelector:"#LeftColumn",tabs:j,activeTab:d,onSwitchTab:q,areFolders:!0}):H?ht.Ay.createElement("div",{className:(0,ft.A)("tabs-placeholder",_)}):void 0,ht.Ay.createElement(Qt.Ay,{ref:N,name:m?"none":B.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:d,renderCount:K?j.length:void 0},W))}))),pa=e=>{const t=(0,Ft.A)(vt.ar.Extra,"ContactList");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)};var ga=a(90054);let ya=function(e){return e[e.waitingForNetwork=0]="waitingForNetwork",e[e.syncing=1]="syncing",e[e.online=2]="online",e}({});function fa(e,t,a,s,n,o){let i,r,c;return i=function(){const[e,t]=(0,ht.J0)(window.navigator.onLine);return(0,ht.vJ)((()=>{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?a?ya.syncing:ya.online:ya.waitingForNetwork,r=i===ya.online||o?"none":s?"middleHeader":n?"minimized":"overlay",i===ya.waitingForNetwork?c=e("WaitingForNetwork"):i===ya.syncing&&(c=e("Updating")),"middleHeader"===r&&(c=c.toLowerCase().replace(/\.+$/,"")),{connectionStatus:i,connectionStatusPosition:r,connectionStatusText:c}}var Ia=a(77523),Aa=a(37661),va=a(39351),ba=a(24920),wa=a(71690),Sa=a(40175),Ca=a(22699),Ea=a(36393),Ma=a(26607),ka=a(57474);const Pa=(0,ht.ph)((e=>{let{connectionStatus:t,connectionStatusText:a,onClick:s}=e;const n=(0,ta.A)();return ht.Ay.createElement("div",{id:"ConnectionStatusOverlay",dir:n.isRtl?"rtl":void 0,onClick:s},ht.Ay.createElement(ka.A,{color:"black"}),ht.Ay.createElement("div",{className:"state-text"},ht.Ay.createElement(Qt.Ay,{activeKey:t,name:"slideFade"},a)),ht.Ay.createElement(aa.A,{round:!0,size:"tiny",color:"translucent-black"},ht.Ay.createElement("span",{className:"icon icon-close"})))}));var Ta=a(4029),xa=a(19800),Na=a(54639),Ba=a(63152),Ua=a(629);const Fa=(0,ht.ph)((0,s.EK)((e=>{const t=(0,b.nTw)(e),{currentUserId:a,archiveSettings:s}=e,{animationLevel:n}=e.settings.byKey,o=e.attachMenu.bots;return{currentUserId:a,theme:(0,b.SJA)(e),animationLevel:n,canInstall:Boolean(t.canInstall),archiveSettings:s,attachBots:o}}))((e=>{let{currentUserId:t,archiveSettings:a,animationLevel:i,theme:r,canInstall:c,attachBots:d,onSelectArchived:l,onSelectContacts:u,onSelectSettings:m,onBotMenuOpened:h,onBotMenuClosed:p}=e;const{openChat:g,setSettingOption:y,updatePerformanceSettings:f,openChatByUsername:I,openUrl:A,openChatWithInfo:v}=(0,s.ko)(),b=(0,ta.A)(),w=(0,va.A)(),S=i!==n.dnp?i===n.zP3?"max":"mid":"min",C=!o.cp&&(window.location.hostname===n.mFn||n.W75),E=(0,zt.ic)()[n._E9]?.chatsCount||0,M=(0,ht.Kr)((()=>Object.values(d).filter((e=>e.isForSideMenu))),[d]),k=(0,Et.A)((()=>{g({id:t,shouldReplaceHistory:!0})})),P=(0,Et.A)((e=>{e.stopPropagation(),y({theme:"light"===r?"dark":"light"}),y({shouldUseSystemTheme:!1})})),T=(0,Et.A)((e=>{e.stopPropagation();let t=i+1;t>n.zP3&&(t=n.dnp);const a=t===n.dnp?it.PI:t===n.zP3?it.LH:it.PX;y({animationLevel:t}),f(a)})),x=(0,Et.A)((()=>{window.open(n.qGQ,"_blank","noopener")})),N=(0,Et.A)((()=>{(0,xa.Bt)("K")})),B=(0,Et.A)((()=>{I({username:b("Settings.TipsUsername")})})),U=(0,Et.A)((()=>{A({url:n.ukY})})),F=(0,Et.A)((()=>{v({id:t,shouldReplaceHistory:!0,profileTab:"stories"})}));return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement(na.A,{icon:"saved-messages",onClick:k},b("SavedMessages")),a.isHidden&&ht.Ay.createElement(na.A,{icon:"archive",onClick:l},ht.Ay.createElement("span",{className:"menu-item-name"},b("ArchivedChats")),E>0&&ht.Ay.createElement("div",{className:"right-badge"},E)),ht.Ay.createElement(na.A,{icon:"user",onClick:u},b("Contacts")),M.map((e=>ht.Ay.createElement(Na.A,{bot:e,theme:r,isInSideMenu:!0,canShowNew:!0,onMenuOpened:h,onMenuClosed:p}))),ht.Ay.createElement(na.A,{icon:"play-story",onClick:F},b("Settings.MyStories")),ht.Ay.createElement(na.A,{icon:"settings",onClick:m},b("Settings")),ht.Ay.createElement(na.A,{icon:"darkmode",onClick:P},ht.Ay.createElement("span",{className:"menu-item-name"},b("lng_menu_night_mode")),ht.Ay.createElement(Ba.A,{id:"darkmode",label:b("dark"===r?"lng_settings_disable_night_theme":"lng_settings_enable_night_theme"),checked:"dark"===r,noAnimation:!0})),ht.Ay.createElement(na.A,{icon:"animations",onClick:T},ht.Ay.createElement("span",{className:"menu-item-name capitalize"},b("Appearance.Animations").toLowerCase()),ht.Ay.createElement(Ua.A,{value:S})),ht.Ay.createElement(na.A,{icon:"help",onClick:B},b("TelegramFeatures")),ht.Ay.createElement(na.A,{icon:"bug",onClick:U},w("MenuReportBug")),n.Cmz&&ht.Ay.createElement(na.A,{icon:"permissions",onClick:x},w("MenuBetaChangelog")),C&&ht.Ay.createElement(na.A,{icon:"K",isCharIcon:!0,href:`${n.qJR}k`,onClick:N},w("MenuSwitchToK")),c&&ht.Ay.createElement(na.A,{icon:"install",onClick:(0,Ta.S)()},w("MenuInstallApp")))})));var Ra=a(82117),La=a(87412),Ja=a(9267),Oa=a(83594);const Da=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StatusPickerMenu",!t);return a?ht.Ay.createElement(a,e):void 0},Va=(0,ht.ph)((0,s.EK)((e=>{const{currentUserId:t}=e,a=t?(0,b.mBe)(e,t):void 0;return{emojiStatus:a?.emojiStatus}}))((e=>{let{emojiStatus:t}=e;const{setEmojiStatus:a,loadCurrentUser:o}=(0,s.ko)(),i=(0,ht.li)(null),[r,c,d]=(0,Aa.A)(!1),[l,u,m]=(0,Aa.A)(!1),[h,p,g]=(0,Aa.A)(!1),{isMobile:y}=(0,F.Ay)(),f=t?.until?1e3*t.until-Date.now()+1e3*(0,ve.SF)():void 0;(0,wt.A)(o,f),(0,Ra.A)((e=>{let[a]=e;r&&t&&a&&t.documentId!==a.documentId&&(u(),d())}),[t,r,u,d]);const I=(0,ht.hb)((e=>{c(),a({emojiStatus:e})}),[c,a]);(0,wt.A)(m,l?1500:void 0);const A=(0,ht.hb)((()=>{p()}),[p]);return ht.Ay.createElement("div",{className:"extra-spacing"},Boolean(l&&t)&&ht.Ay.createElement(Oa.A,{reaction:t,isLottie:!0,className:"emoji-status-effect"}),ht.Ay.createElement(aa.A,{round:!0,ref:i,ripple:!y,size:"smaller",color:"translucent",className:"emoji-status",onClick:A},t?ht.Ay.createElement(La.A,{key:t.documentId,documentId:t.documentId,size:24,loopLimit:n.J$1}):ht.Ay.createElement(Ja.A,null)),ht.Ay.createElement(Da,{statusButtonRef:i,isOpen:h,onEmojiStatusSelect:I,onClose:g}))}))),Ga={date:void 0},ja={id:void 0},qa=(0,ht.ph)((0,s.EK)((e=>{const t=(0,b.nTw)(e),{query:a,fetchingStatus:s,chatId:n,minDate:o}=t.globalSearch,{connectionState:i,isSyncing:r,isFetchingDifference:c}=e,{isConnectionStatusMinimized:d}=e.settings.byKey;return{searchQuery:a,isLoading:!!s&&Boolean(s.chats||s.messages),globalSearchChatId:n,searchDate:o,theme:(0,b.SJA)(e),connectionState:i,isSyncing:r,isFetchingDifference:c,isMessageListOpen:Boolean((0,b.Xf0)(e)),isConnectionStatusMinimized:d,isCurrentUserPremium:(0,b.g29)(e),areChatsLoaded:Boolean(e.chats.listIds.active),hasPasscode:Boolean(e.passcode.hasPasscode),canSetPasscode:(0,b.Ntz)(e)}}))((e=>{let{shouldHideSearch:t,content:a,contactsFilter:i,isClosingSearch:r,searchQuery:d,isLoading:l,isCurrentUserPremium:u,shouldSkipTransition:m,globalSearchChatId:h,searchDate:p,theme:g,connectionState:y,isSyncing:f,isFetchingDifference:I,isMessageListOpen:A,isConnectionStatusMinimized:v,areChatsLoaded:b,hasPasscode:w,canSetPasscode:S,onSearchQuery:C,onSelectSettings:E,onSelectContacts:M,onSelectArchived:k,onReset:P}=e;const{setGlobalSearchDate:T,setSettingOption:x,setGlobalSearchChatId:N,lockScreen:B,requestNextSettingsScreen:U}=(0,s.ko)(),R=(0,ta.A)(),L=(0,va.A)(),{isMobile:J}=(0,F.Ay)(),[O,D,V]=(0,Aa.A)(),G=a===c.Bn.ChatList,j=(0,ht.Kr)((()=>p?(0,de.A)(new Date(1e3*p)):void 0),[p]),{connectionStatus:q,connectionStatusText:z,connectionStatusPosition:H}=fa(R,y,f||I,A,v,!b),_=(0,Et.A)((e=>{e.preventDefault(),e.stopPropagation(),w?B():U({screen:c.VS.PasscodeDisabled})}));(0,$t.v)(S?{"Ctrl+Shift+L":_,"Alt+Shift+L":_,"Meta+Shift+L":_,...o.lE&&{"Mod+L":_}}:void 0);const W=(0,ht.Kr)((()=>e=>{let{onTrigger:t,isOpen:a}=e;return ht.Ay.createElement(aa.A,{round:!0,ripple:G&&!J,size:"smaller",color:"translucent",className:a?"active":"",onClick:G?t:()=>P(),ariaLabel:G?R("AccDescrOpenMenu2"):"Return to chat list"},ht.Ay.createElement("div",{className:(0,ft.A)("animated-menu-icon",!G&&"state-back",m&&"no-animation")}))}),[G,J,R,P,m]),K=(0,Et.A)((()=>{d||C("")})),$=(0,Et.A)((()=>{x({isConnectionStatusMinimized:!v})})),X=(0,Et.A)((()=>{B()})),Q=Boolean(h)||a===c.Bn.GlobalSearch||a===c.Bn.Contacts;(0,ht.vJ)((()=>Q?(0,_t.A)((()=>P())):void 0),[Q,P]);const Z=a===c.Bn.Contacts?L("SearchFriends"):L("Search"),Y=n.Cmz?"10.9.10 Beta (master)":n.Oig?"master":"10.9.10",ee=(0,Ut.zk)(),{shouldDisableDropdownMenuTransitionRef:te,handleDropdownMenuTransitionEnd:ae}=(0,ba.A)(t),se=(0,ht.li)(null);(0,Ia.A)(se);const ne=(0,ht.Kr)((()=>ht.Ay.createElement(ht.Ay.Fragment,null,j&&ht.Ay.createElement(wa.A,{icon:"calendar",title:j,fluid:!0,canClose:!0,isMinimized:Boolean(h),className:"left-search-picker-item search-date",onClick:T,clickArg:Ga}),h&&ht.Ay.createElement(wa.A,{className:"left-search-picker-item",peerId:h,onClick:N,fluid:!0,canClose:!0,isMinimized:!0,clickArg:ja}))),[h,j]);return ht.Ay.createElement("div",{className:"LeftMainHeader"},ht.Ay.createElement("div",{id:"LeftMainHeader",className:"left-header",ref:se},R.isRtl&&ht.Ay.createElement("div",{className:"DropdownMenuFiller"}),ht.Ay.createElement(Ca.A,{trigger:W,footer:`${n.C39} ${Y}`,className:(0,ft.A)("main-menu",R.isRtl&&"rtl",t&&R.isRtl&&"right-aligned",te.current&&R.isRtl&&"disable-transition"),forceOpen:O,positionX:t&&R.isRtl?"right":"left",transformOriginX:o.cp&&o.MP&&!ee?90:void 0,onTransitionEnd:R.isRtl?ae:void 0},ht.Ay.createElement(Fa,{onSelectArchived:k,onSelectContacts:M,onSelectSettings:E,onBotMenuOpened:D,onBotMenuClosed:V})),ht.Ay.createElement(Ea.A,{inputId:"telegram-search-input",resultsItemSelector:".LeftSearch .ListItem-button",className:(0,ft.A)(h||p?"with-picker-item":void 0,t&&"SearchInput--hidden"),value:r?void 0:i||d,focused:Q,isLoading:l||"minimized"===H,spinnerColor:"minimized"===H?"yellow":void 0,spinnerBackgroundColor:"minimized"===H&&"light"===g?"light":void 0,placeholder:Z,autoComplete:"off",canClose:Boolean(h||p),onChange:C,onReset:P,onFocus:K,onSpinnerClick:"minimized"===H?$:void 0},ne,ht.Ay.createElement(Sa.A,{canShow:!Q&&!j&&!h})),u&&ht.Ay.createElement(Va,null),w&&ht.Ay.createElement(aa.A,{round:!0,ripple:!J,size:"smaller",color:"translucent",ariaLabel:`${R("ShortcutsController.Others.LockByPasscode")} (Ctrl+Shift+L)`,onClick:X,className:(0,ft.A)(!u&&"extra-spacing")},ht.Ay.createElement("i",{className:"icon icon-lock"})),ht.Ay.createElement(Ma.A,{isOpen:"overlay"===H,isCustom:!0,className:"connection-state-wrapper"},ht.Ay.createElement(Pa,{connectionStatus:q,connectionStatusText:z,onClick:$}))))}))),za=Object.keys(c.Bn).length/2;let Ha;const _a=(0,ht.ph)((e=>{let{content:t,searchQuery:a,searchDate:i,isClosingSearch:r,contactsFilter:d,shouldSkipTransition:l,foldersDispatch:u,isAppUpdateAvailable:m,isElectronUpdateAvailable:h,isForumPanelOpen:p,onSearchQuery:g,onContentChange:y,onSettingsScreenSelect:f,onReset:I,onTopicSearch:A}=e;const{closeForumPanel:v}=(0,s.ko)(),[b,w]=(0,ht.J0)(o.TF),[S,C]=(0,ht.J0)(!1);(0,ht.vJ)((()=>{window.electron?.getIsAutoUpdateEnabled().then(C)}),[]);const{shouldRenderForumPanel:E,handleForumPanelAnimationEnd:M,handleForumPanelAnimationStart:k,isAnimationStarted:P}=(0,ea.A)(p),T=p&&t===c.Bn.ChatList,x=T&&P,{shouldRender:N,transitionClassNames:B}=(0,Tt.A)(m||h),U=(0,ht.li)(!1),F=(0,Et.A)((()=>{t===c.Bn.ChatList&&(U.current=!0,w(!0))})),R=(0,Et.A)((()=>{U.current=!1,Ha&&(clearTimeout(Ha),Ha=void 0),Ha=window.setTimeout((()=>{U.current||w(!1)}),250)})),L=(0,Et.A)((()=>{y(c.Bn.Settings)})),J=(0,Et.A)((()=>{y(c.Bn.Contacts)})),O=(0,Et.A)((()=>{y(c.Bn.Archived),v()})),D=(0,Et.A)((()=>{o.cp&&!S?window.open(`${n.yq6}/get`,"_blank","noopener"):h?window.electron?.installUpdate():window.location.reload()})),V=(0,Et.A)((()=>{y(c.Bn.NewChannelStep1)})),G=(0,Et.A)((()=>{y(c.Bn.NewGroupStep1)}));(0,ht.vJ)((()=>{let e;return t!==c.Bn.ChatList?e=window.setTimeout((()=>{w(!1)}),250):(U.current||o.TF)&&w(!0),()=>{e&&(clearTimeout(e),e=void 0)}}),[t]);const j=(0,ta.A)();return ht.Ay.createElement("div",{id:"LeftColumn-main",onMouseEnter:o.TF?void 0:F,onMouseLeave:o.TF?void 0:R},ht.Ay.createElement(qa,{shouldHideSearch:x,content:t,contactsFilter:d,onSearchQuery:g,onSelectSettings:L,onSelectContacts:J,onSelectArchived:O,onReset:I,shouldSkipTransition:l,isClosingSearch:r}),ht.Ay.createElement(Qt.Ay,{name:l?"none":"zoomFade",renderCount:za,activeKey:t,shouldCleanup:!0,cleanupExceptionKey:c.Bn.ChatList,shouldWrap:!0,wrapExceptionKey:c.Bn.ChatList},(e=>{switch(t){case c.Bn.ChatList:return ht.Ay.createElement(ha,{shouldHideFolderTabs:x,onSettingsScreenSelect:f,onLeftColumnContentChange:y,foldersDispatch:u,isForumPanelOpen:x});case c.Bn.GlobalSearch:return ht.Ay.createElement(ia,{searchQuery:a,searchDate:i,isActive:e,onReset:I});case c.Bn.Contacts:return ht.Ay.createElement(pa,{filter:d,isActive:e,onReset:I});default:return}})),N&&ht.Ay.createElement(aa.A,{fluid:!0,pill:!0,className:(0,ft.A)("btn-update",B),onClick:D},j("lng_update_telegram")),E&&ht.Ay.createElement(ga.A,{isOpen:p,isHidden:!T,onTopicSearch:A,onOpenAnimationStart:k,onCloseAnimationEnd:M}),ht.Ay.createElement(oa,{isShown:b,onNewPrivateChat:J,onNewChannel:V,onNewGroup:G}))})),Wa=e=>{const t=(0,Ft.A)(vt.ar.Extra,"NewChat");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},Ka=e=>{const t=(0,Ft.A)(vt.ar.Extra,"Settings");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)};var $a=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}($a||{});const Xa=Object.keys($a).length/2,Qa=(0,ht.ph)((0,s.EK)((e=>{const t=(0,b.nTw)(e),{globalSearch:{query:a,minDate:s},shouldSkipHistoryAnimations:n,activeChatFolder:o,nextSettingsScreen:i,nextFoldersAction:r,storyViewer:{isArchivedRibbonShown:c}}=t,{currentUserId:d,passcode:{hasPasscode:l},isAppUpdateAvailable:u,isElectronUpdateAvailable:m,archiveSettings:h}=e,p=(0,b.meB)(e);return{searchQuery:a,searchDate:s,isFirstChatFolderActive:0===o,shouldSkipHistoryAnimations:n,currentUserId:d,hasPasscode:l,nextSettingsScreen:i,nextFoldersAction:r,isChatOpen:Boolean(p?.id),isAppUpdateAvailable:u,isElectronUpdateAvailable:m,isForumPanelOpen:(0,b.clw)(e),forumPanelChatId:t.forumPanelChatId,isClosingSearch:t.globalSearch.isClosing,archiveSettings:h,isArchivedStoryRibbonShown:c}}))((function(e){let{ref:t,searchQuery:a,searchDate:n,isFirstChatFolderActive:i,shouldSkipHistoryAnimations:r,currentUserId:d,hasPasscode:l,nextSettingsScreen:u,nextFoldersAction:m,isChatOpen:h,isAppUpdateAvailable:p,isElectronUpdateAvailable:g,isForumPanelOpen:y,forumPanelChatId:f,isClosingSearch:I,archiveSettings:A,isArchivedStoryRibbonShown:v}=e;const{setGlobalSearchQuery:b,setGlobalSearchClosing:w,setGlobalSearchChatId:S,resetChatCreation:C,setGlobalSearchDate:E,loadPasswordInfo:M,clearTwoFaError:k,openChat:P,requestNextSettingsScreen:T}=(0,s.ko)(),[x,N]=(0,ht.J0)(c.Bn.ChatList),[B,U]=(0,ht.J0)(c.VS.Main),[F,R]=(0,ht.J0)(""),[L,J]=(0,Kt.A)(),[O,D]=(0,ht.J0)(0);let V=$a.Main;switch(x){case c.Bn.Archived:V=$a.Archived;break;case c.Bn.Settings:V=$a.Settings;break;case c.Bn.NewChannelStep1:case c.Bn.NewChannelStep2:V=$a.NewChannel;break;case c.Bn.NewGroupStep1:case c.Bn.NewGroupStep2:V=$a.NewGroup}const G=(0,Et.A)((e=>{function t(){N(c.Bn.ChatList),U(c.VS.Main),R(""),w({isClosing:!0}),C(),setTimeout((()=>{b({query:""}),E({date:void 0}),S({id:void 0}),w({isClosing:!1}),D(Date.now())}),250)}if(!0!==e)if(x!==c.Bn.NewGroupStep2)if(x!==c.Bn.NewChannelStep2){if(x===c.Bn.NewGroupStep1){const e=document.getElementById("new-group-picker-search");e&&e.blur()}if(x===c.Bn.Settings)switch(B){case c.VS.EditProfile:case c.VS.Folders:case c.VS.General:case c.VS.Notifications:case c.VS.DataStorage:case c.VS.Privacy:case c.VS.Performance:case c.VS.ActiveSessions:case c.VS.Language:case c.VS.Stickers:case c.VS.Experimental:return void U(c.VS.Main);case c.VS.GeneralChatBackground:return void U(c.VS.General);case c.VS.GeneralChatBackgroundColor:return void U(c.VS.GeneralChatBackground);case c.VS.PrivacyPhoneNumber:case c.VS.PrivacyAddByPhone:case c.VS.PrivacyLastSeen:case c.VS.PrivacyProfilePhoto:case c.VS.PrivacyBio:case c.VS.PrivacyBirthday:case c.VS.PrivacyPhoneCall:case c.VS.PrivacyPhoneP2P:case c.VS.PrivacyForwarding:case c.VS.PrivacyGroupChats:case c.VS.PrivacyVoiceMessages:case c.VS.PrivacyMessages:case c.VS.PrivacyBlockedUsers:case c.VS.ActiveWebsites:case c.VS.TwoFaDisabled:case c.VS.TwoFaEnabled:case c.VS.TwoFaCongratulations:case c.VS.PasscodeDisabled:case c.VS.PasscodeEnabled:case c.VS.PasscodeCongratulations:return void U(c.VS.Privacy);case c.VS.PasscodeNewPasscode:return void U(l?c.VS.PasscodeEnabled:c.VS.PasscodeDisabled);case c.VS.PasscodeChangePasscodeCurrent:case c.VS.PasscodeTurnOff:return void U(c.VS.PasscodeEnabled);case c.VS.PasscodeNewPasscodeConfirm:return void U(c.VS.PasscodeNewPasscode);case c.VS.PasscodeChangePasscodeNew:return void U(c.VS.PasscodeChangePasscodeCurrent);case c.VS.PasscodeChangePasscodeConfirm:return void U(c.VS.PasscodeChangePasscodeNew);case c.VS.PrivacyPhoneNumberAllowedContacts:case c.VS.PrivacyPhoneNumberDeniedContacts:return void U(c.VS.PrivacyPhoneNumber);case c.VS.PrivacyLastSeenAllowedContacts:case c.VS.PrivacyLastSeenDeniedContacts:return void U(c.VS.PrivacyLastSeen);case c.VS.PrivacyProfilePhotoAllowedContacts:case c.VS.PrivacyProfilePhotoDeniedContacts:return void U(c.VS.PrivacyProfilePhoto);case c.VS.PrivacyBioAllowedContacts:case c.VS.PrivacyBioDeniedContacts:return void U(c.VS.PrivacyBio);case c.VS.PrivacyBirthdayAllowedContacts:case c.VS.PrivacyBirthdayDeniedContacts:return void U(c.VS.PrivacyBirthday);case c.VS.PrivacyPhoneCallAllowedContacts:case c.VS.PrivacyPhoneCallDeniedContacts:return void U(c.VS.PrivacyPhoneCall);case c.VS.PrivacyPhoneP2PAllowedContacts:case c.VS.PrivacyPhoneP2PDeniedContacts:return void U(c.VS.PrivacyPhoneP2P);case c.VS.PrivacyForwardingAllowedContacts:case c.VS.PrivacyForwardingDeniedContacts:return void U(c.VS.PrivacyForwarding);case c.VS.PrivacyVoiceMessagesAllowedContacts:case c.VS.PrivacyVoiceMessagesDeniedContacts:return void U(c.VS.PrivacyVoiceMessages);case c.VS.PrivacyGroupChatsAllowedContacts:case c.VS.PrivacyGroupChatsDeniedContacts:return void U(c.VS.PrivacyGroupChats);case c.VS.TwoFaNewPassword:return void U(c.VS.TwoFaDisabled);case c.VS.TwoFaNewPasswordConfirm:return void U(c.VS.TwoFaNewPassword);case c.VS.TwoFaNewPasswordHint:return void U(c.VS.TwoFaNewPasswordConfirm);case c.VS.TwoFaNewPasswordEmail:return void U(c.VS.TwoFaNewPasswordHint);case c.VS.TwoFaNewPasswordEmailCode:return void U(c.VS.TwoFaNewPasswordEmail);case c.VS.TwoFaChangePasswordCurrent:case c.VS.TwoFaTurnOff:case c.VS.TwoFaRecoveryEmailCurrentPassword:return void U(c.VS.TwoFaEnabled);case c.VS.TwoFaChangePasswordNew:return void U(c.VS.TwoFaChangePasswordCurrent);case c.VS.TwoFaChangePasswordConfirm:return void U(c.VS.TwoFaChangePasswordNew);case c.VS.TwoFaChangePasswordHint:return void U(c.VS.TwoFaChangePasswordConfirm);case c.VS.TwoFaRecoveryEmail:return void U(c.VS.TwoFaRecoveryEmailCurrentPassword);case c.VS.TwoFaRecoveryEmailCode:return void U(c.VS.TwoFaRecoveryEmail);case c.VS.FoldersCreateFolder:case c.VS.FoldersEditFolder:return void U(c.VS.Folders);case c.VS.FoldersShare:return void U(c.VS.FoldersEditFolder);case c.VS.FoldersIncludedChatsFromChatList:case c.VS.FoldersExcludedChatsFromChatList:return void U(c.VS.FoldersEditFolderFromChatList);case c.VS.FoldersEditFolderFromChatList:case c.VS.FoldersEditFolderInvites:return N(c.Bn.ChatList),void U(c.VS.Main);case c.VS.QuickReaction:case c.VS.CustomEmoji:return void U(c.VS.Stickers);case c.VS.DoNotTranslate:return void U(c.VS.Language)}x===c.Bn.ChatList&&i?N(c.Bn.GlobalSearch):t()}else N(c.Bn.NewChannelStep1);else N(c.Bn.NewGroupStep1);else t()})),j=(0,Et.A)((e=>{x!==c.Bn.Contacts?(N(c.Bn.GlobalSearch),e!==a&&b({query:e})):R(e)})),q=(0,Et.A)((()=>{N(c.Bn.GlobalSearch),b({query:""}),S({id:f})}));(0,ht.vJ)((()=>{const e=x===c.Bn.Archived,t=x===c.Bn.ChatList,a=!h&&!y;return e&&a||!t&&!e||i&&a?(0,_t.A)((()=>{G()})):void 0}),[i,x,G,h,y]);const z=(0,Et.A)((e=>{x!==c.Bn.GlobalSearch&&(e.preventDefault(),N(c.Bn.GlobalSearch))})),H=(0,Et.A)((e=>{e.preventDefault(),P({id:d,shouldReplaceHistory:!0})})),_=(0,Et.A)((e=>{e.preventDefault(),N(c.Bn.Archived)})),W=(0,Et.A)((e=>{e.preventDefault(),N(c.Bn.Settings)}));(0,$t.v)({"Mod+Shift+F":z,...!o.$M&&{"Mod+Shift+S":H},...o.lE&&{"Mod+0":H,"Mod+9":_},...o.MP&&o.lE&&{"Mod+,":W}}),(0,ht.vJ)((()=>{k(),B===c.VS.Privacy&&M()}),[k,M,B]),(0,xt.A)((()=>{void 0!==u&&(N(c.Bn.Settings),U(u),T({screen:void 0})),m&&J(m)}),[J,m,u,T]);const K=(0,Et.A)((e=>{N(c.Bn.Settings),U(e)})),$=(0,Xt.i)(function(e){const t=(0,ht.li)(),a=(0,ht.li)();return a.current!==e&&(t.current=a.current),a.current=e,t.current}(V===$a.Settings?B:-1));function X(e){switch(V){case $a.Archived:return ht.Ay.createElement(Yt,{isActive:e,onReset:G,onTopicSearch:q,foldersDispatch:J,onSettingsScreenSelect:K,onLeftColumnContentChange:N,isForumPanelOpen:y,archiveSettings:A,isStoryRibbonShown:v});case $a.Settings:return ht.Ay.createElement(Ka,{isActive:e,currentScreen:B,foldersState:L,foldersDispatch:J,shouldSkipTransition:r,onScreenSelect:K,onReset:G});case $a.NewChannel:return ht.Ay.createElement(Wa,{key:O,isActive:e,isChannel:!0,content:x,onContentChange:N,onReset:G});case $a.NewGroup:return ht.Ay.createElement(Wa,{key:O,isActive:e,content:x,onContentChange:N,onReset:G});default:return ht.Ay.createElement(_a,{content:x,isClosingSearch:I,searchQuery:a,searchDate:n,contactsFilter:F,foldersDispatch:J,onContentChange:N,onSearchQuery:j,onSettingsScreenSelect:K,onReset:G,shouldSkipTransition:r,isAppUpdateAvailable:p,isElectronUpdateAvailable:g,isForumPanelOpen:y,onTopicSearch:q})}}return(0,ht.vJ)((()=>{if(o.TF)return(0,Wt.P)(t.current,{excludedClosestSelector:".ProfileInfo, .color-picker, .hue-picker",selectorToPreventScroll:"#Settings .custom-scroll",onSwipeRightStart:G,onCancel:()=>{N(c.Bn.Settings),K($.current)}})}),[$,t]),ht.Ay.createElement(Qt.Ay,{ref:t,name:r?"none":o.Uh,renderCount:Xa,activeKey:V,shouldCleanup:!0,cleanupExceptionKey:$a.Main,shouldWrap:!0,wrapExceptionKey:$a.Main,id:"LeftColumn",withSwipeControl:!0},X)}))),Za=e=>{let{isOpen:t}=e;const a=(0,Ft.A)(vt.ar.Extra,"MediaViewer",!t);return a?ht.Ay.createElement(a,null):void 0};var Ya=a(53827),es=a(49642),ts=a(4961),as=a(88792),ss=a(10722),ns=a(24909),os=a(56863),is=a(62587);const rs=a.p+"telegram-logo-filled.67469f6dc5e301e8e0bd.svg",cs={width:200,height:200},ds=115;var ls=a(82497),us=a(42452);const ms={.5:.66,.75:.8,1:1,1.5:1.4,2:1.8},hs=Object.keys(ms).sort().map(Number),ps=(0,s.EK)(((e,t)=>{let{message:a}=t;const s=(0,b.Y7C)(e,a),n=(0,b.hds)(e,a.chatId),{volume:o,playbackRate:i,isMuted:r,isPlaybackRateActive:c}=(0,b.nTw)(e).audioPlayer;return{sender:s,chat:n,volume:o,playbackRate:i,isPlaybackRateActive:c,isMuted:r}}))((e=>{let{message:t,className:a,noUi:i,sender:r,chat:c,volume:d,playbackRate:l,isPlaybackRateActive:u,isMuted:m}=e;const{setAudioPlayerVolume:h,setAudioPlayerPlaybackRate:p,setAudioPlayerMuted:g,focusMessage:y,closeAudioPlayer:f}=(0,s.ko)(),A=(0,ht.li)(null),v=(0,ta.A)(),{isMobile:b}=(0,F.Ay)(),{audio:w,voice:S,video:C}=(0,I.r_)(t),E=Boolean(S||C),k=E||(w?.duration||0)>n.CVm,P=r?(0,I.qg)(v,r):void 0,T=Le.Ih((0,I.EO)(t,"inline")),x=((e,t,a)=>{const s=(0,ta.A)(),{audio:n,voice:o}=(0,I.r_)(e),i=n?n.title||n.fileName:o?"Voice message":"",r=n?.performer||t&&(0,I.qg)(s,t),c=a&&(0,I.Js)(s,a)||"Telegram",d=n&&(0,I.AB)(n)&&(0,I.VO)(n,"pictogram"),l=t&&(0,I.cP)(t,"big"),u=n&&d||o&&l,m=(0,is.A)(u),h=(0,ht.Kr)((()=>function(e,t,a){if(!a)return cs;if(e){if(!e.thumbnailSizes?.length)return;const t=e.thumbnailSizes.find((e=>"m"===e.type));return t||e.thumbnailSizes[0]}return t?M.cf:void 0}(n,o,m)),[n,m,o]),{result:p}=(0,os.A)((()=>function(e,t){if(!e)return Promise.resolve(rs);if(!t)return(0,ns.y)(e,ds,ds);const a=Math.min(t.width,t.height);if(a<ds){const t=ds/a;return(0,ns.s)(e,t)}return Promise.resolve(e)}(m,h)),[m,h],rs);return(0,ht.Kr)((()=>(0,es.wp)({title:i,artist:r,album:c,artwork:[{src:p}]})),[c,r,i,p])})(t,r,c),{playPause:N,stop:B,isPlaying:U,requestNextTrack:R,requestPreviousTrack:L,isFirst:J,isLast:O,setVolume:D,toggleMuted:V,setPlaybackRate:G}=(0,as.A)((0,Ya.dj)(t),(0,I.Fk)(t),E?"voice":"audio",T,void 0,x,void 0,!0,void 0,void 0,(0,I.Nb)(t),!0),{isContextMenuOpen:j,handleBeforeContextMenu:q,handleContextMenu:z,handleContextMenuClose:H,handleContextMenuHide:_}=(0,ss.A)(A),W=(0,Et.A)((()=>{y({chatId:t.chatId,messageId:t.id})})),K=(0,Et.A)((()=>{B&&(U&&N(),f(),(0,es.Eg)(),B())})),$=(0,Et.A)((e=>{D&&(h({volume:e/100}),D(e/100))})),X=(0,Et.A)((()=>{o.TF&&!o.pz||V&&(V(),g({isMuted:!m}))})),Q=(0,Et.A)((function(e){if(!G)return;const t=ms[e],a=1!==e&&(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]);p({playbackRate:t,isPlaybackRateActive:a}),G(a?t:1)})),Z=(0,Et.A)((()=>{H();const e=Number(Object.entries(ms).find((e=>{let[,t]=e;return t===l}))?.[0])||1,t=!u;Q(t&&1===e?2:e,t)})),Y=(0,Et.A)((()=>{const e=Object.entries(ms).find((e=>{let[,t]=e;return t===l}))?.[0]||1,t=`${1===l?2:e}Х`;return ht.Ay.createElement("div",{className:"playback-wrapper"},j&&ht.Ay.createElement("div",{className:"playback-backdrop",onClick:H}),ht.Ay.createElement(aa.A,{round:!0,className:(0,ft.A)("playback-button",u&&"applied",j&&"on-top"),color:"translucent",size:"smaller",ariaLabel:"Playback Rate",ripple:!b,onMouseEnter:z,onClick:Z,onMouseDown:q,onContextMenu:z},ht.Ay.createElement("span",{className:(0,ft.A)("playback-button-inner",4===t.length&&"small",5===t.length&&"tiny")},t)))})),ee=(0,ht.Kr)((()=>0===d||m?"icon-muted":d<.3?"icon-volume-1":d<.6?"icon-volume-2":"icon-volume-3"),[d,m]);if(!i)return ht.Ay.createElement("div",{className:(0,ft.A)("AudioPlayer",a),dir:v.isRtl?"rtl":void 0,ref:A},ht.Ay.createElement("div",{className:"AudioPlayer-content",onClick:W},w?function(e){const{title:t,performer:a,fileName:s}=e;return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:"title",dir:"auto"},(0,ts.A)(t||s)),a&&ht.Ay.createElement("div",{className:"subtitle",dir:"auto"},(0,ts.A)(a)))}(w):function(e,t){return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:"title",dir:"auto"},t&&(0,ts.A)(t)),ht.Ay.createElement("div",{className:"subtitle",dir:"auto"},e))}(v("AttachAudio"),P),ht.Ay.createElement(us.A,null)),ht.Ay.createElement(aa.A,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:"player-button",disabled:J?.(),onClick:L,ariaLabel:"Previous track"},ht.Ay.createElement("i",{className:"icon icon-skip-previous"})),ht.Ay.createElement(aa.A,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:(0,ft.A)("toggle-play","player-button",U?"pause":"play"),onClick:N,ariaLabel:U?"Pause audio":"Play audio"},ht.Ay.createElement("i",{className:"icon icon-play"}),ht.Ay.createElement("i",{className:"icon icon-pause"})),ht.Ay.createElement(aa.A,{round:!0,ripple:!b,color:"translucent",size:"smaller",className:"player-button",disabled:O?.(),onClick:R,ariaLabel:"Next track"},ht.Ay.createElement("i",{className:"icon icon-skip-next"})),ht.Ay.createElement("div",{className:"volume-button-wrapper"},ht.Ay.createElement(aa.A,{round:!0,className:"player-button volume-button",color:"translucent",size:"smaller",ariaLabel:"Volume",onClick:X,ripple:!b},ht.Ay.createElement("i",{className:(0,ft.A)("icon",ee)})),!o.pz&&ht.Ay.createElement("div",{className:"volume-slider-wrapper"},ht.Ay.createElement("div",{className:"volume-slider-spacer"}),ht.Ay.createElement("div",{className:"volume-slider"},ht.Ay.createElement(ls.A,{bold:!0,value:m?0:100*d,onChange:$})))),k&&ht.Ay.createElement(Ca.A,{forceOpen:j,positionX:"right",positionY:"top",className:"playback-rate-menu",trigger:Y,onClose:H,onHide:_,onMouseEnterBackdrop:H},hs.map((e=>function(e,t,a,s){const n=t===ms[e]&&s||1===e&&!s;return ht.Ay.createElement(na.A,{key:e,onClick:()=>a(e),icon:n?"check":void 0,customIcon:n?void 0:ht.Ay.createElement("i",{className:"icon icon-placeholder"})},e,"X")}(e,l,Q,u)))),ht.Ay.createElement(aa.A,{round:!0,className:"player-close",color:"translucent",size:"smaller",onClick:K,ariaLabel:"Close player"},ht.Ay.createElement("i",{className:"icon icon-close"})))})),gs=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ReactionPicker",!t);return a?ht.Ay.createElement(a,e):void 0};function ys(){return ys=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},ys.apply(this,arguments)}const fs=(0,ht.ph)((0,s.EK)((e=>({messageLists:(0,b.nTw)(e).messageLists})))((e=>{let{messageLists:t}=e;const{openChat:a}=(0,s.ko)(),n=()=>{a({id:void 0},{forceSyncOnIOs:!0})},o=e=>{let{chatId:t,type:a,threadId:s}=e;(0,da.A)({isActive:!0,hash:(0,Oe.az)(t,a,s),onBack:n})};return ht.Ay.createElement("div",null,t?.map(((e,t)=>ht.Ay.createElement(o,ys({key:`${e.chatId}_${e.threadId}_${e.type}_${t}`},e)))))})));var Is=a(95807),As=a(74824),vs=a(87679);var bs=a(23565),ws=a(29886),Ss=a(39751),Cs=a(67054),Es=a(43336),Ms=a(58674);const ks=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"PrivacySettingsNoticeModal",!t);return a?ht.Ay.createElement(a,e):void 0},Ps=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"SeenByModal",!t);return a?ht.Ay.createElement(a,e):void 0},Ts=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"UnpinAllMessagesModal",!t);return a?ht.Ay.createElement(a,e):void 0},xs=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"PremiumGiftModal",!t);return a?ht.Ay.createElement(a,e):void 0},Ns=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StarsGiftModal",!t);return a?ht.Ay.createElement(a,e):void 0},Bs=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ChatLanguageModal",!t);return a?ht.Ay.createElement(a,e):void 0};var Us=a(41510);const Fs=e=>{const{activeEmojiInteraction:t}=e,a=(0,Ft.A)(vt.ar.Extra,"EmojiInteractionAnimation",!t);return a?ht.Ay.createElement(a,e):void 0};var Rs=a(81954);const Ls=(0,ht.ph)((e=>{let{icon:t,ariaLabelLang:a,unreadCount:s,onClick:n,onReadAll:o,className:i}=e;const r=(0,ta.A)(),c=(0,ht.li)(null),{isContextMenuOpen:d,handleContextMenu:l,handleContextMenuClose:u,handleContextMenuHide:m}=(0,ss.A)(c,!o);return ht.Ay.createElement("div",{className:(0,ft.A)("Y2NKrpKj",i),ref:c},ht.Ay.createElement(aa.A,{color:"secondary",round:!0,className:"cxwA6gDO",onClick:n,onContextMenu:l,ariaLabel:r(a)},ht.Ay.createElement("i",{className:(0,ft.A)("F4zNUFhH","icon",`icon-${t}`)})),Boolean(s)&&ht.Ay.createElement("div",{className:"GovSzpfQ"},(0,qt.Vw)(s)),o&&ht.Ay.createElement(sa.A,{isOpen:d,onClose:u,onCloseAnimationEnd:m,autoClose:!0,positionX:"right",positionY:"bottom"},ht.Ay.createElement(na.A,{icon:"readchats",onClick:o},r("MarkAllAsRead"))))})),Js="UMXbiYB3",Os=(0,ht.ph)((0,s.EK)((e=>{const t=(0,b.Xf0)(e);if(!t)return{};const{chatId:a,threadId:s,type:n}=t,o=(0,b.hds)(e,a),i=Boolean((0,b.TCk)(e)),c=o&&s===r.l3&&"thread"===n&&!i;return{messageListType:n,chatId:a,reactionsCount:c?o.unreadReactionsCount:void 0,unreadReactions:c?o.unreadReactions:void 0,unreadMentions:c?o.unreadMentions:void 0,mentionsCount:c?o.unreadMentionsCount:void 0,unreadCount:c?o.unreadCount:void 0}}))((e=>{let{withScrollDown:t,canPost:a,messageListType:n,chatId:o,unreadCount:i,unreadReactions:r,unreadMentions:c,reactionsCount:d,mentionsCount:l,withExtraShift:u}=e;const{focusNextReply:m,focusNextReaction:h,focusNextMention:p,fetchUnreadReactions:g,readAllMentions:y,readAllReactions:f,fetchUnreadMentions:I}=(0,s.ko)(),A=(0,ht.li)(null),v=Boolean(d),b=Boolean(l);(0,ht.vJ)((()=>{v&&o&&!r?.length&&g({chatId:o})}),[o,g,v,r?.length]),(0,ht.vJ)((()=>{v&&o&&g({chatId:o})}),[o,g,v]),(0,ht.vJ)((()=>{b&&o&&!c?.length&&I({chatId:o})}),[o,I,b,c?.length]),(0,ht.vJ)((()=>{b&&o&&I({chatId:o})}),[o,I,b]);const w=(0,Et.A)((()=>{if(t)if("thread"===n)m();else{const e=A.current.parentElement.querySelector(".Transition_slide-active > .MessageList"),t=e.querySelectorAll(".message-list-item"),a=t[t.length-1];if(!a)return;(0,Rs.Ay)(e,a,"end",20)}})),S=(0,ft.A)("VWoOZCD5",(t||Boolean(d)||Boolean(l))&&"iozW83la",(Boolean(d)||Boolean(l))&&!t&&"UBa5kAK5",!a&&"yzzjqibi",!u&&"wDwOdyQH");return ht.Ay.createElement("div",{ref:A,className:S},ht.Ay.createElement(Ls,{icon:"heart-outline",ariaLabelLang:"AccDescrReactionMentionDown",onClick:h,onReadAll:f,unreadCount:d,className:(0,ft.A)("eO_Fz8SD",!v&&Js,!b&&"gn3iLVq1")}),ht.Ay.createElement(Ls,{icon:"mention",ariaLabelLang:"AccDescrMentionDown",onClick:p,onReadAll:y,unreadCount:l,className:!b&&Js}),ht.Ay.createElement(Ls,{icon:"arrow-down",ariaLabelLang:"AccDescrPageDown",onClick:w,unreadCount:i,className:"u62x81QI"}))})));var Ds=a(9718);function Vs(e){return"albumId"in e}function Gs(e,t,a,s){let n,o=[],i={originalDate:e[0].date,datetime:(0,de.CS)(1e3*e[0].date),senderGroups:[o]};const r=[i];return e.forEach(((c,d)=>{c.isInAlbum?n?(n.messages.push(c),c.hasComments&&(n.commentsMessage=c),c.content.text&&!n.hasMultipleCaptions&&(n.captionMessage?(n.hasMultipleCaptions=!0,n.captionMessage=void 0):n.captionMessage=c)):n={albumId:c.groupedId,messages:[c],mainMessage:c,hasMultipleCaptions:!1}:(c.content.paidMedia?.extendedMedia.length||0)>1?o.push({albumId:`paid-${c.id}`,messages:[c],mainMessage:c,hasMultipleCaptions:!1,isPaidMedia:!0}):o.push(c);const l=e[d+1];!n||l&&l.groupedId&&l.groupedId===n.albumId||(o.push(n),n=void 0);const u=o[o.length-1];if(l){const e=(0,de.CS)(1e3*l.date);i.datetime!==e?(i={originalDate:l.date,datetime:e,senderGroups:[]},r.push(i),o=[],i.senderGroups.push(o)):(l.id===t||c.senderId!==l.senderId||c.isOutgoing!==l.isOutgoing||c.postAuthorTitle!==l.postAuthorTitle||(0,I._P)(c)&&!c.content.action?.phoneCall||(0,I._P)(l)&&!l.content.action?.phoneCall||c.inlineButtons||l.inlineButtons||l.date-c.date>600||a&&(c.id===a||u&&"mainMessage"in u&&u.mainMessage?.id===a)&&l.id!==a||s&&c.forwardInfo?.fromId!==l.forwardInfo?.fromId)&&(o=[],i.senderGroups.push(o))}})),r}var js=a(54464),qs=a(37859),zs=a(81686);var Hs=a(93545),_s=a(56133);var Ws=a(6413);const Ks=(0,ht.ph)((0,s.EK)(((e,t)=>{let{userId:a}=t;const{stickers:s}=e.stickers.greeting,n=(0,b.hds)(e,a);if(!n)return{};const o=(0,b.mBe)(e,a),i=(0,b.vGo)(e,a),r=(0,b.yHC)(e,n.id);return{defaultStickers:s,lastUnreadMessageId:r&&r.id!==n.lastReadInboxMessageId?r.id:void 0,connectionState:e.connectionState,currentMessageList:(0,b.Xf0)(e),businessIntro:i?.businessIntro,user:o}}))((e=>{let{defaultStickers:t,connectionState:a,lastUnreadMessageId:n,currentMessageList:o,businessIntro:i,user:r}=e;const{loadGreetingStickers:c,sendMessage:d,markMessageListRead:l}=(0,s.ko)(),u=(0,ta.A)(),m=(0,ht.li)(null),h=(0,ht.Kr)((()=>{if(i?.sticker)return i.sticker;if(!t?.length)return;const e=Math.floor(Math.random()*t.length);return t[e]}),[i?.sticker,t]);(0,ht.vJ)((()=>{t?.length||"connectionStateReady"!==a||c()}),[a,c,t]),(0,ht.vJ)((()=>{"connectionStateReady"===a&&n&&l({maxId:n})}),[a,l,n]);const p=(0,Et.A)((()=>{o&&d({sticker:{...h,isPreloadedGlobally:!0},messageList:o})})),g=i?.title||u("Conversation.EmptyPlaceholder"),y=i?.description||u("Conversation.GreetingText");return ht.Ay.createElement("div",{className:"osdROIcA"},ht.Ay.createElement("div",{className:"c3NtU3JZ"},ht.Ay.createElement("p",{className:"n2KO1cAv",dir:"auto"},g),ht.Ay.createElement("p",{className:"MVSedxKc",dir:"auto"},y),ht.Ay.createElement("div",{ref:m,className:"qsfxNv7L",onClick:p},h&&ht.Ay.createElement(Ws.A,{containerRef:m,sticker:h,size:160,shouldLoop:!0}))),i&&ht.Ay.createElement("div",{className:"WIbO6rja"},u("Chat.EmptyStateIntroFooter",(0,I.Yg)(r))))})));var $s=a(65843),Xs=a(55158);const Qs="zLLIV9Iw",Zs=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a}=t;const s=(0,b.yps)(e,a);let n,o=!1;if(s){const t=(0,b.vGo)(e,s.id);t?n=t.botInfo:o=!0}return{botInfo:n,isLoadingBotInfo:o}}))((e=>{let{botInfo:t,isLoadingBotInfo:a,isInMessageList:s}=e;const n=(0,ta.A)(),o=(0,is.A)(t?.photo?(0,I.Fi)(t.photo):void 0),i=(0,is.A)(t?.gif?(0,I.sC)(t.gif,"full"):void 0),r=t?.photo?(0,I.Xn)(t.photo):t?.gif?(0,I.NZ)(t.gif):void 0,c=t&&!t.description&&!t.gif&&!t.photo,{width:d,height:l}=r||{};if(!c&&!a||!s)return ht.Ay.createElement("div",{className:(0,ft.A)("sqThK406","empty")},a&&ht.Ay.createElement("span",null,n("Loading")),c&&!a&&ht.Ay.createElement("span",null,n("NoMessages")),t&&ht.Ay.createElement("div",{className:"XhDB6LWO",style:(0,Is.A)(d?`width: ${d}px`:void 0)},o&&ht.Ay.createElement("img",{className:Qs,src:o,width:d,height:l,alt:"Bot info"}),i&&ht.Ay.createElement($s.A,{canPlay:!0,className:Qs,src:i,loop:!0,disablePictureInPicture:!0,muted:!0,playsInline:!0,style:(0,Is.A)(Boolean(d)&&`width: ${d}px`,Boolean(l)&&`height: ${l}px`)}),r&&!o&&!i&&ht.Ay.createElement(Xs.A,{className:Qs,width:d,height:l,forceAspectRatio:!0}),t.description&&ht.Ay.createElement("div",{className:"lbMO1XqP"},ht.Ay.createElement("p",{className:"ELYpyMpR"},n("BotInfoTitle")),(0,ts.A)(t.description,["br","emoji","links"]))))})));var Ys=a(83414),en=a(5912);const tn=o.Ni?1e3:350;var an=a(63988),sn=a(5718),nn=a(95685),on=a(4457),rn=a(83868),cn=a(35049),dn=a(58734);function ln(e){if(!e||1!==e.extendedMedia.length)return{photo:void 0,video:void 0};const t=e.extendedMedia[0],a="mediaType"in t;return{photo:a?t.duration?void 0:t:t.photo,video:a?t.duration?t:void 0:t.video}}var un=a(35127);const mn={None:0,Top:1,Right:2,Bottom:4,Left:8};function hn(e,t){return e.reduce(((e,t)=>e+t),t)}function pn(e){const t={width:0,height:0};return e.forEach((e=>{let{dimensions:a,sides:s}=e;s&mn.Right&&(t.width=a.width+a.x),s&mn.Bottom&&(t.height=a.height+a.y)})),t}function gn(e,t,a,s,n){const o=function(e,t,a){const s=e[0].isOutgoing;return(t?e[0].content.paidMedia.extendedMedia.map((e=>"mediaType"in e?e:e.photo||e.video)):e.map((e=>(0,I.r_)(e).photo||(0,I.r_)(e).video))).filter(Boolean).map((e=>{const t=(0,un.yA)({media:e,isOwn:s,isMobile:a});return t.width/t.height}))}(s.messages,s.isPaidMedia,n),i=function(e){return e.map((e=>e>1.2?"w":e<.8?"n":"q")).join("")}(o),r=function(e){return e.reduce(((e,t)=>t+e),1)/e.length}(o),c=o.length,d=o.some((e=>e>2)),l=(0,M.w4)(e,t,!1,a,n)-(t?2.5:0)*M.$;let u;const m={ratios:o,proportions:i,averageRatio:r,maxWidth:l,minWidth:100,maxHeight:l,spacing:2};return u=c>=5||d?function(e){let{ratios:t,averageRatio:a,maxWidth:s,minWidth:n,spacing:o,maxHeight:i=4*s/3}=e;const r=function(e,t){return e.map((e=>t>1.1?(0,Es.qE)(e,1,2.75):(0,Es.qE)(e,.6667,1)))}(t,a),c=t.length,d=new Array(c),l=[],u=e=>{const t=[];let a=0;e.forEach((e=>{t.push(((e,t)=>{const a=hn(r.slice(e,e+t),0);return(s-(t-1)*o)/a})(a,e)),a+=e})),l.push({lineCounts:e,heights:t})};for(let e=1;e!==c;++e){const t=c-e;e<=3&&t<=3&&u([e,t])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t){const s=c-e-t;e<=3&&t<=(a<.85?4:3)&&s<=3&&u([e,t,s])}for(let e=1;e!==c-1;++e)for(let t=1;t!==c-e;++t)for(let a=1;a!==c-e-t;++a){const s=c-e-t-a;e<=3&&t<=3&&a<=3&&s<=4&&u([e,t,a,s])}let m,h=0;for(let e=0;e<l.length;e++){const{heights:t,lineCounts:a}=l[e],s=a.length,r=hn(t,0)+o*(s-1),c=Math.min(...t)<n?1.5:1,d=(()=>{for(let e=1;e!==s;++e)if(a[e-1]>a[e])return 1.5;return 1})(),u=Math.abs(r-i)*c*d;(!m||u<h)&&(m=l[e],h=u)}const p=m.lineCounts,g=m.heights,y=p.length;let f=0,I=0;for(let e=0;e!==y;++e){const t=p[e],a=g[e],n=Math.round(a);let i=0;for(let c=0;c!==t;++c){const l=mn.None|(0===e?mn.Top:mn.None)|(e===y-1?mn.Bottom:mn.None)|(0===c?mn.Left:mn.None)|(c===t-1?mn.Right:mn.None),u=r[f],m=c===t-1?s-i:Math.round(u*a);d[f]={dimensions:{x:i,y:I,width:m,height:n},sides:l},i+=m+o,++f}I+=n+o}return d}(m):2===c?function(e){const{ratios:t,proportions:a,averageRatio:s}=e;return"ww"===a&&s>1.4&&t[1]-t[0]<.2?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,o=Math.round(Math.min(a/t[0],Math.min(a/t[1],(n-s)/2)));return[{dimensions:{x:0,y:0,width:a,height:o},sides:mn.Left|mn.Top|mn.Right},{dimensions:{x:0,y:o+s,width:a,height:o},sides:mn.Left|mn.Bottom|mn.Right}]}(e):"ww"===a||"qq"===a?function(e){const{ratios:t,maxWidth:a,spacing:s,maxHeight:n}=e,o=(a-s)/2,i=Math.round(Math.min(o/t[0],Math.min(o/t[1],n)));return[{dimensions:{x:0,y:0,width:o,height:i},sides:mn.Top|mn.Left|mn.Bottom},{dimensions:{x:o+s,y:0,width:o,height:i},sides:mn.Top|mn.Right|mn.Bottom}]}(e):function(e){const{ratios:t,minWidth:a,maxWidth:s,spacing:n,maxHeight:o}=e,i=Math.round(1.5*a),r=Math.min(Math.round(Math.max(.4*(s-n),(s-n)/t[0]/(1/t[0]+1/t[1]))),s-n-i),c=s-r-n,d=Math.min(o,Math.round(Math.min(c/t[0],r/t[1])));return[{dimensions:{x:0,y:0,width:c,height:d},sides:mn.Top|mn.Left|mn.Bottom},{dimensions:{x:c+n,y:0,width:r,height:d},sides:mn.Top|mn.Right|mn.Bottom}]}(e)}(m):3===c?function(e){const{proportions:t}=e;return"n"===t[0]?function(e){const{maxHeight:t,spacing:a,ratios:s,maxWidth:n,minWidth:o}=e,i=t,r=Math.round(Math.min((t-a)/2,s[1]*(n-a)/(s[2]+s[1]))),c=i-r-a,d=Math.max(o,Math.round(Math.min((n-a)/2,Math.min(r*s[2],c*s[1])))),l=Math.min(Math.round(i*s[0]),n-a-d);return[{dimensions:{x:0,y:0,width:l,height:i},sides:mn.Top|mn.Left|mn.Bottom},{dimensions:{x:l+a,y:0,width:d,height:c},sides:mn.Top|mn.Right},{dimensions:{x:l+a,y:c+a,width:d,height:r},sides:mn.Bottom|mn.Right}]}(e):function(e){const{maxWidth:t,ratios:a,maxHeight:s,spacing:n}=e,o=t,i=Math.round(Math.min(o/a[0],.66*(s-n))),r=(t-n)/2,c=Math.min(s-i-n,Math.round(Math.min(r/a[1],r/a[2]))),d=o-r-n;return[{dimensions:{x:0,y:0,width:o,height:i},sides:mn.Left|mn.Top|mn.Right},{dimensions:{x:0,y:i+n,width:r,height:c},sides:mn.Bottom|mn.Left},{dimensions:{x:r+n,y:i+n,width:d,height:c},sides:mn.Bottom|mn.Right}]}(e)}(m):function(e){const{proportions:t}=e;return"w"===t[0]?function(e){let{maxWidth:t,ratios:a,spacing:s,maxHeight:n,minWidth:o}=e;const i=t,r=Math.round(Math.min(i/a[0],.66*(n-s))),c=Math.round((t-2*s)/(a[1]+a[2]+a[3])),d=Math.max(o,Math.round(Math.min(.4*(t-2*s),c*a[1]))),l=Math.round(Math.max(Math.max(o,.33*(t-2*s)),c*a[3])),u=i-d-l-2*s,m=Math.min(n-r-s,c);return[{dimensions:{x:0,y:0,width:i,height:r},sides:mn.Left|mn.Top|mn.Right},{dimensions:{x:0,y:r+s,width:d,height:m},sides:mn.Bottom|mn.Left},{dimensions:{x:d+s,y:r+s,width:u,height:m},sides:mn.Bottom},{dimensions:{x:d+s+u+s,y:r+s,width:l,height:m},sides:mn.Right|mn.Bottom}]}(e):function(e){let{maxHeight:t,ratios:a,maxWidth:s,spacing:n,minWidth:o}=e;const i=t,r=Math.round(Math.min(i*a[0],.6*(s-n))),c=Math.round((t-2*n)/(1/a[1]+1/a[2]+1/a[3])),d=Math.round(c/a[1]),l=Math.round(c/a[2]),u=i-d-l-2*n,m=Math.max(o,Math.min(s-r-n,c));return[{dimensions:{x:0,y:0,width:r,height:i},sides:mn.Top|mn.Left|mn.Bottom},{dimensions:{x:r+n,y:0,width:m,height:d},sides:mn.Top|mn.Right},{dimensions:{x:r+n,y:d+n,width:m,height:l},sides:mn.Right},{dimensions:{x:r+n,y:d+l+2*n,width:m,height:u},sides:mn.Bottom|mn.Right}]}(e)}(m),{layout:u,containerStyle:pn(u)}}var yn=a(49746),fn=a(21488),In=a(9705),An=a(5130);let vn;const bn=new In.A;o.CM&&setTimeout((function(){vn||(vn=(0,An.U)(new Worker(new URL(a.p+a.u(667),a.b))),bn.resolve())}),4e3);var wn=a(672),Sn=a(84947);const Cn=new Map;const En=(0,y.nF)((function(e){const{updateChatDetectedLanguage:t}=(0,s.ko)(),a=Cn.get(e);if(!a)return;const n=a.size;if(n<8)return;let o=0,i=0;const r=new Map;for(const e of a.values()){e.isTranslatable&&o++,e.detectedLanguage&&i++;const t=e.detectedLanguage;if(t){const e=r.get(t)||0;r.set(t,e+1)}}if(o/n<.3||i/n<.6)return;t({chatId:e,detectedLanguage:Array.from(r.entries()).sort(((e,t)=>{let[,a]=e,[,s]=t;return s-a}))[0][0]})}),1e3);var Mn=a(79519),kn=a(64154);const Pn=3*M.$,Tn=Number(M.$),xn="data-is-document-group-hover";function Nn(e,t,a,n,i,r,c,d,l,u,m,h,p){const{updateDraftReplyInfo:g,sendDefaultReaction:y}=(0,s.ko)(),[f,I,A]=(0,Aa.A)(),[v,b,w]=(0,Aa.A)(),S=(0,ht.li)(),C=(0,wn.A)((e=>{const t=m.current;if(!t)return;const{clientX:a,clientY:s}=e,{x:n,width:o,y:i,height:r}=t.getBoundingClientRect(),c=n+o/2,d=i+r/2,l=Math.abs(c-a)<Pn,u=Math.abs(d-s)<Tn;l&&u?I():A()}),[m],yt.YS);return(0,ht.vJ)((()=>{if(!o.TF||n||!i||u||!p())return;let e;return(0,ra.wJ)(t.current,{selectorToPreventScroll:".MessageList",excludedClosestSelector:".no-word-wrap",onSwipe:(t,a)=>a===ra.ez.Left&&(e||(e=Date.now()),b(),!0),onRelease:()=>{e&&i&&(g({replyToMsgId:a}),setTimeout(w,Math.max(0,150-(Date.now()-e))),e=void 0)}})}),[t,n,a,b,w,i,u,p]),{handleMouseDown:n?void 0:function(e){(0,js.l)(e),d(e)},handleClick:function(t){if(n)e(t);else if(o.TF)return S.current?(clearInterval(S.current),S.current=void 0,void y({chatId:l,messageId:a})):void(S.current=setTimeout((()=>{S.current=void 0,function(e){if(o.Ni){const t=e.target;if(!t.classList.contains("text-content")&&!t.classList.contains("Message"))return;E.A.getIsKeyboardVisible()?setTimeout((()=>{c(e)}),350):c(e)}}(t)}),200))},handleContextMenu:n?r?rn.A:void 0:function(t){if(o.Ni){if(t.target.matches("a[href]")||u)return;t.preventDefault(),e()}else c(t)},handleDoubleClick:n?void 0:function(){!o.TF&&i&&g({replyToMsgId:a,replyToPeerId:void 0,quoteText:void 0})},handleContentDoubleClick:o.TF?void 0:function(e){e.stopPropagation()},handleMouseMove:C,handleSendQuickReaction:function(e){e.stopPropagation(),y({chatId:l,messageId:a})},handleMouseLeave:function(e){(0,yt.YS)(A),h&&function(e){const t=Un(e.currentTarget);t&&t.removeAttribute(xn)}(e)},isSwiped:v,isQuickReactionVisible:f,handleDocumentGroupMouseEnter:Bn}}function Bn(e){const t=Un(e.currentTarget);t&&t.setAttribute(xn,"")}function Un(e){let t=e;do{t=t.nextElementSibling}while(t&&!t.classList.contains("last-in-document-group"));return t}var Fn=a(65240),Rn=a(21849),Ln=a(44589),Jn=a(80999),On=a(91930),Dn=a(11217),Vn=a(18276);const Gn=e=>{let{story:t,sender:a,noUserColors:n,isProtected:o,observeIntersectionForLoading:i,onClick:r}=e;const{showNotification:c}=(0,s.ko)(),d=(0,ta.A)(),l=(0,ht.li)(null),u=(0,en.Vz)(l,i),m=t&&"content"in t,h=t&&"isDeleted"in t,p=m&&Boolean(t.content.video),g=m?"Story":h?"ExpiredStory":"Loading",y=(0,is.A)(m&&(0,I.EN)(t,"pictogram"),!u),f=p?t.content.video.thumbnail?.dataUri:void 0,A=y||f,v=a?(0,I.qg)(d,a):void 0,b=(0,Et.A)((()=>{t&&!h?r():c({message:d("StoryNotFound")})})),{handleClick:w,handleMouseDown:S}=(0,Dn.Q)(b);return ht.Ay.createElement("div",{ref:l,className:(0,ft.A)("EmbeddedMessage",(0,cn.y)(a,n,!0),A&&"with-thumb"),onClick:w,onMouseDown:S},A&&function(e,t){const{width:a,height:s}=(0,M.mr)();return ht.Ay.createElement("div",{className:"embedded-thumb"},ht.Ay.createElement("img",{src:e,width:a,height:s,alt:"",className:"pictogram",draggable:!1}),t&&ht.Ay.createElement("span",{className:"protector"}))}(A,o),ht.Ay.createElement("div",{className:"message-text with-message-color"},ht.Ay.createElement("p",{className:"embedded-text-wrapper"},h&&ht.Ay.createElement(Vn.A,{name:"story-expired",className:"embedded-origin-icon"}),m&&ht.Ay.createElement(Vn.A,{name:"story-reply",className:"embedded-origin-icon"}),d(g)),ht.Ay.createElement("div",{className:"message-title"},(0,ts.A)(v||" "))))};var jn=a(2578),qn=a(74936),zn=a(45603),Hn=a(90603),_n=a(38102);var Wn=a(61911);const Kn=1.125*M.$,$n=(0,ht.ph)((e=>{let{topic:t,className:a,onClick:s}=e;const n=(0,ta.A)();return ht.Ay.createElement("div",{className:(0,ft.A)("JldIqqof",a),style:`--topic-button-accent-color: var(${(0,Hn.Mt)(t?.iconColor)})`,onClick:s},t?ht.Ay.createElement(_n.A,{topic:t,size:Kn}):ht.Ay.createElement("img",{src:Wn,alt:"",draggable:!1}),t?.title?(0,ts.A)(t.title):n("Loading"),t?.isClosed&&ht.Ay.createElement("i",{className:"icon icon-lock"}),ht.Ay.createElement("i",{className:"icon icon-next"}))}));function Xn(e){return(0,ht.ph)((0,s.EK)(((e,t)=>{const{clickArg:a,noSelectControls:s}=t;return{isInSelectMode:!s&&(0,b.rTV)(e),isSelected:!s&&(0,b.H1_)(e,a)}}))((t=>{const{isInSelectMode:a,isSelected:n,dimensions:o,clickArg:i}=t,{toggleMessageSelection:r}=(0,s.ko)(),c=(0,Et.A)((e=>{e.stopPropagation(),r({messageId:i,withShift:e?.shiftKey})})),d=(0,ht.Kr)((()=>{const{dimensions:e,onClick:s}=t;return{...t,isInSelectMode:a,isSelected:n,dimensions:{...e,x:0,y:0},onClick:a?void 0:s}}),[t,a,n]);return ht.Ay.createElement("div",{className:(0,ft.A)("album-item-select-wrapper",n&&"is-selected"),style:o?`left: ${o.x}px; top: ${o.y}px;`:"",onClick:a?c:void 0},a&&ht.Ay.createElement("div",{className:"message-select-control"},n&&ht.Ay.createElement("i",{className:"icon icon-select"})),ht.Ay.createElement(e,d))})))}var Qn=a(51644),Zn=a(25477);const Yn=Xn(Qn.A),eo=Xn(Zn.A),to=(0,s.EK)((e=>{const t=(0,b.SJA)(e),a=(0,b.yuw)(e);return{theme:t,uploadsByKey:e.fileUploads.byMessageKey,activeDownloads:a}}))((e=>{let{album:t,observeIntersection:a,hasCustomAppendix:n,isOwn:o,isProtected:i,albumLayout:r,onMediaClick:c,uploadsByKey:d,activeDownloads:l,theme:u}=e;const{cancelUploadMedia:m}=(0,s.ko)(),{content:{paidMedia:h}}=t.mainMessage,g=t.isPaidMedia?h.extendedMedia.length:t.messages.length,y=(0,Et.A)((e=>{c(t.mainMessage.id,e)})),f=(0,Et.A)((e=>{c(e)})),A=(0,Et.A)((e=>{m({chatId:t.mainMessage.chatId,messageId:e})})),v=(0,ht.Kr)((()=>t.isPaidMedia?t.mainMessage.content.paidMedia.extendedMedia.map((()=>t.mainMessage)):t.messages),[t]),{width:w,height:S}=r.containerStyle;return ht.Ay.createElement("div",{className:"Album",style:`width: ${w}px; height: ${S}px;`},v.map((function(e,c){const m=t.isPaidMedia?e.content.paidMedia?.extendedMedia[c]:void 0,h=m&&"mediaType"in m?m:m?.photo,v=m&&"mediaType"in m?m:m?.video,w=h||(0,I.yl)(e),S=v||(0,I.r_)(e).video,C=d[(0,p.bj)(e)],E=C?.progress,{dimensions:M,sides:k}=r.layout[c],P=(0,b.wwb)((0,s.mS)(),e),T=(0,b.OEt)((0,s.mS)(),e);if(w){const s=n&&(o?c===g-1:Boolean(k&mn.Left&&k&mn.Bottom));return ht.Ay.createElement(Yn,{id:`album-media-${(0,I.GZ)(e.id,t.isPaidMedia?c:void 0)}`,photo:w,isOwn:o,observeIntersectionForLoading:a,canAutoLoad:P,shouldAffectAppendix:s,uploadProgress:E,dimensions:M,isProtected:i,clickArg:t.isPaidMedia?c:e.id,onClick:t.isPaidMedia?y:f,onCancelUpload:A,isDownloading:"extendedMediaPreview"!==w.mediaType&&(0,I.$r)(l,w),theme:u,noSelectControls:t.isPaidMedia})}if(S)return ht.Ay.createElement(eo,{id:`album-media-${(0,I.GZ)(e.id)}`,video:S,observeIntersectionForLoading:a,canAutoLoad:P,canAutoPlay:T,uploadProgress:E,dimensions:M,isProtected:i,clickArg:t.isPaidMedia?c:e.id,onClick:t.isPaidMedia?y:f,onCancelUpload:A,isDownloading:"extendedMediaPreview"!==S.mediaType&&(0,I.$r)(l,S),theme:u,noSelectControls:t.isPaidMedia})})))}));var ao=a(41733);const so=7*M.$;function no(e,t,a,n,i,r,c){const{interactWithAnimatedEmoji:d,sendEmojiInteraction:l,sendWatchingEmojiInteraction:u}=(0,s.ko)(),m=(0,ht.li)(null),h=(0,ht.li)(null),p=(0,is.A)(a?`document${a}`:void 0,!a),g=c||so,y=(0,Is.A)(`width: ${g}px`,`height: ${g}px`,r&&!o.cp&&"cursor: pointer"),f=(0,ht.li)(void 0),I=(0,ht.li)(void 0),A=(0,Et.A)((()=>{m.current&&(l({chatId:e,messageId:t,emoji:r,interactions:f.current}),I.current=void 0,f.current=void 0)})),v=(0,Et.A)((()=>{const e=h.current;p&&(e&&(e.pause(),e.remove()),h.current=new Audio,h.current.src=p,(0,ao.A)(h.current),h.current.addEventListener("ended",(()=>{h.current=void 0}),{once:!0}))})),b=(0,Et.A)((()=>{v();const a=m.current;if(!(r&&a&&t&&e))return;const{x:s,y:n}=a.getBoundingClientRect();d({emoji:r,x:s,y:n,startSize:g,isReversed:!i}),f.current||(f.current=[],I.current=performance.now(),setTimeout(A,1e3)),f.current.push(I.current?(performance.now()-I.current)/1e3:0)}));return(0,ht.vJ)((()=>{const a=m.current;a&&n&&n.forEach((s=>{let{id:n,startSize:o,messageId:c}=s;if(o||t!==c)return;const{x:d,y:l}=a.getBoundingClientRect();u({id:n,chatId:e,emoticon:r,startSize:g,x:d,y:l,isReversed:!i}),v()}))}),[n,e,r,i,t,v,u,g]),{ref:m,size:g,style:y,handleClick:b}}const oo=(0,ht.ph)((0,s.EK)(((e,t)=>{let{customEmojiId:a,withEffects:s}=t;const n=e.customEmojis.byId[a];return{sticker:n,effect:n?.emoji&&s?(0,b.Nr8)(e,n.emoji):void 0,soundId:n?.emoji&&(0,b.tKM)(e,n.emoji),noPlay:!(0,b.BWX)(e)}}))((e=>{let{isOwn:t,customEmojiId:a,messageId:s,chatId:n,activeEmojiInteractions:o,sticker:i,effect:r,soundId:c,noPlay:d,observeIntersection:l}=e;const{ref:u,size:m,style:h,handleClick:p}=no(n,s,c,o,t,r?.emoji,(0,dn.Rr)(1));return ht.Ay.createElement(La.A,{ref:u,documentId:a,className:(0,ft.A)("AnimatedEmoji media-inner",i?.id===M.AC&&"like-sticker-thumb"),style:h,size:m,isBig:!0,noPlay:d,withSharedAnimation:!0,forceOnHeavyAnimation:Boolean(r&&o?.length),observeIntersectionForLoading:l,onClick:p})})));var io=a(79577);const ro=(0,ht.ph)((0,s.EK)(((e,t)=>{let{emoji:a,withEffects:s}=t;return{sticker:(0,b.oei)(e,a),effect:s?(0,b.Nr8)(e,a):void 0,soundId:(0,b.tKM)(e,a)}}))((e=>{let{isOwn:t,observeIntersection:a,forceLoadPreview:s,messageId:n,chatId:o,activeEmojiInteractions:i,sticker:r,effect:c,soundId:d}=e;const{ref:l,size:u,style:m,handleClick:h}=no(o,n,d,i,t,c?.emoji),p=(0,en.Vz)(l,a);return ht.Ay.createElement(io.A,{sticker:r,size:u,quality:1,noLoad:!p,forcePreview:s,play:p,forceAlways:!0,ref:l,className:(0,ft.A)("AnimatedEmoji media-inner",r?.id===M.AC&&"like-sticker-thumb"),style:m,onClick:h})})));var co=a(93809),lo=a(68292);const uo=(0,ht.ph)((e=>{let{isCustomShape:t,threadInfo:a,disabled:n,isLoading:o}=e;const{openThread:i}=(0,s.ko)(),r=(0,co.A)([o],450),c=(0,ta.A)(),{originMessageId:d,chatId:l,messagesCount:u,lastMessageId:m,lastReadInboxMessageId:h,recentReplierIds:p,originChannelId:g}=a,y=(0,Et.A)((()=>{i({isComments:!0,chatId:l,originMessageId:d,originChannelId:g})})),f=(0,ht.Kr)((()=>{if(!p?.length)return;const e=(0,s.mS)();return p.map((t=>(0,b.PVB)(e,t))).filter(Boolean)}),[p]);if(void 0===u)return;const I=Boolean(h&&m&&h<m),A=u?c("CommentsCount","%COMMENTS_COUNT%",void 0,u).split("%").map((e=>"COMMENTS_COUNT"===e?ht.Ay.createElement(lo.A,{text:(0,qt.Vw)(u)}):e)):void 0;return ht.Ay.createElement("div",{"data-cnt":(0,qt.Vw)(u),className:(0,ft.A)("CommentButton",I&&"has-unread",n&&"disabled",t&&"CommentButton-custom-shape",o&&"loading"),dir:c.isRtl?"rtl":"ltr",onClick:y,role:"button",tabIndex:0},ht.Ay.createElement("i",{className:(0,ft.A)("CommentButton_icon-comments icon icon-comments-sticker",o&&r&&"CommentButton_hidden"),"aria-hidden":!0}),!f?.length&&ht.Ay.createElement("i",{className:"icon icon-comments","aria-hidden":!0}),Boolean(f?.length)&&ht.Ay.createElement("div",{className:"recent-repliers",dir:c.isRtl?"rtl":"ltr"},f.map((e=>ht.Ay.createElement(Rn.A,{key:e.id,size:"small",peer:e})))),ht.Ay.createElement("div",{className:"label",dir:"auto"},u?A:c("LeaveAComment")),ht.Ay.createElement("div",{className:"CommentButton_right"},o&&ht.Ay.createElement(ka.A,{className:(0,ft.A)("CommentButton_loading",!r&&"CommentButton_hidden"),color:t?"white":"blue"}),ht.Ay.createElement("i",{className:(0,ft.A)("CommentButton_icon-open icon icon-next",o&&r&&"CommentButton_hidden"),"aria-hidden":!0})))}));var mo=a(64713),ho=a(39877);function po(){return po=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},po.apply(this,arguments)}const go=(0,ht.ph)((function(e){let{peer:t,peerColor:a,noUserColors:s,shoudReset:n,className:o,emojiIconClassName:i,children:r,...c}=e;const d=a||t?.color;return ht.Ay.createElement("div",po({className:(0,ft.A)("nRjVJOQv",t&&(0,cn.y)(t,s,n),a&&(0,cn.a)(a),o)},c),d?.backgroundEmojiId&&ht.Ay.createElement(ho.A,{className:i,emojiDocumentId:d.backgroundEmojiId}),r)})),yo="ReDHhQHm";function fo(e){return e.firstName&&e.lastName?`${e.firstName} ${e.lastName}`:e.firstName?e.firstName:e.lastName?e.lastName:""}const Io=(0,s.EK)(((e,t)=>{let{contact:a}=t;const{countryList:{phoneCodes:s}}=e;return{user:(0,b.mBe)(e,a.userId),phoneCodeList:s}}))((e=>{let{contact:t,user:a,phoneCodeList:n,noUserColors:o}=e;const i=(0,ta.A)(),{openChat:r,openAddContactDialog:c,showNotification:l,openChatWithInfo:u}=(0,s.ko)(),{phoneNumber:m,userId:h}=t,p="0"!==h,g=p&&a&&(0,I.Gh)(a),y=(0,Et.A)((()=>{r({id:h})})),f=(0,Et.A)((()=>{c({userId:a?.id})})),A=(0,Et.A)((()=>{a?u({id:h}):((0,d.eM)(m),l({message:i("PhoneCopied")}))}));return ht.Ay.createElement(go,{noUserColors:o,peer:a,emojiIconClassName:"SjZYi3sJ",className:"AAHWWWvU"},ht.Ay.createElement("div",{className:"tpDpg82n",onClick:A},ht.Ay.createElement(Rn.A,{size:"large",peer:a,text:fo(t)}),ht.Ay.createElement("div",{className:"fpYynE5s"},ht.Ay.createElement("div",{className:"_PNTJc_V"},a?(0,I.Yg)(a):fo(t)),ht.Ay.createElement("div",{className:"JP_3wes8"},(0,mo.Ox)(n,m)))),p&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:"_OSJcuqH"}),ht.Ay.createElement("div",{className:"Blui4M4G"},ht.Ay.createElement(aa.A,{isText:!0,color:"translucent",ripple:!0,onClick:y,className:yo},i("SharedContactMessage")),g&&ht.Ay.createElement(aa.A,{isText:!0,color:"translucent",ripple:!0,onClick:f,className:yo},i("SharedContactAdd")))))}));var Ao=a(19381),vo=a(18501),bo=a(57675),wo=a(32581);const So={color:0},Co=(0,ht.ph)((e=>{let{factCheck:t,isToggleDisabled:a}=e;const s=(0,ta.A)(),n=(0,ht.li)(null),o=(0,ht.li)(null),{isCollapsed:i,isCollapsible:r,setIsCollapsed:c}=(0,bo.A)(n,4,o),d=(0,ht.Kr)((()=>{if(t.countryCode&&s.code)return new Intl.DisplayNames([s.code],{type:"region"}).of(t.countryCode)}),[t.countryCode,s.code]),l=!a&&i,u=(0,Et.A)((()=>{c(!1)})),m=(0,Et.A)((()=>{c((e=>!e))}));if(t.text)return ht.Ay.createElement(go,{peerColor:So,className:"HMB5LgeX",onClick:l?u:void 0},ht.Ay.createElement("div",{ref:o,className:(0,ft.A)("nfCzKu78",i&&"hYzpXwTM")},ht.Ay.createElement("div",{className:"vZnCPl3t"},s("FactCheck")),ht.Ay.createElement("div",{ref:n,className:"k_dGolcu"},(0,vo.f)({text:t.text.text,entities:t.text.entities})),ht.Ay.createElement(wo.A,{className:"qRaSs5iA"}),ht.Ay.createElement("div",{className:"EDmr0wJG"},s("FactCheckFooter",d))),r&&ht.Ay.createElement("div",{className:(0,ft.A)("mxPizZpR",!a&&"Cj2cLczd"),onClick:a?void 0:m,"aria-hidden":!0},ht.Ay.createElement(Vn.A,{name:i?"down":"up"})))})),Eo=(0,ht.ph)((e=>{let{message:t,canAutoLoadMedia:a}=e;const{clickBotInlineButton:n}=(0,s.ko)(),o=t.content.game,{title:i,description:r}=o,c=(0,I.zb)(o),d=(0,I.ih)(o),l=(0,is.A)(c,!a),u=(0,is.A)(d,!a);return ht.Ay.createElement("div",{className:"Game"},ht.Ay.createElement("div",{className:"preview",style:"width: 480px; height: 270px",onClick:()=>{n({messageId:t.id,button:t.inlineButtons[0][0]})}},!l&&!u&&ht.Ay.createElement(Xs.A,{className:"skeleton preview-content"}),l&&ht.Ay.createElement("img",{className:"preview-content",src:l,alt:i,draggable:!1}),u&&ht.Ay.createElement("video",{className:"preview-content",playsInline:!0,muted:!0,disablePictureInPicture:!0,autoPlay:!0,loop:!0,src:u})),ht.Ay.createElement("div",{className:"title"},i),!(0,I.P5)(t)&&ht.Ay.createElement("div",{className:"description"},r))}));var Mo=a(70636),ko=a(52491),Po=a(42186),To=a(64489),xo=a(94189);const No="ogvcv3mr",Bo="MSFa9BPf",Uo="HfZ6SuLI",Fo="rPyyNYxK",Ro="FV70u896",Lo=(0,ht.ph)((0,s.EK)(((e,t)=>{let{message:a}=t;const{giveaway:s}=a.content,n=(0,b.hds)(e,a.chatId);return{chat:n,sender:(0,b.hds)(e,s?.channelIds[0])||(0,b.Szq)(e,a)||n,giftSticker:s&&(0,b.t0O)(e,s.months),canPlayAnimatedEmojis:(0,b.BWX)(e)}}))((e=>{let{chat:t,sender:a,message:n,canPlayAnimatedEmojis:o,giftSticker:i}=e;const{openChat:r}=(0,s.ko)(),c=(0,ht.li)(!1),[d,l]=(0,ht.J0)(),u=(0,ta.A)(),{giveaway:m,giveawayResults:h}=n.content,p=Boolean(h),{months:g,untilDate:y,prizeDescription:A}=m||h,v=(0,I.Ie)(n),b=p?h.winnersCount:m.quantity,w=(0,ve.Fm)()>y,S=(0,ht.Kr)((()=>{if(p)return;const e=new Intl.DisplayNames([u.code,"en"].filter(Boolean),{type:"region"});return m?.countries?.map((t=>`${(0,ko.D0)(t)} ${e.of(t)}`)).join(", ")}),[m,p,u.code]),C=(0,Et.A)((e=>{r({id:e})})),E=(0,Et.A)((async()=>{if(c.current)return;c.current=!0;const e=await(0,f.px)("fetchGiveawayInfo",{peer:t,messageId:n.id});l(e),c.current=!1})),M=(0,Et.A)((()=>{l(void 0)})),k=(0,ht.Kr)((()=>{if(d)return u("results"===d.type?"BoostingGiveawayEnd":"BoostingGiveAwayAbout")}),[d,u]);return ht.Ay.createElement("div",{className:"CbpKtOey"},ht.Ay.createElement("div",{className:(0,ft.A)("hjjKhvVv",p&&"JEiR48jJ")},p?ht.Ay.createElement(To.A,{size:150,tgsUrl:Po.w.PartyPopper,nonInteractive:!0,noLoop:!0}):ht.Ay.createElement(io.A,{sticker:i,play:o&&w,noLoop:!0,nonInteractive:!0,size:175}),ht.Ay.createElement("span",{className:"n_QCMv_A"},`x${b}`)),p?function(e){const t=e.winnerIds;return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:Bo},ht.Ay.createElement("strong",{className:No},(0,ts.A)(u("BoostingGiveawayResultsMsgWinnersSelected"),["simple_markdown"])),ht.Ay.createElement("p",{className:Uo},(0,ts.A)(u("BoostingGiveawayResultsMsgWinnersTitle",t.length),["simple_markdown"])),ht.Ay.createElement("strong",{className:No},u("lng_prizes_results_winners")),ht.Ay.createElement("div",{className:Fo},t.map((e=>ht.Ay.createElement(wa.A,{peerId:e,forceShowSelf:!0,fluid:!0,withPeerColors:!v,className:Ro,clickArg:e,onClick:C}))))),ht.Ay.createElement("div",{className:Bo},ht.Ay.createElement("p",{className:Uo},u("BoostingGiveawayResultsMsgAllWinnersReceivedLinks"))))}(h):function(e){const t=e.channelIds;return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:Bo},ht.Ay.createElement("strong",{className:No},(0,ts.A)(u("BoostingGiveawayPrizes"),["simple_markdown"])),A&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("p",{className:Uo},(0,ts.A)(u("BoostingGiveawayMsgPrizes",[b,A],void 0,b),["simple_markdown"])),ht.Ay.createElement(wo.A,null,u("BoostingGiveawayMsgWithDivider"))),ht.Ay.createElement("p",{className:Uo},(0,ts.A)(u("Chat.Giveaway.Info.Subscriptions",b),["simple_markdown"]),ht.Ay.createElement("br",null),(0,ts.A)(u("ActionGiftPremiumSubtitle",u("Chat.Giveaway.Info.Months",g)),["simple_markdown"]))),ht.Ay.createElement("div",{className:Bo},ht.Ay.createElement("strong",{className:No},(0,ts.A)(u("BoostingGiveawayMsgParticipants"),["simple_markdown"])),ht.Ay.createElement("p",{className:Uo},(0,ts.A)(u("BoostingGiveawayMsgAllSubsPlural",t.length),["simple_markdown"])),ht.Ay.createElement("div",{className:Fo},t.map((e=>ht.Ay.createElement(wa.A,{peerId:e,forceShowSelf:!0,fluid:!0,withPeerColors:!v,className:Ro,clickArg:e,onClick:C})))),S&&ht.Ay.createElement("span",null,(0,ts.A)(u("Chat.Giveaway.Message.CountriesFrom",S)))),ht.Ay.createElement("div",{className:Bo},ht.Ay.createElement("strong",{className:No},(0,ts.A)(u("BoostingWinnersDate"),["simple_markdown"])),ht.Ay.createElement("p",{className:Uo},(0,de.L2)(1e3*y,u.code,!0))))}(m),ht.Ay.createElement(aa.A,{className:"jMBw7STU",color:"adaptive",size:"smaller",onClick:E},u("BoostingHowItWork")),ht.Ay.createElement(xo.A,{isOpen:Boolean(d),isOnlyConfirm:!0,title:k,confirmHandler:M,onClose:M},function(){if(!a||!d)return;const e="results"===d.type,t=(0,Mo.vj)(a)?(0,I.Js)(u,a):(0,I.Yg)(a),n=u("Chat.Giveaway.Info.Months",g),o=(0,de.U)(u,1e3*y),i=m?.channelIds?m.channelIds.length-1:0,r=u("Chat.Giveaway.Info.OtherChannels",i),c=i>0,l=u(e?"BoostingGiveawayHowItWorksTextEnd":"BoostingGiveawayHowItWorksText",[t,b,n],void 0,b),h=A?u("BoostingGiveawayHowItWorksIncludeText",[t,b,A],void 0,b):void 0;let p="";p=e?c?"BoostingGiveawayHowItWorksSubTextSeveralEnd":"BoostingGiveawayHowItWorksSubTextEnd":c?"BoostingGiveawayHowItWorksSubTextSeveral":"BoostingGiveawayHowItWorksSubText";let f=u(p,[o,b,t,i],void 0,b);e&&d.activatedCount&&(f+=` ${u("BoostingGiveawayUsedLinksPlural",d.activatedCount)}`);let v="";e&&(v=d.isRefunded?u("BoostingGiveawayCanceledByPayment"):u(d.isWinner?"BoostingGiveawayYouWon":"BoostingGiveawayYouNotWon"));let w="";if(e);else if(d.disallowedCountry)w=u("BoostingGiveawayNotEligibleCountry");else if(d.adminDisallowedChatId){const e=(0,s.mS)().chats.byId[d.adminDisallowedChatId],t=e&&(0,I.Js)(u,e);w=u("BoostingGiveawayNotEligibleAdmin",t)}else if(d.joinedTooEarlyDate){const e=(0,de.U)(u,1e3*d.joinedTooEarlyDate);w=u("BoostingGiveawayNotEligible",e)}else w=d.isParticipating?c?u("Chat.Giveaway.Info.ParticipatingMany",[t,i]):u("Chat.Giveaway.Info.Participating",t):c?u("Chat.Giveaway.Info.NotQualifiedMany",[t,r,o]):u("Chat.Giveaway.Info.NotQualified",[t,o]);return ht.Ay.createElement(ht.Ay.Fragment,null,v&&ht.Ay.createElement("p",{className:"ZQ4aVVkI"},(0,ts.A)(v,["simple_markdown"])),ht.Ay.createElement("p",null,(0,ts.A)(l,["simple_markdown"])),h&&ht.Ay.createElement("p",null,(0,ts.A)(h,["simple_markdown"])),ht.Ay.createElement("p",null,(0,ts.A)(f,["simple_markdown"])),w&&ht.Ay.createElement("p",null,(0,ts.A)(w,["simple_markdown"])))}()))})));var Jo=a(85449);const Oo=(0,ht.ph)((e=>{let{message:t,onClick:a}=e;const s=(0,ta.A)(),o=(0,ht.Kr)((()=>{const e=[];return t.inlineButtons.forEach((t=>{e.push(t.map((e=>(0,Jo.A)(s,e))))})),e}),[s,t.inlineButtons]);return ht.Ay.createElement("div",{className:"InlineButtons"},t.inlineButtons.map(((e,s)=>ht.Ay.createElement("div",{className:"row"},e.map(((e,i)=>ht.Ay.createElement(aa.A,{size:"tiny",ripple:!0,disabled:"unsupported"===e.type,onClick:()=>a({messageId:t.id,button:e})},ht.Ay.createElement("span",{className:"inline-button-text"},o[s][i]),(e=>{const{type:t}=e;switch(t){case"url":if(!n.OFc.test(e.url))return ht.Ay.createElement(Vn.A,{className:"corner-icon",name:"arrow-right"});break;case"urlAuth":return ht.Ay.createElement(Vn.A,{className:"corner-icon",name:"arrow-right"});case"buy":case"receipt":return ht.Ay.createElement(Vn.A,{className:"corner-icon",name:"card"});case"switchBotInline":return ht.Ay.createElement(Vn.A,{className:"corner-icon",name:"share-filled"});case"webView":case"simpleWebView":return ht.Ay.createElement(Vn.A,{className:"corner-icon",name:"webapp"})}})(e))))))))}));var Do=a(40435),Vo=a(67749);const Go=(0,ht.ph)((e=>{let{message:t,shouldAffectAppendix:a,isInSelectMode:s,isSelected:o,theme:i,forcedWidth:r}=e;const c=(0,ht.li)(null),d=(0,ta.A)(),l=(0,I.NO)(t),{title:u,text:m,amount:h,currency:p,isTest:g,photo:y}=l,f=(0,is.A)((0,I.cy)(y)),A=Boolean(r),v=(0,Vo.A)(f,!A);(0,qs.A)((e=>{let[t]=e;if(a){if(f){const e=c.current.closest(n.KFG);(0,Do.A)(f,!1,o,i).then((t=>{(0,yt.RK)((()=>{e.style.setProperty("--appendix-bg",t),e.setAttribute(n.D3G,"")}))}))}}else t&&c.current.closest(n.KFG).removeAttribute(n.D3G)}),[a,f,s,o,i]);const b=r||y?.dimensions?.width,w=(0,Is.A)(y?.dimensions&&`width: ${b}px`,y?.dimensions&&`aspect-ratio: ${y.dimensions.width} / ${y.dimensions.height}`,Boolean(!y?.dimensions&&r)&&`width: ${r}px`);return ht.Ay.createElement("div",{ref:c,className:"Invoice"},u&&ht.Ay.createElement("p",{className:"title"},(0,ts.A)(u)),m&&ht.Ay.createElement("div",null,(0,ts.A)(m,["emoji","br"])),ht.Ay.createElement("div",{className:"description "+(y?"has-image":"")},Boolean(y)&&ht.Ay.createElement("div",{className:"invoice-image-container"},A&&ht.Ay.createElement("canvas",{ref:v,className:"thumbnail blurred-bg"}),f&&ht.Ay.createElement("img",{className:"invoice-image",src:f,alt:"",style:w,crossOrigin:"anonymous",draggable:!1}),!f&&y&&ht.Ay.createElement(Xs.A,{width:b,height:y.dimensions?.height,forceAspectRatio:!0})),ht.Ay.createElement("p",{className:"description-text"},(0,mt.v)(h,p,d.code,{iconClassName:"invoice-currency-icon"}),g&&ht.Ay.createElement("span",{className:"test-invoice"},d("PaymentTestInvoice")))))}));var jo=a(27860);const qo={root:"dCK8GQ_8",duration:"CWT8ZMwV",buy:"C38zhCDM",spoiler:"CG55VZP1"},zo=(0,ht.ph)((e=>{let{message:t,isConnected:a}=e;const{openInvoice:n,loadExtendedMedia:o}=(0,s.ko)(),i=(0,ta.A)(),r=(0,I.NO)(t),{chatId:c,id:d}=t,l=(0,Et.A)((()=>{o({chatId:c,ids:[d]})}));(0,bt.A)(l,a?3e4:void 0);const{amount:u,currency:m,extendedMedia:h}=r,{width:p,height:g,thumbnail:y,duration:f}=h,A=(0,Et.A)((()=>{n({type:"message",chatId:c,messageId:d,isExtendedMedia:!0})}));return ht.Ay.createElement("div",{className:(0,ft.A)(qo.root,"media-inner"),onClick:A},ht.Ay.createElement(jo.A,{thumbDataUri:y?.dataUri,width:p,height:g,isVisible:!0,className:qo.spoiler}),Boolean(f)&&ht.Ay.createElement("div",{className:qo.duration},(0,de.QO)(f)),ht.Ay.createElement("div",{className:qo.buy},ht.Ay.createElement("i",{className:(0,ft.A)("icon","icon-lock",qo.lock)}),i("Checkout.PayPrice",(0,mt.A)(u,m))))}));var Ho=a(47526),_o=a(38691);const Wo=a.p+"map-pin.899635f6fe777c28998a.svg",Ko=24*Math.PI,$o=1e-4,Xo={width:400,height:300,zoom:16};function Qo(){return ht.Ay.createElement("svg",{className:"round-pin",style:"enable-background:new 0 0 64 64",viewBox:"0 0 64 64"},ht.Ay.createElement("circle",{cx:"32",cy:"32",r:"24.5"}),ht.Ay.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"}),ht.Ay.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"}),ht.Ay.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 Zo=(0,ht.ph)((e=>{let{message:t,peer:a}=e;const{openMapModal:n}=(0,s.ko)(),o=(0,ht.li)(null),i=(0,ht.li)(null),r=(0,ta.A)(),c=(0,St.A)(),d=(0,I.fB)(t),{mediaType:l,geo:u}=d,m=(0,ve.Fm)(),h=(0,I.vz)(t),p="geoLive"!==l||h?void 0:t.date+d.period-m,[g,y]=(0,ht.J0)(u),f="venue"===l||"geoLive"===l&&!h,{width:A,height:v,zoom:b}=Xo,w=(0,_o.A)(),S=(0,I.rt)(g,A,v,b,w),C=(0,is.A)(S),E=(0,ws.A)(C,!0),M=C||E,k=(0,ht.Kr)((()=>{if("geoLive"!==l||!g.accuracyRadius)return 0;const{lat:e,accuracyRadius:t}=g;return t/(0,Ho._u)(e,b)}),[l,g,b]),P=(0,Et.A)((e=>{if("geoLive"!==l)return;const a=e.lastElementChild,s=e.firstElementChild,n=t.date+d.period-(0,ve.Fm)(),o=(1-n/d.period)*Ko,i=(0,de.dq)(r,1e3*n);s.textContent=i,a.firstElementChild.setAttribute("stroke-dashoffset",`-${o}`)}));return(0,ht.Nf)((()=>{i.current&&P(i.current)}),[P]),(0,ht.vJ)((()=>{Math.abs(u.lat-g.lat)<$o&&Math.abs(u.long-g.long)<$o?g.accuracyRadius!==u.accuracyRadius&&y({...g,accuracyRadius:u.accuracyRadius}):y(u)}),[u,g]),(0,wt.A)((()=>{c()}),h?void 0:1e3*(p||0)),(0,bt.A)((()=>{(0,yt.RK)((()=>{const e=i.current;e&&P(e)}))}),p?1e3:void 0),ht.Ay.createElement("div",{ref:o,className:"Location media-inner interactive",onClick:()=>{n({geoPoint:g,zoom:b})}},ht.Ay.createElement("div",{className:"map-wrapper"},M?ht.Ay.createElement("img",{className:"full-media map",src:M,alt:"Location on a map",draggable:!1,style:`width: ${Xo.width}px; height: ${Xo.height}px;`}):ht.Ay.createElement(Xs.A,{width:A,height:v}),function(){if(M)return ht.Ay.createElement(ht.Ay.Fragment,null,Boolean(k)&&!h&&ht.Ay.createElement("div",{className:"location-accuracy",style:`width: ${2*k}px; height: ${2*k}px`}),function(){const e=(0,ft.A)("pin",l,h&&"expired");if("geoLive"===l)return ht.Ay.createElement("div",{className:e},ht.Ay.createElement(Qo,null),ht.Ay.createElement(Rn.A,{peer:a,className:"location-avatar"}),void 0!==d.heading&&ht.Ay.createElement("div",{className:"direction",style:`--direction: ${d.heading}deg`}));if("venue"===l){const t=(0,Ho.PP)(d.venueType),a=(0,Ho.KE)(d.venueType);if(a)return ht.Ay.createElement("div",{className:e,style:`--pin-color: ${t}`},ht.Ay.createElement(Qo,null),ht.Ay.createElement("img",{src:a,draggable:!1,className:"venue-icon",alt:""}))}return ht.Ay.createElement("img",{className:e,draggable:!1,src:Wo,alt:""})}())}()),function(){if(f)return"venue"===l?ht.Ay.createElement("div",{className:"location-info"},ht.Ay.createElement("div",{className:"location-info-title"},d.title),ht.Ay.createElement("div",{className:"location-info-subtitle"},d.address)):"geoLive"===l?ht.Ay.createElement("div",{className:"location-info"},ht.Ay.createElement("div",{className:"location-info-title"},r("AttachLiveLocation")),ht.Ay.createElement("div",{className:"location-info-subtitle"},(0,de.hI)(r,m,t.editDate)),!h&&ht.Ay.createElement("div",{className:"geo-countdown",ref:i},ht.Ay.createElement("span",{className:"geo-countdown-text"}),ht.Ay.createElement("svg",{width:"32px",height:"32px"},ht.Ay.createElement("circle",{cx:"16",cy:"16",r:12,className:"geo-countdown-progress",transform:"rotate(-90, 16, 16)","stroke-dasharray":Ko,"stroke-dashoffset":"0"})))):void 0}())})),Yo=function(e){let{isOwn:t}=e;const a=t?"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 ht.Ay.createElement("svg",{width:"9",height:"20",className:"svg-appendix"},ht.Ay.createElement("defs",null,ht.Ay.createElement("filter",{x:"-50%",y:"-14.7%",width:"200%",height:"141.2%",filterUnits:"objectBoundingBox",id:"messageAppendix"},ht.Ay.createElement("feOffset",{dy:"1",in:"SourceAlpha",result:"shadowOffsetOuter1"}),ht.Ay.createElement("feGaussianBlur",{stdDeviation:"1",in:"shadowOffsetOuter1",result:"shadowBlurOuter1"}),ht.Ay.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"}))),ht.Ay.createElement("g",{fill:"none","fill-rule":"evenodd"},ht.Ay.createElement("path",{d:a,fill:"#000",filter:"url(#messageAppendix)"}),ht.Ay.createElement("path",{d:a,fill:t?"#EEFFDE":"FFF",className:"corner"})))};var ei=a(97676),ti=a(45);const ai=(0,ht.ph)((e=>{let{message:t,outgoingStatus:a,signature:n,withReactionOffset:o,repliesThreadInfo:i,renderQuickReactionButton:r,noReplies:c,isTranslated:d,isPinned:l,withFullDate:u,effectEmoji:m,onClick:h,onTranslationClick:p,onEffectClick:g,onOpenThread:y}=e;const{showNotification:f}=(0,s.ko)(),I=(0,ta.A)(),[A,v]=(0,Aa.A)();function b(e){e.stopPropagation(),f({message:I("ImportedInfo")})}const w=(0,ht.Kr)((()=>{if(!A)return;const e=(0,de.L2)(1e3*t.date,I.code,void 0,I.timeFormat),a=t.isEdited&&(0,de.L2)(1e3*t.editDate,I.code,void 0,I.timeFormat),s=t.forwardInfo&&(0,de.L2)(1e3*(t.forwardInfo.savedDate||t.forwardInfo.date),I.code,void 0,I.timeFormat);let n=e;return a&&(n+="\n",n+=I("lng_edited_date").replace("{date}",a)),s&&(n+="\n",n+=I("lng_forwarded_date").replace("{date}",s)),n}),[A,I,t,I.timeFormat]),S=(0,ht.Kr)((()=>{const e=(0,de.fU)(I,1e3*t.date);return u?(0,de.be)(I,1e3*(t.forwardInfo?.date||t.date),!0):e}),[I,t.date,t.forwardInfo?.date,u]),C=(0,ft.A)("MessageMeta",o&&"reactions-offset",t.forwardInfo?.isImported&&"is-imported");return ht.Ay.createElement("span",{className:C,dir:I.isRtl?"rtl":"ltr",onClick:h,"data-ignore-on-paste":!0},m&&ht.Ay.createElement("span",{className:"message-effect-icon",onClick:g},(0,ts.A)(m)),d&&ht.Ay.createElement(Vn.A,{name:"language",className:"message-translated",onClick:p}),Boolean(t.viewsCount)&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("span",{className:"message-views"},(0,qt.Vw)(t.viewsCount)),ht.Ay.createElement(Vn.A,{name:"channelviews"})),!c&&Boolean(i?.messagesCount)&&ht.Ay.createElement("span",{onClick:function(e){e.stopPropagation(),y()},className:"message-replies-wrapper"},ht.Ay.createElement("span",{className:"message-replies"},ht.Ay.createElement(lo.A,{text:(0,qt.Vw)(i.messagesCount)})),ht.Ay.createElement(Vn.A,{name:"reply-filled"})),l&&ht.Ay.createElement(Vn.A,{name:"pinned-message",className:"message-pinned"}),n&&ht.Ay.createElement("span",{className:"message-signature"},(0,ts.A)(n)),ht.Ay.createElement("span",{className:"message-time",title:w,onMouseEnter:v},t.forwardInfo?.isImported&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("span",{className:"message-imported",onClick:b},(0,de.L2)(1e3*t.forwardInfo.date,I.code,!0)),ht.Ay.createElement("span",{className:"message-imported",onClick:b},I("ImportedMessage"))),t.isEdited&&`${I("EditedMessage")} `,S),a&&ht.Ay.createElement(ti.A,{status:a}),r&&r())})),si=(0,ht.ph)((e=>{let{phoneCall:t,message:a,chatId:n}=e;const{requestMasterAndRequestCall:i}=(0,s.ko)(),r=(0,ta.A)(),{isOutgoing:c,isVideo:d,reason:l,duration:u}=t,m="missed"===l,h="busy"===l||void 0===u,p=(0,Et.A)((()=>{i({isVideo:d,userId:n})})),g=(0,ht.Kr)((()=>d?m?c?"CallMessageVideoOutgoingMissed":"CallMessageVideoIncomingMissed":h?"CallMessageVideoIncomingDeclined":c?"CallMessageVideoOutgoing":"CallMessageVideoIncoming":m?c?"CallMessageOutgoingMissed":"CallMessageIncomingMissed":h?"CallMessageIncomingDeclined":c?"CallMessageOutgoing":"CallMessageIncoming"),[h,m,c,d]),y=(0,ht.Kr)((()=>t.duration?(0,de.zA)(r,t.duration):void 0),[r,t.duration]),f=(0,de.fU)(r,1e3*a.date);return ht.Ay.createElement("div",{className:"wqsZyy8u"},ht.Ay.createElement(aa.A,{size:"smaller",color:"translucent",round:!0,ripple:!0,onClick:p,className:"NGmo4ADz",disabled:!o.OL,ariaLabel:r(c?"CallAgain":"CallBack")},ht.Ay.createElement("i",{className:(0,ft.A)("icon",d?"icon-video-outlined":"icon-phone")})),ht.Ay.createElement("div",{className:"iFn6m6hd"},ht.Ay.createElement("div",{className:"l8QfocIQ"},r(g)),ht.Ay.createElement("div",{className:"rF5tkx92"},ht.Ay.createElement("i",{className:(0,ft.A)("icon","icon-arrow-right","ONmpzmUS",m&&"Alra_BWu",h&&"J7xsuCAm",!c&&"BfgDXljM")}),ht.Ay.createElement("span",{className:"kKPKwFzu"},y?r("CallMessageWithDuration",[f,y]):f))))}));var ni=a(98607);const oi=(0,ht.ph)((e=>{let{paidMedia:t,chatId:a,messageId:o,isOutgoing:i,children:r}=e;const{openInvoice:c}=(0,s.ko)(),d=(0,ta.A)(),l=!t.isBought,u=(0,ht.Kr)((()=>{const e=d("UnlockPaidContent",t.starsAmount);return(0,ni.i)(e,n.Cyx,ht.Ay.createElement(Ja.A,{className:"ywiOugiH",type:"gold",size:"adaptive"}))}),[d,t]),m=(0,Et.A)((e=>{c({type:"message",chatId:a,messageId:o}),(0,rn.A)(e)}));return ht.Ay.createElement("div",{className:"mVaSjZRJ",onClick:l?m:void 0},r,l&&ht.Ay.createElement(aa.A,{className:"GnKGu6D9",color:"dark",size:"tiny",fluid:!0,pill:!0},ht.Ay.createElement("span",{className:"gLaaVQXr"},u)),t.isBought&&ht.Ay.createElement("div",{className:(0,ft.A)("message-paid-media-status","IGXW5hWr")},i?(0,mt.v)(t.starsAmount,n.OUy):d("Chat.PaidMedia.Purchased")))}));var ii=a(26875),ri=a(77561),ci=a(21052),di=a(1087);function li(e,t){return t>0?(e/t*100).toFixed():0}const ui=e=>{let{answer:t,voteResults:a,totalVoters:s,maxVotersCount:n,correctResults:o,shouldAnimate:i}=e;const r=a&&a.find((e=>e.option===t.option)),c=0===o.length||-1!==o.indexOf(t.option),d=o.length>0&&c||r?.isChosen,l=r?li(r.votersCount,s||0):0,[u,m]=(0,ht.J0)(i?0:l),h=r?li(r.votersCount,n||0):0,p=u!==l;if((0,ht.vJ)((()=>{i&&m(l)}),[i,l]),!a||!r)return;const g=`width: ${h}%; transform:scaleX(${p?0:1})`;return ht.Ay.createElement("div",{className:"PollOption",dir:"ltr"},ht.Ay.createElement("div",{className:"poll-option-share "+("100"===l?"limit-width":"")},l,"%",d&&ht.Ay.createElement("span",{className:(0,ft.A)("poll-option-chosen",!c&&"wrong",i&&"animate")},ht.Ay.createElement("i",{className:(0,ft.A)("icon",c?"icon-check":"icon-close")}))),ht.Ay.createElement("div",{className:"poll-option-right"},ht.Ay.createElement("div",{className:"poll-option-text",dir:"auto"},(0,vo.f)({text:t.text.text,entities:t.text.entities})),ht.Ay.createElement("div",{className:(0,ft.A)("poll-option-answer",d&&!c&&"wrong")},i&&ht.Ay.createElement("svg",{className:"poll-line",style:p?"":"stroke-dasharray: 100% 200%; stroke-dashoffset: -44"},ht.Ay.createElement("path",{d:"M4.47 5.33v13.6a9 9 0 009 9h13"})),ht.Ay.createElement("div",{className:"poll-option-line",style:g}))))},mi=12*Math.PI;function hi(e){e.stopPropagation()}const pi=(0,ht.ph)((0,s.EK)(((e,t)=>{let{poll:a}=t;const{recentVoterIds:s}=a.results,{users:{byId:n}}=e;return s&&0!==s.length?{recentVoterIds:s,usersById:n}:{}}))((e=>{let{message:t,poll:a,recentVoterIds:n,observeIntersectionForLoading:o,observeIntersectionForPlaying:i,onSendVote:r}=e;const{loadMessage:c,openPollResults:d,requestConfetti:l}=(0,s.ko)(),{id:u,chatId:m}=t,{summary:h,results:p}=a,[g,y]=(0,ht.J0)(!1),[f,I]=(0,ht.J0)([]),[A,v]=(0,ht.J0)(!1),[b,w]=(0,ht.J0)(!1),[S,C]=(0,ht.J0)(!h.closed&&h.closeDate&&h.closeDate>0?Math.min(h.closeDate-(0,ve.Fm)(),h.closePeriod):0),E=(0,ht.li)(null),M=(0,ht.li)(null),{results:k,totalVoters:P}=p,T=k&&k.some((e=>e.isChosen)),x=!h.closed&&!T,N=!x&&h.isPublic&&Number(p.totalVoters)>0,B=x&&h.multipleChoice,U=k?Math.max(...k.map((e=>e.votersCount))):P,F=(0,ht.Kr)((()=>k?.filter((e=>e.isCorrect)).map((e=>e.option))||[]),[k]),R=(0,ht.Kr)((()=>h.answers.map((e=>({label:(0,vo.f)({text:e.text.text,entities:e.text.entities,observeIntersectionForLoading:o,observeIntersectionForPlaying:i}),value:e.option,hidden:Boolean(h.quiz&&h.closePeriod&&S<=0)})))),[S,o,i,h.answers,h.closePeriod,h.quiz]);(0,ht.vJ)((()=>{const e=a.results.results?.find((e=>e.isChosen));g&&e&&(e.isCorrect&&l({}),y(!1))}),[g,a.results.results,l]),(0,ht.Nf)((()=>{if(S>0&&setTimeout((()=>C(S-1)),1e3),!M.current)return;S<=5&&E.current.classList.add("hurry-up");const e=(h.closePeriod-S)/h.closePeriod*mi;M.current.setAttribute("stroke-dashoffset",`-${e}`)}),[S,h.closePeriod]),(0,ht.vJ)((()=>{h.quiz&&(S<=0||T&&!h.closed)&&c({chatId:m,messageId:u})}),[m,S,T,c,u,h.closed,h.quiz]),(0,ht.vJ)((()=>{let e;return h.quiz&&!h.closed&&h.closePeriod&&h.closePeriod>0&&(e=window.setTimeout((()=>{c({chatId:m,messageId:u})}),1e3*h.closePeriod)),()=>{e&&window.clearTimeout(e)}}),[x,m,c,u,h.closePeriod,h.closed,h.quiz]);const L=(0,ht.Kr)((()=>{const e=(0,s.mS)().chats.byId,t=(0,s.mS)().users.byId;return n?n.reduce(((a,s)=>{const n=e[s],o=t[s];return o?a.push(o):n&&a.push(n),a}),[]):[]}),[n]),J=(0,Et.A)((e=>{I([e]),y(!0),w(!0),r([e])})),O=(0,Et.A)((e=>{I(e)})),D=(0,Et.A)((()=>{y(!0),w(!0),r(f)})),V=(0,Et.A)((()=>{d({chatId:m,messageId:u})})),G=(0,Et.A)((()=>{v(!0)})),j=(0,Et.A)((()=>{v(!1),w(!1)}));(0,ht.vJ)((()=>{b&&T&&h.quiz&&p.results&&a.results.solution&&(p.results.find((e=>e.isChosen&&e.isCorrect))||v(!0))}),[T,b,p.results,h.quiz,a.results.solution]);const q=(0,ta.A)();return ht.Ay.createElement("div",{className:"Poll",dir:q.isRtl?"auto":"ltr"},A&&a.results.solution&&ht.Ay.createElement(ci.A,{message:(0,vo.f)({text:a.results.solution,entities:a.results.solutionEntities}),duration:5e3,onDismiss:j,containerId:"#middle-column-portals"}),ht.Ay.createElement("div",{className:"poll-question"},(0,vo.f)({text:h.question.text,entities:h.question.entities,observeIntersectionForLoading:o,observeIntersectionForPlaying:i})),ht.Ay.createElement("div",{className:"poll-type"},q(function(e){return void 0===e.isPublic?" ":e.closed?"FinalResults":e.quiz?e.isPublic?"QuizPoll":"AnonymousQuizPoll":e.isPublic?"PublicPoll":"AnonymousPoll"}(h)),L.length>0&&ht.Ay.createElement("div",{className:"poll-recent-voters"},ht.Ay.createElement(ii.A,{size:"micro",peers:L})),S>0&&x&&ht.Ay.createElement("div",{ref:E,className:"poll-countdown"},ht.Ay.createElement("span",null,(0,de.QO)(S)),ht.Ay.createElement("svg",{width:"16px",height:"16px"},ht.Ay.createElement("circle",{ref:M,cx:"8",cy:"8",r:6,className:"poll-countdown-progress",transform:"rotate(-90, 8, 8)","stroke-dasharray":mi,"stroke-dashoffset":"0"}))),h.quiz&&a.results.solution&&!x&&ht.Ay.createElement(aa.A,{round:!0,size:"tiny",color:"translucent",className:"poll-quiz-help",disabled:A,onClick:G,ariaLabel:"Show Solution"},ht.Ay.createElement("i",{className:"icon icon-lamp"}))),x&&ht.Ay.createElement("div",{className:"poll-answers",onClick:hi},B?ht.Ay.createElement(ri.A,{options:R,onChange:O,disabled:t.isScheduled||g,loadingOptions:g?f:void 0}):ht.Ay.createElement(di.A,{name:`poll-${u}`,options:R,onChange:J,disabled:t.isScheduled||g,loadingOption:g?f[0]:void 0})),!x&&ht.Ay.createElement("div",{className:"poll-results"},h.answers.map((function(e){return ht.Ay.createElement(ui,{key:e.option,shouldAnimate:b||!x,answer:e,voteResults:k,totalVoters:P,maxVotersCount:U,correctResults:F})}))),!N&&!B&&ht.Ay.createElement("div",{className:"poll-voters-count"},function(e,t,a){return a?e(t?"Answer":"Vote",a,"i"):e(t?"Chat.Quiz.TotalVotesEmpty":"Chat.Poll.TotalVotesResultEmpty")}(q,h.quiz,p.totalVoters)),B&&ht.Ay.createElement(aa.A,{isText:!0,disabled:0===f.length,size:"tiny",onClick:D},q("PollSubmitVotes")),N&&ht.Ay.createElement(aa.A,{isText:!0,size:"tiny",onClick:V},q("PollViewResults")))})));var gi=a(19129),yi=a(23470),fi=a(69988);const Ii=1.25*M.$,Ai=(0,ht.ph)((e=>{let{reaction:t,containerId:a,isOwnMessage:s,recentReactors:n,className:o,chosenClassName:i,shouldDelayInit:r,observeIntersection:c,onClick:d}=e;const l=(0,Et.A)((()=>{d?.(t.reaction)}));return ht.Ay.createElement(aa.A,{className:(0,ft.A)(fi.A.root,s&&fi.A.own,(0,I.eu)(t)&&fi.A.chosen,(0,I.eu)(t)&&i,o),size:"tiny",onClick:l},ht.Ay.createElement(yi.A,{className:fi.A.animatedEmoji,containerId:a,reaction:t.reaction,size:Ii,observeIntersection:c,shouldDelayInit:r}),n?.length?ht.Ay.createElement(ii.A,{size:"mini",peers:n}):ht.Ay.createElement(lo.A,{text:(0,qt.Vw)(t.count),className:fi.A.counter}))}));var vi=a(92915);const bi=(0,ht.ph)((e=>{let{message:t,threadId:a,isOutside:n,maxWidth:o,metaChildren:i,observeIntersection:r,noRecentReactors:c,isCurrentUserPremium:d,tags:l,getIsMessageListReady:u}=e;const{toggleReaction:m,updateMiddleSearch:h,performMiddleSearch:g,openPremiumModal:y}=(0,s.ko)(),f=(0,ta.A)(),{results:A,areTags:v,recentReactions:w}=t.reactions,S=(0,ht.Kr)((()=>A.reduce(((e,t)=>e+t.count),0)),[A]),C=(0,gi.A)(u),E=(0,ht.Kr)((()=>{const e=(0,s.mS)();return w?.reduce(((t,a)=>{const{reaction:s,peerId:n}=a,o=(0,I.Jj)(s),i=(0,b.PVB)(e,n);if(!i)return t;const r=t[o]||[];return r.push(i),t[o]=r,t}),{})}),[w]),M=(0,ht.Kr)((()=>{const e=(0,p.bj)(t);return A.map((t=>{const a=(0,I.Jj)(t.reaction),s=E?.[a],n=S>3||c,o=v?l?.[a]:void 0;return{reaction:t,reactionKey:a,messageKey:e,recentReactors:n?void 0:s,isChosen:(0,I.eu)(t),tag:o}}))}),[t,c,E,A,v,l,S]),k=(0,Et.A)((e=>{if(v)return d?(h({chatId:t.chatId,threadId:a,update:{savedTag:e}}),void g({chatId:t.chatId,threadId:a})):void y({initialSection:"saved_tags"});m({chatId:t.chatId,messageId:t.id,reaction:e})})),P=(0,Et.A)((e=>{m({chatId:t.chatId,messageId:t.id,reaction:e})}));return ht.Ay.createElement("div",{className:(0,ft.A)("Reactions",n&&"is-outside"),style:o?`max-width: ${o}px`:void 0,dir:f.isRtl?"rtl":"ltr"},M.map((e=>{let{reaction:a,recentReactors:s,messageKey:n,reactionKey:o,isChosen:i,tag:c}=e;return v?ht.Ay.createElement(vi.A,{key:o,className:"message-reaction",chosenClassName:"chosen",containerId:n,isOwnMessage:t.isOutgoing,isChosen:i,reaction:a.reaction,tag:c,withContextMenu:d,onClick:k,onRemove:P,observeIntersection:r,shouldDelayInit:!C}):ht.Ay.createElement(Ai,{key:o,className:"message-reaction",chosenClassName:"chosen",containerId:n,isOwnMessage:t.isOutgoing,recentReactors:s,reaction:a,onClick:k,observeIntersection:r,shouldDelayInit:!C})})),i)}));var wi=a(84555),Si=a(10221),Ci=a(18104),Ei=a(3325);const Mi="GydRBA08",ki=e=>{let{message:t,observeIntersection:a,observeIntersectionForPlaying:n,shouldLoop:i,shouldPlayEffect:c,withEffect:d,onStopEffect:l}=e;const{showNotification:u,openStickerSet:m}=(0,s.ko)(),h=(0,ta.A)(),{isMobile:p}=(0,F.Ay)(),g=(0,ht.li)(null),y=(0,ht.li)(null),f=t.content.sticker,{stickerSetInfo:A,isVideo:v,hasEffect:b}=f,w=!t.isOutgoing,S=f.isPreloadedGlobally?void 0:(0,I.Mw)(f,v&&!o.OF?"pictogram":"inline"),C=(0,en.Vz)(g,a),E=(0,en.Vz)(g,n),k=`sticker${f.id}?size=f`,P=(0,is.A)(k,!C||!b||!d,r.qZ.BlobUrl),[T,x,N]=(0,Aa.A)(),B=(0,Et.A)((()=>{N(),l?.()}));(0,ht.vJ)((()=>{b&&d&&E&&c&&x()}),[b,E,c,x,d]);const U=b&&d&&P&&T;(0,Si.A)({anchorRef:g,overlayRef:y,isMirrored:w,isDisabled:!U});const R=(0,Et.A)((()=>{m({stickerSetInfo:f.stickerSetInfo})})),L=(0,Et.A)((()=>{if(b){if(T||!d)return void u({message:h("PremiumStickerTooltip"),action:{action:"openStickerSet",payload:{stickerSetInfo:f.stickerSetInfo}},actionText:h("ViewAction")});if(d)return void x()}R()})),J="isMissing"in A,{width:O,height:D}=(0,M.bu)(f,p),V=(0,ft.A)("media-inner","FPceNkgD",J&&"hruUWBuj",b&&w&&Mi);return ht.Ay.createElement("div",{ref:g,className:V,style:`width: ${O}px; height: ${D}px;`,onClick:J?void 0:L},ht.Ay.createElement(Ws.A,{containerRef:g,sticker:f,fullMediaHash:S,fullMediaClassName:"full-media",size:O,shouldLoop:i,noLoad:!C,noPlay:!E,withSharedAnimation:!0}),U&&ht.Ay.createElement(Ei.A,null,ht.Ay.createElement(Ci.A,{ref:y,key:k,className:(0,ft.A)("WMMaWlOL",w&&Mi),tgsUrl:P,size:1.49*O,play:!0,isLowPriority:!0,noLoop:!0,onEnded:B})))};var Pi=a(70297);const Ti=(0,ht.ph)((0,s.EK)(((e,t)=>{let{message:a}=t;const{id:s,peerId:n}=a.content.storyData;return{story:(0,b.Msb)(e,n,s),isConnected:"connectionStateReady"===e.connectionState}}))((function(e){let{message:t,story:a,isProtected:s,isConnected:n}=e;const{storyData:o}=t.content;return ht.Ay.createElement(Pi.A,{story:a||o,isProtected:s,isConnected:n})}))),xi=(0,ht.ph)((0,s.EK)(((e,t)=>{let{message:a}=t;const{id:s,peerId:n}=a.content.storyData,o=(0,b._bp)(e,n)?.lastReadId;return{story:(0,b.Msb)(e,n,s),peer:(0,b.PVB)(e,n),targetUser:(0,b.mBe)(e,a.chatId),isUnread:Boolean(o&&o<s)}}))((function(e){let{message:t,story:a,peer:n,isUnread:o,targetUser:i}=e;const{openStoryViewer:r}=(0,s.ko)(),c=(0,ta.A)(),{storyData:d}=t.content,l=(0,Et.A)((()=>{r({peerId:a.peerId,storyId:a.id,isSinglePeer:!0,isSingleStory:!0})})),u=a&&"isDeleted"in a,m=a&&"content"in a,h=m?a.content.video:void 0,p=m?(0,I.EN)(a,"pictogram"):void 0,g=(0,is.A)(p)||h?.thumbnail?.dataUri;return(0,fn.A)(d.peerId,d.id,a),ht.Ay.createElement("div",{className:(0,ft.A)("action-message-story-mention",o&&"is-unread",m&&"with-preview"),tabIndex:0,role:"button",onClick:m?l:void 0},m&&ht.Ay.createElement("span",{className:"story-media-wrapper"},g&&ht.Ay.createElement("img",{src:g,alt:"",className:"story-media"})),ht.Ay.createElement("span",{className:"story-title"},(0,ts.A)(n&&"isSelf"in n&&n.isSelf?c(u?"ExpiredStoryMentioned":"StoryYouMentionedTitle",(0,I.u0)(i)):u?c("ExpiredStoryMention"):c("StoryMentionedTitle",(0,I.qg)(c,n)),["emoji","simple_markdown"])))})));var Ni=a(70314);const Bi=1.75*M.$,Ui=2.25*M.$,Fi=(0,ht.ph)((0,s.EK)(((e,t)=>{const{focusedMessage:a,forwardMessages:s,activeReactions:i,activeEmojiInteractions:c,loadingThread:d}=(0,b.nTw)(e),{message:l,album:u,withSenderName:m,withAvatar:h,threadId:g,messageListType:y,isLastInDocumentGroup:f,isFirstInGroup:A}=t,{id:v,chatId:w,viaBotId:S,isOutgoing:E,forwardInfo:M,transcriptionId:k,isPinned:P,viaBusinessBotId:T,effectId:x}=l,N=(0,b.hds)(e,w),B=(0,b.nZ4)(e,w),U=(0,I.kE)(w),F=(0,I.Qe)(w),R=N&&(0,I.WX)(N),L=N&&(0,I.YE)(N),J=(0,I.L8)(w)?void 0:(0,b.AWZ)(e,w),O=l.content.webPage?.story,D=O?(0,b.Msb)(e,O.peerId,O.id):void 0,V=s.messageIds&&s.messageIds.includes(v),G=!B&&(0,I.zP)(l),j=m||h||G,q=(0,b.Y7C)(e,l),z=(0,b.Szq)(e,l),H=S?(0,b.mBe)(e,S):void 0,_=q?.id&&L?J?.adminMembersById?.[q?.id]:void 0,W=l.id===g,{replyToMsgId:K,replyToPeerId:$,replyFrom:X}=(0,C.Q)(l)||{},{peerId:Q,storyId:Z}=(0,C.W)(l)||{},Y=K&&K===g,ee=K?(0,b.O5q)(e,$||w,K):void 0,te=M||X,ae=ee?(0,b.As8)(e,ee):!te||U||F?void 0:(0,b.HdA)(e,te),se=ee&&(0,b.Szq)(e,ee),ne=$?(0,b.hds)(e,$):void 0,oe=!U&&!F&&ne&&!(0,I.gA)(ne)&&(ne.isNotJoined||ne.isRestricted),ie="topicCreate"===ee?.content.action?.type,re=Z&&Q?(0,b.Msb)(e,Q,Z):void 0,ce=Q?(0,b.PVB)(e,Q):void 0,de=(0,b.ldX)(e,l),le="thread"===y&&(u?u.messages.some((t=>(0,b.nJv)(e,t,g))):(0,b.nJv)(e,l,g)),{direction:ue,noHighlight:me,isResizingContainer:he,quote:pe,scrollTargetPosition:ge}=le&&a||{},ye=(0,b.TCk)(e),fe=ye?.results?.query&&`${ye.isHashtag?"#":""}${ye.results.query}`,Ie=(0,I.wb)(l),Ae=Ie&&(0,b.oei)(e,Ie)?Ie:void 0,ve=(0,I.Jw)(l);let be;be=u?.messages?u.messages.every((t=>{let{id:a}=t;return(0,b.H1_)(e,a)})):(0,b.H1_)(e,v);const{canReply:we}="thread"===y&&(0,b.Plp)(e,l,g)||{},Se=(0,b.yuw)(e),Ce=(0,I.ed)(l),Ee=Ce&&(0,I.$r)(Se,Ce),Me=(0,b.Vw0)(e,w,u?.commentsMessage?.id||v),ke=Boolean(l.groupedId)&&!l.isInAlbum,Pe=ke?(0,b.D_S)(e,w,l.groupedId)[0]:void 0,Te=ke?f?(0,b.O5q)(e,w,Pe):void 0:l,xe=N?.unreadReactions?.includes(l.id),Ne=g===r.l3&&N?.isForum&&A,Be=Ne?(0,b.nkm)(e,l)||N?.topics?.[n.HxB]:void 0,Ue=(0,b.RnX)(e,w),Fe=(0,b.Rny)(e,w,l.id),Re=(0,b.qZq)(e,w),Le=o.CM&&e.settings.byKey.canTranslate&&!Re,Je="connectionStateReady"===e.connectionState,Oe=Boolean(Te&&i[(0,p.bj)(Te)]?.length),De=(0,b.g29)(e),Ve=q&&(0,b.nZ4)(e,q.id)?J?.boostsApplied??l.senderBoosts:l.senderBoosts,Ge=N?.boostLevel||0,je=e.appConfig?.groupTranscribeLevelMin,qe=De||Boolean(je&&Ge>=je),ze=T?(0,b.mBe)(e,T):void 0,He=x?e.availableEffectById[x]:void 0;return{theme:(0,b.SJA)(e),forceSenderName:G,sender:q,canShowSender:j,originSender:z,botSender:H,shouldHideReply:Y||ie,isThreadTop:W,replyMessage:ee,replyMessageSender:ae,replyMessageForwardSender:se,replyMessageChat:ne,replyStory:re,isReplyPrivate:oe,storySender:ce,isInDocumentGroup:ke,isProtected:(0,b.ynf)(e,l),isChatProtected:(0,b.ryq)(e,w),isFocused:le,isForwarding:V,reactionMessage:Te,isChatWithSelf:B,isRepliesChat:U,isAnonymousForwards:F,isChannel:R,isGroup:L,canReply:we,highlight:fe,animatedEmoji:Ae,animatedCustomEmoji:ve,isInSelectMode:(0,b.rTV)(e),isSelected:be,isGroupSelected:Boolean(l.groupedId)&&!l.isInAlbum&&(0,b.SLS)(e,w,l.groupedId),threadId:g,isDownloading:Ee,isPinnedList:"pinned"===y,isPinned:P,canAutoLoadMedia:(0,b.wwb)(e,l),canAutoPlayMedia:(0,b.OEt)(e,l),autoLoadFileMaxSizeMb:e.settings.byKey.autoLoadFileMaxSizeMb,shouldLoopStickers:(0,b.ML4)(e),repliesThreadInfo:Me,availableReactions:e.reactions.availableReactions,defaultReaction:(0,I.Nb)(l)||"scheduled"===y?void 0:(0,b.nTJ)(e,w),hasActiveReactions:Oe,activeEmojiInteractions:c,hasUnreadReaction:xe,isTranscribing:void 0!==k&&e.transcriptions[k]?.isPending,transcribedText:void 0!==k?e.transcriptions[k]?.text:void 0,isPremium:De,senderAdminMember:_,messageTopic:Be,hasTopicChip:Ne,chatTranslations:Ue,areTranslationsEnabled:Le,shouldDetectChatLanguage:(0,b.LRV)(e,w),requestedTranslationLanguage:Fe,requestedChatTranslationLanguage:Re,hasLinkedChat:Boolean(J?.linkedChatId),withAnimatedEffects:(0,b.xYJ)(e,"stickerEffects"),webPageStory:D,isConnected:Je,isLoadingComments:Me?.isCommentsInfo&&d?.loadingChatId===Me?.originChannelId&&d?.loadingMessageId===Me?.originMessageId,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,...E&&{outgoingStatus:(0,b.Tl2)(e,l,"scheduled"===y)},..."number"==typeof de&&{uploadProgress:de},...le&&{focusDirection:ue,noFocusHighlight:me,isResizingContainer:he,focusedQuote:pe,scrollTargetPosition:ge},senderBoosts:Ve,tags:e.savedReactionTags?.byKey,canTranscribeVoice:qe,viaBusinessBot:ze,effect:He}}))((e=>{let{message:t,observeIntersectionForBottom:a,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,album:l,noAvatars:u,withAvatar:m,withSenderName:h,noComments:p,noReplies:g,appearanceOrder:y,isJustAdded:f,isFirstInGroup:A,isPremium:v,isLastInGroup:b,isFirstInDocumentGroup:w,isLastInDocumentGroup:S,isTranscribing:E,transcribedText:k,isLastInList:P,theme:T,forceSenderName:x,sender:N,canShowSender:B,originSender:U,botSender:R,isThreadTop:L,shouldHideReply:J,replyMessage:O,replyMessageSender:D,replyMessageForwardSender:V,replyMessageChat:G,replyStory:j,isReplyPrivate:q,storySender:z,outgoingStatus:H,uploadProgress:_,isInDocumentGroup:W,isLoadingComments:K,isProtected:$,isChatProtected:X,isFocused:Q,focusDirection:Z,focusedQuote:Y,noFocusHighlight:ee,scrollTargetPosition:te,isResizingContainer:ae,isForwarding:se,isChatWithSelf:ne,isRepliesChat:oe,isAnonymousForwards:ie,isChannel:re,isGroup:ce,canReply:de,highlight:le,animatedEmoji:ue,animatedCustomEmoji:me,hasActiveReactions:he,hasLinkedChat:pe,isInSelectMode:ge,isSelected:ye,isGroupSelected:fe,threadId:Ie,reactionMessage:Ae,availableReactions:ve,defaultReaction:be,activeEmojiInteractions:we,messageListType:Se,isPinnedList:Ce,isPinned:Ee,isDownloading:Me,canAutoLoadMedia:ke,canAutoPlayMedia:Pe,shouldLoopStickers:Te,autoLoadFileMaxSizeMb:xe,repliesThreadInfo:Ne,hasUnreadReaction:Be,memoFirstUnreadIdRef:Ue,senderAdminMember:Fe,messageTopic:Re,hasTopicChip:Le,chatTranslations:Je,areTranslationsEnabled:Oe,shouldDetectChatLanguage:De,requestedTranslationLanguage:Ve,requestedChatTranslationLanguage:Ge,withAnimatedEffects:je,webPageStory:qe,isConnected:ze,getIsMessageListReady:He,shouldWarnAboutSvg:_e,senderBoosts:We,tags:Ke,canTranscribeVoice:$e,viaBusinessBot:Xe,effect:Qe,onPinnedIntersectionChange:Ze}=e;const{toggleMessageSelection:Ye,clickBotInlineButton:et,disableContextMenuHint:tt,animateUnreadReaction:at,focusLastMessage:st,markMentionsRead:nt}=(0,s.ko)(),ot=(0,ht.li)(null),it=(0,ht.li)(null),rt=(0,ht.li)(null),ct=(0,ht.li)(0),dt=(0,ta.A)(),[lt,ut]=(0,ht.J0)(!1),[mt,pt,gt]=(0,Aa.A)(),{isMobile:yt,isTouchScreen:It}=(0,F.Ay)();(0,en.mv)(it,a);const{isContextMenuOpen:At,contextMenuPosition:vt,contextMenuTarget:bt,handleBeforeContextMenu:wt,handleContextMenu:St,handleContextMenuClose:Mt,handleContextMenuHide:kt}=(0,ss.A)(ot,It&&ge,!o.cp,o.Ni,He);(0,ht.vJ)((()=>{At&&tt()}),[At,tt]);const Pt=y<=0,[xt,Nt]=(0,Aa.A)(Pt);(0,ht.vJ)((()=>{Pt||setTimeout(Nt,10*y)}),[y,Nt,Pt]);const{transitionClassNames:Bt}=(0,Tt.A)(xt||f,void 0,Pt&&!f,!1),{id:Ut,chatId:Ft,forwardInfo:Rt,viaBotId:Lt,isTranscriptionError:Jt,factCheck:Ot}=t;(0,ht.vJ)((()=>{if(!Ee)return;const e=l?l.mainMessage.id:Ut;return()=>{Ze({viewportPinnedIdsToRemove:[e],isUnmount:!0})}}),[l,Ee,Ut,Ze]);const Dt=(0,I.Nb)(t),Vt=(0,I.Ie)(t),Gt="scheduled"===Se||t.isScheduled,jt=(0,I.Tv)(t)&&!J,{paidMedia:qt}=(0,I.r_)(t),{photo:zt,video:Ht}=ln(qt),{photo:_t=zt,video:Wt=Ht,audio:Kt,voice:$t,document:Xt,sticker:Qt,contact:Zt,poll:Yt,webPage:ea,invoice:sa,location:na,action:oa,game:ia,storyData:ra,giveaway:ca,giveawayResults:da}=(0,I.r_)(t),la=(0,C.Q)(t),ua=(0,C.W)(t),ma=Boolean(ua),ha=Boolean(Ne)&&"thread"===Se,pa=(0,I.aN)(t),ga=pa&&(ue||me),ya=Ae?.reactions&&!(0,I.G)(Ae.reactions),fa=Rt&&(!ne||Gt)&&!oe&&!ie&&!Rt.isLinkedChannelPost&&!pa||Boolean(ra&&!ra.isMention),Ia=Boolean(We)&&!fa&&A,va=ra?.isMention,ba="video"===Wt?.mediaType&&Wt.isRound,wa=Boolean(l)&&(l.isPaidMedia&&qt.extendedMedia.length>1||l.messages.length>1)&&!l.messages.some((e=>0===Object.keys(e.content).length)),Sa=W&&!w,Ca=W&&!S,Ea=void 0!==vt,Ma=!(Ea||ge||se||Ca||va),ka=re&&!Gt&&t.isForwardingAllowed&&!X,Pa=Boolean(Ce||Rt&&(Rt.isChannelPost||ne&&!Vt||oe||ie)&&Rt.fromMessageId),Ta=Vt&&!pa,xa=Boolean(Ot?.text),Na=Le||jt||ma,Ba=(0,Et.A)(((e,t)=>{Ye({messageId:Ut,groupedId:t,...e?.shiftKey&&{withShift:!0},...wa&&{childMessageIds:l.messages.map((e=>{let{id:t}=e;return t}))}})})),Ua=B?N:void 0,Fa=Boolean(!lt&&(Jt||k)),Ra=Rt&&(ne||oe||ie||!Ua)?U:Ua,Oa=U||N,Da=Rt||ra?U:Ua,Va=(0,I.G5)(t),{handleMouseDown:Ga,handleClick:ja,handleContextMenu:qa,handleDoubleClick:za,handleContentDoubleClick:Ha,handleMouseMove:_a,handleSendQuickReaction:Wa,handleMouseLeave:Ka,isSwiped:$a,isQuickReactionVisible:Xa,handleDocumentGroupMouseEnter:Qa}=Nn(Ba,ot,Ut,Boolean(ge),Boolean(de),Boolean($),St,wt,Ft,Ea,rt,Ca,He),{handleAvatarClick:Za,handleSenderClick:Ya,handleViaBotClick:es,handleReplyClick:as,handleMediaClick:ns,handleAudioPlay:os,handleAlbumMediaClick:is,handlePhotoMediaClick:rs,handleVideoMediaClick:cs,handleMetaClick:ds,handleTranslationClick:ls,handleOpenThread:us,handleReadMedia:ms,handleCancelUpload:hs,handleVoteSend:ps,handleGroupForward:gs,handleForward:ys,handleFocus:fs,handleFocusForwarded:Is,handleDocumentGroupSelectAll:As,handleTopicChipClick:vs,handleStoryClick:bs}=function(e,t,a,n,o,i,d,l,u,m,h,p,g,y,f,I,A){const{openChat:v,showNotification:b,focusMessage:w,openMediaViewer:S,openAudioPlayer:E,markMessagesRead:M,cancelUploadMedia:k,sendPollVote:P,openForwardMenu:T,openChatLanguageModal:x,openThread:N,openStoryViewer:B,searchChatMediaMessages:U}=(0,s.ko)(),{id:F,forwardInfo:R,groupedId:L,content:{paidMedia:J}}=a,{replyToMsgId:O,replyToPeerId:D,replyToTopId:V,isQuote:G,quoteText:j}=(0,C.Q)(a)||{},q=(0,Et.A)((()=>{m&&v({id:m.id})})),z=(0,Et.A)((()=>{h?d&&R?.channelPostId?w({chatId:h.id,messageId:R.channelPostId}):v({id:h.id}):b({message:e("HidAccount")})})),H=(0,Et.A)((()=>{p&&v({id:p.id})})),_=(0,Et.A)((()=>{O&&!I?w({chatId:D||n,threadId:A?V:o,messageId:O,replyMessageId:D?void 0:F,noForumTopicPanel:!D,...G&&{quote:j?.text}}):b({message:e(G?"QuotePrivate":"ReplyPrivate")})})),W=(0,Et.A)((()=>{S({chatId:n,threadId:o,messageId:F,origin:l?c.TQ.ScheduledInline:c.TQ.Inline})})),K=(0,Et.A)((e=>{J&&!J.isBought||(e&&U({chatId:n,threadId:o,currentMediaMessageId:F}),S({chatId:n,threadId:o,messageId:F,origin:l?c.TQ.ScheduledInline:c.TQ.Inline,withDynamicLoading:e}))})),$=(0,Et.A)((()=>{K(!l&&!J)})),X=(0,Et.A)((()=>{const e=a.content?.video?.isGif;K(!e&&!l&&!J)})),Q=(0,Et.A)((()=>{E({chatId:n,messageId:F})})),Z=(0,Et.A)(((e,t)=>{J&&!J.isBought||(U({chatId:n,threadId:o,currentMediaMessageId:F}),S({chatId:n,threadId:o,messageId:e,mediaIndex:t,origin:l?c.TQ.ScheduledAlbum:c.TQ.Album,withDynamicLoading:!J}))})),Y=(0,Et.A)((()=>{M({messageIds:[F]})})),ee=(0,Et.A)((()=>{k({chatId:n,messageId:F})})),te=(0,Et.A)((e=>{P({chatId:n,messageId:F,options:e})})),ae=(0,Et.A)((()=>{T({fromChatId:n,groupedId:L})})),se=(0,Et.A)((()=>{if(u&&u.messages){const e=u.messages.map((e=>{let{id:t}=e;return t}));T({fromChatId:n,messageIds:e})}else T({fromChatId:n,messageIds:[F]})})),ne=(0,Et.A)((()=>{w({chatId:n,threadId:r.l3,messageId:F})})),oe=(0,Et.A)((()=>{w(i?{chatId:R.fromChatId,groupedId:L,groupedChatId:n,messageId:R.fromMessageId}:D&&V?{chatId:D,threadId:V,messageId:R.fromMessageId}:{chatId:R.fromChatId,messageId:R.fromMessageId})})),ie=(0,Et.A)((e=>{e.stopPropagation(),t(e,L)}));return{handleAvatarClick:q,handleSenderClick:z,handleViaBotClick:H,handleReplyClick:_,handleMediaClick:W,handleAudioPlay:Q,handleAlbumMediaClick:Z,handlePhotoMediaClick:$,handleVideoMediaClick:X,handleMetaClick:ie,handleTranslationClick:(0,Et.A)((e=>{e.stopPropagation(),x({chatId:n,messageId:y?void 0:F})})),handleOpenThread:(0,Et.A)((()=>{N({chatId:a.chatId,threadId:a.id})})),handleReadMedia:Y,handleCancelUpload:ee,handleVoteSend:te,handleGroupForward:ae,handleForward:se,handleFocus:ne,handleFocusForwarded:oe,handleDocumentGroupSelectAll:ie,handleTopicChipClick:(0,Et.A)((()=>{g&&w({chatId:D||n,threadId:g.id,messageId:F})})),handleStoryClick:(0,Et.A)((()=>{f&&B({peerId:f.peerId,storyId:f.id,isSingleStory:!0})}))}}(dt,Ba,t,Ft,Ie,W,fa,Gt,l,Ra,Da,R,Re,Boolean(Ge),j&&"content"in j?j:void 0,q,oe),Ss=(0,Et.A)((e=>{e.stopPropagation(),pt()}));(0,ht.vJ)((()=>{P&&Fa&&k&&st()}),[st,P,k,Fa]);const Cs=l?.hasMultipleCaptions?void 0:l?.captionMessage||t,Es=Cs&&(0,I.XR)(Cs),Ms=Es||xa,ks=(0,ft.A)("Message message-list-item",A&&"first-in-group",$&&!Es?"is-protected":"allow-selection",b&&"last-in-group",w&&"first-in-document-group",S&&"last-in-document-group",P&&"last-in-list",Vt&&"own",Boolean(t.viewsCount)&&"has-views",t.isEdited&&"was-edited",jt&&"has-reply",At&&"has-menu-open",Q&&!ee&&"focused",se&&"is-forwarding",t.isDeleting&&"is-deleting",W&&"is-in-document-group",wa&&"is-album",t.hasUnreadMention&&"has-unread-mention",ye&&"is-selected",ge&&"is-in-selection-mode",L&&!m&&"is-thread-top",Boolean(t.inlineButtons)&&"has-inline-buttons",$a&&"is-swiped",Bt,f&&"is-just-added",(he||mt)&&"has-active-effect",va&&"is-story-mention"),Ps=Cs&&(0,I.r_)(Cs).text,Ts=Boolean(t.isInvertedMedia),{replyToMsgId:xs,replyToPeerId:Ns,isQuote:Bs}=la||{},{peerId:Us,storyId:Fs}=ua||{};(0,ht.vJ)((()=>{(Qt?.hasEffect||Qe)&&(Ue.current&&Ut>=Ue.current||Dt)&&pt()}),[Qe,Dt,Ue,Ut,Qt?.hasEffect]);const Ls=function(e,t,a){const[s,n]=(0,ht.J0)();return(0,ht.vJ)((()=>{t||a&&!a()||(e?async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;return vn||await bn.promise,await vn.request({name:"detectLanguage",args:[e,t]})}(e).then(n):n(void 0))}),[t,e,a]),s}(Ps?.text,!(Oe||De),He);!function(e,t,a,s){(0,ht.vJ)((()=>{if(a||s&&!s())return;const n=Boolean(e.content.text?.text.length);!function(e,t,a,s){const n=Cn.get(e)||new Sn.A(150),o=n.get(t);o&&o.detectedLanguage===s&&o.isTranslatable===a||(n.set(t,{id:t,isTranslatable:a,detectedLanguage:s}),Cn.set(e,n),En(e))}(e.chatId,e.id,n,t)}),[e,t,a,s])}(t,Ls,!De,He);const Js=(0,I.ZR)(t,!Ge),{isPending:Os,translatedText:Ds}=(0,kn.A)(Je,Ft,Js?Ut:void 0,Ve),Vs=(0,ws.A)(Ds,Boolean(Js)),Gs=Ds||Vs,{phoneCall:js}=oa||{},qs=(Ne||pe&&re&&Dt)&&!Ca&&"thread"===Se&&!p,zs=Ne?.isCommentsInfo&&!Ca&&"thread"===Se&&!p,_s=!It&&!js&&!ge&&be&&!Ca&&!va&&!Va,Ws=ya&&(pa||(_t||Wt||ra||"geo"===na?.mediaType)&&!Ms),Ks=function(e,t){let{hasSubheader:a,isCustomShape:s,isLastInGroup:o,asForwarded:i,hasThread:r,forceSenderName:c,hasCommentCounter:d,hasActionButton:l,hasReactions:u,isGeoLiveActive:m,withVoiceTranscription:h,peerColorClass:p,hasOutsideReactions:g}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{paidMedia:y}=(0,I.r_)(e),{photo:f,video:A}=ln(y),{photo:v=f,video:b=A,audio:w,voice:S,document:C,poll:E,webPage:M,contact:k,location:P,invoice:T,storyData:x,giveaway:N,giveawayResults:B}=(0,I.r_)(e),U=t?.hasMultipleCaptions?void 0:(0,I.r_)(t?.captionMessage||e).text,F=Boolean(e.factCheck?.text),R="video"===b?.mediaType&&b.isRound,L=e.isInvertedMedia,J=v||b&&!R||t||M,O=[n.zPk],D=x||v||b||P||T?.extendedMedia||y,V=U||"venue"===P?.mediaType||m||F,G=D&&!V,j=Boolean(e.viaBotId),q=L&&J?!(!u||g)||!!F||!(!M||!V):V;return p&&O.push(p),!D&&e.emojiOnlyCount?(O.push("emoji-only"),e.emojiOnlyCount<=n.Apc&&O.push(`emoji-only-${e.emojiOnlyCount}`)):V?O.push("text"):O.push("no-text"),l&&O.push("has-action-button"),s&&(O.push("custom-shape"),R&&O.push("round"),d&&O.push("has-comment-counter")),D?O.push("media"):w?O.push("audio"):S?(O.push("voice"),h&&O.push("with-voice-transcription")):C?O.push("document"):k?O.push("contact"):E?O.push("poll"):N||B?O.push("giveaway"):M&&(O.push("web-page"),(M.photo||M.video)&&O.push("media"),M.document&&O.push("document")),T&&!T.extendedMedia&&O.push("invoice"),x&&O.push("story"),i&&O.push("is-forwarded"),a&&O.push("has-subheader"),r&&O.push("has-replies"),u&&O.push("has-reactions"),g&&O.push("has-outside-reactions"),j&&O.push("is-via-bot"),c&&O.push("force-sender-name"),s||(O.push("has-shadow"),D&&r&&O.push("has-background"),(a||i||j||!G||c||F)&&O.push("has-solid-background"),F&&O.push("has-fact-check"),o&&(v||!G||P&&i)&&O.push("has-appendix")),J&&L&&O.push("is-inverted-media"),q?O.push("has-footer"):O.push("no-footer"),O.join(" ")}(t,l,{hasSubheader:Na,isCustomShape:pa,isLastInGroup:b,asForwarded:fa,hasThread:ha&&!p,forceSenderName:x,hasCommentCounter:ha&&Ne.messagesCount>0,hasActionButton:ka||Pa,hasReactions:ya,isGeoLiveActive:"geoLive"===na?.mediaType&&!(0,I.vz)(t),withVoiceTranscription:Fa,peerColorClass:(0,cn.y)(Oa,Ta),hasOutsideReactions:Ws}),$s=Ks.includes("has-appendix"),Xs=(0,dn.Rr)(t.emojiOnlyCount);let Qs,Zs;Qs=js||Ca?"none":!Ms||ea||Xs||Ts?Ts&&!Xs&&(xa||ea)?"in-text":"standalone":"in-text",ya?Ws?Zs="outside":fa?(Qs="standalone",Zs="inside"):Zs="inside":Zs="none";const Ys=pa?"in-meta":"in-content";(0,yn.A)(Ns||Ft,xs,O,t.id,J||Bs||q),(0,fn.A)(Us||Ft,Fs,j),(0,Mn.A)(ot,Ft,Q,Z,ee,ae,f,Boolean(Y),te);const tn=Xe?(0,I.qg)(dt,Xe):void 0,an=!t.senderId,sn=tn||an&&t.postAuthorTitle||(fa||ne)&&Rt?.postAuthorTitle||void 0,nn=P,mn=(0,Et.A)((e=>{const t=ct.current,a=e.contentRect.height;if(ct.current=a,(0,Rs.o8)()||!t||a<=t)return;const s=e.target.closest(".MessageList");if(!s)return;(0,Ct.UH)(400);const n=a-t,{offsetHeight:o,scrollHeight:i,scrollTop:r}=s;Math.round(i-r-o)-n<=5&&st()})),hn=(0,wn.A)(mn,[mn],300,!1);(0,Hs.A)(ot,hn,!nn),(0,ht.vJ)((()=>{const e=it.current;e&&(0,on.Y)(e)&&(Be&&at({messageIds:[Ut]}),t.hasUnreadMention&&nt({messageIds:[Ut]}))}),[Be,Ut,at,t.hasUnreadMention]);const pn=(0,ht.Kr)((()=>wa?gn(Vt,Boolean(fa),Boolean(u),l,yt):void 0),[wa,Vt,fa,u,l,yt]),In=fa?28:0,An=(0,ht.Kr)((()=>{let e,t,a,s=!1,n="";if(!wa&&(_t||Wt||sa?.extendedMedia)){let a;if(_t)a=(0,un.yA)({media:_t,isOwn:Vt,asForwarded:fa,noAvatars:u,isMobile:yt}).width;else if(Wt)a=ba?M.Wd:(0,un.yA)({media:Wt,isOwn:Vt,asForwarded:fa,noAvatars:u,isMobile:yt}).width;else if(sa?.extendedMedia&&sa.extendedMedia.width&&sa.extendedMedia.height){const{width:e,height:t}=sa.extendedMedia;a=(0,M.kn)({width:e,height:t,fromOwnMessage:Vt,asForwarded:fa,noAvatars:u,isMobile:yt}).width}a&&(a<un.MC&&(t=a),e=Math.max((0,un.nP)(Ps?.text,qs),a),!fa&&sa?.extendedMedia&&e-a>18&&(s=!0))}else pn&&(e=Math.max((0,un.nP)(Ps?.text,qs),pn.containerStyle.width),!fa&&e-pn.containerStyle.width>18&&(s=!0));if(e)n=`width: ${e+In}px`,a=e+Ui;else if(Qt&&!Na){const{width:e}=(0,M.bu)(Qt,yt);n=`width: ${e+In}px`,a=e+Ui}return{contentWidth:t,noMediaCorners:s,style:n,reactionsMaxWidth:a}}),[pn,fa,In,Na,sa?.extendedMedia,wa,qs,yt,Vt,u,_t,Qt,Ps?.text,Wt,ba]),{contentWidth:Pn,noMediaCorners:Tn,style:xn,reactionsMaxWidth:Bn}=An;function Un(e){if(Cs)return ht.Ay.createElement(qn.A,{messageOrStory:Cs,translatedText:Ve?Gs:void 0,isForAnimation:e,focusedQuote:Y,emojiSize:Xs,highlight:le,isProtected:$,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,withTranslucentThumbs:pa,isInSelectMode:ge,canBeEmpty:xa})}const Dn=(0,ht.hb)((()=>{if(be)return ht.Ay.createElement("div",{className:(0,ft.A)("quick-reaction",Xa&&!he&&"visible"),onClick:Wa,ref:rt},ht.Ay.createElement(zn.A,{reaction:be,size:Bi,availableReactions:ve,observeIntersection:d}))}),[he,ve,be,Wa,Xa,d]);function Hn(){const e=ht.Ay.createElement(ai,{message:t,isPinned:Ee,withFullDate:ne&&!Vt,noReplies:g,repliesThreadInfo:Ne,outgoingStatus:H,signature:sn,withReactionOffset:"inside"===Zs,renderQuickReactionButton:_s&&"in-meta"===Ys?Dn:void 0,availableReactions:ve,isTranslated:Boolean(Ve?Gs:void 0),effectEmoji:Qe?.emoticon,onClick:ds,onEffectClick:Ss,onTranslationClick:ls,onOpenThread:us});return"inside"!==Zs?e:ht.Ay.createElement(bi,{message:Ae,threadId:Ie,metaChildren:e,observeIntersection:d,noRecentReactors:re,tags:Ke,isCurrentUserPremium:v,getIsMessageListReady:He})}function _n(){return ea&&ht.Ay.createElement(Ni.A,{message:t,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,noAvatars:u,canAutoLoad:ke,canAutoPlay:Pe,asForwarded:fa,isDownloading:Me,isProtected:$,theme:T,story:qe,isConnected:ze,backgroundEmojiId:N?.color?.backgroundEmojiId,shouldWarnAboutSvg:_e,autoLoadFileMaxSizeMb:xe,onAudioPlay:os,onMediaClick:ns,onCancelMediaTransfer:hs})}function Wn(e){const t=ht.Ay.createElement(ht.Ay.Fragment,null,wa&&ht.Ay.createElement(to,{album:l,albumLayout:pn,observeIntersection:i,isOwn:Vt,isProtected:$,hasCustomAppendix:e,onMediaClick:is}),!wa&&_t&&ht.Ay.createElement(Qn.A,{messageText:Ps?.text,photo:_t,isOwn:Vt,observeIntersection:i,noAvatars:u,canAutoLoad:ke,uploadProgress:_,shouldAffectAppendix:e,isDownloading:Me,isProtected:$,asForwarded:fa,theme:T,forcedWidth:Pn,onClick:rs,onCancelUpload:hs}),!wa&&Wt&&!ba&&ht.Ay.createElement(Zn.A,{video:Wt,isOwn:Vt,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,forcedWidth:Pn,noAvatars:u,canAutoLoad:ke,canAutoPlay:Pe,uploadProgress:_,isDownloading:Me,isProtected:$,asForwarded:fa,onClick:cs,onCancelUpload:hs}));return qt?ht.Ay.createElement(oi,{chatId:Ft,messageId:Ut,paidMedia:qt,isOutgoing:Vt},t):t}function Kn(){if(pa&&!Lt||!(h&&(!(_t||Wt||na||qt)||Le)||fa||Lt||x)||Sa||jt&&pa)return;let e;!Da||pa&&Lt?Rt?.hiddenUserName?e=Rt.hiddenUserName:ra&&U&&(e=(0,I.qg)(dt,U)):e=(0,I.qg)(dt,Da);const a=Da&&"emojiStatus"in Da&&Da.emojiStatus,s=Da&&"isPremium"in Da&&Da.isPremium,o=fa&&Da;return ht.Ay.createElement("div",{className:"message-title",dir:"ltr"},e||fa?ht.Ay.createElement("span",{className:(0,ft.A)("message-title-name",Rt?.hiddenUserName?"sender-hidden":"interactive",void 0),onClick:Ya,dir:"ltr"},fa&&ht.Ay.createElement(Vn.A,{name:Rt?.hiddenUserName?"forward":"share-filled"}),ra&&ht.Ay.createElement(Vn.A,{name:"play-story"}),o&&ht.Ay.createElement(Rn.A,{className:"forward-avatar",peer:Da,size:"micro"}),e?(0,ts.A)(e):fa?" ":void 0,!fa&&a&&ht.Ay.createElement(La.A,{documentId:a.documentId,loopLimit:n.J$1,observeIntersectionForLoading:i,observeIntersectionForPlaying:d}),!fa&&!a&&s&&ht.Ay.createElement(Ja.A,null),Da?.fakeType&&ht.Ay.createElement(jn.A,{fakeType:Da.fakeType})):R?void 0:" ",R&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("span",{className:"via"},dt("ViaBot")),ht.Ay.createElement("span",{className:"interactive",onClick:es},(0,ts.A)(`@${R.usernames[0].username}`))),ht.Ay.createElement("div",{className:"title-spacer"}),Rt?.isLinkedChannelPost?ht.Ay.createElement("span",{className:"admin-title",dir:"auto"},dt("DiscussChannel")):t.forwardInfo?.postAuthorTitle&&ce&&fa?ht.Ay.createElement("span",{className:"admin-title",dir:"auto"},t.forwardInfo?.postAuthorTitle):t.postAuthorTitle&&ce&&!fa?ht.Ay.createElement("span",{className:"admin-title",dir:"auto"},t.postAuthorTitle):!Fe||fa||Lt?void 0:ht.Ay.createElement("span",{className:"admin-title",dir:"auto"},Fe.customTitle||dt(Fe.isOwner?"GroupInfo.LabelOwner":"GroupInfo.LabelAdmin")),Ia&&ht.Ay.createElement("span",{className:"sender-boosts","aria-hidden":!0},ht.Ay.createElement(Vn.A,{name:We>1?"boosts":"boost"}),We>1?We:void 0))}const Xn=ce&&fa?t.postAuthorTitle:void 0;return ht.Ay.createElement("div",{ref:ot,id:(0,I.GZ)(t.id),className:ks,"data-message-id":Ut,onCopy:$?rn.A:void 0,onMouseDown:Ga,onClick:ja,onContextMenu:qa,onDoubleClick:za,onMouseEnter:Ca?Qa:void 0,onMouseMove:_s?_a:void 0,onMouseLeave:_s||Ca?Ka:void 0},ht.Ay.createElement("div",{ref:it,className:"bottom-marker","data-message-id":Ut,"data-last-message-id":l?l.messages[l.messages.length-1].id:void 0,"data-album-main-id":l?l.mainMessage.id:void 0,"data-has-unread-mention":t.hasUnreadMention||void 0,"data-has-unread-reaction":Be||void 0,"data-is-pinned":Ee||void 0,"data-should-update-views":void 0!==t.viewsCount}),!W&&ht.Ay.createElement("div",{className:"message-select-control"},ye&&ht.Ay.createElement(Vn.A,{name:"select"})),S&&ht.Ay.createElement("div",{className:(0,ft.A)("message-select-control group-select",fe&&"is-selected"),onClick:As},fe&&ht.Ay.createElement(Vn.A,{name:"select"})),m&&function(){const e=!Ra&&Rt?Rt.hiddenUserName:void 0;return ht.Ay.createElement(Rn.A,{size:yt?"small-mobile":"small",peer:Ra,text:e,onClick:Ra?Za:void 0})}(),ht.Ay.createElement("div",{className:(0,ft.A)("message-content-wrapper",Ks.includes("text")&&"can-select-text")},ht.Ay.createElement("div",{className:Ks,style:xn,dir:"auto"},fa&&!Sa&&ht.Ay.createElement(ht.Ay.Fragment,null,Kn(),Xn&&ht.Ay.createElement("span",{className:"admin-title",dir:"auto"},Xn)),function(){const e=(0,ft.A)("content-inner",fa&&"forwarded-message",Na&&"with-subheader",Tn&&"no-media-corners"),a=b&&(!Ms||Ts&&!xa&&!ya)&&!fa&&!zs,s=(0,ft.A)("text-content","clearfix","in-text"===Qs&&"with-meta",H&&"with-outgoing-icon"),n=!Va||!Vt||ne;return ht.Ay.createElement("div",{className:e,onDoubleClick:Ha,dir:"auto"},!fa&&Kn(),Na&&ht.Ay.createElement("div",{className:"message-subheader"},Le&&ht.Ay.createElement($n,{topic:Re,onClick:vs,className:"message-topic"}),jt&&ht.Ay.createElement(On.A,{message:O,replyInfo:la,noUserColors:Ta,isProtected:$,sender:D,senderChat:G,forwardSender:V,chatTranslations:Je,requestedChatTranslationLanguage:Ge,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,onClick:as}),ma&&ht.Ay.createElement(Gn,{story:j,sender:z,noUserColors:Ta,isProtected:$,observeIntersectionForLoading:i,onClick:bs})),Qt&&ht.Ay.createElement(ki,{message:t,observeIntersection:i,observeIntersectionForPlaying:d,shouldLoop:Te,shouldPlayEffect:mt,withEffect:je,onStopEffect:gt}),ga&&me&&ht.Ay.createElement(oo,{customEmojiId:me,withEffects:je&&(0,I.L8)(Ft)&&!Qe,isOwn:Vt,observeIntersection:i,forceLoadPreview:Dt,messageId:Ut,chatId:Ft,activeEmojiInteractions:we}),ga&&ue&&ht.Ay.createElement(ro,{emoji:ue,withEffects:je&&(0,I.L8)(Ft)&&!Qe,isOwn:Vt,observeIntersection:i,forceLoadPreview:Dt,messageId:Ut,chatId:Ft,activeEmojiInteractions:we}),je&&Qe&&!Dt&&ht.Ay.createElement(ei.A,{shouldPlay:mt,messageId:t.id,isMirrored:!t.isOutgoing,effect:Qe,observeIntersectionForLoading:i,observeIntersectionForPlaying:d,onStop:gt}),js&&ht.Ay.createElement(si,{message:t,phoneCall:js,chatId:Ft}),!wa&&ba&&ht.Ay.createElement(wi.A,{message:t,observeIntersection:i,canAutoLoad:ke,isDownloading:Me,onReadMedia:n?ms:void 0}),(Kt||$t)&&ht.Ay.createElement(Fn.Ay,{theme:T,message:t,origin:c.d9.Inline,uploadProgress:_,isSelectable:W,isSelected:ye,noAvatars:u,onPlay:os,onReadMedia:$t&&n?ms:void 0,onCancelUpload:hs,isDownloading:Me,isTranscribing:E,isTranscriptionHidden:lt,isTranscribed:Boolean(k),isTranscriptionError:Jt,canDownload:!$,onHideTranscription:ut,canTranscribe:$e&&!Va}),Xt&&ht.Ay.createElement(Ln.A,{document:Xt,observeIntersection:i,canAutoLoad:ke,autoLoadFileMaxSizeMb:xe,uploadProgress:_,isSelectable:W,isSelected:ye,onMediaClick:ns,onCancelUpload:hs,isDownloading:Me,shouldWarnAboutSvg:_e}),ra&&!va&&ht.Ay.createElement(Ti,{message:t,isProtected:$}),va&&ht.Ay.createElement(xi,{message:t}),Zt&&ht.Ay.createElement(Io,{contact:Zt,noUserColors:Vt}),Yt&&ht.Ay.createElement(pi,{message:t,poll:Yt,onSendVote:ps}),(ca||da)&&ht.Ay.createElement(Lo,{message:t}),ia&&ht.Ay.createElement(Eo,{message:t,canAutoLoadMedia:ke}),sa?.extendedMedia&&ht.Ay.createElement(zo,{message:t,isConnected:ze}),Fa&&ht.Ay.createElement("p",{className:(0,ft.A)("transcription",!lt&&Jt&&"transcription-error"),dir:"auto"},Jt?dt("NoWordsRecognized"):E&&k?ht.Ay.createElement(Jn.A,{content:k}):k),Ts&&function(e){const t=(0,ft.A)("text-content","clearfix"),a=(0,ft.A)("text-content","clearfix","in-text"===Qs&&"with-meta",H&&"with-outgoing-icon"),s=wa||!wa&&_t||!wa&&Wt&&!ba||!ga&&xa,n="in-text"===Qs;return ht.Ay.createElement(ht.Ay.Fragment,null,_n(),Ms&&!ga&&ht.Ay.createElement("div",{className:t,dir:"auto"},Un(),Os&&ht.Ay.createElement("div",{className:"translation-animation"},ht.Ay.createElement("div",{className:"text-loading"},Un(!0))),!s&&n&&Hn()),s&&ht.Ay.createElement(ht.Ay.Fragment,null,Wn(e),!ga&&ht.Ay.createElement("div",{className:a,dir:"auto"},xa&&ht.Ay.createElement(Co,{factCheck:Ot,isToggleDisabled:ge}),n&&Hn())))}(a),!Ts&&ht.Ay.createElement(ht.Ay.Fragment,null,Wn(a),Ms&&!ga&&ht.Ay.createElement("div",{className:s,dir:"auto"},Un(),Os&&ht.Ay.createElement("div",{className:"translation-animation"},ht.Ay.createElement("div",{className:"text-loading"},Un(!0))),xa&&ht.Ay.createElement(Co,{factCheck:Ot,isToggleDisabled:ge}),"in-text"===Qs&&Hn()),_n()),sa&&!sa.extendedMedia&&ht.Ay.createElement(Go,{message:t,shouldAffectAppendix:a&&!ya,isInSelectMode:ge,isSelected:ye,theme:T,forcedWidth:Pn}),na&&ht.Ay.createElement(Zo,{message:t,isInSelectMode:ge,isSelected:ye,theme:T,peer:N}))}(),!Ca&&"standalone"===Qs&&!va&&Hn(),Ma&&ht.Ay.createElement("div",{className:(0,ft.A)("message-action-buttons",K&&"message-action-buttons-shown")},ka&&ht.Ay.createElement(aa.A,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:dt("lng_context_forward_msg"),onClick:S?gs:ys},ht.Ay.createElement(Vn.A,{name:"share-filled"})),Pa&&ht.Ay.createElement(aa.A,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:"Focus message",onClick:Ce?fs:Is},ht.Ay.createElement(Vn.A,{name:"arrow-right"}))),zs&&ht.Ay.createElement(uo,{threadInfo:Ne,disabled:p,isLoading:K,isCustomShape:pa}),$s&&ht.Ay.createElement(Yo,{isOwn:Vt}),_s&&"in-content"===Ys&&Dn()),t.inlineButtons&&ht.Ay.createElement(Oo,{message:t,onClick:et}),"outside"===Zs&&!va&&ht.Ay.createElement(bi,{message:Ae,threadId:Ie,isOutside:!0,isCurrentUserPremium:v,maxWidth:Bn,observeIntersection:d,noRecentReactors:re,tags:Ke,getIsMessageListReady:He})),vt&&ht.Ay.createElement(Ao.A,{isOpen:At,anchor:vt,targetHref:bt?.matches("a[href]")?bt.href:void 0,message:t,album:l,messageListType:Se,onClose:Mt,onCloseAnimationEnd:kt,repliesThreadInfo:Ne,noReplies:g,detectedLanguage:Ls}))}))),Ri=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"AboutAdsModal",!t);return a?ht.Ay.createElement(a,e):void 0},Li=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"SponsoredMessageContextMenuContainer",!t);return a?ht.Ay.createElement(a,e):void 0},Ji=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a}=t;return{message:(0,b.v8U)(e,a)}}))((e=>{let{chatId:t,message:a,containerRef:n}=e;const{viewSponsoredMessage:i,openUrl:r,hideSponsoredMessages:c,clickSponsoredMessage:d,reportSponsoredMessage:l}=(0,s.ko)(),u=(0,ta.A)(),m=(0,ht.li)(null),h=(0,ht.li)(null),p=Boolean(a),{observe:g}=(0,en.BL)({rootRef:n,debounceMs:200,threshold:1}),{isContextMenuOpen:y,contextMenuPosition:f,handleBeforeContextMenu:I,handleContextMenu:A,handleContextMenuClose:v,handleContextMenuHide:b}=(0,ss.A)(m,void 0,!0,o.Ni),[w,S,C]=(0,Aa.A)(!1);(0,ht.vJ)((()=>p?g(h.current,(e=>{e.isIntersecting&&i({chatId:t})})):void 0),[t,p,g,i]);const E=(0,Et.A)((()=>{l({chatId:t,randomId:a.randomId})})),M=(0,Et.A)((()=>{c()})),k=(0,Et.A)((()=>{a&&(d({chatId:t}),r({url:a.url,shouldSkipModal:!0}))}));if(a)return ht.Ay.createElement("div",{ref:m,key:"sponsored-message",className:"SponsoredMessage Message open"},ht.Ay.createElement("div",{className:"message-content has-shadow has-solid-background has-appendix",dir:"auto",onMouseDown:e=>{(0,js.l)(e),I(e)},onContextMenu:A},ht.Ay.createElement(go,{peerColor:a.peerColor,className:"content-inner",dir:"auto"},a.photo&&ht.Ay.createElement(Rn.A,{size:"large",photo:a.photo,className:(0,ft.A)("channel-avatar",u.isRtl&&"is-rtl")}),ht.Ay.createElement("span",{className:"message-title message-type"},a.isRecommended?u("Message.RecommendedLabel"):u("SponsoredMessage"),ht.Ay.createElement("span",{onClick:S,className:"ad-about"},u("SponsoredMessageAdWhatIsThis"))),function(){if(a)return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:"message-title message-peer",dir:"auto"},a.title),ht.Ay.createElement("div",{className:"text-content with-meta",dir:"auto",ref:h},ht.Ay.createElement("span",{className:"text-content-inner",dir:"auto"},(0,vo.f)({text:a.text.text,entities:a.text.entities}))),ht.Ay.createElement(aa.A,{className:"SponsoredMessage__button",size:"tiny",color:"translucent",isRectangular:!0,onClick:k},a.buttonText))}()),ht.Ay.createElement(Yo,null),ht.Ay.createElement("div",{className:"message-action-buttons"},ht.Ay.createElement(aa.A,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:u("Close"),onClick:M},ht.Ay.createElement(Vn.A,{name:"close"})),a.canReport&&ht.Ay.createElement(aa.A,{className:"message-action-button",color:"translucent-white",round:!0,size:"tiny",ariaLabel:u("More"),onClick:A,onContextMenu:A},ht.Ay.createElement(Vn.A,{name:"more"})))),f&&ht.Ay.createElement(Li,{isOpen:y,anchor:f,message:a,onAboutAdsClick:S,onReportAd:E,onClose:v,onCloseAnimationEnd:b}),ht.Ay.createElement(Ri,{isOpen:w,isMonetizationSharing:a.canReport,onClose:C}))}))),Oi=(0,ht.ph)((e=>{let{areAdsEnabled:t,chatId:a,threadId:i,messageIds:d,messageGroups:l,getContainerHeight:u,isViewportNewest:m,isUnread:p,isComments:g,isEmptyThread:f,withUsers:A,isChannelChat:v,noAvatars:b,containerRef:w,anchorIdRef:S,memoUnreadDividerBeforeIdRef:C,memoFirstUnreadIdRef:E,type:M,isReady:k,hasLinkedChat:P,isSchedule:T,shouldRenderBotInfo:x,noAppearanceAnimation:N,isSavedDialog:B,onScrollDownToggle:U,onNotchToggle:R,onPinnedIntersectionChange:L}=e;const{openHistoryCalendar:J}=(0,s.ko)(),O=(0,Ys.A)(k),D=!B&&!T,{observeIntersectionForReading:V,observeIntersectionForLoading:G,observeIntersectionForPlaying:j}=function(e,t,a,n,o){const{markMessageListRead:i,markMentionsRead:r,animateUnreadReaction:c,scheduleForViewsIncrement:d}=(0,s.ko)(),{isMobile:l}=(0,F.Ay)(),u=l?300:500,{observe:m,freeze:h,unfreeze:p}=(0,en.BL)({rootRef:t,throttleMs:150},(t=>{if("thread"!==e||(0,Nt.g)())return;let s=0;const l=[],u=[],m=[],h=[],p=[];let g=!1;t.forEach((e=>{const{isIntersecting:t,target:a,boundingClientRect:n,rootBounds:o}=e,{dataset:i}=a,r=Number(i.lastMessageId||i.messageId),c="true"===i.shouldUpdateViews,d=i.albumMainId?Number(i.albumMainId):void 0;t?(r>s&&(s=r),i.hasUnreadMention&&l.push(r),i.hasUnreadReaction&&u.push(r),i.isPinned&&m.push(d||r),c&&p.push(d||r)):i.isPinned&&(o&&n.bottom<o.top&&(g=!0),h.push(d||r))})),a.current&&s>=a.current&&i({maxId:s}),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:o,ids:p})}));(0,Nt.A)(h,p);const{observe:g}=(0,en.BL)({rootRef:t,throttleMs:tn,margin:u}),{observe:y}=(0,en.BL)({rootRef:t,throttleMs:tn});return{observeIntersectionForReading:m,observeIntersectionForLoading:g,observeIntersectionForPlaying:y}}(M,w,E,L,a),{withHistoryTriggers:q,backwardsTriggerRef:z,forwardsTriggerRef:H,fabTriggerRef:_}=function(e,t,a,n,i,r,d,l,u){const{loadViewportMessages:m}=(0,s.ko)(),[h,p]=(0,ht.Kr)((()=>"thread"===e?[(0,y.sg)((()=>m({direction:c.TN.Backwards})),1e3,!0,!1),(0,y.sg)((()=>m({direction:c.TN.Forwards})),1e3,!0,!1)]:[]),[m,a]),g=(0,ht.li)(null),f=(0,ht.li)(null),I=(0,ht.li)(null),A=(0,Et.A)((()=>{if(!u)return;if(!a?.length)return d(!1),void l(!1);if(!i)return d(!0),void l(!0);const e=t.current;if(!e)return;const{offsetHeight:s,scrollHeight:n,scrollTop:o}=e,c=Math.round(n-o-s),m=c<=1;0!==n&&(d(r?!m:!(c<=50)),l(!m))})),{observe:v}=(0,en.BL)({rootRef:t,margin:o.et},(e=>{p&&h&&e.forEach((e=>{let{isIntersecting:t,target:a}=e;t&&("backwards-trigger"===a.className&&h(),"forwards-trigger"===a.className&&p())}))})),b=a&&a.length>1;(0,en.mv)(g,b?v:void 0),(0,en.mv)(f,b?v:void 0);const{observe:w,freeze:S,unfreeze:C}=(0,en.BL)({rootRef:t,margin:100,throttleScheduler:yt.YS},A);(0,en.mv)(I,w);const{observe:E,freeze:M,unfreeze:k}=(0,en.BL)({rootRef:t,margin:1,throttleScheduler:yt.YS},A);(0,en.mv)(I,E),(0,ht.vJ)((()=>{u&&A()}),[u,A]);const P=(0,Et.A)((()=>{S(),M(),setTimeout((()=>{k(),C()}),350)}));(0,xt.A)(P,[P,a]);const T=(0,an.D7)(n,200);return(0,sn.R)(P,[P,T]),{withHistoryTriggers:b,backwardsTriggerRef:g,forwardsTriggerRef:f,fabTriggerRef:I}}(M,w,d,u,m,p,U,R,k),W=(0,ta.A)(),K=ht.Ay.createElement("div",{className:(0,ft.A)("unread-divider","local-action-message"),key:"unread-messages"},ht.Ay.createElement("span",null,W("UnreadMessages"))),$=N?0:l.reduce(((e,t)=>e+t.senderGroups.flat().length),0);let X=0;const Q=(0,ws.A)(d),Z=Boolean(d&&Q&&d[d.length-2]===Q[Q.length-1]),Y=l.map(((e,t,a)=>{const s=e.senderGroups.map(((e,s,n)=>{if(1===e.length&&!Vs(e[0])&&(0,I._P)(e[0])&&!e[0].content.action?.phoneCall){const o=e[0],c=s===n.length-1&&t===a.length-1;return(0,h.oE)([o.id===C.current&&K,ht.Ay.createElement(nn.A,{key:o.id,message:o,threadId:i,messageListType:M,isInsideTopic:Boolean(i&&i!==r.l3&&!B),observeIntersectionForReading:V,observeIntersectionForLoading:G,observeIntersectionForPlaying:j,memoFirstUnreadIdRef:E,appearanceOrder:$-++X,isJustAdded:c&&Z,isLastInList:c,onPinnedIntersectionChange:L})])}let o;return e.map(((c,d)=>{const l=Vs(c)?c.mainMessage:c,u=Vs(c)?c:void 0,m=(0,I.Ie)(l),p=Vs(c),y=e[d+1];l.previousLocalId&&S.current===(0,I.GZ)(l.previousLocalId)&&(S.current=(0,I.GZ)(l.id));const w=!p&&l.groupedId?l.groupedId:void 0,k=y&&!Vs(y)?y.groupedId:void 0,T=l.id===i,x={isFirstInGroup:0===d,isLastInGroup:d===e.length-1,isFirstInDocumentGroup:Boolean(w&&w!==o),isLastInDocumentGroup:Boolean(w&&w!==k),isLastInList:d===e.length-1&&s===n.length-1&&t===a.length-1};o=w;const N=(0,I.sj)(l),B=(0,I.u7)(l)?`${l.date}_${N}`:N,U=!1===P||!v;return(0,h.oE)([l.id===C.current&&K,ht.Ay.createElement(Fi,{key:B,message:l,observeIntersectionForBottom:V,observeIntersectionForLoading:G,observeIntersectionForPlaying:j,album:u,noAvatars:b,withAvatar:x.isLastInGroup&&A&&!m&&(!T||!g),withSenderName:x.isFirstInGroup&&A&&!m,threadId:i,messageListType:M,noComments:U,noReplies:!U||i!==r.l3||"scheduled"===M,appearanceOrder:$-++X,isJustAdded:x.isLastInList&&Z,isFirstInGroup:x.isFirstInGroup,isLastInGroup:x.isLastInGroup,isFirstInDocumentGroup:x.isFirstInDocumentGroup,isLastInDocumentGroup:x.isLastInDocumentGroup,isLastInList:x.isLastInList,memoFirstUnreadIdRef:E,onPinnedIntersectionChange:L,getIsMessageListReady:O}),l.id===i&&ht.Ay.createElement("div",{className:"local-action-message",key:"discussion-started"},ht.Ay.createElement("span",null,W(f?g?"NoComments":"NoReplies":"DiscussionStarted")))])})).flat()}));return ht.Ay.createElement("div",{className:"message-date-group",key:e.datetime,onMouseDown:js.l,teactFastList:!0},ht.Ay.createElement("div",{className:(0,ft.A)("sticky-date",D&&"interactive"),key:"date-header",onMouseDown:js.l,onClick:D?()=>J({selectedAt:e.datetime}):void 0},ht.Ay.createElement("span",{dir:"auto"},T&&e.originalDate===n.NkL&&W("MessageScheduledUntilOnline"),T&&e.originalDate!==n.NkL&&W("MessageScheduledOn",(0,de.F5)(W,e.datetime,void 0,!0)),!T&&(0,de.F5)(W,e.datetime))),s.flat())}));return ht.Ay.createElement("div",{className:"messages-container",teactFastList:!0},q&&ht.Ay.createElement("div",{ref:z,key:"backwards-trigger",className:"backwards-trigger"}),x&&ht.Ay.createElement(Zs,{isInMessageList:!0,key:`bot_info_${a}`,chatId:a}),Y.flat(),t&&m&&ht.Ay.createElement(Ji,{key:a,chatId:a,containerRef:w}),q&&ht.Ay.createElement("div",{ref:H,key:"forwards-trigger",className:"forwards-trigger"}),ht.Ay.createElement("div",{ref:_,key:"fab-trigger",className:"fab-trigger"}))})),Di=3*M.$,Vi=(0,ht.ph)((e=>{let{isChatWithSelf:t,type:a,isGroupChatJustCreated:s,topic:n}=e;const o=(0,ta.A)();return"scheduled"===a?function(e){return ht.Ay.createElement("div",{className:"empty"},ht.Ay.createElement("span",null,e("ScheduledMessages.EmptyPlaceholder")))}(o):t?function(e){return ht.Ay.createElement("div",{className:"NoMessages"},ht.Ay.createElement("div",{className:"wrapper"},ht.Ay.createElement("i",{className:"icon no-messages-icon icon-cloud-download"}),ht.Ay.createElement("h3",{className:"title"},e("Conversation.CloudStorageInfo.Title")),ht.Ay.createElement("ul",{className:"description"},ht.Ay.createElement("li",null,e("Conversation.ClousStorageInfo.Description1")),ht.Ay.createElement("li",null,e("Conversation.ClousStorageInfo.Description2")),ht.Ay.createElement("li",null,e("Conversation.ClousStorageInfo.Description3")),ht.Ay.createElement("li",null,e("Conversation.ClousStorageInfo.Description4")))))}(o):s?function(e){return ht.Ay.createElement("div",{className:"NoMessages"},ht.Ay.createElement("div",{className:"wrapper",dir:e.isRtl?"rtl":void 0},ht.Ay.createElement("h3",{className:"title"},e("EmptyGroupInfo.Title")),ht.Ay.createElement("p",{className:"description"},e("EmptyGroupInfo.Subtitle")),ht.Ay.createElement("ul",{className:"list-checkmarks"},ht.Ay.createElement("li",null,e("EmptyGroupInfo.Line1")),ht.Ay.createElement("li",null,e("EmptyGroupInfo.Line2")),ht.Ay.createElement("li",null,e("EmptyGroupInfo.Line3")),ht.Ay.createElement("li",null,e("EmptyGroupInfo.Line4")))))}(o):n?function(e,t){return ht.Ay.createElement("div",{className:"NoMessages"},ht.Ay.createElement("div",{className:"wrapper"},ht.Ay.createElement(_n.A,{topic:t,size:Di,className:"no-messages-icon topic-icon"}),ht.Ay.createElement("h3",{className:"title"},e("Chat.EmptyTopicPlaceholder.Title")),ht.Ay.createElement("p",{className:"description topic-description"},(0,ts.A)(e("Chat.EmptyTopicPlaceholder.Text"),["br"]))))}(o,n):ht.Ay.createElement("div",{className:"empty"},ht.Ay.createElement("span",null,o("NoMessages")))})),Gi=(0,ht.ph)((0,s.EK)(((e,t)=>{let{userId:a}=t;const s=(0,b.SJA)(e),{patternColor:n}=e.settings.themes[s]||{},o=(0,b.mBe)(e,a);return{patternColor:n,userName:(0,I.u0)(o)}}))((function(e){let{patternColor:t,userName:a}=e;const n=(0,ta.A)(),{openPremiumModal:o}=(0,s.ko)(),i=(0,Et.A)((()=>o()));return ht.Ay.createElement("div",{className:"tFp81o13"},ht.Ay.createElement("div",{className:"xzZFmIqC"},ht.Ay.createElement("div",{className:"vyeCoKP3"},ht.Ay.createElement(To.A,{tgsUrl:Po.w.Unlock,size:54,color:t,className:"YVmR5pRi"}),ht.Ay.createElement(Vn.A,{name:"comments-sticker",className:"ouB5dgHN"})),ht.Ay.createElement("span",{className:"oEQISdJD"},(0,ts.A)(n("MessageLockedPremium",a),["simple_markdown"])),ht.Ay.createElement(aa.A,{color:"translucent-black",size:"tiny",onClick:i,className:"KJVF1etk"},n("MessagePremiumUnlock"))))}))),ji=(0,y.sg)((e=>e()),200,!1),qi=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a,threadId:s,type:o}=t;const i=e.currentUserId,c=(0,b.hds)(e,a);if(!c)return{currentUserId:i};const d=(0,b.vRX)(e,a,s,o),l="scheduled"===o?(0,b.yFI)(e,a):(0,b.zeq)(e,a),u=(0,I.cG)(a,s,i);if(!(s===r.l3||u||c?.isForum||l&&s&&l[Number(s)]))return{currentUserId:i};const{isRestricted:m,restrictionReason:h}=c,p=(0,b.yHC)(e,a,u?"saved":"all"),g=(0,b.kdX)(e,a),y=s===r.l3&&!d&&!c.unreadCount&&!g&&p&&!p.groupedId,f=(0,b.yps)(e,a),A=c.topics?.[s],v=(0,I.L8)(a)?void 0:(0,b.AWZ)(e,a),w=!(0,b.Vw0)(e,a,s)?.messagesCount;return{areAdsEnabled:!(0,b.g29)(e)||(0,b.vGo)(e,i)?.areAdsEnabled,isChatLoaded:!0,isRestricted:m,restrictionReason:h,isChannelChat:(0,I.WX)(c),isGroupChat:(0,I.YE)(c),isChannelWithAvatars:c.areProfilesShown,isCreator:c.isCreator,isChatWithSelf:(0,b.nZ4)(e,a),isRepliesChat:(0,I.kE)(a),isAnonymousForwards:(0,I.Qe)(a),isBot:Boolean(f),isSynced:e.isSynced,messageIds:d,messagesById:l,firstUnreadId:(0,b.RjD)(e,a,s),isViewportNewest:"thread"!==o||(0,b.haw)(e,a,s),focusingId:g,isSelectModeActive:(0,b.rTV)(e),hasLinkedChat:v?Boolean(v.linkedChatId):void 0,channelJoinInfo:v?.joinInfo,topic:A,noMessageSendingAnimation:!(0,b.xYJ)(e,"messageSendingAnimations"),isServiceNotificationsChat:a===n.zv8,isForum:c.isForum,isEmptyThread:w,currentUserId:i,...y&&{lastMessage:p}}}))((e=>{let{chatId:t,threadId:a,type:o,hasTools:i,isChatLoaded:d,isForum:l,isChannelChat:u,isGroupChat:m,isChannelWithAvatars:g,canPost:f,isSynced:A,isReady:v,isChatWithSelf:w,isRepliesChat:S,isAnonymousForwards:C,isCreator:E,isBot:M,messageIds:k,messagesById:P,firstUnreadId:T,isComments:x,isViewportNewest:N,isRestricted:B,restrictionReason:U,isEmptyThread:F,focusingId:R,isSelectModeActive:L,lastMessage:J,hasLinkedChat:O,withBottomShift:D,withDefaultBg:V,topic:G,noMessageSendingAnimation:j,isServiceNotificationsChat:q,currentUserId:z,getForceNextPinnedInHeader:H,isContactRequirePremium:_,areAdsEnabled:W,channelJoinInfo:K,onPinnedIntersectionChange:$,onScrollDownToggle:X,onNotchToggle:Q}=e;const{loadViewportMessages:Z,setScrollOffset:Y,loadSponsoredMessages:ee,loadMessageReactions:te,copyMessagesByIds:ae,loadMessageViews:se,loadPeerStoriesByIds:ne,loadFactChecks:oe}=(0,s.ko)(),ie=(0,ht.li)(null),re=(0,ht.li)("thread"===o&&(0,b.j_4)((0,s.mS)(),t,a)||(0,b.rKQ)((0,s.mS)(),t,a)||0),ce=(0,ht.li)(),de=(0,ht.li)(),le=(0,ht.li)(),ue=(0,ht.li)(),me=(0,ht.li)(),he=(0,ht.li)(),pe=(0,ht.li)(!1),ge=(0,ht.li)(Boolean(J)),ye=(0,I.cG)(t,a,z),fe=ye&&a!==n.Ckz,Ie=Boolean(k);(0,xt.A)((()=>{Ie&&(0,y.aj)((()=>{ge.current=!1}))}),[Ie]),(0,xt.A)((()=>{ue.current=T}),[T]),(0,ht.vJ)((()=>{W&&u&&A&&v&&ee({chatId:t})}),[t,A,v,u,W]),(0,xt.A)((()=>{Ie&&(me.current=ue.current)}),[Ie]),(0,xt.A)((()=>{he.current=R}),[R]),(e=>{(0,$t.v)({"Mod+C":function(t){const a=(0,zs.A)();a&&a.length>1&&(t.preventDefault(),e({messageIds:a}))}})})(ae);const Ae=(0,ht.Kr)((()=>{if(!k?.length||!P)return;const e=[];k.forEach(((t,a,s)=>{const n=e[e.length-1],o=P[t];if(!o)return;const{shouldAppendJoinMessage:i,shouldAppendJoinMessageAfterCurrent:r}=(()=>{if(K)return n&&n.date<K.joinedDate&&K.joinedDate<=o.date?{shouldAppendJoinMessage:!0,shouldAppendJoinMessageAfterCurrent:!1}:a===s.length-1&&o.date<K.joinedDate?{shouldAppendJoinMessage:!0,shouldAppendJoinMessageAfterCurrent:!0}:void 0})()||{};if(r&&e.push(o),i){const t=r?o.id:n?.id||o.id-1;e.push({id:zi(t),chatId:o.chatId,date:K.joinedDate,isOutgoing:!1,content:{action:{type:"joinedChannel",mediaType:"action",text:"",translationValues:[],targetChatId:o.chatId}}})}r||e.push(o)}));const t="scheduled"===o||q?["date","id"]:["id"];return e.length?Gs((0,h.My)(e,t),me.current,l?void 0:Number(a),w):void 0}),[k,P,o,q,l,a,w,K]);(0,bt.A)((()=>{if(!k||!P||"scheduled"===o)return;if(!u&&!m)return;const e=k.filter((e=>{const t=P[e];return t&&t.reactions?.results.length&&!t.content.action}));e.length&&te({chatId:t,ids:e})}),2e4,!0),(0,bt.A)((()=>{if(!k||!P||"scheduled"===o)return;const e=k.map((e=>P[e]?.content.storyData)).filter(Boolean);if(!e.length)return;const t=e.reduce(((e,t)=>{const{peerId:a,id:s}=t;return e[a]||(e[a]=[]),e[a].push(s),e}),{});Object.entries(t).forEach((e=>{let[t,a]=e;ne({peerId:t,storyIds:a})}))}),3e5),(0,bt.A)((()=>{if(!k||!P||a!==r.l3||"scheduled"===o)return;const e=(0,s.mS)(),n=k.filter((a=>(0,b.Vw0)(e,t,a)?.isCommentsInfo||void 0!==P[a]?.viewsCount));n.length&&se({chatId:t,ids:n})}),2e4,!0),(0,bt.A)((()=>{if(!k||!P||a!==r.l3||"scheduled"===o)return;const e=k.filter((e=>P[e]?.factCheck?.shouldFetch));e.length&&oe({chatId:t,ids:e})}),5e3);const ve=(0,ht.Kr)((()=>{if("thread"===o)return(0,y.sg)((()=>Z({direction:c.TN.Around})),1e3,!0,!1)}),[Z,k]),{isScrolled:be,updateStickyDates:we}=function(){const[e,t]=(0,Aa.A)(!1),a=(0,_s.A)(1e3,!0);return{isScrolled:e,updateStickyDates:(0,Et.A)(((e,s)=>{t(),document.body.classList.contains("is-scrolling-messages")||(0,yt.RK)((()=>{document.body.classList.add("is-scrolling-messages")})),a((()=>{const t=function(e,t){const a=e.querySelectorAll(".sticky-date"),s=e.scrollTop;return Array.from(a).find((e=>{const{offsetTop:a,offsetHeight:n}=e,o=a-s;return-n<=o&&o<=(t?60:10)}))}(e,s);t&&(0,yt.RK)((()=>{t.classList.add("stuck")})),(0,yt.RK)((()=>{const e=document.querySelector(".stuck");e&&e.classList.remove("stuck"),document.body.classList.remove("is-scrolling-messages")}))}))}))}}(),Se=(0,Et.A)((()=>{if(pe.current)return void(pe.current=!1);const e=ie.current;e&&(he.current||we(e,i),ji((()=>{const n=(0,s.mS)();H()&&!(0,b.nTw)(n).focusedMessage?.chatId&&$({hasScrolled:!0}),e.parentElement&&(re.current=e.scrollHeight-e.scrollTop,"thread"===o&&Y({chatId:t,threadId:a,scrollOffset:re.current}))})))})),[Ce,Ee]=function(e,t){const[a,s]=(0,ht.Ul)(),n=(0,Et.A)((e=>{s(e.contentRect.height)}));(0,Hs.A)(e,n),(0,ht.vJ)((()=>{const s=Number(e.current.dataset.normalHeight)||0,n=a();n&&n>s&&t&&(e.current.dataset.normalHeight=String(n))}),[t,e,a]);const o=(0,ht.li)();return[a,o]}(ie,f&&!L);(0,ht.vJ)((()=>{if(!ve||!d||B||R)return;if(k&&(0,p.iL)(k[k.length-1]))return;const e=ie.current;(!k||1===k.length||k.length<n.yo2/2&&e.firstElementChild.clientHeight<=e.offsetHeight)&&ve()}),[d,k,ve,R,B]);const Me=(0,Xt.i)((()=>{if(!k||!le.current)return;const e=le.current.filter((e=>k.includes(Number(e.dataset.messageId)))),t=e[1]||e[0];t&&(ce.current=t.id,de.current=t.getBoundingClientRect().top)}));(0,xt.A)((()=>(0,yt.Uj)((()=>Me.current()))),[k,N,i,Me]),(0,ht.vJ)((()=>Me.current()),[Ce,Me]),(0,qs.A)((e=>{let[t,a]=e;const s=Ce(),o=Ee.current;if(Ee.current=s,k===t&&N===a&&s!==o&&void 0===o)return;const r=ie.current;le.current=Array.from(r.querySelectorAll(".message-list-item"));const c=le.current[le.current.length-1],d=ue.current?r.querySelector(`#${(0,I.GZ)(ue.current)}`):void 0,l=k&&t&&k[k.length-1]!==t[t.length-1],u=k?.[0]!==t?.[0]&&k?.length===n.yo2/2+1,m=l&&!u;N&&m&&k&&k.length<n.yo2/2&&!r.parentElement.classList.contains("force-messages-scroll")&&(0,yt.Uj)((()=>r.firstElementChild.clientHeight<=2*r.offsetHeight))&&((0,pt.YM)(r.parentElement,"force-messages-scroll"),r.parentElement.classList.add("force-messages-scroll"),setTimeout((()=>{r.parentElement&&(0,pt.HW)(r.parentElement,"force-messages-scroll")}),500)),(0,yt.gm)((()=>{const{scrollTop:e,scrollHeight:t,offsetHeight:n}=r,l=re.current;let u=l-(o||n);m&&(u-=c?c.offsetHeight:0);const h=N&&a&&u<=50,p=k&&he.current===k[k.length-1];m&&h&&!p&&(0,yt.YS)((()=>{const e=!(0,Nt.g)()||!d;(0,Rs.Ay)(r,e?c:d,e?"end":"start",20,void 0,void 0,j?0:void 0)}));const g=void 0!==o&&o!==s;if(g&&(0,Rs.o8)())return;const y=ce.current&&r.querySelector(`#${ce.current}`),f=!y&&me.current&&r.querySelector(".unread-divider");let I;if(h&&g)I=t-n;else if(y){const t=y.getBoundingClientRect().top;I=e+(t-(de.current||0))}else I=f?Math.min(f.offsetTop-(i?60:10),t-l):t-l;return()=>{(0,Ds.A)(r,Math.ceil(I)),(0,Rs._v)(),re.current=Math.max(Math.ceil(t-I),n),he.current||(pe.current=!0,(0,yt.YS)((()=>{pe.current=!1})))}}))}),[k,N,i,Ce,Ee,j]),(0,Ra.A)((e=>{let[t]=e;void 0!==t&&(0,Ct.UH)(200+n.xB5)}),[L]);const ke=(0,I.L8)(t),Pe=Boolean(!ke&&!u||w||S||C||g),Te=Boolean(!Pe||u&&!g),xe=(0,I.L8)(t)&&!w&&!M&&!C&&"thread"===o&&(!Ae&&!J&&k&&(!le.current||0===le.current.length)||1===k?.length&&"contactSignUp"===P?.[k[0]]?.content.action?.type||"contactSignUp"===J?.content?.action?.type),Ne=m&&E&&1===k?.length&&"chatCreate"===P?.[k[0]]?.content.action?.type,Be=1===k?.length&&"topicCreate"===P?.[k[0]]?.content.action?.type,Ue=(0,ft.A)("MessageList custom-scroll",Te&&"no-avatars",!f&&"no-composer","pinned"===o&&"type-pinned",D&&"with-bottom-shift",V&&"with-default-bg",L&&"select-mode-active",be&&"scrolled",!v&&"is-animating",fe&&"saved-dialog"),Fe=k&&Ae||J;return(0,ht.vJ)((()=>{Fe||X(!1)}),[Fe,X]),ht.Ay.createElement("div",{ref:ie,className:Ue,onScroll:Se,onMouseDown:js.l},B?ht.Ay.createElement("div",{className:"empty"},ht.Ay.createElement("span",null,U?U.text:"This is a private "+(u?"channel":"chat"))):_&&!Fe?ht.Ay.createElement(Gi,{userId:t}):M&&!Fe?ht.Ay.createElement(Zs,{chatId:t}):xe?ht.Ay.createElement(Ks,{key:t,userId:t}):k&&(!Ae||Ne||Be)?ht.Ay.createElement(Vi,{chatId:t,topic:G,type:o,isChatWithSelf:w,isGroupChatJustCreated:Ne}):Fe?ht.Ay.createElement(Oi,{areAdsEnabled:W,chatId:t,isComments:x,isChannelChat:u,isSavedDialog:ye,messageIds:k||[J.id],messageGroups:Ae||Gs([J]),getContainerHeight:Ce,isViewportNewest:Boolean(N),isUnread:Boolean(T),isEmptyThread:F,withUsers:Pe,noAvatars:Te,containerRef:ie,anchorIdRef:ce,memoUnreadDividerBeforeIdRef:me,memoFirstUnreadIdRef:ue,threadId:a,type:o,isReady:v,hasLinkedChat:O,isSchedule:!!Ae&&"scheduled"===o,shouldRenderBotInfo:M,noAppearanceAnimation:!Ae||!ge.current,onScrollDownToggle:X,onNotchToggle:Q,onPinnedIntersectionChange:$}):ht.Ay.createElement(Zt.A,{color:"white",backgroundColor:"dark"}))})));function zi(e){return e+1e-6}const Hi=e=>{const{isActive:t}=e,a=(0,Ft.A)(vt.ar.Extra,"MessageSelectToolbar",!t);return a?ht.Ay.createElement(a,e):void 0};var _i=a(14),Wi=a(38218),Ki=a(63744),$i=a(51083),Xi=a(17751),Qi=a(19806);const Zi=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a}=t;return{currentUserId:e.currentUserId,chat:(0,b.hds)(e,a),user:(0,b.mBe)(e,a)}}))((e=>{let{chatId:t,className:a,chat:n,user:o,settings:i,currentUserId:r}=e;const{openAddContactDialog:c,blockUser:d,reportSpam:l,deleteChat:u,leaveChannel:m,deleteChatUser:h,deleteHistory:p,toggleChatArchived:g,hideChatReportPanel:y}=(0,s.ko)(),f=(0,ta.A)(),[A,v,b]=(0,Aa.A)(),[w,S]=(0,ht.J0)(!0),[C,E]=(0,ht.J0)(!0),{isAutoArchived:M,canReportSpam:k,canAddContact:P,canBlockContact:T}=i||{},x=n&&(0,I.yn)(n),N=(0,Et.A)((()=>{c({userId:t}),M&&g({id:t})})),B=(0,Et.A)((()=>{b(),d({userId:t}),k&&w&&l({chatId:t}),C&&u({chatId:t})})),U=(0,Et.A)((()=>{y({chatId:t})})),F=(0,Et.A)((()=>{b(),l({chatId:t}),x?(h({chatId:t,userId:r}),p({chatId:t,shouldDeleteForAll:!1})):m({chatId:t})}));if(i&&(n||o))return ht.Ay.createElement("div",{className:(0,ft.A)("ChatReportPanel",a),dir:f.isRtl?"rtl":void 0},P&&ht.Ay.createElement(aa.A,{isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:N},f("lng_new_contact_add")),T&&ht.Ay.createElement(aa.A,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:v},f("lng_new_contact_block")),k&&!T&&ht.Ay.createElement(aa.A,{color:"danger",isText:!0,fluid:!0,size:"tiny",className:"UserReportPanel--Button",onClick:v},f("lng_report_spam_and_leave")),ht.Ay.createElement(aa.A,{round:!0,ripple:!0,size:"tiny",color:"translucent",onClick:U,ariaLabel:f("Close")},ht.Ay.createElement("i",{className:"icon icon-close"})),ht.Ay.createElement(xo.A,{isOpen:A,onClose:b,title:f("BlockUserTitle",o?(0,I.u0)(o):(0,I.Js)(f,n)),text:o?f("UserInfo.BlockConfirmationTitle",(0,I.Yg)(o)):f("Chat.Confirm.ReportSpam.Channel"),confirmIsDestructive:!0,confirmLabel:f("Block"),confirmHandler:o?B:F},o&&ht.Ay.createElement(Qi.A,{label:f("DeleteThisChat"),checked:C,onCheck:E}),o&&k&&ht.Ay.createElement(Qi.A,{label:f("ReportChat"),checked:w,onCheck:S})))})));var Yi=a(48553),er=a(22867),tr=a(18653);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 sr(e,t,a,s,n){return`M${e},${t+n}a${n},${n},0,0,1,\n ${a},0v${s-2*n}a${n},${n},0,0,1,${-a},0Z`}const nr=(0,ht.ph)((e=>{let{count:t,index:a}=e;const s=(0,ht.li)(null),n=(0,ht.Kr)((()=>function(e,t){const a=e-t-1,s=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 a=36;return 1===e?a=36:2===e?a=17:3===e?a=1===t?12:11:(4===e||e>3)&&(a=7.5),a}(e,a),o=function(e,t){return e<=3?36:t*e+2*(e-1)}(e,s),i=`clipPath${e}`,r=function(e,t,a){let s="";if(3===a)s=sr(0,0,2,t,1)+sr(0,12,2,t+1,1)+sr(0,25,2,t,1);else for(let e=0;e<a;e++)s+=sr(0,(t+2)*e,2,t,1);return`<clipPath id="${e}">\n <path d="${s}" />\n </clipPath>`}(i,s,e),c=function(e,t,a){return 1===a?0:2===a?0===e?0:t+2:3===a?0===e?0:1===e?12:25:(t+2)*e}(a,s,e),d=function(e,t,a,s){return t<=4||e<=1?0:e>=t-2?s-36:(a+4)/2+(e-2)*(a+2)}(a,e,s,o);return{markHeight:n,clipPath:r,markTranslateY:c,trackTranslateY:d,trackHeight:o,clipPathId:i}}(t,a)),[t,a]);if((0,ht.Nf)((()=>{if(!s.current)return;const{trackHeight:e,trackTranslateY:t,markHeight:a,markTranslateY:o,clipPathId:i,clipPath:r}=n,c=s.current.firstElementChild;if(s?.current){const n=s.current,{style:d}=n;d.height=`${e}px`,d.transform=`translateY(-${t}px)`,d.clipPath=`url("#${i}")`;const l=n.querySelector("svg"),u=n.querySelector("div"),m=n.querySelector("defs");l||c&&(c.innerHTML=`<svg height="0" width="0"><defs> ${r} </defs></svg>`),m&&(m.innerHTML=r),u&&(u.style.height=`${a}px`,u.style.transform=`translateY(${o}px)`)}}),[n]),1===t)return ht.Ay.createElement("div",{className:ar.pinnedMessageBorder},ht.Ay.createElement("div",{className:ar.pinnedMessageBorderWrapper1,ref:s}));const{trackHeight:o,trackTranslateY:i,markHeight:r,markTranslateY:c,clipPathId:d}=n;return ht.Ay.createElement("div",{className:(0,ft.A)(ar.pinnedMessageBorder,t>4&&ar.pinnedMessageBorderMask)},ht.Ay.createElement("div",{className:ar.pinnedMessageBorderWrapper,ref:s,style:`clip-path: url("#${d}"); width: 2px;\n height: ${o}px; transform: translateY(-${i}px);`},ht.Ay.createElement("span",null),ht.Ay.createElement("div",{className:ar.pinnedMessageBorderMark,style:`--height: ${r}px; --translate-y: ${c}px; --translate-track: ${i}px;`})))})),or="OibpUlOd",ir="_f3hwC8p",rr=1.125*M.$,cr=(0,ht.ph)((e=>{let{message:t,count:a,index:n,customTitle:i,className:r,onUnpinMessage:c,onClick:d,onAllPinnedClick:l,isLoading:u,isFullWidth:m}=e;const{clickBotInlineButton:h}=(0,s.ko)(),p=(0,ta.A)(),g=(0,er.A)(t),y=(0,is.A)((0,I.EO)(t,"pictogram")),f=(0,I.y2)(t),A=(0,co.A)([u],450)&&u,[v,b,w]=(0,Aa.A)(),S=(0,Et.A)((()=>{w(),c&&c(t.id)})),C=(0,I.rK)(t),E=(0,Et.A)((()=>{C&&h({messageId:t.id,button:C})})),[k,P,T]=(0,Aa.A)(),{handleClick:x,handleMouseDown:N}=(0,Dn.Q)(d);return ht.Ay.createElement("div",{className:(0,ft.A)("HeaderPinnedMessageWrapper","Guj4V7W_",m&&"full-width",r)},(a>1||A)&&ht.Ay.createElement(aa.A,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("EventLogFilterPinnedMessages"),onClick:A?void 0:l},u&&ht.Ay.createElement(ka.A,{color:"blue",className:(0,ft.A)("clu9vjEC",or,!A&&ir)}),ht.Ay.createElement("i",{className:(0,ft.A)("icon","icon-pin-list",or,A&&ir)})),c&&ht.Ay.createElement(aa.A,{round:!0,size:"smaller",color:"translucent",ariaLabel:p("UnpinMessageAlertTitle"),onClick:b},ht.Ay.createElement("i",{className:"icon icon-close"})),ht.Ay.createElement(xo.A,{isOpen:v,onClose:w,text:"Would you like to unpin this message?",confirmLabel:"Unpin",confirmHandler:S}),ht.Ay.createElement("div",{className:(0,ft.A)("GgG7nh8p",k&&"Nki3ifmz"),onClick:x,onMouseDown:N,dir:p.isRtl?"rtl":void 0},ht.Ay.createElement(nr,{count:a,index:n}),ht.Ay.createElement(Qt.Ay,{activeKey:t.id,name:"slideVertical",className:"ud4LJMTI"},function(e,t,a){const{width:s,height:n}=(0,M.mr)(),o=t||e;return ht.Ay.createElement("div",{className:"_M8tJtJD"},e&&!a&&ht.Ay.createElement("img",{className:"KKUhI313",src:o,width:s,height:n,alt:"",draggable:!1}),e&&ht.Ay.createElement(jo.A,{thumbDataUri:o,isVisible:Boolean(a),width:s,height:n}))}(g,y,f)),ht.Ay.createElement("div",{className:(0,ft.A)("LPdDfCw0",g&&"hRtSF_Ex"),dir:p.isRtl?"rtl":void 0},ht.Ay.createElement("div",{className:"bY9umAoY",dir:p.isRtl?"rtl":void 0},!i&&ht.Ay.createElement(lo.A,{text:`${p("PinnedMessage")} ${n>0?"#"+(a-n):""}`}),i&&(0,ts.A)(i)),ht.Ay.createElement(Qt.Ay,{activeKey:t.id,name:"slideVerticalFade",className:"lo853Tki"},ht.Ay.createElement("p",{dir:"auto",className:"Ko14czNN"},ht.Ay.createElement(tr.A,{message:t,noEmoji:Boolean(g),emojiSize:rr})))),ht.Ay.createElement(us.A,null),C&&ht.Ay.createElement(aa.A,{size:"tiny",className:"lfWlkB7k",onClick:E,shouldStopPropagation:!0,onMouseEnter:o.TF?void 0:P,onMouseLeave:o.TF?void 0:T},(0,Jo.A)(p,C))))})),dr=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a,threadId:s,messageListType:n,isMobile:o}=t;const{isLeftColumnShown:i,shouldSkipHistoryAnimations:c,audioPlayer:d,messageLists:l}=(0,b.nTw)(e),u=(0,b.hds)(e,a),{chatId:m,messageId:h}=d,p=m&&h?(0,b.O5q)(e,m,h):void 0;let g;if("pinned"===n){const t=(0,b.fcC)(e,a,s);g=t?.length}else if("scheduled"===n){const t=(0,b.K3w)(e,a,s);g=t?.length}else if("thread"===n&&s!==r.l3){const t=(0,b.Vw0)(e,a,s);g=t?.messagesCount||0}const y="thread"===n&&s===r.l3,f=u&&(0,b.ALW)(e,u),A=Boolean(f&&(0,b.apd)(e,a)),v=f&&!A&&Boolean((0,b.I_m)(e,a)),w=Boolean(u&&(y||u.isForum)&&((0,I.WX)(u)||(0,I.Vs)(u))&&u.isNotJoined),S=Boolean(u?.isNotJoined&&u.isJoinRequest),C=(0,b.C5H)(e,a,s,"typingStatus"),E=u?.emojiStatus,M=E&&e.customEmojis.byId[E.documentId],k=(0,I.cG)(a,s,e.currentUserId),P=Boolean((0,b.TCk)(e)),T={typingStatus:C,isLeftColumnShown:i,isRightColumnShown:(0,b.gjV)(e,o),isSelectModeActive:(0,b.rTV)(e),audioMessage:p,chat:u,messagesCount:g,isChatWithSelf:(0,b.nZ4)(e,a),shouldSkipHistoryAnimations:c,currentTransitionKey:Math.max(0,l.length-1),connectionState:e.connectionState,isSyncing:e.isSyncing,isSynced:e.isSynced,isFetchingDifference:e.isFetchingDifference,emojiStatusSticker:M,hasButtonInHeader:v||A||w||S,isSavedDialog:k,isMiddleSearchOpen:P},x=(0,b.zeq)(e,a);if("thread"!==n||!x)return T;if(s!==r.l3&&!k&&!u?.isForum){const t=Number(s),n=t?(0,b.O5q)(e,a,t):void 0,o=n?(0,b.Szq)(e,n):void 0;return{...T,pinnedMessageIds:t,messagesById:x,canUnpin:!1,topMessageSender:o}}const N=k?void 0:(0,b.fcC)(e,a,s);if(N?.length){const t=x[N[0]],{canUnpin:a=!1}=t&&1===N.length&&(0,b.Plp)(e,t,s)||{};return{...T,pinnedMessageIds:N,messagesById:x,canUnpin:a}}return T}))((e=>{let{chatId:t,threadId:a,messageListType:o,isReady:i,isMobile:d,pinnedMessageIds:l,messagesById:u,canUnpin:m,topMessageSender:h,typingStatus:g,isSelectModeActive:y,isLeftColumnShown:f,isRightColumnShown:A,audioMessage:v,chat:b,messagesCount:w,isComments:S,isChatWithSelf:C,hasButtonInHeader:E,shouldSkipHistoryAnimations:M,currentTransitionKey:k,connectionState:P,isSyncing:T,isSynced:x,isFetchingDifference:N,getCurrentPinnedIndexes:B,getLoadingPinnedId:U,emojiStatusSticker:R,isSavedDialog:L,isMiddleSearchOpen:J,onFocusPinnedMessage:O}=e;const{openThreadWithInfo:D,pinMessage:V,focusMessage:G,openChat:j,openPreviousChat:q,loadPinnedMessages:z,toggleLeftColumn:H,exitMessageSelectMode:_,openPremiumModal:W,openThread:K,openStickerSet:$,updateMiddleSearch:X}=(0,s.ko)(),Q=(0,ta.A)(),Z=(0,ht.li)(!0),{isTablet:Y}=(0,F.Ay)(),ee=(0,gi.A)(B)[`${t}_${a}`]||0,te=(0,gi.A)(U),ae=Array.isArray(l)?l[ee]:l,se=u&&ae?u[ae]:void 0,ne=Array.isArray(l)?l.length:l?1:void 0,oe=b&&(0,I.Js)(Q,b).length,ie=h?(0,I.qg)(Q,h):void 0,{settings:re}=b||{},ce=b?.isForum;(0,ht.vJ)((()=>{x&&i&&(a===r.l3||ce)&&z({chatId:t,threadId:a})}),[t,a,x,i,ce]),(0,yn.A)(t,ae,se);const{width:de}=(0,Ss.A)(),le=de<=n.j7z,ue=Y&&f,me=(0,ht.li)(null),he=(0,ht.li)(!0),pe=(0,Et.A)((()=>{X({chatId:t,threadId:a,update:{}})})),ge=(0,Et.A)((e=>{e.target.closest(".title > .custom-emoji")||D({chatId:t,threadId:a})})),{onMouseDown:ye,onMouseUp:fe,onMouseLeave:Ie,onTouchStart:Ae,onTouchEnd:ve}=(0,Wi.A)({onStart:pe,onClick:ge,threshold:500}),be=(0,Et.A)((e=>{V({messageId:e,isUnpin:!0})})),we=(0,Et.A)((e=>{const s=e.shiftKey&&Array.isArray(l)?l[(0,Cs.A)(l.length,l.indexOf(ae)-2)]:ae;O(s)&&G({chatId:t,threadId:a,messageId:s,noForumTopicPanel:!0})})),Se=(0,Et.A)((()=>{K({chatId:t,threadId:a,type:"pinned"})})),Ce=(0,Et.A)((()=>{setTimeout((()=>{Z.current=!0}),450)})),Ee=(0,Et.A)((()=>{W({fromUserId:t})})),Me=(0,Et.A)((()=>{$({stickerSetInfo:R.stickerSetInfo})})),ke=(0,Et.A)((e=>{if(Z.current){if(Z.current=!1,d){const e=document.querySelector(n.m$5);e?.blur()}if(y)return _(),void Ce();if("thread"===o&&0===k)return!Y||ue?(e.stopPropagation(),j({id:void 0},{forceOnHeavyAnimation:!0})):H(),void Ce();q(),Ce()}})),Pe=de>=n.j7z&&de<n.Iye||de>n.c2m&&de<n.j7z&&(!oe||oe>30),Te=Pe||de>n.gQx&&de<n.ltn,xe=Boolean(re?.canAddContact||re?.canBlockContact||re?.canReportSpam),{shouldRender:Ne,transitionClassNames:Be}=(0,Tt.A)(xe),Ue=(0,_i.A)(xe?re:void 0,!0),{shouldRender:Fe,transitionClassNames:Re}=(0,Tt.A)(Boolean(v)),Le=(0,_i.A)(v,!0),{shouldRender:Je,transitionClassNames:Oe}=(0,Tt.A)(Boolean(se)&&!J,void 0,!0),De=(0,_i.A)(se,!0),Ve=(0,_i.A)(ne,!0),Ge=(0,_i.A)(m,!0),je=(0,_i.A)(ie),qe=(0,ws.A)(k),ze=void 0!==qe&&qe<k?qe:void 0,He=Je&&De||Fe&&Le;(0,ht.Nf)((()=>{const e=me.current;if(e)return Te&&He?void(A||Pe?(he.current&&(e.classList.add("tools-stacked","animated"),he.current=!1),setTimeout((()=>{(0,yt.RK)((()=>{e.classList.remove("animated")}))}),350)):(e.classList.remove("tools-stacked"),he.current=!0)):(e.classList.remove("tools-stacked","animated"),void(he.current=!0))}),[Te,He,Pe,A]);const{connectionStatusText:_e}=fa(Q,P,T||N,!0);function We(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ht.Ay.createElement("div",{className:"back-button"},ht.Ay.createElement(aa.A,{round:!0,size:"smaller",color:"translucent",onClick:ke,ariaLabel:Q(e?"Close":"Back")},ht.Ay.createElement("div",{className:(0,ft.A)("animated-close-icon",!e&&"state-back")})),t&&ht.Ay.createElement(Ht,null))}const Ke=Boolean(Fe&&Le),$e=Ke||!d&&E&&de<n.MEw;return(0,Ia.A)(me),ht.Ay.createElement("div",{className:"MiddleHeader",ref:me},ht.Ay.createElement(Qt.Ay,{name:M?"none":"slideFade",activeKey:k,shouldCleanup:!0,cleanupExceptionKey:ze},"thread"===o&&(a===r.l3||L||b?.isForum)?function(){const e=L?Q("SavedMessages"):void 0,s=L?String(a):t;return ht.Ay.createElement(ht.Ay.Fragment,null,(le||k>0)&&We(ue,!L),ht.Ay.createElement("div",{className:"chat-info-wrapper",onMouseDown:ye,onMouseUp:fe,onMouseLeave:Ie,onTouchStart:Ae,onTouchEnd:ve},(0,I.L8)(s)?ht.Ay.createElement(Xi.A,{key:s,userId:s,typingStatus:g,status:_e||e,withDots:Boolean(_e),withFullInfo:!0,withMediaViewer:!0,withStory:!C,withUpdatingStatus:!0,isSavedDialog:L,storyViewerOrigin:c.G9.MiddleHeaderAvatar,emojiStatusSize:22,noRtl:!0,onEmojiStatusClick:Ee}):ht.Ay.createElement($i.A,{key:s,chatId:s,threadId:L?void 0:a,typingStatus:g,status:_e||e,withDots:Boolean(_e),withMediaViewer:a===r.l3,withFullInfo:a===r.l3,withUpdatingStatus:!0,withStory:!0,isSavedDialog:L,storyViewerOrigin:c.G9.MiddleHeaderAvatar,emojiStatusSize:22,onEmojiStatusClick:Me,noRtl:!0})))}():ht.Ay.createElement(ht.Ay.Fragment,null,We(),ht.Ay.createElement("h3",null,void 0!==w?"thread"===o?w?Q(S?"Comments":"Replies",w,"i"):Q(S?"CommentsTitle":"RepliesTitle"):"pinned"===o?Q("PinnedMessagesCount",w,"i"):"scheduled"===o?C?Q("Reminders"):Q("messages",w,"i"):void 0:Q("Loading")))),a===r.l3&&!b?.isForum&&ht.Ay.createElement(Ki.A,{hasPinnedOffset:Je&&Boolean(De)||Fe&&Boolean(Le),chatId:t}),Je&&De&&ht.Ay.createElement(cr,{key:t,message:De,count:Ve||0,index:ee,customTitle:je,className:Oe,onUnpinMessage:Ge?be:void 0,onClick:we,onAllPinnedClick:Se,isLoading:void 0!==te,isFullWidth:$e}),Ne&&ht.Ay.createElement(Zi,{key:t,chatId:t,settings:Ue,className:Be}),ht.Ay.createElement("div",{className:"header-tools"},Ke&&ht.Ay.createElement(ps,{key:(0,p.bj)(Le),message:Le,className:Re}),ht.Ay.createElement(Yi.A,{chatId:t,threadId:a,messageListType:o,isMobile:d,canExpandActions:!Ke})))})));var lr=a(96530);const ur=(0,ht.ph)((0,s.EK)(((e,t)=>{let{userId:a}=t;const s=(0,b.mBe)(e,a);return{userName:(0,I.u0)(s)}}))((function(e){let{userName:t}=e;const a=(0,ta.A)(),{openPremiumModal:n}=(0,s.ko)(),o=(0,Et.A)((()=>n()));return ht.Ay.createElement("div",null,ht.Ay.createElement("div",null,a("Chat.MessagingRestrictedPlaceholder",t)),ht.Ay.createElement(lr.A,{isPrimary:!0,onClick:o},a("Chat.MessagingRestrictedPlaceholderAction")))}))),mr=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ReactorListModal",!t);return a?ht.Ay.createElement(a,e):void 0},hr=e=>{const{isActive:t}=e,a=(0,Ft.A)(vt.ar.Extra,"MiddleSearch",!t,!0);return a?ht.Ay.createElement(a,e):void 0};function pr(e){return"file"===e.kind&&e.type&&n.gex.has(e.type)}const gr=450+n.xB5,yr=(0,ht.ph)((0,s.EK)(((e,t)=>{let{isMobile:a}=t;const s=(0,b.SJA)(e),{isBlurred:o,background:i,backgroundColor:c,patternColor:d}=e.settings.themes[s]||{},{messageLists:l,isLeftColumnShown:u,activeEmojiInteractions:m,seenByModal:h,giftModal:p,starsGiftModal:g,reactorModal:y,audioPlayer:f,shouldSkipHistoryAnimations:A,chatLanguageModal:v,privacySettingsNoticeModal:w}=(0,b.nTw)(e),S=(0,b.Xf0)(e),{leftColumnWidth:C}=e,E={theme:s,customBackground:i,backgroundColor:c,patternColor:d,isLeftColumnShown:u,isRightColumnShown:(0,b.gjV)(e,a),isBackgroundBlurred:o,hasActiveMiddleSearch:Boolean((0,b.TCk)(e)),isSelectModeActive:(0,b.rTV)(e),isSeenByModalOpen:Boolean(h),isPrivacySettingsNoticeModalOpen:Boolean(w),isReactorListModalOpen:Boolean(y),isPremiumGiftModalOpen:p?.isOpen,isStarsGiftModalOpen:g?.isOpen,isChatLanguageModalOpen:Boolean(v),withInterfaceAnimations:(0,b.PKK)(e),currentTransitionKey:Math.max(0,l.length-1),activeEmojiInteractions:m,leftColumnWidth:C};if(!S)return E;const{chatId:M,threadId:k,type:P}=S,T=(0,I.L8)(M),x=(0,b.hds)(e,M),N=(0,b.yps)(e,M),B=(0,b.fcC)(e,M,k),{chatId:U,messageId:F}=f,R=M?(0,b.AWZ)(e,M):void 0,L=(0,b.Vw0)(e,M,k),J=Boolean(!L?.isCommentsInfo&&L?.fromChannelId),O=x&&(0,I.__)(x,k,J,R),D=(0,b.I_m)(e,M),V="pinned"===P,G="thread"===P&&k===r.l3,j=Boolean(x&&(0,I.WX)(x)),q=Boolean(x&&G&&(j||(0,I.Vs)(x))&&x.isNotJoined&&!x.joinRequests),z=Boolean(x?.isNotJoined&&x.isJoinToSend),H=Boolean(x?.isNotJoined&&x.isJoinRequest),_=!!T&&(0,b.apd)(e,M),W=Boolean(N&&_),K=!W&&D,$=_&&!N,X=Boolean(x&&(0,I.YE)(x)&&!R),Q=(0,b.GA4)(e,M,k)?.replyInfo,Z=!!x?.isForum&&k===r.l3&&!Q&&x.topics?.[n.HxB]?.isClosed,Y=U&&F?(0,b.O5q)(e,U,F):void 0,ee=(0,I.cG)(M,k,e.currentUserId),te=ee&&k!==n.Ckz,ae=k!==r.l3&&!ee&&!x?.isForum,se=ae?Number(k):void 0,ne=x&&(T||x?.isCreator||!j&&!(0,I.Sq)(x,"pinMessages")||(0,I.ub)(x,"pinMessages")),oe=(0,b.vGo)(e,M)?.isContactRequirePremium;return{...E,chatId:M,threadId:k,messageListType:P,chat:x,draftReplyInfo:Q,isPrivate:T,areChatSettingsLoaded:Boolean(x?.settings),isComments:J,canPost:!V&&(!x||O)&&!D&&!(z&&x?.isNotJoined)&&!Z&&!ee,isPinnedMessageList:V,currentUserBannedRights:x?.currentUserBannedRights,defaultBannedRights:x?.defaultBannedRights,hasPinned:ae||Boolean(!V&&B?.length),hasAudioPlayer:Boolean(Y),hasButtonInHeader:K||W||q||H,pinnedMessagesCount:B?B.length:0,shouldSkipHistoryAnimations:A,isChannel:j,canSubscribe:q,canStartBot:K,canRestartBot:W,shouldJoinToSend:z,shouldSendJoinRequest:H,shouldLoadFullChat:X,pinnedIds:B,topMessageId:se,canUnpin:ne,canUnblock:$,isSavedDialog:ee,canShowOpenChatButton:te,isContactRequirePremium:oe}}))((function(e){let{leftColumnRef:t,chatId:a,threadId:i,isComments:r,messageListType:c,isMobile:d,chat:l,draftReplyInfo:u,isPrivate:m,isPinnedMessageList:p,canPost:g,currentUserBannedRights:y,defaultBannedRights:f,hasPinned:A,hasAudioPlayer:v,hasButtonInHeader:w,pinnedMessagesCount:S,customBackground:C,theme:E,backgroundColor:B,patternColor:U,isLeftColumnShown:R,isRightColumnShown:L,isBackgroundBlurred:J,leftColumnWidth:O,hasActiveMiddleSearch:D,isSelectModeActive:V,isSeenByModalOpen:G,isPrivacySettingsNoticeModalOpen:j,isReactorListModalOpen:q,isPremiumGiftModalOpen:z,isStarsGiftModalOpen:H,isChatLanguageModalOpen:_,withInterfaceAnimations:W,shouldSkipHistoryAnimations:K,currentTransitionKey:$,isChannel:X,areChatSettingsLoaded:Q,canSubscribe:Z,canStartBot:Y,canRestartBot:ee,activeEmojiInteractions:te,shouldJoinToSend:ae,shouldSendJoinRequest:se,shouldLoadFullChat:ne,pinnedIds:oe,topMessageId:ie,canUnpin:re,canUnblock:ce,isSavedDialog:de,canShowOpenChatButton:le,isContactRequirePremium:ue}=e;const{openChat:me,openPreviousChat:he,unpinAllMessages:pe,loadUser:ge,loadChatSettings:ye,exitMessageSelectMode:fe,joinChannel:Ie,sendBotCommand:Ae,restartBot:ve,showNotification:be,loadFullChat:we,setLeftColumnWidth:Se,resetLeftColumnWidth:Ce,unblockUser:Ee}=(0,s.ko)(),{width:Me}=(0,Ss.A)(),{isTablet:ke,isDesktop:Pe}=(0,F.Ay)(),Te=(0,ta.A)(),[xe,Ne]=(0,ht.J0)(Us.I.None),[Be,Ue]=(0,ht.J0)(!1),Fe=Be&&(!d||!D),[Re,Le]=(0,ht.J0)(),[Je,Oe]=(0,ht.J0)(!1),{onIntersectionChanged:De,onFocusPinnedMessage:Ve,getCurrentPinnedIndexes:Ge,getLoadingPinnedId:je,getForceNextPinnedInHeader:qe}=function(e,t,a,n){const[o,i]=(0,ht.Ul)({}),[r,c]=(0,ht.Ul)(),d=(0,ht.li)(),[l,u]=(0,ht.Ul)(),m=e?`${e}_${t}`:void 0;return(0,ht.vJ)((()=>{c(void 0),d.current=void 0,u(void 0)}),[e,i,c,u,t]),(0,ht.vJ)((()=>{if(!m)return;const e=o()[m],t=a?.length||0;e>=t&&i({...o(),[m]:Math.max(0,t-1)})}),[o,m,a?.length,i]),{onIntersectionChanged:(0,Et.A)((n=>{let{viewportPinnedIdsToAdd:p=[],viewportPinnedIdsToRemove:g=[],isReversed:y,hasScrolled:f,isUnmount:I}=n;if(!e||!t||!m)return;const A=(0,s.mS)();if(!a?.length||!a)return;const v=l();if(v&&!f){const e=a.indexOf(v);i({...o(),[m]:e}),u(void 0)}f&&(c(void 0),u(void 0));const w=r(),S=d.current;if(I&&0===p.length&&1===g.length&&!S?.includes(g[0]))return;const C=(0,h.Am)((S?.filter((e=>!g.includes(e)))||[]).concat(p));d.current=C;const E=(0,b.kdX)(A,e);if(!C.length&&I&&E&&!a.includes(E)){const e=a.find((e=>e<E));if(e){const t=a.indexOf(e);i({...o(),[m]:t})}}if(w||I)return;const M=Math.max(...C),k=a.findIndex((e=>e===M)),P=y?0:1,T=C.length?k:S?.length?(0,Es.qE)(a.indexOf(S[0])+P,0,a.length-1):0;i({...o(),[m]:T})})),onFocusPinnedMessage:(0,Et.A)((r=>{if(!e||!t||!m||l())return!1;const d=(0,s.mS)();if(!a?.length)return n===r;const h=a.indexOf(r),p=(0,Cs.A)(a.length,h+1);c(!0);const g=(0,b.gCU)(d,e,t);return g?.includes(r)||(0,b.Lzh)(d,e,t,r)?(i({...o(),[m]:p}),!0):(u(a[p]),!0)})),getCurrentPinnedIndexes:o,getLoadingPinnedId:l,getForceNextPinnedInHeader:r}}(a,i,oe,ie),ze=d?gr:void 0,He=A&&(Me<n.c2m||v||L&&Me>n.gQx&&Me<n.ltn||!d&&w&&Me<n.MEw),_e=(0,bs.A)(a,ze),We=(0,bs.A)(i,ze),Ke=(0,bs.A)(c,ze),$e=(0,bs.A)(Z,ze),Xe=(0,bs.A)(Y,ze),Qe=(0,bs.A)(ee,ze),Ze=(0,bs.A)(ce,ze),Ye=(0,bs.A)(g,ze)&&!Qe&&!Xe&&!$e&&!Ze&&a!==n.Xab&&!ue,et=(0,bs.A)(He,ze),tt=(0,bs.A)(Fe,ze)&&a!==n.Xab,at=(0,bs.A)(X,ze),st=(0,bs.A)(ae,ze),nt=(0,bs.A)(se,ze),ot=(0,bs.A)(a?De:void 0,ze),it=(0,ws.A)($),rt=void 0!==it&&it<$?it:void 0,{isReady:ct,handleCssTransitionEnd:dt,handleSlideTransitionStop:lt}=function(e,t,a,s,n){const[o,i]=(0,ht.J0)(!n),r=(0,St.A)(),c=void 0!==a&&a!==t;return c&&(e?(i(!1),setTimeout((()=>{i(!0)}),gr)):r()),(0,xt.A)((()=>{e||i(!0)}),[e]),{isReady:o&&!c,handleCssTransitionEnd:e?function(e){"transform"===e.propertyName&&e.target===e.currentTarget&&i(Boolean(s))}:void 0,handleSlideTransitionStop:e?function(){i(!0)}:void 0}}(!K&&W,$,it,a,d);(0,ht.vJ)((()=>a?(0,_t.A)((()=>{me({id:void 0})})):void 0),[a,me]),(0,xt.A)((()=>{Ne(Us.I.None),Le(void 0)}),[a]),(0,ht.vJ)((()=>{if(!o.pz&&!o.Ni)return;const{visualViewport:e}=window;if(!e)return;const t=()=>{const t=e.height!==document.documentElement.clientHeight;(0,yt.RK)((()=>{document.body.classList.toggle("keyboard-visible",t),(0,yt.YS)((()=>{!t&&e.offsetTop&&(0,yt.RK)((()=>{window.scrollTo({top:0})}))}))}))};return e.addEventListener("resize",t),()=>{e.removeEventListener("resize",t)}})),(0,ht.vJ)((()=>{m&&ge({userId:a})}),[a,m,ge]),(0,ht.vJ)((()=>{Q||ye({chatId:a})}),[a,m,Q]),(0,ht.vJ)((()=>{a&&ne&&ct&&we({chatId:a})}),[ne,a,ct,we]);const{initResize:ut,resetResize:mt,handleMouseUp:pt}=function(e,t,a,s,n){const[o,i,r]=(0,Aa.A)(),[c,d]=(0,ht.J0)(0),[l,u]=(0,ht.J0)(0),m=(0,Et.A)((t=>{(0,yt.RK)((()=>{if(!e.current)return;const a=t?`${t}px`:"";e.current.style.width=a,n&&e.current.style.setProperty(n,a)}))}));function h(){(0,yt.RK)((()=>{document.body.classList.remove("cursor-ew-resize")}))}return(0,ht.Nf)((()=>{e.current&&s&&m(s)}),[n,e,s,m]),(0,ht.vJ)((()=>{if(!o)return;const a=e=>{const t=Math.ceil(l+e.clientX-c);m(t)};function s(){n(),t(e.current.offsetWidth)}function n(){h(),document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",s,!1),document.removeEventListener("blur",s,!1),r()}return document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",s,!1),document.addEventListener("blur",s,!1),n}),[l,c,e,t,o,r,m]),{initResize:function(t){t.preventDefault(),(0,yt.RK)((()=>{document.body.classList.add("cursor-ew-resize")})),d(t.clientX),u(e.current.offsetWidth),i()},resetResize:function(e){e.preventDefault(),m(void 0),a()},handleMouseUp:h}}(t,(e=>Se({leftColumnWidth:e})),Ce,O,"--left-column-width"),gt=(0,Et.A)((e=>{const{items:t}=e.dataTransfer||{},a=t&&t.length>0&&Array.from(t).filter((e=>"text/uri-list"!==e.type)).every(pr);Ne(a?Us.I.QuickFile:Us.I.Document)})),It=(0,Et.A)((()=>{Ne(Us.I.None)})),At=(0,Et.A)((()=>{Oe(!0)})),vt=(0,Et.A)((()=>{Oe(!1)})),bt=(0,Et.A)((()=>{me({id:String(i)})})),wt=(0,Et.A)((()=>{pe({chatId:a,threadId:i}),vt(),he()})),Ct=(0,Et.A)((()=>{me({id:a})})),Mt=(0,Et.A)((()=>{Ie({chatId:a}),nt&&be({message:Te(X?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")})})),kt=(0,Et.A)((()=>{Ae({command:"/start"})})),Pt=(0,Et.A)((()=>{ve({chatId:a})})),Tt=(0,Et.A)((()=>{Ee({userId:a})})),Nt=((e,t)=>{const{setThemeSettings:a}=(0,s.ko)(),[o,i]=(0,ht.J0)(t);return(0,ht.vJ)((()=>{t&&(t.startsWith("#")?i(t):As.fetch(n.nfi,e,As.Type.Blob).then((e=>{const t=URL.createObjectURL(e);(0,vs.NN)(t).then((()=>{i(`url(${t})`)}))})).catch((()=>{a({theme:e,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===e?n.MkD:n.be8})})))}),[t,e]),t?o:void 0})(E,C),Bt=(0,ft.A)(et&&"has-header-tools",o.So?"mask-image-disabled":"mask-image-enabled"),Ut=(0,ft.A)("C6IaXYew","nXhZtCma",C&&"K1xhz7U5",B&&"CwoXMwaR",C&&J&&"JBrOVLsX",L&&"Lyw3O8XE",o.cp&&!(_e&&We)&&"jMpPshUt"),Ft=(0,ft.A)("messaging-disabled",!V&&"shown"),Rt=(0,I.gU)(Te,y,f),Lt=(0,I.zc)(Te,l,i,Boolean(u)),Jt=Rt??Lt??(ue?ht.Ay.createElement(ur,{userId:a}):void 0),{composerHiddenScale:Ot,toolbarHiddenScale:Dt,composerTranslateX:Vt,toolbarTranslateX:Gt,unpinHiddenScale:jt,toolbarForUnpinHiddenScale:qt}=(0,ht.Kr)((()=>function(e,t){const a=e<=n.c2m?M.$:2*M.$,s=function(e){if(e>n.gQx){const t=Math.min(Math.max(.25*e,x),T),a=Math.min(.25*e,T);return Math.min(e-t-a,P)}if(e>n.j7z){const t=Math.min(Math.max(.4*e,x),T);return Math.min(e-t,P)}return e>P?P:e}(e),o=e<=n.c2m?3.375*M.$:4*M.$,i=t?s-a-o:s-a,r=e>n.c2m?Math.min(s-a,k):s-a,c=r/i,d=i/r;return{composerHiddenScale:c,toolbarHiddenScale:d,composerTranslateX:t?o/2*d:0,toolbarTranslateX:t?o/2*-1*c:0,unpinHiddenScale:r/N,toolbarForUnpinHiddenScale:N/r}}(Me,Ye)),[Ye,Me]),zt=(0,ft.A)("middle-column-footer",!Ye&&"no-composer",Ye&&Re&&!V&&"with-notch");(0,da.A)({isActive:V,onBack:fe});const Ht=Boolean(!p&&!de&&!Ye&&!Qe&&!Xe&&!$e&&Jt),Wt=Boolean(Qe||$e||nt||Xe||p&&re||le||Ze),Kt=Boolean(Ht||V);return ht.Ay.createElement("div",{id:"MiddleColumn",className:Bt,onTransitionEnd:dt,style:(0,Is.A)(`--composer-hidden-scale: ${Ot}`,`--toolbar-hidden-scale: ${Dt}`,`--unpin-hidden-scale: ${jt}`,`--toolbar-unpin-hidden-scale: ${qt},`,`--composer-translate-x: ${Vt}px`,`--toolbar-translate-x: ${Gt}px`,`--pattern-color: ${U}`,B&&`--theme-background-color: ${B}`),onClick:ke&&R?Ct:void 0},Pe&&ht.Ay.createElement("div",{className:"resize-handle",onMouseDown:ut,onMouseUp:pt,onDoubleClick:mt}),ht.Ay.createElement("div",{className:Ut,style:Nt?`--custom-background: ${Nt}`:void 0}),ht.Ay.createElement("div",{id:"middle-column-portals"}),Boolean(_e&&We)&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:"messages-layout",onDragEnter:Ye?gt:void 0},ht.Ay.createElement(dr,{chatId:_e,threadId:We,messageListType:Ke,isComments:r,isReady:ct,isMobile:d,getCurrentPinnedIndexes:Ge,getLoadingPinnedId:je,onFocusPinnedMessage:Ve}),ht.Ay.createElement(Qt.Ay,{name:K?"none":W?"slide":"fade",activeKey:$,shouldCleanup:!0,cleanupExceptionKey:rt,onStop:lt},ht.Ay.createElement(qi,{key:`${_e}-${We}-${Ke}`,chatId:_e,threadId:We,type:Ke,isComments:r,canPost:Ye,hasTools:et,onScrollDownToggle:Ue,onNotchToggle:Le,isReady:ct,isContactRequirePremium:ue,withBottomShift:Wt,withDefaultBg:Boolean(!C&&!B),onPinnedIntersectionChange:ot,getForceNextPinnedInHeader:qe}),ht.Ay.createElement("div",{className:zt},Ye&&ht.Ay.createElement(Ms.A,{type:"messageList",chatId:_e,threadId:We,messageListType:Ke,dropAreaState:xe,onDropHide:It,isReady:ct,isMobile:d,editableInputId:n.CfG,editableInputCssSelector:n.m$5,inputId:"message-input-text"}),p&&re&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,color:"secondary",className:"composer-button unpin-all-button",onClick:At},ht.Ay.createElement("i",{className:"icon icon-unpin"}),ht.Ay.createElement("span",null,Te("Chat.Pinned.UnpinAll",S,"i")))),le&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,color:"secondary",className:"composer-button open-chat-button",onClick:bt},ht.Ay.createElement("span",null,Te("SavedOpenChat")))),Ht&&ht.Ay.createElement("div",{className:Ft},ht.Ay.createElement("div",{className:"messaging-disabled-inner"},ht.Ay.createElement("span",null,Jt))),d&&($e||st&&!nt)&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:Mt},Te(at?"ProfileJoinChannel":"ProfileJoinGroup"))),d&&nt&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:Mt},Te("ChannelJoinRequest"))),d&&Xe&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:kt},Te("BotStart"))),d&&Qe&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:Pt},Te("BotRestart"))),d&&Ze&&ht.Ay.createElement("div",{className:"middle-column-footer-button-container",dir:Te.isRtl?"rtl":void 0},ht.Ay.createElement(aa.A,{size:"tiny",fluid:!0,ripple:!0,className:"composer-button join-subscribe-button",onClick:Tt},Te("Unblock"))),ht.Ay.createElement(Hi,{messageListType:Ke,isActive:V,canPost:Ye}),ht.Ay.createElement(Ps,{isOpen:G}),ht.Ay.createElement(ks,{isOpen:j}),ht.Ay.createElement(mr,{isOpen:q}),o.CM&&ht.Ay.createElement(Bs,{isOpen:_}))),ht.Ay.createElement(Os,{withScrollDown:tt,canPost:Ye,withExtraShift:Kt})),ht.Ay.createElement(hr,{isActive:Boolean(D)})),a&&ht.Ay.createElement(Ts,{isOpen:Je,chatId:a,pinnedMessagesCount:S,onClose:vt,onUnpin:wt}),ht.Ay.createElement("div",{teactFastList:!0},te?.map(((e,t)=>ht.Ay.createElement(Fs,{teactOrderKey:t,key:e.id,activeEmojiInteraction:e})))),ht.Ay.createElement(xs,{isOpen:z}),ht.Ay.createElement(Ns,{isOpen:H}))}))),fr={giftCodeModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"GiftCodeModal",!t);return a?ht.Ay.createElement(a,e):void 0},boostModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"BoostModal",!t);return a?ht.Ay.createElement(a,e):void 0},chatlistModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ChatlistModal",!t);return a?ht.Ay.createElement(a,e):void 0},urlAuth:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"UrlAuthModal",!t);return a?ht.Ay.createElement(a,e):void 0},oneTimeMediaModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"OneTimeMediaModal",!t);return a?ht.Ay.createElement(a,e):void 0},inviteViaLinkModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"InviteViaLinkModal",!t);return a?ht.Ay.createElement(a,e):void 0},requestedAttachBotInstall:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"AttachBotInstallModal",!t);return a?ht.Ay.createElement(a,e):void 0},reportAdModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ReportAdModal",!t);return a?ht.Ay.createElement(a,e):void 0},webApp:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"WebAppModal",!t);return a?ht.Ay.createElement(a,e):void 0},collectibleInfoModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"CollectibleInfoModal",!t);return a?ht.Ay.createElement(a,e):void 0},mapModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"MapModal",!t);return a?ht.Ay.createElement(a,e):void 0},isStarPaymentModalOpen:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StarPaymentModal",!t);return a?ht.Ay.createElement(a,e):void 0},starsBalanceModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StarsBalanceModal",!t);return a?ht.Ay.createElement(a,e):void 0},starsTransactionModal:e=>{const{modal:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StarsTransactionInfoModal",!t);return a?ht.Ay.createElement(a,e):void 0}},Ir=Object.keys(fr),Ar=Object.entries(fr),vr=(0,ht.ph)((0,s.EK)((e=>(0,h.Up)((0,b.nTw)(e),Ir)))((e=>Ar.map((t=>{let[a,s]=t;return ht.Ay.createElement(s,{key:a,modal:e[a]})}))))),br=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"PaymentModal",!t);return a?ht.Ay.createElement(a,e):void 0},wr=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ReceiptModal",!t);return a?ht.Ay.createElement(a,e):void 0};var Sr=a(79582),Cr=a(54960),Er=a(12933);const Mr=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a}=t;const s=(0,b.hds)(e,a),{userIds:n}=e.contactList||{},{newChatMembersProgress:o}=(0,b.nTw)(e),{currentUserId:i}=e,r=s&&(0,I.WX)(s),{query:d,fetchingStatus:l,globalUserIds:u,localUserIds:m}=(0,b.nTw)(e).userSearch;return{isChannel:r,members:(0,b.AWZ)(e,a)?.members,currentUserId:i,localContactIds:n,searchQuery:d,isSearching:l,isLoading:o===c.D7.Loading,globalUserIds:u,localUserIds:m}}))((e=>{let{isChannel:t,members:a,onNextStep:n,currentUserId:o,localContactIds:i,isLoading:r,searchQuery:c,isSearching:d,localUserIds:l,globalUserIds:u,onClose:m,isActive:p}=e;const{setUserSearchQuery:g}=(0,s.ko)(),y=(0,ta.A)(),[f,A]=(0,ht.J0)([]),v=(0,ws.A)(f)===f;(0,da.A)({isActive:p,onBack:m});const b=(0,ht.Kr)((()=>a?a.map((e=>e.userId)):[]),[a]),w=(0,ht.hb)((e=>{g({query:e})}),[g]),S=(0,ht.Kr)((()=>{const e=(0,s.mS)().users.byId,a=i?(0,I.Z$)(i,e,c):[];return(0,Sr.A)((0,h.Am)([...a,...l||[],...u||[]]).filter((a=>{const s=e[a];return!b.includes(a)&&a!==o&&(!s||!(0,I.tv)(s)||!t&&s.canBeInvitedToGroup)})))}),[i,c,l,u,o,b,t]),C=(0,ht.hb)((()=>{f.length&&(g({query:""}),n(f))}),[f,g,n]);return ht.Ay.createElement("div",{className:"AddChatMembers"},ht.Ay.createElement("div",{className:"AddChatMembers-inner"},ht.Ay.createElement(Cr.A,{itemIds:S,selectedIds:f,filterValue:c,filterPlaceholder:y("lng_channel_add_users"),searchInputId:"new-members-picker-search",isLoading:d,onSelectedIdsChange:A,onFilterChange:w,isSearchable:!0,withDefaultPadding:!0,noScrollRestore:v,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),ht.Ay.createElement(Er.A,{isShown:Boolean(f.length),disabled:r,ariaLabel:y("lng_channel_add_users"),onClick:C},r?ht.Ay.createElement(ka.A,{color:"white"}):ht.Ay.createElement("i",{className:"icon icon-arrow-right"}))))}))),kr=e=>{const t=(0,Ft.A)(vt.ar.Extra,"CreateTopic");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},Pr=e=>{const t=(0,Ft.A)(vt.ar.Extra,"EditTopic");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},Tr=()=>{const e=(0,Ft.A)(vt.ar.Extra,"GifSearch");return e?ht.Ay.createElement(e,null):ht.Ay.createElement(Zt.A,null)},xr=e=>{const t=(0,Ft.A)(vt.ar.Extra,"Management");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},Nr=()=>{const e=(0,Ft.A)(vt.ar.Extra,"PollResults");return e?ht.Ay.createElement(e,null):ht.Ay.createElement(Zt.A,null)};var Br=a(55429),Ur=a(23459);const Fr=(0,y.nF)((e=>e()),250,!1);let Rr=!1;function Lr(e){switch(e){case"members":return c.zW.MemberList;case"stories":return c.zW.StoryList;case"dialogs":return c.zW.SavedDialogs;default:return c.zW.SharedMedia}}var Jr=a(96374);function Or(e,t){const[a,s]=(0,Jr.A)(e,t,void 0,n.nnT);return[a,s,!(!a||!t||a[0]===t[0])]}function Dr(e,t,a,s,o,i){const r=(0,ht.li)();(0,xt.A)((()=>{r.current=void 0}),[i]),(0,xt.A)((()=>{t===e&&s&&o&&(r.current=(0,I.lH)(s,o,e))}),[s,o,t,e]);const[c,d]=(0,Jr.A)(a,r.current,void 0,"media"===e?n.Um:n.gXr);return[c,d,!(!c||!r.current||c[0]===r.current[0])]}var Vr=a(81524),Gr=a(42827),jr=a(37960);const qr=(0,ht.ph)((e=>{let{media:t,idPrefix:a="preview-media",isProtected:s,observeIntersection:n,onClick:o,index:i}=e;const r=(0,ht.li)(null),c=(0,en.Vz)(r,n),d=(0,I.CI)(t),l=(0,is.A)((0,I.EO)(t,"preview"),!c),u=(0,jr.A)(l),m=t.content.video,h=(0,Et.A)((()=>{o(i)}));return ht.Ay.createElement("div",{ref:r,id:`${a}${i}`,className:"Media scroll-item",onClick:h},ht.Ay.createElement("img",{src:d,className:"media-miniature",alt:"",draggable:!s,decoding:"async",onContextMenu:s?rn.A:void 0}),ht.Ay.createElement("img",{src:l,className:(0,ft.A)("full-media","media-miniature",u),alt:"",draggable:!s,decoding:"async",onContextMenu:s?rn.A:void 0}),m&&ht.Ay.createElement("span",{className:"video-duration"},m.isGif?"GIF":(0,de.QO)(m.duration)),s&&ht.Ay.createElement("span",{className:"protector"}))}));var zr=a(44784),Hr=a(70195),_r=a(37378),Wr=a(94803),Kr=a(83429);const $r="NOCaj4mx",Xr=(0,ht.ph)((0,s.EK)(((e,t)=>{let{story:a}=t;const s=(0,b.hds)(e,a.peerId),n=s?.isProtected,{maxPinnedStoriesCount:o}=e.appConfig||{},i="isOut"in a&&a.isOut,r=(0,b.gVx)(e,a.peerId),c=r?.some((e=>e.id===a.id));return{isProtected:n,isPinned:c,canPin:i&&(!o||(r?.length||0)<o)}}))((function(e){let{story:t,isProtected:a,isArchive:n,isPinned:o,canPin:i}=e;const{openStoryViewer:r,loadPeerSkippedStories:c,toggleStoryInProfile:d,toggleStoryPinnedToTop:l,showNotification:u}=(0,s.ko)(),m=(0,ta.A)(),h=(0,ht.li)(null),p=(0,Et.A)((()=>h.current)),g=(0,Et.A)((()=>document.body)),y=(0,Et.A)((()=>document.querySelector("#portals .story-context-menu .bubble"))),f=(0,Et.A)((()=>({withPortal:!0,isDense:!0}))),A=t&&t.peerId,v=t&&"content"in t,b=v&&t.isOut,w=t&&"isDeleted"in t,S=v?t.content.video:void 0,C=S&&(0,de.QO)(S.duration),E=v?(0,I.EN)(t):void 0,M=(0,is.A)(E)||S?.thumbnail?.dataUri;(0,ht.vJ)((()=>{!t||v||w||c({peerId:t.peerId})}),[w,v,t]);const{isContextMenuOpen:k,contextMenuPosition:P,handleBeforeContextMenu:T,handleContextMenu:x,handleContextMenuClose:N,handleContextMenuHide:B}=(0,ss.A)(h,!b),{positionX:U,positionY:F,transformOriginX:R,transformOriginY:L,style:J}=(0,Wr.A)(P,p,g,y,f),O=(0,ht.hb)((()=>{r({peerId:t.peerId,storyId:t.id,isSinglePeer:!0,isPrivate:!0,isArchive:n})}),[n,t.id,t.peerId]),D=(0,Et.A)((e=>{(0,js.u)(e),T(e)})),V=(0,Et.A)((e=>{(0,rn.A)(e),d({peerId:A,storyId:t.id,isInProfile:!0}),u({message:m("Story.ToastSavedToProfileText")}),N()})),G=(0,Et.A)((e=>{(0,rn.A)(e),d({peerId:A,storyId:t.id,isInProfile:!1}),u({message:m("Story.ToastRemovedFromProfileText")}),N()})),j=(0,Et.A)((()=>{l({peerId:A,storyId:t.id}),N()}));return ht.Ay.createElement("div",{ref:h,className:(0,ft.A)("kxMIqtqr","scroll-item"),onMouseDown:D,onClick:O,onContextMenu:x},w&&ht.Ay.createElement("span",null,ht.Ay.createElement(Vn.A,{className:"cq7jTRkg",name:"story-expired"}),m("ExpiredStory")),o&&ht.Ay.createElement(Vn.A,{className:(0,ft.A)($r,"GTWFQyJx"),name:"pin-badge"}),v&&Boolean(t.views?.viewsCount)&&ht.Ay.createElement("span",{className:(0,ft.A)($r,"g09Rb4Ps")},ht.Ay.createElement(Vn.A,{name:"eye"}),t.views.viewsCount),C&&ht.Ay.createElement("span",{className:(0,ft.A)($r,"lM_2MMyQ")},C),ht.Ay.createElement("div",{className:"D6Yajvjx"},M&&ht.Ay.createElement("img",{src:M,alt:"",className:"cV_QL3N5",draggable:!1}),v&&ht.Ay.createElement(Kr.A,{story:t}),a&&ht.Ay.createElement("span",{className:"protector"})),void 0!==P&&ht.Ay.createElement(sa.A,{isOpen:k,transformOriginX:R,transformOriginY:L,positionX:U,positionY:F,style:J,className:(0,ft.A)("UAfI9izT","story-context-menu"),autoClose:!0,onClose:N,onCloseAnimationEnd:B,withPortal:!0},n&&ht.Ay.createElement(na.A,{icon:"archive",onClick:V},m("StoryList.SaveToProfile")),!n&&ht.Ay.createElement(na.A,{icon:"archive",onClick:G},m("Story.Context.RemoveFromProfile")),!n&&!o&&i&&ht.Ay.createElement(na.A,{icon:"pin",onClick:j},m("StoryList.ItemAction.Pin")),!n&&o&&ht.Ay.createElement(na.A,{icon:"unpin",onClick:j},m("StoryList.ItemAction.Unpin"))))})));var Qr=a(46222),Zr=a(22720),Yr=a(285);const ec=[{type:"media",title:"SharedMediaTab2"},{type:"documents",title:"SharedFilesTab2"},{type:"links",title:"SharedLinksTab2"},{type:"audio",title:"SharedMusicTab2"}],tc=(0,ht.ph)((0,s.EK)(((e,t)=>{let{chatId:a,threadId:s,isMobile:n}=t;const o=(0,b.hds)(e,a),i=(0,b.AWZ)(e,a),c=(0,b.zeq)(e,a),{currentType:d,resultsByType:l}=(0,b.BU_)(e)||{},{foundIds:u}=l&&d&&l[d]||{},m=Boolean(o?.isForum&&s&&s!==r.l3),{byId:h,statusesById:p}=e.users,{byId:g}=e.chats,y=(0,I.cG)(a,s,e.currentUserId),f=o&&(0,I.YE)(o),A=o&&(0,I.WX)(o),v=!m&&!y&&(f||A&&(0,I.SJ)(o)),w=i?.members,S=i?.adminMembersById,C=v&&o&&(o.isForbidden||i&&!i.canViewMembers),E=v&&o&&((0,I.ub)(o,"inviteUsers")||!A&&!(0,I.Sq)(o,"inviteUsers")||o.isCreator),M=v&&o&&((0,I.ub)(o,"banUsers")||o.isCreator),k=(0,b.yuw)(e),{similarChannelIds:P}=(0,b.dg4)(e,a)||{},T=(0,b.g29)(e);let x,N,B;(0,I.L8)(a)&&(N=a,B=(0,b.mBe)(e,N),x=B&&!B.isSelf&&!(0,I.tv)(B)&&!y);const U=B||o,F=(0,b.kBv)(e,a),R=(0,b.vGo)(e,a),L=R?.botInfo?.hasPreviewMedia,J=e.users.previewMediaByBotId[a],O=U&&(B?.isSelf||!U.areStoriesHidden&&F?.hasPinnedStories)&&!y,D=O?(0,b._bp)(e,U.id):void 0,V=D?.profileIds,G=D?.pinnedIds,j=D?.byId,q=D?.archiveIds;return{theme:(0,b.SJA)(e),isChannel:A,resolvedUserId:N,messagesById:c,foundIds:u,mediaSearchType:d,hasCommonChatsTab:x,hasStoriesTab:O,hasMembersTab:v,hasPreviewMediaTab:L,areMembersHidden:C,canAddMembers:E,canDeleteMembers:M,currentUserId:e.currentUserId,isRightColumnShown:(0,b.gjV)(e,n),isRestricted:o?.isRestricted,activeDownloads:k,usersById:h,userStatusesById:p,chatsById:g,storyIds:V,pinnedStoryIds:G,archiveStoryIds:q,storyByIds:j,isChatProtected:o?.isProtected,nextProfileTab:(0,b.nTw)(e).nextProfileTab,forceScrollProfileTab:(0,b.nTw)(e).forceScrollProfileTab,shouldWarnAboutSvg:e.settings.byKey.shouldWarnAboutSvg,similarChannels:P,botPreviewMedia:J,isCurrentUserPremium:T,isTopicInfo:m,isSavedDialog:y,isSynced:e.isSynced,limitSimilarChannels:(0,ne.B)(e,"recommendedChannels"),...v&&w&&{members:w,adminMembersById:S},...x&&B&&{commonChatIds:B.commonChats?.ids}}}))((e=>{let{chatId:t,threadId:a,profileState:i,onProfileStateChange:d,theme:l,isChannel:u,resolvedUserId:m,currentUserId:h,messagesById:p,foundIds:g,storyIds:y,pinnedStoryIds:f,archiveStoryIds:A,storyByIds:v,mediaSearchType:b,hasCommonChatsTab:w,hasStoriesTab:S,hasMembersTab:C,hasPreviewMediaTab:E,botPreviewMedia:M,areMembersHidden:k,canAddMembers:P,canDeleteMembers:T,commonChatIds:x,members:N,adminMembersById:B,usersById:U,userStatusesById:F,chatsById:R,isRightColumnShown:L,isRestricted:J,activeDownloads:O,isChatProtected:D,nextProfileTab:V,shouldWarnAboutSvg:G,similarChannels:j,isCurrentUserPremium:q,limitSimilarChannels:z,isTopicInfo:H,isSavedDialog:_,forceScrollProfileTab:W,isSynced:K}=e;const{setSharedMediaSearchType:$,loadMoreMembers:X,loadCommonChats:Q,openChat:Z,searchSharedMediaMessages:Y,openMediaViewer:ee,openAudioPlayer:te,focusMessage:ae,setNewChatMembersDialogState:se,loadPeerProfileStories:ne,loadStoriesArchive:oe,openPremiumModal:ie,loadChannelRecommendations:re,loadPreviewMedias:ce}=(0,s.ko)(),de=(0,ht.li)(null),le=(0,ht.li)(null),ue=(0,ta.A)(),[me,he]=(0,ht.J0)(),pe=_?String(a):m||t,ge=pe===h&&!_,ye=(0,ht.Kr)((()=>[...ge&&!_?[{type:"dialogs",title:"SavedDialogsTab"}]:[],...S?[{type:"stories",title:"ProfileStories"}]:[],...S&&ge?[{type:"storiesArchive",title:"ProfileStoriesArchive"}]:[],...C?[{type:"members",title:u?"ChannelSubscribers":"GroupMembers"}]:[],...E?[{type:"previewMedia",title:"ProfileBotPreviewTab"}]:[],...ec,...H?[]:[{type:"voice",title:"SharedVoiceTab2"}],...w?[{type:"commonChats",title:"SharedGroupsTab2"}]:[],...u&&j?.length?[{type:"similarChannels",title:"SimilarChannelsTab"}]:[]]),[w,C,E,S,u,H,j,ge,_]),fe=(0,ht.Kr)((()=>{if(!V)return 0;const e=ye.findIndex((e=>{let{type:t}=e;return t===V}));return-1===e?0:e}),[V,ye]),[Ie,Ae,ve]=(0,Aa.A)(!1),[be,we]=(0,ht.J0)(fe);(0,ht.vJ)((()=>{if(!V)return;const e=ye.findIndex((e=>{let{type:t}=e;return t===V}));-1!==e&&we(e)}),[V,ye]);const Se=(0,ht.hb)((e=>{Ae(),we(e)}),[]);(0,ht.vJ)((()=>{E&&!M&&ce({botId:t})}),[t,M,E]),(0,ht.vJ)((()=>{u&&!j&&K&&re({chatId:t})}),[t,u,j,K]);const Ce=be>ye.length-1?ye.length-1:be,Ee=ye[Ce].type,Me=(0,ht.hb)((e=>{let{offsetId:a}=e;ne({peerId:t,offsetId:a})}),[t]),ke=(0,ht.hb)((e=>{let{offsetId:t}=e;oe({peerId:h,offsetId:t})}),[h]),[Pe,Te,xe,Ne]=function(e,t,a,s,n,o,i,r,c,d,l,u,m,h,p,g,y,f,A){const v="members"!==o&&i?i:o,b=(0,ht.Kr)((()=>{if(r&&d&&l)return(0,I.UB)(r.map((e=>{let{userId:t}=e;return t})),d,l)}),[r,d,l]),w=(0,ht.Kr)((()=>{if(c&&u)return(0,Sr.A)(c,!0)}),[u,c]),[S,C,E]=Or(e,b),[M,k,P]=Dr("media",v,a,m,h,p),[T,x,N]=Dr("documents",v,a,m,h,p),[B,U,F]=Dr("links",v,a,m,h,p),[R,L,J]=Dr("audio",v,a,m,h,p),[O,D,V]=Dr("voice",v,a,m,h,p),[G,j,q]=Or(t,w),z=(0,ht.Kr)((()=>{if(!g?.length)return g;const e=new Set(y);return g.slice().sort(((t,a)=>{const s=e.has(t),n=e.has(a);return s&&!n?-1:!s&&n?1:a-t}))}),[g,y]),[H,_,W]=Or(s,z),[K,$,X]=Or(n,f);let Q,Z,Y=!1;switch(v){case"members":Q=S,Z=C,Y=E;break;case"commonChats":Q=G,Z=j,Y=q;break;case"media":Q=M,Z=k,Y=P;break;case"documents":Q=T,Z=x,Y=N;break;case"links":Q=B,Z=U,Y=F;break;case"audio":Q=R,Z=L,Y=J;break;case"voice":Q=O,Z=D,Y=V;break;case"stories":Q=H,Z=_,Y=W;break;case"storiesArchive":Q=K,Z=$,Y=X;break;case"similarChannels":Q=A;break;case"dialogs":Y=!0}return[v,Q,Z,Y]}(X,Q,Y,Me,ke,Ee,b,N,x,U,F,R,p,g,a,y,f,A,j),Be=ge&&"dialogs"===Pe||S&&"stories"===Pe||"members"===Pe||!C&&"media"===Pe,Ue=ye.findIndex((e=>{let{type:t}=e;return t===Pe}));(0,Ur.A)("members"===Pe?Te:void 0);const Fe=(0,Et.A)((()=>{ve()})),{handleScroll:Re}=function(e,t,a,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6?arguments[6]:void 0;(0,Ra.A)((a=>{let[r]=a;if(r&&r!==t&&o||t&&n){const a=e.current,n=a.querySelector(".TabList");i(),a.scrollTop<n.offsetTop&&(s(Lr(t)),Rr=!0,(0,Rs.Ay)(a,n,"start",void 0,void 0,void 0,300),setTimeout((()=>{Rr=!1}),350))}}),[t,s,e,n,o,i]),(0,Ra.A)((t=>{let[s]=t;if(a!==c.zW.Profile||a===s)return;const n=e.current;if(!n)return;const o=n.querySelector(".TabList");!o||o.offsetTop>n.scrollTop||(Rr=!0,(0,Rs.Ay)(n,n.firstElementChild,"start",void 0,2*n.offsetHeight),setTimeout((()=>{Rr=!1}),350))}),[a,e]);const r=(0,Et.A)((()=>{const a=e.current;if(!a)return;const n=a.querySelector(".TabList");if(!n)return;let o=c.zW.Profile;a.scrollTop>=n.offsetTop&&(o=Lr(t)),s(o)}));return(0,ht.vJ)((()=>{Rr||r()}),[r,t]),{handleScroll:(0,Et.A)((()=>{Rr||Fr(r)}))}}(de,Pe,i,d,W,Ie,Fe),{applyTransitionFix:Le,releaseTransitionFix:Je}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".Transition.shared-media-transition";return(0,ht.vJ)((()=>{function a(){const a=e.current,s=a.querySelector(t),n=a.querySelector(".TabList");if(s&&n){const e=a.offsetHeight-n.offsetHeight;(0,yt.RK)((()=>{s.style.minHeight=`${e}px`}))}}return a(),window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}}),[e,t]),{applyTransitionFix:(0,Et.A)((()=>{(0,yt.YS)((()=>{const t=e.current;if("hidden"===t.style.overflowY)return;const a=t.offsetWidth-t.clientWidth;(0,yt.RK)((()=>{t.style.overflowY="hidden",t.style.paddingRight=`${a}px`}))}))})),releaseTransitionFix:(0,Et.A)((()=>{const t=e.current;t.style.overflowY="scroll",t.style.paddingRight="0"}))}}(de),[Oe,De]=(()=>{const[e,t]=(0,ht.J0)(0);return[e,(0,ht.hb)((()=>{t((e=>e+1))}),[])]})(),{observe:Ve}=(0,en.BL)({rootRef:de,throttleMs:500}),Ge=(0,Et.A)((()=>{Je(),De()})),je=(0,Et.A)((()=>{se({newChatMembersProgress:c.D7.InProgress})}));(0,ht.vJ)((()=>{$({mediaType:Ee})}),[$,Ee,a]);const qe=(0,Et.A)((e=>{ee({chatId:pe,threadId:r.l3,messageId:e,origin:c.TQ.SharedMedia})})),ze=(0,Et.A)((e=>{ee({standaloneMedia:M?.flatMap((e=>e?.content.photo||e?.content.video)).filter(Boolean),origin:c.TQ.PreviewMedia,mediaIndex:e})})),He=(0,Et.A)((e=>{te({chatId:pe,messageId:e})})),_e=(0,Et.A)((e=>{Z({id:e})})),We=(0,Et.A)((e=>{ae({chatId:e.chatId,messageId:e.id})})),Ke=(0,Et.A)((()=>{he(void 0)}));let $e;(0,Ra.A)((e=>{let[t]=e;if(void 0===t||0===be||t===C)return;const a=be+(C?1:-1);we(Math.min(a,ye.length-1))}),[C,be,ye]),(0,ht.vJ)((()=>{if(le.current&&o.TF)return(0,ra.wJ)(le.current,{selectorToPreventScroll:".Profile",onSwipe:(e,t)=>t===ra.ez.Left?(we(Math.min(Ce+1,ye.length-1)),!0):t===ra.ez.Right&&(we(Math.max(0,Ce-1)),!0)})}),[Ce,ye.length]),Be?$e=L?0:1e3:Te||M||($e=n.jhd);const Xe=(0,co.A)([t,a,Pe,Ce],$e);return ht.Ay.createElement(Qr.A,{ref:de,className:"Profile custom-scroll",itemSelector:`.shared-media-transition > .Transition_slide-active.${Pe}-list > .scroll-item`,items:Xe?Te:void 0,cacheBuster:Oe,sensitiveArea:n.ZhW,preloadBackwards:Xe?"members"===Pe?n.nnT:n.Um:0,noScrollRestoreOnTop:!0,noFastList:!0,onLoadMore:xe,onScroll:Re},!Ne&&!ge&&function(e,t,a){return ht.Ay.createElement("div",{className:"profile-info"},ht.Ay.createElement(Hr.A,{peerId:e,canPlayVideo:t}),ht.Ay.createElement(zr.A,{chatOrUserId:e,isSavedDialog:a}))}(pe,L&&Xe,_),!J&&ht.Ay.createElement("div",{className:"shared-media"},ht.Ay.createElement(Qt.Ay,{ref:le,name:ue.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:Ue,renderCount:ye.length,shouldRestoreHeight:!0,className:"shared-media-transition",onStart:Le,onStop:Ge},function(){if("dialogs"===Pe)return ht.Ay.createElement(ma.A,{className:"saved-dialogs",folderType:"saved",isActive:!0});if(!Te&&!M||!Xe||!p){const e=Be&&!Xe,t=Boolean("members"===Pe&&k);return ht.Ay.createElement("div",{className:"content empty-list"},!e&&!t&&ht.Ay.createElement(ka.A,null),t&&ht.Ay.createElement(Gr.A,{text:"You have no access to group members list."}))}if(Te&&!Te?.length){let e;switch(Pe){case"members":e=k?"You have no access to group members list.":"No members found";break;case"commonChats":e=ue("NoGroupsInCommon");break;case"documents":e=ue("lng_media_file_empty");break;case"links":e=ue("lng_media_link_empty");break;case"audio":e=ue("lng_media_song_empty");break;case"voice":e=ue("lng_media_audio_empty");break;case"stories":e=ue("StoryList.SavedEmptyState.Title");break;case"storiesArchive":e=ue("StoryList.ArchivedEmptyState.Title");break;default:e=ue("SharedMedia.EmptyTitle")}return ht.Ay.createElement("div",{className:"content empty-list"},ht.Ay.createElement(Gr.A,{text:e}))}return ht.Ay.createElement("div",{className:`content ${Pe}-list`,dir:ue.isRtl&&"media"===Pe?"rtl":void 0,teactFastList:!0},"media"===Pe?Te.map((e=>p[e]&&ht.Ay.createElement(Vr.A,{key:e,message:p[e],isProtected:D||p[e].isProtected,observeIntersection:Ve,onClick:qe}))):"stories"===Pe||"storiesArchive"===Pe?Te.map(((e,t)=>v?.[e]&&ht.Ay.createElement(Xr,{teactOrderKey:t,key:`${Pe}_${e}`,story:v[e],isArchive:"storiesArchive"===Pe}))):"documents"===Pe?Te.map((e=>p[e]&&ht.Ay.createElement(Ln.A,{key:e,document:(0,I.zC)(p[e]),withDate:!0,smaller:!0,className:"scroll-item",isDownloading:(0,I.$r)(O,(0,I.zC)(p[e])),observeIntersection:Ve,onDateClick:We,message:p[e],shouldWarnAboutSvg:G}))):"links"===Pe?Te.map((e=>p[e]&&ht.Ay.createElement(_r.A,{key:e,message:p[e],isProtected:D||p[e].isProtected,observeIntersection:Ve,onMessageClick:We}))):"audio"===Pe?Te.map((e=>p[e]&&ht.Ay.createElement(Fn.Ay,{key:e,theme:l,message:p[e],origin:c.d9.SharedMedia,date:p[e].date,className:"scroll-item",onPlay:He,onDateClick:We,canDownload:!D&&!p[e].isProtected,isDownloading:(0,I.$r)(O,p[e].content.audio)}))):"voice"===Pe?Te.map((e=>p[e]&&ht.Ay.createElement(Fn.Ay,{key:e,theme:l,message:p[e],senderTitle:(0,Br.N)(ue,p[e],R,U),origin:c.d9.SharedMedia,date:p[e].date,className:"scroll-item",onPlay:He,onDateClick:We,canDownload:!D&&!p[e].isProtected,isDownloading:(0,I.$r)(O,p[e].content.voice)}))):"members"===Pe?Te.map(((e,t)=>{return ht.Ay.createElement(Zr.A,{key:e,teactOrderKey:t,className:"chat-item-clickable contact-list-item scroll-item small-icon",onClick:()=>_e(e),contextActions:(a=e,a!==h&&T?[{title:ue("lng_context_remove_from_group"),icon:"stop",handler:()=>{he(a)}}]:void 0)},ht.Ay.createElement(Xi.A,{userId:e,adminMember:B?.[e],forceShowSelf:!0,withStory:!0}));var a})):"commonChats"===Pe?Te.map(((e,t)=>ht.Ay.createElement(Zr.A,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item small-icon",onClick:()=>Z({id:e})},ht.Ay.createElement($i.A,{chatId:e})))):"previewMedia"===Pe?M.map(((e,t)=>ht.Ay.createElement(qr,{key:e.date,media:e,isProtected:D,observeIntersection:Ve,onClick:ze,index:t}))):"similarChannels"===Pe?ht.Ay.createElement("div",{key:Pe},Te.map(((e,t)=>ht.Ay.createElement(Zr.A,{key:e,teactOrderKey:t,className:(0,ft.A)("chat-item-clickable search-result",!q&&t===j.length-1&&"blured"),onClick:()=>Z({id:e})},ht.Ay.createElement($i.A,{avatarSize:"large",chatId:e,withFullInfo:!0})))),!q&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement(aa.A,{className:"show-more-channels",size:"smaller",onClick:()=>ie()},ue("UnlockSimilar"),ht.Ay.createElement("i",{className:"icon icon-unlock-badge"})),ht.Ay.createElement("div",{className:"more-similar"},(0,ts.A)(ue("MoreSimilarText",z),["simple_markdown"])))):void 0)}()),ht.Ay.createElement(ua.A,{big:!0,activeTab:Ce,tabs:ye,onSwitchTab:Se})),P&&ht.Ay.createElement(Er.A,{isShown:"members"===Pe,onClick:je,ariaLabel:ue("lng_channel_add_users")},ht.Ay.createElement("i",{className:"icon icon-add-user-filled"})),T&&ht.Ay.createElement(Yr.A,{isOpen:Boolean(me),userId:me,onClose:Ke}))}))),ac=450+n.xB5;var sc=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.MonetizationStatistics=9]="MonetizationStatistics",e[e.Management=10]="Management",e[e.ManageInitial=11]="ManageInitial",e[e.ManageChannelSubscribers=12]="ManageChannelSubscribers",e[e.ManageChatAdministrators=13]="ManageChatAdministrators",e[e.ManageChatPrivacyType=14]="ManageChatPrivacyType",e[e.ManageDiscussion=15]="ManageDiscussion",e[e.ManageGroupPermissions=16]="ManageGroupPermissions",e[e.ManageGroupRemovedUsers=17]="ManageGroupRemovedUsers",e[e.ManageChannelRemovedUsers=18]="ManageChannelRemovedUsers",e[e.ManageGroupUserPermissionsCreate=19]="ManageGroupUserPermissionsCreate",e[e.ManageGroupUserPermissions=20]="ManageGroupUserPermissions",e[e.ManageGroupRecentActions=21]="ManageGroupRecentActions",e[e.ManageGroupAdminRights=22]="ManageGroupAdminRights",e[e.ManageGroupNewAdminRights=23]="ManageGroupNewAdminRights",e[e.ManageGroupMembers=24]="ManageGroupMembers",e[e.ManageGroupAddAdmins=25]="ManageGroupAddAdmins",e[e.StickerSearch=26]="StickerSearch",e[e.GifSearch=27]="GifSearch",e[e.PollResults=28]="PollResults",e[e.AddingMembers=29]="AddingMembers",e[e.ManageInvites=30]="ManageInvites",e[e.ManageEditInvite=31]="ManageEditInvite",e[e.ManageReactions=32]="ManageReactions",e[e.ManageInviteInfo=33]="ManageInviteInfo",e[e.ManageJoinRequests=34]="ManageJoinRequests",e[e.CreateTopic=35]="CreateTopic",e[e.EditTopic=36]="EditTopic",e[e.SavedDialogs=37]="SavedDialogs",e}(sc||{});const nc=(0,s.EK)(((e,t)=>{let{chatId:a,isProfile:s,isManagement:n,threadId:o}=t;const i=(0,b.nTw)(e),{query:c}=(0,b.BmE)(e)||{},{query:d}=(0,b.Wy7)(e)||{},l=a?(0,b.hds)(e,a):void 0,u=s&&a&&(0,I.L8)(a)?(0,b.mBe)(e,a):void 0,m=l&&(0,I.WX)(l),h=l?.isForum&&Boolean(o&&o!==r.l3),p=h?l.topics?.[o]:void 0,g=h&&p&&(0,I.l1)(l,p),y=u&&(0,I.tv)(u),f=a?(0,b.nZ4)(e,a):void 0,A=y&&u?.canEditBot,v=u&&(0,I.Gh)(u),w=Boolean(!n&&s&&a&&(0,b.e5V)(e,a)),S=Boolean(a&&i.management.byChatId[a]?.editingInvite),C=!h&&a?(0,b.AWZ)(e,a)?.canViewStatistics:void 0,E=a?i.management.byChatId[a]?.inviteInfo?.invite:void 0;return{canManage:w,canAddContact:v,canViewStatistics:C,isChannel:m,isBot:y,isInsideTopic:h,canEditTopic:g,userId:u?.id,isSelf:u?.isSelf,stickerSearchQuery:c,gifSearchQuery:d,isEditingInvite:S,currentInviteInfo:E,isSavedMessages:f,shouldSkipHistoryAnimations:i.shouldSkipHistoryAnimations,canEditBot:A}}))((e=>{let{chatId:t,threadId:a,isColumnOpen:o,isProfile:i,isManagement:r,isStatistics:d,isMessageStatistics:l,isStoryStatistics:u,isMonetizationStatistics:m,isBoostStatistics:h,isStickerSearch:p,isGifSearch:g,isPollResults:y,isCreatingTopic:f,isEditingTopic:I,isAddingChatMembers:A,profileState:v,managementScreen:b,canAddContact:w,userId:S,isSelf:C,canManage:E,isChannel:M,stickerSearchQuery:k,gifSearchQuery:P,isEditingInvite:T,canViewStatistics:x,currentInviteInfo:N,shouldSkipHistoryAnimations:B,isBot:U,isInsideTopic:R,canEditTopic:L,isSavedMessages:J,onClose:O,onScreenSelect:D,canEditBot:V}=e;const{setStickerSearchQuery:G,setGifSearchQuery:j,toggleManagement:q,openAddContactDialog:z,toggleStatistics:H,setEditingExportedInvite:_,deleteExportedChatInvite:W,openEditTopicPanel:K}=(0,s.ko)(),[$,X,Q]=(0,Aa.A)(),{isMobile:Z}=(0,F.Ay)(),Y=(0,zt.g5)(),ee=(0,Et.A)((()=>{_({chatId:t,invite:N}),D(c.je.EditInvite)})),te=(0,Et.A)((()=>{W({chatId:t,link:N.link}),D(c.je.Invites),Q()})),ae=(0,Et.A)((e=>{G({query:e})})),se=(0,Et.A)((e=>{j({query:e})})),ne=(0,Et.A)((()=>{z({userId:S})})),oe=(0,Et.A)((()=>{t&&a&&K({chatId:t,topicId:Number(a)})})),ie=(0,Et.A)((()=>{q()})),re=(0,Et.A)((()=>{H()})),ce=(0,Et.A)((()=>{O(!J)})),[de,le]=(0,ht.J0)(!o);(0,ht.vJ)((()=>{setTimeout((()=>{le(!o)}),ac)}),[o]);const ue=(0,ta.A)(),me=i?v===c.zW.Profile?sc.Profile:v===c.zW.SharedMedia?sc.SharedMedia:v===c.zW.MemberList?sc.MemberList:v===c.zW.StoryList?sc.StoryList:v===c.zW.SavedDialogs?sc.SavedDialogs:-1:y?sc.PollResults:p?sc.StickerSearch:g?sc.GifSearch:A?sc.AddingMembers:r?b===c.je.Initial?sc.ManageInitial:b===c.je.ChatPrivacyType?sc.ManageChatPrivacyType:b===c.je.Discussion?sc.ManageDiscussion:b===c.je.ChannelSubscribers?sc.ManageChannelSubscribers:b===c.je.GroupPermissions?sc.ManageGroupPermissions:b===c.je.ChatAdministrators?sc.ManageChatAdministrators:b===c.je.GroupRemovedUsers?sc.ManageGroupRemovedUsers:b===c.je.ChannelRemovedUsers?sc.ManageChannelRemovedUsers:b===c.je.GroupUserPermissionsCreate?sc.ManageGroupUserPermissionsCreate:b===c.je.GroupUserPermissions?sc.ManageGroupUserPermissions:b===c.je.GroupRecentActions?sc.ManageGroupRecentActions:b===c.je.ChatAdminRights?sc.ManageGroupAdminRights:b===c.je.ChatNewAdminRights?sc.ManageGroupNewAdminRights:b===c.je.GroupMembers?sc.ManageGroupMembers:b===c.je.Invites?sc.ManageInvites:b===c.je.EditInvite?sc.ManageEditInvite:b===c.je.GroupAddAdmins?sc.ManageGroupAddAdmins:b===c.je.Reactions?sc.ManageReactions:b===c.je.InviteInfo?sc.ManageInviteInfo:b===c.je.JoinRequests?sc.ManageJoinRequests:void 0:d?sc.Statistics:l?sc.MessageStatistics:u?sc.StoryStatistics:h?sc.BoostStatistics:f?sc.CreateTopic:I?sc.EditTopic:m?sc.MonetizationStatistics:void 0,he=(0,_i.A)(me,!0)??-1,pe=Z||!J&&(me===sc.SharedMedia||me===sc.MemberList||me===sc.StoryList||me===sc.AddingMembers||me===sc.MessageStatistics||me===sc.StoryStatistics||r),ge=(0,ft.A)("animated-close-icon",pe&&"state-back",(de||B)&&"no-transition"),ye=(0,ht.li)(null);return(0,Ia.A)(ye),ht.Ay.createElement("div",{className:"RightHeader",ref:ye},ht.Ay.createElement(aa.A,{className:"close-button",round:!0,color:"translucent",size:"smaller",onClick:ce,ariaLabel:ue(pe?"Common.Back":"Common.Close")},ht.Ay.createElement("div",{className:ge})),ht.Ay.createElement(Qt.Ay,{name:de||B?"none":"slideFade",activeKey:he},function(){if(-1!==he)switch(he){case sc.PollResults:return ht.Ay.createElement("h3",{className:"title"},ue("PollResults"));case sc.AddingMembers:return ht.Ay.createElement("h3",{className:"title"},ue(M?"ChannelAddSubscribers":"GroupAddMembers"));case sc.ManageInitial:return ht.Ay.createElement("h3",{className:"title"},ue("Edit"));case sc.ManageChatPrivacyType:return ht.Ay.createElement("h3",{className:"title"},ue(M?"ChannelTypeHeader":"GroupTypeHeader"));case sc.ManageDiscussion:return ht.Ay.createElement("h3",{className:"title"},ue("Discussion"));case sc.ManageChatAdministrators:return ht.Ay.createElement("h3",{className:"title"},ue("ChannelAdministrators"));case sc.ManageGroupRecentActions:return ht.Ay.createElement("h3",{className:"title"},ue("Group.Info.AdminLog"));case sc.ManageGroupAdminRights:return ht.Ay.createElement("h3",{className:"title"},ue("EditAdminRights"));case sc.ManageGroupNewAdminRights:return ht.Ay.createElement("h3",{className:"title"},ue("SetAsAdmin"));case sc.ManageGroupPermissions:return ht.Ay.createElement("h3",{className:"title"},ue("ChannelPermissions"));case sc.ManageGroupRemovedUsers:return ht.Ay.createElement("h3",{className:"title"},ue("BlockedUsers"));case sc.ManageChannelRemovedUsers:return ht.Ay.createElement("h3",{className:"title"},ue("ChannelBlockedUsers"));case sc.ManageGroupUserPermissionsCreate:return ht.Ay.createElement("h3",{className:"title"},ue("ChannelAddException"));case sc.ManageGroupUserPermissions:return ht.Ay.createElement("h3",{className:"title"},ue("UserRestrictions"));case sc.ManageInvites:return ht.Ay.createElement("h3",{className:"title"},ue("lng_group_invite_title"));case sc.ManageEditInvite:return ht.Ay.createElement("h3",{className:"title"},ue(T?"EditLink":"NewLink"));case sc.ManageInviteInfo:return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("h3",{className:"title"},ue("InviteLink")),ht.Ay.createElement("section",{className:"tools"},N&&!N.isRevoked&&ht.Ay.createElement(aa.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ee},ht.Ay.createElement("i",{className:"icon icon-edit"})),N&&N.isRevoked&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement(aa.A,{round:!0,color:"danger",size:"smaller",ariaLabel:ue("Delete"),onClick:X},ht.Ay.createElement("i",{className:"icon icon-delete"})),ht.Ay.createElement(xo.A,{isOpen:$,onClose:Q,title:ue("DeleteLink"),text:ue("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:ue("Delete"),confirmHandler:te}))));case sc.ManageJoinRequests:return ht.Ay.createElement("h3",{className:"title"},ue(M?"SubscribeRequests":"MemberRequests"));case sc.ManageGroupAddAdmins:return ht.Ay.createElement("h3",{className:"title"},ue("Channel.Management.AddModerator"));case sc.StickerSearch:return ht.Ay.createElement(Ea.A,{value:k,placeholder:ue("SearchStickersHint"),autoFocusSearch:!0,onChange:ae});case sc.GifSearch:return ht.Ay.createElement(Ea.A,{value:P,placeholder:ue("SearchGifsTitle"),autoFocusSearch:!0,onChange:se});case sc.Statistics:return ht.Ay.createElement("h3",{className:"title"},ue(M?"ChannelStats.Title":"GroupStats.Title"));case sc.MessageStatistics:return ht.Ay.createElement("h3",{className:"title"},ue("Stats.MessageTitle"));case sc.StoryStatistics:return ht.Ay.createElement("h3",{className:"title"},ue("Stats.StoryTitle"));case sc.BoostStatistics:return ht.Ay.createElement("h3",{className:"title"},ue("Boosts"));case sc.MonetizationStatistics:return ht.Ay.createElement("h3",{className:"title"},ue("lng_channel_earn_title"));case sc.SharedMedia:return ht.Ay.createElement("h3",{className:"title"},ue("SharedMedia"));case sc.ManageChannelSubscribers:return ht.Ay.createElement("h3",{className:"title"},ue("ChannelSubscribers"));case sc.MemberList:case sc.ManageGroupMembers:return ht.Ay.createElement("h3",{className:"title"},ue("GroupMembers"));case sc.StoryList:return ht.Ay.createElement("h3",{className:"title"},ue(C?"Settings.MyStories":"PeerInfo.PaneStories"));case sc.SavedDialogs:return ht.Ay.createElement("div",{className:"header"},ht.Ay.createElement("h3",{className:"title"},ue("SavedMessagesTab")),ht.Ay.createElement("div",{className:"subtitle"},ue("Chats",Y[n.pX9])));case sc.ManageReactions:return ht.Ay.createElement("h3",{className:"title"},ue("Reactions"));case sc.CreateTopic:return ht.Ay.createElement("h3",{className:"title"},ue("NewTopic"));case sc.EditTopic:return ht.Ay.createElement("h3",{className:"title"},ue("EditTopic"));default:return ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("h3",{className:"title"},ue(J?"SavedMessages":R?"AccDescrTopic":M?"Channel.TitleInfo":S?U?"lng_info_bot_title":"lng_info_user_title":"GroupInfo.Title")),ht.Ay.createElement("section",{className:"tools"},w&&ht.Ay.createElement(aa.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("AddContact"),onClick:ne},ht.Ay.createElement("i",{className:"icon icon-add-user","aria-hidden":!0})),E&&!R&&ht.Ay.createElement(aa.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ie},ht.Ay.createElement("i",{className:"icon icon-edit"})),V&&ht.Ay.createElement(aa.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Edit"),onClick:ie},ht.Ay.createElement(Vn.A,{name:"edit"})),L&&ht.Ay.createElement(aa.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("EditTopic"),onClick:oe},ht.Ay.createElement("i",{className:"icon icon-edit"})),x&&ht.Ay.createElement(aa.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:ue("Statistics"),onClick:re},ht.Ay.createElement("i",{className:"icon icon-stats"}))))}}()))}));var oc=a(58968),ic=a(55317),rc=a(47058),cc=a(20333),dc=a(71950);const lc={root:"gk6pIryJ",noResults:"WP4wRUbm","section-header":"LWcgK3OX",sectionHeader:"LWcgK3OX",section:"C8KF95yU",user:"oMy5KOFr",stats:"GOzrl0zF",down:"QuLtxDUV",loadMoreSpinner:"ln5zB7KK",status:"r3zLiaXx",info:"Eo1qQlxx",month:"McSPvm0N",quantity:"s1yf_GJa",floatingBadge:"oSCjRZtx",floatingBadgeButtonColor:"duVpAT_e",floatingBadgeWarning:"DsJMXNNk",floatingBadgeButton:"urrWJVYB",floatingBadgeIcon:"hcA9VPeV",floatingBadgeValue:"hHkCO4Ge",content:"SG00REIA",boostSection:"ETgjBS4d",giveawayButton:"wOCtp5Kk",giveawayIcon:"B9GF4NDB"};var uc=a(72078);const mc={3:a(68153),6:uc,12:a(65741)},hc=(0,ht.ph)((0,s.EK)((e=>{const t=(0,b.nTw)(e).boostStatistics,a=(0,b.hc)(e),s=t&&t.chatId,n=s?(0,b.hds)(e,s):void 0,o=n&&(0,I.WX)(n),i=e.appConfig?.giveawayBoostsPerPremium;return{boostStatistics:t,isGiveawayAvailable:a,chatId:s,giveawayBoostsPerPremium:i,isChannel:o}}))((e=>{let{boostStatistics:t,isGiveawayAvailable:a,chatId:o,giveawayBoostsPerPremium:i,isChannel:r}=e;const{openChat:c,loadMoreBoosters:d,closeBoostStatistics:l,openGiveawayModal:u,showNotification:m}=(0,s.ko)(),h=(0,ta.A)(),p=(0,ht.li)(null),g=t?.boostStatus,y=g?t.boostStatus:void 0,f=!(t&&t?.boosts?.count===t?.giftedBoosts?.count)&&t?.giftedBoosts&&t?.giftedBoosts?.list?.length>0,{currentLevel:I,hasNextLevel:A,boosts:v,levelProgress:b,remainingBoosts:w}=(0,ht.Kr)((()=>y?(0,ic.z)(y):{currentLevel:0,hasNextLevel:!1,boosts:0,levelProgress:0,remainingBoosts:0,prepaidGiveaways:[]}),[y]),S=(0,ht.Kr)((()=>{if(y)return{level:I,boosts:v,premiumSubscribers:y.premiumSubscribers,remainingBoosts:w,prepaidGiveaways:y.prepaidGiveaways}}),[y,v,I,w]),C=(0,ht.Kr)((()=>f?[{type:"boostList",title:h("BoostingBoostsCount",t?.boosts?.count,"i")},{type:"giftedBoostList",title:h("BoostingGiftsCount",t?.giftedBoosts?.count,"i")}]:[]),[f,h,t?.boosts?.count,t?.giftedBoosts?.count]),E=(0,ht.Kr)((()=>t?.boosts&&t.boosts?.list.length>0?1:0),[t]),[M,k]=(0,ht.J0)(E),P=M>C.length-1?C.length-1:M,T=C[P]?.type,x=C.findIndex((e=>{let{type:t}=e;return t===T})),N=(0,ht.Kr)((()=>{if(!t)return;const e=f?"boostList"===T?t.boosts:t.giftedBoosts:t.boosts;if(!e?.count)return;const a=e.list.reduce(((e,t)=>e+(t.multiplier||1)),0),s=e.count-a;return s>0?s:void 0}),[f,t,T]),B=(0,Et.A)((e=>ht.Ay.createElement("div",{className:lc.quantity},ht.Ay.createElement("div",{className:(0,ft.A)(lc.floatingBadge,lc.floatingBadgeButtonColor)},ht.Ay.createElement(Vn.A,{name:"boost",className:lc.floatingBadgeIcon}),ht.Ay.createElement("div",{className:lc.floatingBadgeValue},e))))),U=(0,Et.A)((e=>{if(e.isFromGiveaway||e.isGift)return ht.Ay.createElement("div",{className:lc.quantity},ht.Ay.createElement("div",{className:(0,ft.A)(lc.floatingBadge,!e.isFromGiveaway&&lc.floatingBadgeWarning,lc.floatingBadgeButtonColor,lc.floatingBadgeButton)},ht.Ay.createElement(Vn.A,{name:"gift",className:lc.floatingBadgeIcon}),ht.Ay.createElement("div",{className:lc.floatingBadgeValue},h(e.isFromGiveaway?"BoostingGiveaway":"BoostingGift"))))})),F=(0,Et.A)((e=>{e?(c({id:e}),l()):m({message:h("BoostingRecipientWillBeSelected")})})),R=(0,Et.A)((e=>ht.Ay.createElement(Zr.A,{className:"chat-item-clickable",onClick:()=>F(e.userId)},ht.Ay.createElement(Xi.A,{className:lc.user,userId:e.userId,customPeer:e.userId?void 0:oc.VI,status:h("BoostExpireOn",(0,de.U)(h,1e3*e.expires)),noEmojiStatus:!0,forceShowSelf:!0,noFake:!0,noVerified:!0,iconElement:e.multiplier?B(e.multiplier):void 0,rightElement:U(e)})))),L=(0,Et.A)((e=>{e.preventDefault(),u({chatId:o})})),J=(0,Et.A)((e=>{e.preventDefault(),d({isGifts:"giftedBoostList"===T})})),O=(0,Et.A)((e=>{u({chatId:o,prepaidGiveaway:e})}));return ht.Ay.createElement("div",{className:(0,ft.A)(lc.root,"custom-scroll")},!g&&ht.Ay.createElement(Zt.A,null),g&&S&&ht.Ay.createElement(ht.Ay.Fragment,null,ht.Ay.createElement("div",{className:lc.section},ht.Ay.createElement(cc.A,{leftText:h("BoostsLevel",I),rightText:A?h("BoostsLevel",I+1):void 0,progress:b,floatingBadgeText:(0,qt.Sm)(v),floatingBadgeIcon:"boost"}),ht.Ay.createElement(dc.A,{className:lc.stats,statistics:S,type:"boost"})),S.prepaidGiveaways&&ht.Ay.createElement("div",{className:lc.section},ht.Ay.createElement("h4",{className:lc.sectionHeader,dir:h.isRtl?"rtl":void 0},h("BoostingPreparedGiveaways")),S?.prepaidGiveaways?.map((e=>ht.Ay.createElement(Zr.A,{key:e.id,className:"chat-item-clickable",onClick:()=>O(e)},ht.Ay.createElement("div",{className:(0,ft.A)(lc.status,"status-clickable")},ht.Ay.createElement("div",null,ht.Ay.createElement("img",{src:mc[e.months],className:lc.giveawayIcon,alt:h("Giveaway")})),ht.Ay.createElement("div",{className:lc.info},ht.Ay.createElement("h3",null,h("BoostingTelegramPremiumCountPlural",e.quantity)),ht.Ay.createElement("p",{className:lc.month},h("PrepaidGiveawayMonths",e.months))),ht.Ay.createElement("div",{className:lc.quantity},ht.Ay.createElement("div",{className:(0,ft.A)(lc.floatingBadge,lc.floatingBadgeButtonColor,lc.floatingBadgeButton)},ht.Ay.createElement(Vn.A,{name:"boost",className:lc.floatingBadgeIcon}),ht.Ay.createElement("div",{className:lc.floatingBadgeValue,dir:h.isRtl?"rtl":void 0},e.quantity*(i??n.CQG)))))))),ht.Ay.createElement("p",{className:"text-muted hint",key:"links-hint"},h("BoostingSelectPaidGiveaway"))),ht.Ay.createElement("div",null,f?ht.Ay.createElement("div",{className:(0,ft.A)(lc.boostSection,lc.content)},ht.Ay.createElement(Qt.Ay,{ref:p,name:h.isRtl?"slideOptimizedRtl":"slideOptimized",activeKey:x,renderCount:C.length,shouldRestoreHeight:!0},function(){let e;if("boostList"===T?e=t?.boosts?.list:"giftedBoostList"===T&&(e=t?.giftedBoosts?.list),!e||e?.length)return ht.Ay.createElement("div",{className:lc.section},e?.map((e=>R(e))))}()),ht.Ay.createElement(ua.A,{big:!0,activeTab:P,tabs:C,onSwitchTab:k})):ht.Ay.createElement("div",{className:lc.section},ht.Ay.createElement("h4",{className:lc.sectionHeader,dir:h.isRtl?"rtl":void 0},h("BoostingBoostsCount",t?.boosts?.count)),!t?.boosts?.list?.length&&ht.Ay.createElement("div",{className:lc.noResults},h(r?"NoBoostersHint":"NoBoostersGroupHint")),t?.boosts?.list?.map((e=>R(e)))),ht.Ay.createElement("div",{className:lc.section},Boolean(N)&&ht.Ay.createElement(Zr.A,{key:"load-more",className:lc.showMore,disabled:t?.isLoadingBoosters,onClick:J},t?.isLoadingBoosters?ht.Ay.createElement(ka.A,{className:lc.loadMoreSpinner}):ht.Ay.createElement(Vn.A,{name:"down",className:lc.down}),h("ShowVotes",N,"i")))),ht.Ay.createElement(rc.A,{className:lc.section,link:y.boostUrl,withShare:!0,title:h("LinkForBoosting")}),a&&ht.Ay.createElement("div",{className:lc.section},ht.Ay.createElement(Zr.A,{key:"load-more",icon:"gift",onClick:L,className:lc.giveawayButton},h("BoostingGetBoostsViaGifts")),ht.Ay.createElement("p",{className:"text-muted hint",key:"links-hint"},h(r?"BoostingGetMoreBoosts":"BoostingGetMoreBoostsGroup")))))}))),pc=e=>{const t=(0,Ft.A)(vt.ar.Extra,"MessageStatistics");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},gc=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"AboutMonetizationModal",!t);return a?ht.Ay.createElement(a,e):void 0};var yc=a(56440);const fc={root:"vBPv6lUS",graph:"EbPbvB1I",hidden:"nsPIlLYL",ready:"s6qyDhkE",section:"cB2IkwY6",topText:"FLOpxZd1",availableReward:"emE6bAD8",rewardValue:"eyDAxGDU",decimalPart:"jkRV_L7b",integer:"xE9kfGi7",decimalUsdPart:"hWMnYdxX",toncoinIcon:"ubDl9CvS",textBottom:"P3qZJJzF"};let Ic,Ac;const vc={topHoursGraph:"ChannelStats.Graph.ViewsByHours",revenueGraph:"lng_channel_earn_chart_revenue"},bc=Object.keys(vc),wc=(0,ht.ph)((0,s.EK)((e=>{const t=(0,b.nTw)(e),a=t.monetizationStatistics,s=a&&a.chatId,n=s?(0,b.hds)(e,s):void 0,o=n&&n.isCreator,i=(0,b.AWZ)(e,s)?.statisticsDcId;return{chatId:s,dcId:i,statistics:t.statistics.monetization,canCollect:o}}))((e=>{let{chatId:t,dcId:o,statistics:i,canCollect:r}=e;const{loadChannelMonetizationStatistics:c}=(0,s.ko)(),d=(0,ta.A)(),l=(0,va.A)(),u=(0,ht.li)(null),[m,h]=(0,ht.J0)(!1),p=(0,ht.li)([]),g=(0,St.A)(),[y,f,I]=(0,Aa.A)(!1),A=Boolean(0!==i?.balances?.availableBalance);(0,ht.vJ)((()=>{t&&c({chatId:t})}),[t,c]),(0,ht.vJ)((()=>{(async()=>{await async function(){return Ic||(Ic=a.e(1184).then(a.bind(a,31184)),Ac=await Ic),Ic}(),m?i&&u.current&&(bc.forEach(((e,t)=>{const a=i[e];"string"==typeof a||p.current.includes(e)||(a?(Ac.create(u.current.children[t],{title:d(vc[e]),...a}),p.current.push(e),u.current.children[t].classList.remove(fc.hidden)):p.current.push(e))})),g()):h(!0)})()}),[m,i,d,t,o,g]);const v=(0,ht.Kr)((()=>{const e=d("LearnMore");return l("ChannelEarnAbout",{link:ht.Ay.createElement(lr.A,{isPrimary:!0,onClick:f},e,ht.Ay.createElement(Vn.A,{name:"next"}))},{withNodes:!0})}),[l,d]),b=(0,ht.Kr)((()=>{const e=d("LearnMore");return l("MonetizationBalanceZeroInfo",{link:ht.Ay.createElement(yc.A,{url:d("MonetizationProceedsInfoLink"),text:e},e,ht.Ay.createElement(Vn.A,{name:"next"}))},{withNodes:!0})}),[l,d]);return m&&i?ht.Ay.createElement("div",{className:(0,ft.A)(fc.root,"custom-scroll",m&&fc.ready)},ht.Ay.createElement("div",{className:(0,ft.A)(fc.section,fc.topText)},v),ht.Ay.createElement(dc.A,{statistics:i,isToncoin:!0,type:"monetization",title:d("MonetizationOverview")}),!p.current.length&&ht.Ay.createElement(Zt.A,null),ht.Ay.createElement("div",{ref:u,className:fc.section},bc.map((e=>ht.Ay.createElement("div",{key:e,className:(0,ft.A)(fc.graph,fc.hidden)})))),A&&ht.Ay.createElement("div",{className:fc.section},d("lng_channel_earn_balance_title"),function(){const e=i?.balances?.availableBalance,[t,a]=e?e.toFixed(4).split("."):[0],[s,n]=e&&i?.usdRate?(e*i.usdRate).toFixed(2).split("."):[0];return ht.Ay.createElement("div",{className:fc.availableReward},ht.Ay.createElement("div",{className:fc.toncoin},ht.Ay.createElement(Vn.A,{className:fc.toncoinIcon,name:"toncoin"}),ht.Ay.createElement("b",{className:fc.rewardValue},t,ht.Ay.createElement("span",{className:fc.decimalPart},".",a)))," ",ht.Ay.createElement("span",{className:fc.integer},"≈ $",s,ht.Ay.createElement("span",{className:fc.decimalUsdPart},".",n)))}(),ht.Ay.createElement(aa.A,{size:"smaller",type:"button",href:n.ixD,disabled:r&&A},d("MonetizationWithdraw")),ht.Ay.createElement("div",{className:fc.textBottom},b)),ht.Ay.createElement(gc,{isOpen:y,onClose:I})):ht.Ay.createElement(Zt.A,null)}))),Sc=e=>{const t=(0,Ft.A)(vt.ar.Extra,"Statistics");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},Cc=e=>{const t=(0,Ft.A)(vt.ar.Extra,"StoryStatistics");return t?ht.Ay.createElement(t,e):ht.Ay.createElement(Zt.A,null)},Ec=()=>{const e=(0,Ft.A)(vt.ar.Extra,"StickerSearch");return e?ht.Ay.createElement(e,null):ht.Ay.createElement(Zt.A,null)},Mc=450+n.xB5,kc=Object.keys(c.Ul).length/2,Pc=Object.keys(c.je).length/2;function Tc(){const e=document.querySelector(".RightHeader .SearchInput input");e&&e.blur()}const xc=(0,ht.ph)((0,s.EK)(((e,t)=>{let{isMobile:a}=t;const{chatId:s,threadId:n}=(0,b.Xf0)(e)||{},o=(0,b.bE$)(e),{management:i,shouldSkipHistoryAnimations:r,nextProfileTab:c,shouldCloseRightColumn:d}=(0,b.nTw)(e),l=s?i.byChatId[s]?.nextScreen:void 0,u=s?(0,b.nZ4)(e,s):void 0,m=s?(0,I.cG)(s,n,e.currentUserId):void 0;return{contentKey:(0,b.t75)(e,a),chatId:s,threadId:n,isChatSelected:Boolean(s&&o),shouldSkipHistoryAnimations:r,nextManagementScreen:l,nextProfileTab:c,shouldCloseRightColumn:d,isSavedMessages:u,isSavedDialog:m}}))((e=>{let{contentKey:t,chatId:a,threadId:o,isMobile:i,isChatSelected:r,shouldSkipHistoryAnimations:d,nextManagementScreen:l,nextProfileTab:u,shouldCloseRightColumn:m,isSavedMessages:h,isSavedDialog:p}=e;const{toggleChatInfo:g,toggleManagement:y,setStickerSearchQuery:f,setGifSearchQuery:I,closePollResults:A,addChatMembers:v,setNewChatMembersDialogState:b,setEditingExportedInvite:w,toggleStatistics:S,toggleMessageStatistics:C,toggleStoryStatistics:E,setOpenedInviteInfo:M,requestNextManagementScreen:k,resetNextProfileTab:P,closeCreateTopicPanel:T,closeEditTopicPanel:x,closeBoostStatistics:N,setShouldCloseRightColumn:B,closeMonetizationStatistics:U}=(0,s.ko)(),{width:F}=(0,Ss.A)(),[R,L]=(0,ht.J0)(h&&!p?c.zW.SavedDialogs:c.zW.Profile),[J,O]=(0,ht.J0)(c.je.Initial),[D,V]=(0,ht.J0)(),[G,j]=(0,ht.J0)(),q=R!==c.zW.Profile,z=void 0!==t,H=t===c.Ul.ChatInfo,_=t===c.Ul.Management,W=t===c.Ul.Statistics,K=t===c.Ul.MessageStatistics,$=t===c.Ul.StoryStatistics,X=t===c.Ul.BoostStatistics,Q=t===c.Ul.MonetizationStatistics,Z=t===c.Ul.StickerSearch,Y=t===c.Ul.GifSearch,ee=t===c.Ul.PollResults,te=t===c.Ul.AddingMembers,ae=t===c.Ul.CreateTopic,se=t===c.Ul.EditTopic,ne=F<=n.gQx,[oe,ie]=(0,ht.J0)(!z),re=(0,_i.A)(t,!0,!r)??-1,ce=(0,Et.A)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];switch(t){case c.Ul.AddingMembers:b({newChatMembersProgress:c.D7.Closed});break;case c.Ul.ChatInfo:if(q&&e&&!h){L(c.zW.Profile);break}g({force:!1},{forceSyncOnIOs:!0});break;case c.Ul.Management:switch(J){case c.je.Initial:y();break;case c.je.ChatPrivacyType:case c.je.Discussion:case c.je.GroupPermissions:case c.je.GroupType:case c.je.ChatAdministrators:case c.je.ChannelSubscribers:case c.je.GroupMembers:case c.je.Invites:case c.je.Reactions:case c.je.JoinRequests:case c.je.ChannelRemovedUsers:O(c.je.Initial);break;case c.je.GroupUserPermissionsCreate:case c.je.GroupRemovedUsers:case c.je.GroupUserPermissions:O(c.je.GroupPermissions),V(void 0),j(void 0);break;case c.je.ChatAdminRights:case c.je.ChatNewAdminRights:case c.je.GroupAddAdmins:case c.je.GroupRecentActions:O(c.je.ChatAdministrators);break;case c.je.EditInvite:case c.je.InviteInfo:O(c.je.Invites),M({chatId:a,invite:void 0}),w({chatId:a,invite:void 0})}break;case c.Ul.MessageStatistics:C();break;case c.Ul.StoryStatistics:E();break;case c.Ul.Statistics:S();break;case c.Ul.BoostStatistics:N();break;case c.Ul.MonetizationStatistics:U();break;case c.Ul.StickerSearch:Tc(),f({query:void 0});break;case c.Ul.GifSearch:Tc(),I({query:void 0});break;case c.Ul.PollResults:A();break;case c.Ul.CreateTopic:T();break;case c.Ul.EditTopic:x()}})),de=(0,Et.A)(((e,t)=>{V(e),j(t)})),le=(0,Et.A)((e=>{v({chatId:a,memberIds:e})}));function ue(e){if(-1!==re)switch(re){case c.Ul.AddingMembers:return ht.Ay.createElement(Mr,{key:`add_chat_members_${a}`,chatId:a,isActive:z&&e,onNextStep:le,onClose:ce});case c.Ul.ChatInfo:return ht.Ay.createElement(tc,{key:`profile_${a}_${o}`,chatId:a,threadId:o,profileState:R,isMobile:i,onProfileStateChange:L});case c.Ul.Management:return ht.Ay.createElement(xr,{key:`management_${a}_${J}`,chatId:a,currentScreen:J,isPromotedByCurrentUser:G,selectedChatMemberId:D,isActive:z&&e,onScreenSelect:O,onChatMemberSelect:de,onClose:ce});case c.Ul.Statistics:return ht.Ay.createElement(Sc,{chatId:a});case c.Ul.BoostStatistics:return ht.Ay.createElement(hc,null);case c.Ul.MonetizationStatistics:return ht.Ay.createElement(wc,null);case c.Ul.MessageStatistics:return ht.Ay.createElement(pc,{chatId:a,isActive:z&&e});case c.Ul.StoryStatistics:return ht.Ay.createElement(Cc,{chatId:a,isActive:z&&e});case c.Ul.StickerSearch:return ht.Ay.createElement(Ec,{onClose:ce,isActive:z&&e});case c.Ul.GifSearch:return ht.Ay.createElement(Tr,{onClose:ce,isActive:z&&e});case c.Ul.PollResults:return ht.Ay.createElement(Nr,{onClose:ce,isActive:z&&e});case c.Ul.CreateTopic:return ht.Ay.createElement(kr,{onClose:ce,isActive:z&&e});case c.Ul.EditTopic:return ht.Ay.createElement(Pr,{onClose:ce,isActive:z&&e})}}return(0,ht.vJ)((()=>z&&a?(0,_t.A)(ce):void 0),[z,ce,a]),(0,ht.vJ)((()=>{setTimeout((()=>{ie(!z)}),Mc)}),[z]),(0,ht.vJ)((()=>{l&&(O(l),k(void 0))}),[l]),(0,ht.vJ)((()=>{u&&P()}),[u]),(0,ht.vJ)((()=>{m&&(ce(),B({value:void 0}))}),[m]),(0,ht.vJ)((()=>{z&&ne&&ce()}),[ne]),(0,qs.A)((e=>{let[t,s]=e;t===a&&s===o||(L(h&&!p?c.zW.SavedDialogs:c.zW.Profile),O(c.je.Initial))}),[a,o,p,h]),(0,da.A)({isActive:r&&(t===c.Ul.ChatInfo||t===c.Ul.Management||t===c.Ul.AddingMembers||t===c.Ul.CreateTopic||t===c.Ul.EditTopic),onBack:()=>ce(!1)}),ht.Ay.createElement("div",{id:"RightColumn-wrapper",className:r?void 0:"is-hidden"},ne&&ht.Ay.createElement("div",{className:"overlay-backdrop",onClick:ce}),ht.Ay.createElement("div",{id:"RightColumn"},ht.Ay.createElement(nc,{chatId:a,threadId:o,isColumnOpen:z,isProfile:H,isManagement:_,isStatistics:W,isBoostStatistics:X,isMonetizationStatistics:Q,isMessageStatistics:K,isStoryStatistics:$,isStickerSearch:Z,isGifSearch:Y,isPollResults:ee,isCreatingTopic:ae,isEditingTopic:se,isAddingChatMembers:te,profileState:R,managementScreen:J,onClose:ce,onScreenSelect:O}),ht.Ay.createElement(Qt.Ay,{name:oe||d?"none":"zoomFade",renderCount:kc+Pc,activeKey:_?kc+J:re,shouldCleanup:!0,cleanupExceptionKey:re===c.Ul.MessageStatistics||re===c.Ul.StoryStatistics?c.Ul.Statistics:void 0},ue)))}))),Nc=(0,ht.ph)((e=>{let{isOpen:t}=e;const a=(0,Ft.A)(vt.ar.Extra,"StoryViewer",!t);return a?ht.Ay.createElement(a,null):void 0})),Bc=e=>{const{requestedAttachBotInChat:t}=e,a=(0,Ft.A)(vt.ar.Extra,"AttachBotRecipientPicker",!t);return a?ht.Ay.createElement(a,e):void 0},Uc=e=>{const{bot:t}=e,a=(0,Ft.A)(vt.ar.Extra,"BotTrustModal",!t);return a?ht.Ay.createElement(a,e):void 0},Fc={root:"e0JMk_Kh"},Rc=["#E8BC2C","#D0049E","#02CBFE","#5723FD","#FE8C27","#6CB859"],Lc=new Path2D("M6.63869 12.1902L3.50621 14.1092C3.18049 14.3087 2.75468 14.2064 2.55515 13.8807C2.45769 13.7216 2.42864 13.5299 2.47457 13.3491L2.95948 11.4405C3.13452 10.7515 3.60599 10.1756 4.24682 9.86791L7.6642 8.22716C7.82352 8.15067 7.89067 7.95951 7.81418 7.80019C7.75223 7.67116 7.61214 7.59896 7.47111 7.62338L3.66713 8.28194C2.89387 8.41581 2.1009 8.20228 1.49941 7.69823L0.297703 6.69116C0.00493565 6.44581 -0.0335059 6.00958 0.211842 5.71682C0.33117 5.57442 0.502766 5.48602 0.687982 5.47153L4.35956 5.18419C4.61895 5.16389 4.845 4.99974 4.94458 4.75937L6.36101 1.3402C6.5072 0.987302 6.91179 0.819734 7.26469 0.965925C7.43413 1.03612 7.56876 1.17075 7.63896 1.3402L9.05539 4.75937C9.15496 4.99974 9.38101 5.16389 9.6404 5.18419L13.3322 5.47311C13.713 5.50291 13.9975 5.83578 13.9677 6.2166C13.9534 6.39979 13.8667 6.56975 13.7269 6.68896L10.9114 9.08928C10.7131 9.25826 10.6267 9.52425 10.6876 9.77748L11.5532 13.3733C11.6426 13.7447 11.414 14.1182 11.0427 14.2076C10.8642 14.2506 10.676 14.2208 10.5195 14.1249L7.36128 12.1902C7.13956 12.0544 6.8604 12.0544 6.63869 12.1902Z"),Jc=(0,ht.ph)((0,s.EK)((e=>(0,h.Up)((0,b.nTw)(e),["confetti"])))((e=>{let{confetti:t}=e;const a=(0,ht.li)(null),s=(0,ht.li)([]),n=(0,ht.li)(!1),o=(0,Ss.A)(),i=(0,St.A)(),{isMobile:r}=(0,F.Ay)(),c=r?50:100,{lastConfettiTime:d,top:l,width:u,left:m,height:h,style:p="poppers"}=t||{},g=(0,Et.A)((function(e,a){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c;for(let o=0;o<n;o++){const{position:n,velocity:i}=Oc(p,e,a,o),r=10+Dc(5),c=Rc[Math.floor(Math.random()*Rc.length)];s.current.push({pos:n,size:r,color:c,velocity:i,flicker:r,flickerFrequency:.2*Math.random(),rotation:0,lastDrawnAt:Date.now(),frameCount:0,isStar:t?.withStars&&Math.random()>.8})}})),y=(0,Et.A)((()=>{if(!a.current||!n.current)return;const e=a.current,t=e.getContext("2d");if(!t)return;const{width:o,height:i}=e;t.clearRect(0,0,o,i);const r=[];s.current.forEach(((e,a)=>{const{pos:n,velocity:o,size:c,color:d,flicker:l,flickerFrequency:u,rotation:m,lastDrawnAt:h,frameCount:p}=e,g=(Date.now()-h)/1e3,y={x:n.x+o.x*g,y:n.y+o.y*g},f={x:o.x*.5**(g/1),y:o.y+=1e3*g},I=c*Math.abs(Math.sin(p*u)),A=5*p*u*(Math.PI/180),v=p+1,b=Date.now();if(y.y>i+e.size)return void r.push(e);const w={...e,pos:y,velocity:f,flicker:I,rotation:A,lastDrawnAt:b,frameCount:v};s.current[a]=w,t.fillStyle=d,e.isStar?(t.save(),t.translate(n.x,n.y),t.scale(c/10*1.5,c/10*1.5),t.rotate(m),t.fill(Lc),t.restore()):(t.beginPath(),t.ellipse(n.x,n.y,c,l,m,0,2*Math.PI),t.fill())})),s.current=s.current.filter((e=>!r.includes(e))),s.current.length?(0,yt.YS)(y):n.current=!1}));if((0,xt.A)((e=>{let t,[a]=e;return a!==d&&(g(u||o.width,h||o.height),t=setTimeout(i,1e4),n.current||(n.current=!0,(0,yt.YS)(y))),()=>{clearTimeout(t)}}),[d,i,y]),!d||Date.now()-d>1e4)return;const f=(0,Is.A)(Boolean(l)&&`top: ${l}px`,Boolean(m)&&`left: ${m}px`,Boolean(u)&&`width: ${u}px`,Boolean(h)&&`height: ${h}px`);return ht.Ay.createElement("div",{id:"Confetti",className:Fc.root,style:f},ht.Ay.createElement("canvas",{ref:a,className:Fc.canvas,width:o.width,height:o.height}))})));function Oc(e,t,a,s){if("poppers"===e){const e=s%2,n={x:t*(e?-.1:1.1),y:.66*a},o=Math.random()*t;return{position:n,velocity:{x:e?o:-1*o,y:-a-Dc(.75*a)}}}return{position:{x:Math.random()*t,y:-20},velocity:{x:Dc(t),y:-a*Math.random()*1.25}}}function Dc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return Math.random()*e-e/2}const Vc=e=>{const{folder:t}=e,a=(0,Ft.A)(vt.ar.Extra,"DeleteFolderDialog",!t);return a?ht.Ay.createElement(a,e):void 0},Gc=e=>{let{isOpen:t}=e;const a=(0,Ft.A)(vt.ar.Extra,"Dialogs",!t);return a?ht.Ay.createElement(a,null):void 0};var jc=a(95362);const qc=new Set,zc=new Set,Hc=(0,ht.ph)((0,s.EK)((e=>({activeDownloads:(0,b.nTw)(e).activeDownloads})))((e=>{let{activeDownloads:t}=e;const{cancelMediaHashDownloads:a,showNotification:n}=(0,s.ko)(),i=(0,_s.A)(1e3,!0),c=(0,Et.A)((e=>{zc.add(e),i((()=>{zc.size&&(a({mediaHashes:Array.from(zc)}),zc.clear())}))}));(0,ht.vJ)((()=>{Object.keys(t).length?Object.entries(t).forEach((e=>{let[t,a]=e;if(qc.has(t))return;qc.add(t);const{size:s,filename:i,format:d}=a,l=Le.Ih(t);return l?((0,jc.A)(l,i),void c(t)):s>o.kn&&!o.l5&&!o.Tz?(n({message:"Downloading files bigger than 2GB is not supported in your browser."}),void c(t)):void Le.hd(t,d,!0).then((e=>{if(d===r.qZ.DownloadUrl){const t=new URL(e,window.document.baseURI);t.searchParams.set("filename",encodeURIComponent(i));const a=window.open(t.toString());a?.addEventListener("beforeunload",(()=>{n({message:"Download started. Please, do not close the app before it is finished."})}))}else e&&(0,jc.A)(e,i);c(t)}))})):qc.clear()}),[t])}))),_c=e=>{const{requestedDraft:t}=e,a=(0,Ft.A)(vt.ar.Extra,"DraftRecipientPicker",!t);return a?ht.Ay.createElement(a,e):void 0},Wc=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"ForwardRecipientPicker",!t);return a?ht.Ay.createElement(a,e):void 0};var Kc=a(73172),$c=a(8410);const Xc=(0,ht.ph)((0,s.EK)(((e,t)=>{let{openedGame:a}=t;const{chatId:s}=a||{},n=s&&(0,b.hds)(e,s),o=s?(0,b.AWZ)(e,s):void 0;return{canPost:Boolean(n)&&(0,I.__)(n,r.l3,void 0,o)}}))((e=>{let{openedGame:t,gameTitle:a,canPost:s}=e;const{closeGame:n,openForwardMenu:o}=(0,ge.ko)(),i=(0,ta.A)(),{url:r,chatId:c,messageId:d}=t||{},l=Boolean(r),u=(0,Kc.A)(c);(0,bt.A)((()=>{u({type:"playingGame"})}),l&&s?5e3:void 0);const m=(0,ht.hb)((e=>{try{const t=JSON.parse(e.data);"share_score"===t.eventType&&(o({fromChatId:c,messageIds:[d],withMyScore:!0}),n()),"share_game"===t.eventType&&(o({fromChatId:c,messageIds:[d]}),n())}catch(e){}}),[c,n,d,o]),h=(0,ht.hb)((e=>{e.currentTarget.focus()}),[]);return(0,ht.vJ)((()=>(window.addEventListener("message",m),()=>window.removeEventListener("message",m))),[m]),ht.Ay.createElement($c.A,{className:"GameModal",isOpen:l,onClose:n,title:a,hasCloseButton:!0},l&&ht.Ay.createElement("iframe",{className:"game-frame",onLoad:h,src:r,title:i("AttachGame"),sandbox:"allow-scripts allow-same-origin allow-orientation-lock",allow:"fullscreen"}))}))),Qc=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"HistoryCalendar",!t);return a?ht.Ay.createElement(a,e):void 0},Zc=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"NewContactModal",!t);return a?ht.Ay.createElement(a,e):void 0},Yc=e=>{let{isOpen:t}=e;const a=(0,Ft.A)(vt.ar.Extra,"Notifications",!t);return a?ht.Ay.createElement(a,null):void 0},ed=e=>{const{limit:t}=e,a=(0,Ft.A)(vt.ar.Extra,"PremiumLimitReachedModal",!t);return a?ht.Ay.createElement(a,e):void 0},td=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"GiveawayModal",!t);return a?ht.Ay.createElement(a,e):void 0},ad=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"PremiumGiftingPickerModal",!t);return a?ht.Ay.createElement(a,e):void 0},sd=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"PremiumMainModal",!t);return a?ht.Ay.createElement(a,e):void 0},nd=e=>{const{isOpen:t}=e,a=(0,Ft.A)(vt.ar.Extra,"StarsGiftingPickerModal",!t);return a?ht.Ay.createElement(a,e):void 0},od=e=>{const{url:t}=e,a=(0,Ft.A)(vt.ar.Extra,"SafeLinkModal",!t);return a?ht.Ay.createElement(a,e):void 0};let id=!1;const rd=(0,ht.ph)((0,s.EK)(((e,t)=>{let{isMobile:a}=t;const{settings:{byKey:{language:s,wasTimeFormatSetManually:n}},currentUserId:o}=e,{botTrustRequest:i,requestedAttachBotInChat:r,requestedDraft:c,safeLinkModalUrl:d,openedStickerSetShortName:l,openedCustomEmojiSetIds:u,shouldSkipHistoryAnimations:m,openedGame:h,audioPlayer:p,isLeftColumnShown:g,historyCalendarSelectedAt:y,notifications:f,dialogs:I,newContact:A,ratingPhoneCall:v,premiumModal:w,giveawayModal:S,deleteMessageModal:C,giftingModal:E,starsGiftingModal:M,isMasterTab:k,payment:P,limitReachedModal:T,deleteFolderDialogModal:x}=(0,b.nTw)(e),{chatId:N,messageId:B}=p,U=N&&B?(0,b.O5q)(e,N,B):void 0,F=h&&(0,b.O5q)(e,h.chatId,h.messageId),R=F?.content.game?.title,{chatId:L}=(0,b.Xf0)(e)||{},J=!(0,b.xYJ)(e,"rightColumnAnimations")||!(0,b.PKK)(e),O=x?(0,b.$aQ)(e,x):void 0;return{currentUserId:o,isLeftColumnOpen:g,isMiddleColumnOpen:Boolean(L),isRightColumnOpen:(0,b.gjV)(e,a),isMediaViewerOpen:(0,b.F4N)(e),isStoryViewerOpen:(0,b.gd2)(e),isForwardModalOpen:(0,b.p5z)(e),isReactionPickerOpen:(0,b.Ani)(e),hasNotifications:Boolean(f.length),hasDialogs:Boolean(I.length),audioMessage:U,safeLinkModalUrl:d,isHistoryCalendarOpen:Boolean(y),shouldSkipHistoryAnimations:m,openedStickerSetShortName:l,openedCustomEmojiSetIds:u,isServiceChatReady:(0,b.dqr)(e),activeGroupCallId:k?e.groupCalls.activeGroupCallId:void 0,withInterfaceAnimations:(0,b.PKK)(e),language:s,wasTimeFormatSetManually:n,isPhoneCallActive:k?Boolean(e.phoneCall):void 0,addedSetIds:e.stickers.added.setIds,addedCustomEmojiIds:e.customEmojis.added.setIds,newContactUserId:A?.userId,newContactByPhoneNumber:A?.isByPhoneNumber,openedGame:h,gameTitle:R,isRatePhoneCallModalOpen:Boolean(v),botTrustRequest:i,botTrustRequestBot:i&&(0,b.mBe)(e,i.botId),requestedAttachBotInChat:r,isCurrentUserPremium:(0,b.g29)(e),isPremiumModalOpen:w?.isOpen,isGiveawayModalOpen:S?.isOpen,isDeleteMessageModalOpen:Boolean(C),isPremiumGiftingPickerModal:E?.isOpen,isStarsGiftingPickerModal:M?.isOpen,limitReached:T?.limit,isPaymentModalOpen:P.isPaymentModalOpen,isReceiptModalOpen:Boolean(P.receipt),deleteFolderDialog:O,isMasterTab:k,requestedDraft:c,noRightColumnAnimation:J,isSynced:e.isSynced}}))((e=>{let{isMobile:t,isLeftColumnOpen:a,isMiddleColumnOpen:i,isRightColumnOpen:r,isMediaViewerOpen:c,isStoryViewerOpen:d,isForwardModalOpen:l,hasNotifications:u,hasDialogs:m,audioMessage:h,activeGroupCallId:p,safeLinkModalUrl:g,isHistoryCalendarOpen:y,shouldSkipHistoryAnimations:f,limitReached:I,openedStickerSetShortName:A,openedCustomEmojiSetIds:v,isServiceChatReady:b,withInterfaceAnimations:w,language:S,wasTimeFormatSetManually:C,addedSetIds:E,addedCustomEmojiIds:M,isPhoneCallActive:k,newContactUserId:P,newContactByPhoneNumber:T,openedGame:x,gameTitle:N,isRatePhoneCallModalOpen:B,botTrustRequest:U,botTrustRequestBot:R,requestedAttachBotInChat:L,requestedDraft:J,isPremiumModalOpen:O,isGiveawayModalOpen:D,isDeleteMessageModalOpen:V,isPremiumGiftingPickerModal:G,isStarsGiftingPickerModal:j,isPaymentModalOpen:q,isReceiptModalOpen:z,isReactionPickerOpen:H,isCurrentUserPremium:_,deleteFolderDialog:W,isMasterTab:K,noRightColumnAnimation:$,isSynced:X,currentUserId:Q}=e;const{initMain:Z,loadAnimatedEmojis:Y,loadBirthdayNumbersStickers:ee,loadNotificationSettings:te,loadNotificationExceptions:ae,updateIsOnline:se,onTabFocusChange:ne,loadTopInlineBots:oe,loadEmojiKeywords:ie,loadCountryList:re,loadAvailableReactions:ce,loadStickerSets:de,loadPremiumGifts:le,loadDefaultTopicIcons:ue,loadAddedStickers:me,loadFavoriteStickers:he,loadDefaultStatusIcons:pe,ensureTimeFormat:ge,closeStickerSetModal:ye,closeCustomEmojiSets:fe,checkVersionNotification:Ie,loadConfig:Ae,loadAppConfig:ve,loadAttachBots:be,loadContactList:we,loadCustomEmojis:Se,loadGenericEmojiEffects:Ce,closePaymentModal:Ee,clearReceipt:Me,checkAppVersion:ke,openThread:Pe,toggleLeftColumn:Te,loadRecentEmojiStatuses:xe,updatePageTitle:Ne,loadTopReactions:Be,loadRecentReactions:Ue,loadDefaultTagReactions:Fe,loadFeaturedEmojiStickers:Re,setIsElectronUpdateAvailable:Le,loadAuthorizations:Je,loadPeerColors:De,loadSavedReactionTags:Ve,loadTimezones:Ge,loadQuickReplies:je,loadStarStatus:qe,loadAvailableEffects:ze,loadTopBotApps:He}=(0,s.ko)();n.Oig&&!id&&(id=!0,console.log(">>> RENDER MAIN")),(0,wt.A)((()=>{(0,vt.po)(vt.ar.Calls)}),5e3);const _e=(0,ht.li)(null),We=(0,ht.li)(null),{isDesktop:Ke}=(0,F.Ay)();(0,ht.vJ)((()=>{a||i||Ke?a&&i&&t&&Te():Te()}),[Ke,a,i,t,Te]),(0,bt.A)(ke,K?3e5:void 0,!0),(0,ht.vJ)((()=>{if(!o.cp)return;const e=window.electron.on(gt.v.UPDATE_AVAILABLE,(()=>{Le(!0)})),t=window.electron.on(gt.v.UPDATE_ERROR,(()=>{Le(!1),e?.()}));return()=>{t?.(),e?.()}}),[]),(0,ht.vJ)((()=>{K&&X&&(se(!0),Ae(),ve(),De(),Z(),ce(),Y(),te(),ae(),be(),we(),ue(),ke(),Be(),Ue(),Fe(),Re(),oe(),ie({language:n.cUY}),Ge(),je(),qe(),le(),ze(),ee(),Ce(),Ve(),Je(),He())}),[K,X]),(0,ht.vJ)((()=>{K&&_&&(pe(),xe())}),[_,K]),(0,ht.vJ)((()=>{K&&(S!==n.cUY&&ie({language:S}),re({langCode:S}))}),[S,K]),(0,ht.vJ)((()=>{K&&Se({ids:Object.keys((0,s.mS)().customEmojis.byId),ignoreCache:!0})}),[K]),(0,ht.vJ)((()=>{K&&X&&(E&&M||(de(),he()),E&&M&&me())}),[E,M,K,X]),(0,ht.vJ)((()=>{b&&K&&Ie()}),[b,K]),(0,ht.vJ)((()=>{C||ge()}),[C]),(0,ht.vJ)((()=>{if(!X)return;const e=(0,Oe.f4)();e?.tgaddr&&(0,At.__)(decodeURIComponent(e.tgaddr))}),[X]),(0,ht.vJ)((()=>window.electron?.on(gt.v.DEEPLINK,(e=>{(0,At.__)(decodeURIComponent(e))}))),[]),(0,ht.vJ)((()=>{const e=(0,Oe.xV)(Q);e&&Pe({chatId:e.chatId,threadId:e.threadId,type:e.type})}),[Q]),(0,ht.Nf)((()=>{const e=_e.current;1===e.parentNode.childElementCount&&(0,pt.YM)(e,"Transition_slide-active")}),[]);const Xe=(0,Tt.A)(a,void 0,!0,void 0,f,void 0,!0),Qe=(0,ht.li)(!1),Ze=(0,St.A)();(0,xt.A)((e=>{let[t]=e;if(void 0===t||a===t||!w)return;Qe.current=!0,o.Ni&&(0,yt.Uz)((()=>{document.body.classList.toggle("android-left-blackout-open",!a)}));const s=(0,Ct.UH)();(0,It.j)(document.getElementById("MiddleColumn"),(()=>{s(),Qe.current=!1,Ze()}))}),[a,w,Ze]);const Ye=(0,Tt.A)(r,void 0,!0,void 0,f,void 0,!0),et=(0,ht.li)(!1),[tt,at]=(0,ht.J0)(r),st=(0,Ut.zk)();(0,xt.A)((e=>{let[t,a]=e;if(void 0===a||r===a)return;if(!t||$)return void at(r);et.current=!0;const s=(0,Ct.UH)();(0,It.j)(document.getElementById("RightColumn"),(()=>{s(),et.current=!1,Ze(),at(r)}))}),[i,r,$,Ze]);const nt=(0,ft.A)(Xe.hasShownClass&&"left-column-shown",Xe.hasOpenClass&&"left-column-open",Qe.current&&"left-column-animating",Ye.hasShownClass&&"right-column-shown",Ye.hasOpenClass&&"right-column-open",et.current&&"right-column-animating",tt&&"narrow-message-list",f&&"history-animation-disabled",st&&"is-fullscreen"),ot=(0,Et.A)((()=>{ne({isBlurred:!0})})),it=(0,Et.A)((()=>{ne({isBlurred:!1}),document.title.includes(n.LaL)||Ne(),$e(!1)})),rt=(0,Et.A)((()=>{ye()})),ct=(0,Et.A)((()=>{fe()}));return(0,Nt.A)(ot,it,!!o.cp),(0,Bt.A)(ot),function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,ht.vJ)((()=>{if(o.TF){if(!e)return Mt?.setAttribute("content",kt),o.pz&&!o._7&&document.addEventListener("gesturestart",Pt),()=>{Mt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no"),o.pz&&!o._7&&document.removeEventListener("gesturestart",Pt)};Mt?.setAttribute("content","width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover")}}),[e])}(c||d),ht.Ay.createElement("div",{ref:_e,id:"Main",className:nt},ht.Ay.createElement(Qa,{ref:We}),ht.Ay.createElement(yr,{leftColumnRef:We,isMobile:t}),ht.Ay.createElement(xc,{isMobile:t}),ht.Ay.createElement(Za,{isOpen:c}),ht.Ay.createElement(Nc,{isOpen:d}),ht.Ay.createElement(Wc,{isOpen:l}),ht.Ay.createElement(_c,{requestedDraft:J}),ht.Ay.createElement(Yc,{isOpen:u}),ht.Ay.createElement(Gc,{isOpen:m}),h&&ht.Ay.createElement(ps,{key:h.id,message:h,noUi:!0}),ht.Ay.createElement(vr,null),ht.Ay.createElement(od,{url:g}),ht.Ay.createElement(Qc,{isOpen:y}),ht.Ay.createElement(Gt,{isOpen:Boolean(A),onClose:rt,stickerSetShortName:A}),ht.Ay.createElement(Dt,{customEmojiSetIds:v,onClose:ct}),p&&ht.Ay.createElement(Lt,{groupCallId:p}),ht.Ay.createElement(Rt,{isActive:Boolean(p||k)}),ht.Ay.createElement(Zc,{isOpen:Boolean(P||T),userId:P,isByPhoneNumber:T}),ht.Ay.createElement(Xc,{openedGame:x,gameTitle:N}),ht.Ay.createElement(Hc,null),ht.Ay.createElement(Jc,null),ht.Ay.createElement(Jt,{isActive:k}),ht.Ay.createElement(Ht,{isForAppBadge:!0}),ht.Ay.createElement(Ot,{isOpen:B}),ht.Ay.createElement(Uc,{bot:R,type:U?.type,shouldRequestWriteAccess:U?.shouldRequestWriteAccess}),ht.Ay.createElement(Bc,{requestedAttachBotInChat:L}),ht.Ay.createElement(fs,null),O&&ht.Ay.createElement(sd,{isOpen:O}),D&&ht.Ay.createElement(td,{isOpen:D}),G&&ht.Ay.createElement(ad,{isOpen:G}),j&&ht.Ay.createElement(nd,{isOpen:j}),ht.Ay.createElement(ed,{limit:I}),ht.Ay.createElement(br,{isOpen:q,onClose:Ee}),ht.Ay.createElement(wr,{isOpen:z,onClose:Me}),ht.Ay.createElement(Vc,{folder:W}),ht.Ay.createElement(gs,{isOpen:H}),ht.Ay.createElement(Vt,{isOpen:V}))})));var cd=a(15535);var dd=a(89704);const ld=(0,ht.ph)((0,s.EK)((e=>({passcodeSettings:e.passcode})))((e=>{let{isLocked:t,passcodeSettings:a}=e;const{unlockScreen:n,signOut:o,logInvalidUnlockAttempt:i,resetInvalidUnlockAttempts:r}=(0,s.ko)(),{invalidAttemptsCount:c,timeoutUntil:d,isLoading:l}=a,u=(0,ta.A)(),[m,h]=(0,ht.J0)(""),[p,g]=(0,ht.J0)(!1),[y,f,I]=(0,Aa.A)(!1),{shouldRender:A}=(0,Tt.A)(t);(0,wt.A)(r,d?d-Date.now():void 0);const v=(0,ht.hb)((()=>{h("")}),[]),b=(0,ht.hb)((e=>{void 0===d?(h(""),(0,st.UQ)(e).then(n,(e=>{e instanceof st.Mv&&o({forceInitApi:!0}),i(),h(u("lng_passcode_wrong"))}))):h(u("FloodWait"))}),[u,d]);(0,ht.vJ)((()=>{void 0!==d?h(u("FloodWait")):0===c&&h("")}),[d,u,c]);const w=(0,ht.hb)((()=>{I(),o({forceInitApi:!0})}),[I,o]);if(A)return ht.Ay.createElement("div",{className:"bdKGCai4"},ht.Ay.createElement("div",{className:"BIi4Pl4Z",dir:u.isRtl?"rtl":void 0},ht.Ay.createElement(To.A,{tgsUrl:Po.w.Lock,previewUrl:dd,size:160,className:"JwlsF2tF"}),ht.Ay.createElement(cd.A,{key:"password-form",shouldShowSubmit:!0,shouldDisablePasswordManager:!0,isLoading:l,error:m,placeholder:u("Passcode.EnterPasscodePlaceholder"),submitLabel:u("Next"),clearError:v,isPasswordVisible:p,noRipple:!0,onChangePasswordVisibility:g,onSubmit:b}),ht.Ay.createElement("div",{className:"VlXFyC_a"},ht.Ay.createElement("p",null,ht.Ay.createElement(lr.A,{onClick:f},"Log out")," ","if you don't remember your passcode."),ht.Ay.createElement("p",null,ht.Ay.createElement(aa.A,{color:"translucent",size:"tiny",isText:!0,onClick:f},u("AccountSettings.Logout"))))),ht.Ay.createElement(xo.A,{isOpen:y,onClose:I,text:u("lng_sure_logout"),confirmLabel:u("AccountSettings.Logout"),confirmHandler:w,confirmIsDestructive:!0}))})));n.Oig&&console.log(">>> FINISH LOAD MAIN BUNDLE");const{passcode:{isScreenLocked:ud},connectionState:md}=(0,s.mS)();md||ud||o.bs||(0,s.ko)().initApi()}}]);
//# sourceMappingURL=7768.f44562ed129e56f88168.js.map