2 lines
557 KiB
JavaScript
2 lines
557 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[3779],{56676:(e,t,n)=>{n.r(t),n.d(t,{AboutAdsModal:()=>hr,ArchivedChats:()=>Ld,AttachBotInstallModal:()=>Ks,AttachBotRecipientPicker:()=>bs,AttachmentModal:()=>Um,BoostModal:()=>Wo,BotCommandMenu:()=>vu,BotCommandTooltip:()=>pu,BotTrustModal:()=>qs,CalendarModal:()=>Us,ChatFolderModal:()=>Fd,ChatLanguageModal:()=>yr,ChatlistModal:()=>mr,ContactList:()=>bd,ContextMenuContainer:()=>qd,CreateTopic:()=>Hh,CustomEmojiSetsModal:()=>em,CustomEmojiTooltip:()=>Cu,CustomSendMenu:()=>bu,DeleteFolderDialog:()=>Ws,DeleteMessageModal:()=>ae,Dialogs:()=>Is,DraftRecipientPicker:()=>Cs,DropArea:()=>fu.Z,EditTopic:()=>zh,EmojiInteractionAnimation:()=>fr,EmojiTooltip:()=>Su,ForwardRecipientPicker:()=>Es,GifSearch:()=>Uu,GiftCodeModal:()=>sr,GiftPremiumModal:()=>oo,HeaderMenuContainer:()=>am,HistoryCalendar:()=>_s,InlineBotTooltip:()=>Ru,InviteViaLinkModal:()=>cP,LeftSearch:()=>ll,Management:()=>MZ,MapModal:()=>Ts,MediaViewer:()=>kt,MentionTooltip:()=>Lm,MessageSelectToolbar:()=>gr,MessageStatistics:()=>Sh,MobileSearch:()=>im,MuteChatModal:()=>Dd,NewChat:()=>Sd,NewChatStep1:()=>fd,NewChatStep2:()=>yd,NewContactModal:()=>js,Notifications:()=>ks,PaymentModal:()=>iP,PinMessageModal:()=>Zr,PollModal:()=>_m,PollResults:()=>Lh,PremiumLimitReachedModal:()=>ho,PremiumMainModal:()=>ao,ReactionPicker:()=>cm,ReactorListModal:()=>br,ReceiptModal:()=>lP,RightSearch:()=>Fu,SafeLinkModal:()=>ws,SeenByModal:()=>Er,SendAsMenu:()=>Lu,Settings:()=>Cd,SponsoredMessageContextMenuContainer:()=>Kd,Statistics:()=>ph,StatusPickerMenu:()=>Xo,StickerSearch:()=>Ou,StickerSetModal:()=>Wd,StickerTooltip:()=>gu,StoryStatistics:()=>Ah,StoryViewer:()=>ls,SymbolMenu:()=>Zu,TextFormatter:()=>yu.Z,UnpinAllMessagesModal:()=>Pr,UrlAuthModal:()=>Ls,WebAppModal:()=>Ys});var a=n(60748),s=n(33555),i=n(91713),o=n(83716),r=n(4463),l=n(7054),c=n(10396),d=n(23989),m=n(98069),u=n(74399),h=n(996),Z=n(57710),P=n(9933),p=n(55254),v=n(3858),g=n(97184),E=n(43858);function C(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if(a.draggable=!1,a.oncontextmenu=v.Z,"string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,n.appendChild(a),t===i.bZ.ProfileAvatar||t===i.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===i.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===i.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function b(e,t){const n=document.querySelector(".Transition_slide-active > .MessageList");let a=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(a+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),a>n.scrollTop&&a+t.offsetHeight<n.scrollTop+n.offsetHeight}function f(e,t){let n,a;switch(e){case i.bZ.Album:case i.bZ.ScheduledAlbum:n=`.Transition_slide-active > .MessageList #album-media-${(0,r.d0)(t.id)}`,a=".full-media";break;case i.bZ.SharedMedia:n=`#shared-media${(0,r.d0)(t.id)}`,a="img";break;case i.bZ.SearchResult:n=`#search-media${(0,r.d0)(t.id)}`,a="img";break;case i.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition_slide-active .ChatInfo .Avatar",a=".avatar-media";break;case i.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition_slide-active .ProfilePhoto",a=".avatar-media";break;case i.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition_slide-active .ProfilePhoto",a=".avatar-media";break;case i.bZ.SuggestedAvatar:n=`.Transition_slide-active > .MessageList #${(0,r.d0)(t.id)}`,a=".Avatar img";break;case i.bZ.ScheduledInline:case i.bZ.Inline:default:n=`.Transition_slide-active > .MessageList #${(0,r.d0)(t.id)}`,a=`${o.be_} .full-media,${o.be_} .thumbnail:not(.blurred-bg)`}const s=document.querySelector(n),l=s&&s.querySelectorAll(a);return{container:s,mediaEl:l?.[0]}}function y(e,t){switch(t){case i.bZ.Album:case i.bZ.ScheduledAlbum:case i.bZ.Inline:case i.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case i.bZ.SharedMedia:case i.bZ.SettingsAvatar:case i.bZ.ProfileAvatar:case i.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case i.bZ.MiddleHeaderAvatar:case i.bZ.SuggestedAvatar:e.classList.add("circle"),t===i.bZ.SuggestedAvatar&&e.classList.add("transition-circle")}}var I=n(42797),S=n(97458),k=n(60706),N=n(65326),w=n(18674),M=n(59107),T=n(25190),A=n(74753),R=n(19369);const L=(0,R.gQ)(!1),B=L[1];function F(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function x(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){o.eMD&&console.log("[MV] PictureInPicture Error",e)}}var D=n(87204),O=n(92112),U=n(70971),_=n(6137),$=n(96264),j=n(71394);const V=new Map;var G=n(34446);var H=n(6202),J=n(6701);const z=({message:e,mediaId:t=0,avatarOwner:n,origin:s,delay:o})=>{const l=e?(0,r.O$)(e):void 0,c=e?(0,r.g8)(e):void 0,d=e?(0,r.b7)(e):void 0,m=e?(0,r.F$)(e):void 0,h=e?(0,r.Cg)(e):void 0,Z=!!e&&(0,r.rl)(e),P=!!e&&(0,r.hC)(e),p=e?(0,r.c0)(e):void 0,v=n?.photos?.[t],g=Boolean(v?.isVideo||c?.isVideo),E=Boolean(d||h||P),C=Boolean(!E&&(l||m||Z||c)),{isGif:b}=d||h||{},f=s===i.bZ.SharedMedia,y=s===i.bZ.SearchResult,I=(0,a.Ye)((()=>a=>n?v?v.isVideo&&a?(0,r.Dk)(v):0===t?(0,r.RT)(n,a?"big":"normal"):`photo${v.id}?size=c`:(0,r.RT)(n,a?"big":"normal"):c&&g&&a?`videoAvatar${c.id}?size=u`:e&&(0,r.Ti)(e,a?"full":"preview")),[n,c,g,e,v,t]),S=(0,H.Z)(e&&(f||y||Z||P)&&(0,r.Ti)(e,"pictogram"),void 0,_.IU.BlobUrl,o),k=I(),w=(0,H.Z)(k,void 0,_.IU.BlobUrl,o),{mediaData:M,loadProgress:T}=(0,J.Z)(I(!0),void 0,e&&(0,r.kG)(e,"full"),o),A=l||d?(l||d).blobUrl:void 0;let R=!E&&(A||M)||w||S;const L=function(e){const t=(0,a.sO)();let n=!1;(0,G.Z)((()=>{if(n=!0,t.current=void 0,!e)return;const a=new Image;if(a.src=e,!a.width)return;const s=(0,j.ao)(a);(0,$.Z)(s.getContext("2d"),0,0,s.width,s.height,2,2),t.current=s.toDataURL()}),[e]);const s=function(e,t=!1,n){const s=(0,a.sO)(e?V.get(e):void 0),i=(0,a.sO)(),o=(0,N.Z)();return i.current&&t&&(clearTimeout(i.current),i.current=void 0),(0,a.d4)((()=>{if(!e||s.current||t)return;const a=new Image;a.onload=()=>{const t=(0,j.ao)(a);(0,$.Z)(t.getContext("2d"),0,0,t.width,t.height,2,2);const n=t.toDataURL();s.current=n,o(),V.size>=1e3&&V.clear(),V.set(e,n)},n?i.current=window.setTimeout((()=>{a.src=e}),n):a.src=e}),[e,n,o,t]),s.current}(e||void 0,Boolean(t.current));return t.current||!n&&s||e||void 0}(!R&&e&&(0,r.DH)(e));R||s===i.bZ.SearchResult||(R=L),g&&w&&(R=w);const B=A||M||(g||E?void 0:w||S||R),F=Boolean(A),x=e?(0,r.ep)(e):n?`avatar${n.id}.${n?.hasVideoAvatar?"mp4":"jpg"}`:void 0,D=(0,a.Ye)((()=>e?Z||P?(0,r.aE)(e).mediaSize:l||m||c?(0,r.bV)(l||m||c):d||h?(0,r.jC)(d||h):void 0:g?u.Fp:u.vY),[Z,P,g,e,l,d,c,m,h]);return{getMediaHash:I,photo:l,video:d,webPagePhoto:m,actionPhoto:c,webPageVideo:h,isVideo:E,isPhoto:C,isGif:b,isDocumentPhoto:Z,isDocumentVideo:P,fileName:x,bestImageData:R,bestData:B,dimensions:D,isFromSharedMedia:f,avatarPhoto:v,isVideoAvatar:g,isLocal:F,loadProgress:T,videoSize:p}};var X=n(66534),Y=n(231),q=n(40126),K=n(2255);const[W,Q]=(0,R.gQ)(1);function ee(){return(0,a.d4)((()=>()=>{Q(1)}),[]),[W,Q]}var te=n(32340),ne=n(34563);const ae=(0,a.X$)((0,s.c$)(((e,{message:t,isSchedule:n})=>{const{threadId:a}=(0,l.Btg)(e)||{},{canDeleteForAll:s}=a&&(0,l._kf)(e,t,a)||{},i=(0,l.Z1J)(e,t.chatId),o=i&&(0,r.YC)(i.id)?(0,r.Vl)((0,l.dyD)(e,(0,r.zX)(i))):void 0,c=Boolean((0,l.kBx)(e,t.chatId));return{canDeleteForAll:!n&&s,contactName:o,willDeleteForCurrentUserOnly:i&&(0,r.G9)(i)&&!s||c,willDeleteForAll:i&&(0,r.ZV)(i)}}))((({isOpen:e,isSchedule:t,message:n,album:i,canDeleteForAll:o,contactName:r,willDeleteForCurrentUserOnly:l,willDeleteForAll:c,onConfirm:d,onClose:m})=>{const{deleteMessages:u,deleteScheduledMessages:h}=(0,s.Sv)(),Z=(0,a.I4)((()=>{d?.();const e=i?.messages?i.messages.map((({id:e})=>e)):[n.id];u({messageIds:e,shouldDeleteForAll:!0}),m()}),[d,i,n.id,u,m]),P=(0,a.I4)((()=>{d?.();const e=i?.messages?i.messages.map((({id:e})=>e)):[n.id];t?h({messageIds:e}):u({messageIds:e,shouldDeleteForAll:!1}),m()}),[d,i,n.id,t,m,h,u]),p=(0,M.Z)();return a.ZP.createElement(ne.Z,{isOpen:e,onClose:m,onEnter:e&&!o?P:void 0,className:"delete",title:p("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,p("AreYouSureDeleteSingleMessage")),l&&a.ZP.createElement("p",null,p("lng_delete_for_me_chat_hint",1,"i")),c&&a.ZP.createElement("p",null,p("lng_delete_for_everyone_hint",1,"i")),a.ZP.createElement("div",{className:o?"dialog-buttons-column":"dialog-buttons"},o&&a.ZP.createElement(Y.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},r&&(0,te.Z)(p("Conversation.DeleteMessagesFor",r)),!r&&p("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(Y.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},p(o?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},p("Cancel"))))}))),se=(0,a.X$)((({isOpen:e,photo:t,profileId:n,onClose:i,onConfirm:o})=>{const{deleteProfilePhoto:l,deleteChatPhoto:c}=(0,s.Sv)(),d=(0,a.I4)((()=>{o?.(),(0,r.YC)(n)?l({photo:t}):c({photo:t,chatId:n}),i()}),[o,n,i,l,t,c]),m=(0,M.Z)();return a.ZP.createElement(ne.Z,{isOpen:e,onClose:i,onEnter:d,className:"delete dialog-buttons-column",title:m("AreYouSure")},a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d},m("Preview.DeletePhoto")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:i},m("Cancel"))))}));var ie=n(53106),oe=n(58964),re=n(39196);const le=(0,a.X$)((0,s.c$)(((e,{message:t,canUpdateMedia:n,avatarPhoto:a,avatarOwner:s})=>{const i=(0,l.Btg)(e),{threadId:o}=(0,l.Btg)(e)||{},r=!!t&&(0,l.teg)(e,t),c=(0,l.EVS)(e,t),d=t&&(0,l.AmN)(e,t?.chatId),{canDelete:m}=o&&t&&(0,l._kf)(e,t,o)||{},u=a&&a.id===s?.avatarHash,h=m||n&&!!a,Z=n&&!!a&&!u,P=i?.type;return{isDownloading:r,isProtected:c,isChatProtected:d,canDelete:h,canUpdate:Z,messageListType:P,avatarOwnerId:s?.id}}))((({mediaData:e,isVideo:t,message:n,avatarPhoto:i,avatarOwnerId:o,fileName:l,isChatProtected:c,isDownloading:d,isProtected:m,canReport:u,canDelete:h,canUpdate:Z,messageListType:P,selectMedia:p,onReport:v,onCloseMediaViewer:g,onBeforeDelete:E,onForward:C})=>{const[b,f,y]=(0,k.Z)(!1),[S,N]=ee(),{isMobile:w}=(0,I.ZP)(),{downloadMessageMedia:A,cancelMessageMediaDownload:R,updateProfilePhoto:L,updateChatPhoto:B}=(0,s.Sv)(),{loadProgress:F}=(0,J.Z)(n&&(0,r.Ti)(n,"download"),!d,n&&(0,r.kG)(n,"download")),x=(0,T.Z)((()=>{d?R({message:n}):A({message:n})})),D=(0,T.Z)((()=>{const e=S();N((e<0?e:0)-1)})),O=(0,T.Z)((()=>{const e=S();N((e>0?e:0)+1)})),U=(0,T.Z)((()=>{i&&o&&((0,r.YC)(o)?L({photo:i}):B({chatId:o,photo:i}),p(0))})),_=(0,M.Z)(),$=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon icon-more"}))),[]);function j(){return n?a.ZP.createElement(ae,{isOpen:b,isSchedule:"scheduled"===P,onClose:y,onConfirm:E,message:n}):o&&i?a.ZP.createElement(se,{isOpen:b,onClose:y,onConfirm:E,profileId:o,photo:i}):void 0}if(w){const s=[];if(n?.isForwardingAllowed&&!c&&s.push({icon:"forward",onClick:C,children:_("Forward")}),m||(t?s.push({icon:d?"close":"download",onClick:x,children:d?`${Math.round(100*F)}% Downloading...`:"Download"}):s.push({icon:"download",href:e,download:l,children:_("AccActionDownload")})),u&&s.push({icon:"flag",onClick:v,children:_("ReportPeer.Report")}),Z&&s.push({icon:"copy-media",onClick:U,children:_("ProfilePhoto.SetMainPhoto")}),h&&s.push({icon:"delete",onClick:f,children:_("Delete"),destructive:!0}),0===s.length)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(ie.Z,{trigger:$,positionX:"right"},s.map((({icon:e,onClick:t,href:n,download:s,children:i,destructive:o})=>a.ZP.createElement(oe.Z,{key:e,icon:e,href:n,download:s,onClick:t,destructive:o},i)))),d&&a.ZP.createElement(re.Z,{progress:F,size:"s",noCross:!0}),h&&j())}return a.ZP.createElement("div",{className:"MediaViewerActions"},n?.isForwardingAllowed&&!c&&a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("Forward"),onClick:C},a.ZP.createElement("i",{className:"icon icon-forward"})),function(){if(!m)return t?a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("AccActionDownload"),onClick:x},d?a.ZP.createElement(re.Z,{progress:F,size:"s",onClick:x}):a.ZP.createElement("i",{className:"icon icon-download"})):a.ZP.createElement(Y.Z,{href:e,download:l,round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("AccActionDownload")},a.ZP.createElement("i",{className:"icon icon-download"}))}(),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("MediaZoomOut"),onClick:D},a.ZP.createElement("i",{className:"icon icon-zoom-out"})),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("MediaZoomIn"),onClick:O},a.ZP.createElement("i",{className:"icon icon-zoom-in"})),u&&a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_(t?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:v},a.ZP.createElement("i",{className:"icon icon-flag"})),Z&&a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("ProfilePhoto.SetMainPhoto"),onClick:U},a.ZP.createElement("i",{className:"icon icon-copy-media"})),h&&a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("Delete"),onClick:f},a.ZP.createElement("i",{className:"icon icon-delete"})),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:_("Close"),onClick:g},a.ZP.createElement("i",{className:"icon icon-close"})),h&&j())})));var ce=n(46752),de=n(64963),me=n(28712),ue=n(69118),he=n(67360),Ze=n(86203),Pe=n(36413),pe=n(46590),ve=n(33799),ge=n(7792);function Ee(e){const t=(0,a.sO)(e());return(0,ge.Z)((()=>e.subscribe((()=>{t.current=e()})))),t}var Ce=n(28183),be=n(12255),fe=n(71790);const[ye,Ie]=(0,R.gQ)(!1),[Se,ke]=(0,R.gQ)(!1);function Ne(){return[(0,fe.Z)((()=>ye()&&!Se()),[ye,Se]),Ie,ke]}var we=n(49204);const Me=({text:e="",isForVideo:t,onClick:n,isProtected:s,isForceMobileVersion:i})=>{const[o,r]=(0,a.eJ)(!1),{isMobile:l}=(0,I.ZP)(),[c]=Ne(),d=(0,Ze.Z)((()=>!!g.$b&&!c()),[c]);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;r(t>2*u.Gw)};t();const n=(0,ue.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const m=(0,ce.Z)("MediaViewerFooter",t&&"is-for-video",d&&"is-hidden",s&&"is-protected",i&&"mobile");return a.ZP.createElement("div",{className:m,onClick:function(t){e&&t.stopPropagation()}},Boolean(e)&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:l?void 0:n},a.ZP.createElement("p",{className:"media-text custom-scroll allow-selection "+(o?"multiline":""),dir:"auto"},e)))};var Te=n(13617),Ae=n(12019);const[Re,Le]=(0,R.gQ)(0);function Be(){return(0,a.d4)((()=>()=>{Le(0)}),[]),[Re,Le]}var Fe=n(31212),xe=n(46898);const[De,Oe]=(0,R.gQ)(!1);function Ue(){return(0,a.d4)((()=>()=>{Oe(!1)}),[]),[De,Oe]}var _e=n(790),$e=n(2155),je=n(52328),Ve=n(18051),Ge=n(76857),He=n(92387);function Je(e,t,n){var a;return(t="symbol"==typeof(a=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t))?a:String(a))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ze=g.wZ||g.cj,Xe=g.wZ||g.cj?.3:.25,Ye=ze?40:80,qe=200,Ke=(0,Ge.Z)();let We;class Qe{constructor(e,t){Je(this,"frames",new Map),Je(this,"currentTime",0),Je(this,"canvas",void 0),this.canvas=t,Ke.forEach((({connector:t},n)=>{t.request({name:"video-preview:init",args:[e,Ye,n,Ge.j,this.onFrame.bind(this)]})}))}onFrame(e,t){this.frames.set(e,t),e===this.currentTime&&this.render(e)}clearCache(){this.frames.forEach((e=>{e.close()})),this.frames.clear()}render(e){this.currentTime=e;const t=this.frames.get(e);return!!t&&((0,Z.WM)((()=>{this.canvas.width=t.width,this.canvas.height=t.height,this.canvas.getContext("2d").drawImage(t,0,0,this.canvas.width,this.canvas.height)})),!0)}destroy(){this.clearCache(),Ke.forEach((({connector:e})=>{e.request({name:"video-preview:destroy",args:[]})}))}}Ke.forEach((({worker:e})=>{e.addEventListener("message",(async t=>{const{type:n,messageId:a,params:s}=t.data;if("requestPart"!==n)return;const i=await(0,He.t9)("downloadMedia",{mediaFormat:_.IU.Progressive,...s});if(!i)return;const{arrayBuffer:o}=i;e.postMessage({type:"partResponse",messageId:a,result:o},[o])}))}));var et=n(11309);const tt="YiY5CtrarIYsGovxCo1b";let nt;const at=(0,a.X$)((({duration:e,bufferedRanges:t,isReady:n,posterSize:s,playbackRate:i,url:o,isActive:r,isPlaying:l,isPreviewDisabled:c,onSeek:d,onSeekStart:m})=>{const u=(0,a.sO)(null),[h]=Be(),[Z]=Ue(),p=(0,et.WR)(h,250),[v,E]=(0,ve.Z)(p()),[C,b]=(0,ve.Z)(0),[f,y]=(0,ve.Z)(0),I=(0,a.sO)(!1),[S,k]=(0,a.eJ)(!1),[N,w]=(0,a.eJ)(!1),M=(0,a.sO)(null),A=(0,a.sO)(null),R=(0,a.sO)(null),L=(0,a.sO)(null),B=(0,a.Ye)((()=>function(e,t){const n=(e=Math.round(e*Xe))/(t=Math.round(t*Xe));return e>qe&&(e=qe,t=Math.round(e/n)),t>qe&&(t=qe,e=Math.round(t*n)),{width:e,height:t}}(s?.width||0,s?.height||0)),[s]),F=(0,T.Z)((e=>{e=Math.floor(e),y(e),function(e){We&&We.render(e)}(e)}));return(0,a.d4)((()=>{if(!c&&o&&n)return function(e,t){return We&&We.destroy(),We=new Qe(e,t),()=>We?.destroy()}(o,M.current)}),[o,n,c]),(0,a.d4)((()=>{k(!1)}),[r]),(0,a.d4)((()=>{if(nt&&nt(),nt=void 0,!I.current&&!N){const t=p(),n=e-t;nt=(0,P.vr)({from:t,to:e,duration:1e3*n/i,onUpdate:E})}}),[p,N,E,i,e]),(0,a.d4)((()=>{l&&!Z()||(nt&&nt(),nt=void 0)}),[l,v,Z]),(0,a.d4)((()=>{if(l){nt&&nt(),nt=void 0;const t=p(),n=e-t;nt=(0,P.vr)({from:t,to:e,duration:1e3*n/i,onUpdate:E})}}),[l,i,e]),(0,a.bt)((()=>{if(!R.current)return;const t=(0,me.NM)(v()/e*100,2);R.current.style.width=`${t}%`}),[v,e]),(0,a.bt)((()=>{A.current&&(A.current.style.left=`${C()}px`)}),[C]),(0,a.bt)((()=>{L.current&&(L.current.innerText=(0,_e.k9)(f()))}),[f]),(0,a.d4)((()=>{if(!u.current||!r)return;const t=u.current;let n=t.getBoundingClientRect(),a=0,s=0;const i=a=>{const s=a instanceof MouseEvent?a.pageX:a.touches[0].pageX,i=(0,me.uZ)(e*((s-n.left)/n.width),0,e);if(c)return[i,0];n.width||(n=t.getBoundingClientRect());const o=A.current;return[i,(0,me.uZ)(s-n.left-o.clientWidth/2,-4,n.width-o.clientWidth+4)]},o=()=>{nt&&nt(),nt=void 0},l=()=>{o(),I.current=!0,k(!1),w(!1),E(a),d(a),setTimeout((()=>{I.current=!1}),250)},h=(0,de.sf)(t,{onCapture:()=>{o(),k(!0),w(!0),m()},onRelease:l,onClick:l,onDrag:e=>{o(),k(!0),[a,s]=i(e),F(a),b(s),E(a)}});if(g.$b||c)return h;const Z=e=>{k(!0),[a,s]=i(e),b(s),F(a)},P=()=>{k(!1)};return t.addEventListener("mousemove",Z),t.addEventListener("mouseenter",Z),t.addEventListener("mouseleave",P),()=>{h(),t.removeEventListener("mousemove",Z),t.removeEventListener("mouseenter",Z),t.removeEventListener("mouseleave",P)}}),[e,F,r,d,m,b,E,w,c,i]),a.ZP.createElement("div",{className:"FWH9e05HHn4BJrkuqmgL",ref:u},!c&&a.ZP.createElement(q.Z,{isOpen:!0,isHidden:!S,className:"PmR9chdfbwrolc8FOkNB",style:`width: ${B.width}px; height: ${B.height}px`,ref:A},a.ZP.createElement("canvas",{className:"O7IGkaF5yzopTKVImH2v",ref:M}),a.ZP.createElement("div",{className:"R85IB61J5InMMYwLQWxU"},a.ZP.createElement("span",{className:"QBMgsZDdCiXJzzHzd8rg",ref:L}))),a.ZP.createElement("div",{className:tt},t.map((({start:e,end:t})=>a.ZP.createElement("div",{key:`${e}-${t}`,className:"s3rSBAeNFQimTK3eRl8t",style:`left: ${100*e}%; right: ${100-100*t}%`})))),a.ZP.createElement("div",{className:tt},a.ZP.createElement("div",{ref:R,className:(0,ce.Z)("sQTcQShWx8rMXJFKN2hO",N&&"pNanY7hqtTLHXdRob0qg")})))})),st=e=>{e.stopPropagation()},it=[.5,1,1.5,2],ot=(0,a.X$)((({url:e,bufferedRanges:t,bufferedProgress:n,duration:s,isReady:i,fileSize:o,isForceMobileVersion:r,isPlaying:l,isFullscreenSupported:c,isFullscreen:d,isBuffered:m,isPreviewDisabled:u,volume:h,isMuted:Z,playbackRate:P,posterSize:p,onChangeFullscreen:v,onVolumeClick:E,onVolumeChange:C,onPlaybackRateChange:b,isPictureInPictureSupported:f,onPictureInPictureChange:y,onPlayPause:S,onSeek:N})=>{const[w,A,R]=(0,k.Z)(),[L]=Be(),B=(0,Ze.Z)((()=>Math.trunc(L())),[L]),[F,x]=(0,ve.Z)(!1),{isMobile:D}=(0,I.ZP)(),[O,U]=Ne(),_=(0,Ze.Z)(O);(0,a.d4)((()=>{if(!g.$b&&!r)return;let e;if(_&&l&&!w&&!F())return e=window.setTimeout((()=>{U(!1)}),3e3),()=>{e&&window.clearTimeout(e)};e&&window.clearTimeout(e)}),[l,_,U,w,F,r]),(0,a.bt)((()=>(_?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[_]),(0,a.d4)((()=>{_||R()}),[R,_]);const $=(0,M.Z)(),j=(0,T.Z)((e=>{x(!1),N(e)})),V=(0,T.Z)((()=>{x(!0)})),G=(0,a.Ye)((()=>0===h||Z?"icon-muted":h<.3?"icon-volume-1":h<.6?"icon-volume-2":"icon-volume-3"),[h,Z]);return a.ZP.createElement("div",{className:(0,ce.Z)("VideoPlayerControls",r&&"mobile",_&&"active"),onClick:st},a.ZP.createElement(at,{url:e,duration:s,isReady:i,isPlaying:l,isPreviewDisabled:u,posterSize:p,bufferedRanges:t,playbackRate:P,onSeek:j,onSeekStart:V,isActive:_}),a.ZP.createElement("div",{className:"buttons"},a.ZP.createElement(Y.Z,{ariaLabel:$("AccActionPlay"),size:"tiny",ripple:!D,color:"translucent-white",className:"play",round:!0,onClick:S},a.ZP.createElement("i",{className:(0,ce.Z)("icon",l?"icon-pause":"icon-play")})),a.ZP.createElement(Y.Z,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:E},a.ZP.createElement("i",{className:(0,ce.Z)("icon",G)})),!g.cj&&a.ZP.createElement(Ve.Z,{bold:!0,className:"volume-slider",value:Z?0:100*h,onChange:C}),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,_e.k9)(e)} / ${(0,_e.k9)(t)}`)}(B,s),!m&&a.ZP.createElement("div",{className:"player-file-size"},`${(0,$e.sS)($,o*n)} / ${(0,$e.sS)($,o)}`),a.ZP.createElement("div",{className:"spacer"}),a.ZP.createElement(Y.Z,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:A},`${P}x`),f&&a.ZP.createElement(Y.Z,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:y},a.ZP.createElement("i",{className:"icon icon-pip"})),c&&a.ZP.createElement(Y.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:v},a.ZP.createElement("i",{className:(0,ce.Z)("icon ",d?"icon-smallscreen":"icon-fullscreen")}))),a.ZP.createElement(je.Z,{isOpen:w,className:(0,ce.Z)("playback-rate-menu",!c&&"no-fullscreen",!f&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:R},it.map((e=>a.ZP.createElement(oe.Z,{disabled:P===e,onClick:()=>b(e)},`${e}x`)))))}));function rt(){return rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},rt.apply(this,arguments)}const lt=(0,a.X$)((({url:e,isGif:t,posterData:n,posterSize:i,loadProgress:r,fileSize:l,isMediaViewerOpen:c,noPlay:d,volume:m,isMuted:u,playbackRate:h,onClose:Z,isForceMobileVersion:P,shouldCloseOnClick:p,isProtected:E,isClickDisabled:C,isPreviewDisabled:b})=>{const{setMediaViewerVolume:f,setMediaViewerMuted:y,setMediaViewerPlaybackRate:S,setMediaViewerHidden:k}=(0,s.Sv)(),N=(0,a.sO)(null),[w,M]=(0,a.eJ)(!g.$b||!g.cj),[R,L,D]=(0,Pe.ZP)(N,M),{isMobile:O}=(0,I.ZP)(),U=N.current?.duration||0,_=t||U<=30,$=(0,T.Z)((()=>{g.nJ||k({isHidden:!0})})),j=(0,T.Z)((()=>{g.nJ||k({isHidden:!1})})),[V,G,H]=function(e,t,n){const[s,i]=(0,a.eJ)(!1),[r,l]=(0,a.eJ)(!1);(0,a.bt)((()=>{if(g.cj&&g.fl||!e.current)return;const a=e.current,s=F(a);if((!document.pictureInPictureEnabled||e.current?.disablePictureInPicture)&&void 0===s)return;a.autoPictureInPicture=!0,i(!0);const o=()=>{t(),l(!0),B(!0)},r=()=>{B(!1),l(!1),n()};return a.addEventListener("enterpictureinpicture",o),a.addEventListener("leavepictureinpicture",r),()=>{a.removeEventListener("enterpictureinpicture",o),a.removeEventListener("leavepictureinpicture",r)}}),[e,t,n]);const c=(0,a.I4)((()=>{if(!e.current)return;const t=F(e.current);t?t("inline"):x()}),[e]),d=(0,a.I4)((()=>{if(!e.current)return;c();const t=e.current,n=(0,A.h)(t),a=F(t);a?a("picture-in-picture"):function(e){if(e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(e){o.eMD&&console.log("[MV] PictureInPicture Error",e)}}(t),n&&(0,A.Z)(t)}),[e,c]);return s?[s,d,r]:[!1]}(N,$,j),[,J,z]=Ne(),X=(0,T.Z)((()=>{J(!0)})),q=(0,T.Z)((e=>{const t=N.current?.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&J(!1)})),{isReady:K,isBuffered:W,bufferedRanges:Q,bufferingHandlers:ee,bufferedProgress:te}=(0,Ae.Z)(),ne=(0,Te.Z)(N,void 0,!e),{shouldRender:ae,transitionClassNames:se}=(0,Fe.Z)(!W&&!ne,void 0,void 0,"slow"),{shouldRender:ie,transitionClassNames:oe}=(0,Fe.Z)(g.cj&&!w&&!ae&&!ne,void 0,void 0,"slow");(0,a.d4)((()=>{z(ae)}),[z,ae]),(0,a.d4)((()=>{d||!c||ne?N.current.pause():e&&!g.$b&&(0,A.Z)(N.current)}),[d,c,e,y,ne]),(0,a.d4)((()=>{N.current.volume=m}),[m]),(0,a.d4)((()=>{N.current.playbackRate=h}),[h]);const le=(0,T.Z)((e=>{e.stopPropagation(),w?(N.current.pause(),M(!1)):((0,A.Z)(N.current),M(!0))})),ce=(0,T.Z)((e=>{C||(p?Z(e):le(e))}));(0,xe.Z)(N,[]);const[,de]=Be(),[,ue]=Ue(),he=(0,T.Z)((e=>{const t=e.currentTarget;t.readyState>=4&&(ue(!1),de(t.currentTime)),_||t.currentTime!==t.duration||(de(0),M(!1))})),Ze=(0,T.Z)((()=>{_||(de(0),M(!1),J(!0))})),pe=(0,T.Z)((()=>{R&&D?D():!R&&L&&L()})),ve=(0,T.Z)((e=>{N.current.currentTime=e})),ge=(0,T.Z)((e=>{f({volume:e/100})})),Ee=(0,T.Z)((()=>{N.current.muted=!N.current.muted,y({isMuted:!u})})),Ce=(0,T.Z)((e=>{S({playbackRate:e})}));(0,a.d4)((()=>{if(!c)return;const e=e=>{if(!R)return;const t=N.current,n=(0,me.uZ)(t.currentTime+5*e,0,t.duration);Number.isFinite(n)&&(t.currentTime=n)},t=t=>{if(!H)switch(t.key){case" ":case"Enter":t.preventDefault(),le(t);break;case"Left":case"ArrowLeft":t.preventDefault(),e(-1);break;case"Right":case"ArrowRight":t.preventDefault(),e(1)}};return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}}),[le,c,R,H]);const be=i&&`width: ${i.width}px; height: ${i.height}px`,fe=`background-image: url(${n})`,ye=!g.$b&&!P;return a.ZP.createElement("div",{className:"VideoPlayer",onMouseMove:ye?X:void 0,onMouseOut:ye?q:void 0},a.ZP.createElement("div",{style:be},E&&a.ZP.createElement("div",{onContextMenu:v.Z,onDoubleClick:g.$b?void 0:pe,onClick:O?void 0:le,className:"protector"}),a.ZP.createElement("video",rt({ref:N,autoPlay:g.$b,controlsList:"nodownload",playsInline:!0,loop:_,muted:t||u,id:"media-viewer-video",style:fe,onWaiting:()=>ue(!0),onPlay:()=>M(!0),onEnded:Ze,onClick:O||R?void 0:ce,onDoubleClick:g.$b?void 0:pe},ee,{onPause:e=>{M(!1),ee.onPause(e)},onTimeUpdate:he,src:e}))),ie&&a.ZP.createElement(Y.Z,{round:!0,className:`play-button ${oe}`,onClick:le},a.ZP.createElement("i",{className:"icon icon-play"})),ae&&a.ZP.createElement("div",{className:["spinner-container",se].join(" ")},!W&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(re.Z,{size:"xl",progress:W?1:r,square:!0,onClick:Z})),!t&&!ne&&a.ZP.createElement(ot,{url:e,isPlaying:w,bufferedRanges:Q,bufferedProgress:te,isBuffered:W,isFullscreenSupported:Boolean(L),isPictureInPictureSupported:V,isFullscreen:R,isPreviewDisabled:b,fileSize:l,duration:U,isReady:K,posterSize:i,isForceMobileVersion:P,onSeek:ve,onChangeFullscreen:pe,onPictureInPictureChange:G,onPlayPause:le,volume:m,playbackRate:h,isMuted:u,onVolumeClick:Ee,onVolumeChange:ge,onPlaybackRateChange:Ce}))})),ct=(0,a.X$)((0,s.c$)(((e,t)=>{const{chatId:n,threadId:a,mediaId:s,avatarOwnerId:o,origin:r}=t,{volume:c,isMuted:d,playbackRate:m,isHidden:u}=(0,l.jUK)(e).mediaViewer;if(r===i.bZ.SearchResult){if(!n||!s)return{volume:c,isMuted:d,playbackRate:m};const t=(0,l.hjO)(e,n,s);return t?{chatId:n,mediaId:s,senderId:t.senderId,origin:r,message:t,isProtected:(0,l.EVS)(e,t),volume:c,isMuted:d,isHidden:u,playbackRate:m}:{volume:c,isMuted:d,playbackRate:m}}if(o)return{mediaId:s,senderId:o,avatarOwner:(0,l.dyD)(e,o)||(0,l.Z1J)(e,o),origin:r,volume:c,isMuted:d,isHidden:u,playbackRate:m};if(!(n&&a&&s))return{volume:c,isMuted:d,playbackRate:m};let h;return h=r&&[i.bZ.ScheduledAlbum,i.bZ.ScheduledInline].includes(r)?(0,l.TmO)(e,n,s):(0,l.hjO)(e,n,s),h?{chatId:n,threadId:a,mediaId:s,senderId:h.senderId,origin:r,message:h,isProtected:(0,l.EVS)(e,h),volume:c,isMuted:d,isHidden:u,playbackRate:m}:{volume:c,isMuted:d,playbackRate:m}}))((e=>{const{mediaId:t,isActive:n,avatarOwner:s,chatId:i,message:o,origin:r,withAnimation:l,isProtected:c,volume:d,playbackRate:m,isMuted:Z,isHidden:P,onClose:p,onFooterClick:E,isMoving:C}=e,b=(0,M.Z)(),{isVideo:f,isPhoto:y,actionPhoto:S,bestImageData:k,bestData:N,dimensions:w,isGif:A,isLocal:R,isVideoAvatar:L,videoSize:B,loadProgress:F}=z({message:o,avatarOwner:s,mediaId:t,origin:r,delay:!!l&&350}),[,x]=Ne(),D=Boolean(s||t),{isMobile:O}=(0,I.ZP)(),U=(0,T.Z)((()=>{x(!0)}));if(s||S)return L?a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},a.ZP.createElement(lt,{key:t,url:N,isGif:!0,posterData:k,posterSize:(0,u.PA)(w,!1,!0),loadProgress:F,fileSize:B,isMediaViewerOpen:D&&n,isProtected:c,isPreviewDisabled:!g.zQ||R,noPlay:!n,onClose:p,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:C,playbackRate:1})):a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},dt(N,(0,u.PA)(w,!1),!O&&!c,c));if(!o)return;const _="suggestProfilePhoto"===o.content.action?.type?b("Conversation.SuggestedPhotoTitle"):(0,h.X)({message:o,forcePlayback:!0,isForMediaViewer:!0}),$=Boolean(_),j=o&&(0,u.PA)(w,$,f),V=O||function(e){return!!e&&e.width<350}(j);return a.ZP.createElement("div",{className:(0,ce.Z)("MediaViewerContent",$&&"has-footer"),onMouseMove:V&&!g.$b?U:void 0},y&&dt(N,j,!O&&!c,c),f&&(n?a.ZP.createElement(lt,{key:t,url:N,isGif:A,posterData:k,posterSize:j,loadProgress:F,fileSize:B,isMediaViewerOpen:D&&n,noPlay:!n,isPreviewDisabled:!g.zQ||R,onClose:p,isMuted:Z,isHidden:P,isForceMobileVersion:V,isProtected:c,volume:d,isClickDisabled:C,playbackRate:m}):function(e,t,n,s){const i=t&&`width: ${t.width}px; height: ${t.height}px`,o=`background-image: url(${e})`;return e?a.ZP.createElement("div",{className:"VideoPlayer"},s&&a.ZP.createElement("div",{onContextMenu:v.Z,className:"protector"}),a.ZP.createElement("div",{style:i},a.ZP.createElement("video",{style:o,className:(0,ce.Z)(s&&"is-protected"),draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(we.Z,{color:"white"}))}(k,j,!O&&!c,c)),_&&a.ZP.createElement(Me,{text:_,onClick:E,isProtected:c,isForceMobileVersion:V,isForVideo:f&&!A}))})));function dt(e,t,n,s){return e?a.ZP.createElement("div",{style:"position: relative;"},s&&a.ZP.createElement("div",{onContextMenu:v.Z,className:"protector"}),a.ZP.createElement("img",{src:e,alt:"",className:(0,ce.Z)(s&&"is-protected"),style:t?`width: ${t.width}px`:"",draggable:Boolean(n)})):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(we.Z,{color:"white"}))}function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},mt.apply(this,arguments)}const{easeOutCubic:ut,easeOutQuart:ht}=P.timingFunctions,Zt=g.$b?40:0,Pt=350;let pt,vt;var gt=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(gt||{});const Et=(0,a.X$)((({mediaId:e,getMediaId:t,selectMedia:n,isVideo:s,isGif:i,isOpen:o,withAnimation:r,isHidden:l,...c})=>{const d=(0,a.sO)(null),m=(0,a.sO)(null),u=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)({x:0,y:0,scale:1}),p=(0,a.sO)(void 0),v=(0,a.sO)(void 0),E=(0,a.sO)(!1),[C,b]=(0,a.eJ)(!0),[f]=ee(),y=(0,a.sO)(f()),I=(0,Pe.Ar)(),[S,k]=(0,a.eJ)(!1),[N,w]=(0,ve.Z)({x:0,y:0,scale:1}),A=Ee(N),[R,L]=(0,ve.Z)(e),B=Ee(R),F=(0,Ze.Z)((()=>1!==N().scale),[N]),x=(0,Ze.Z)(R),{height:D,width:O,isResizing:U}=(0,be.Z)(),[_,$,j]=Ne(),{onClose:V}=c,G=(0,M.Z)();(0,pe.Z)({isActive:o,onBack:V,shouldBeReplaced:!0});const H=(0,he.Z)(n,[n],350,!0),J=(0,he.Z)((()=>{p.current=void 0}),[],500,!0),z=(0,he.Z)((e=>b(e)),[],800,!0),X=Boolean(i&&!g.cj),Y=g.$b?40:O/10,q=(0,T.Z)((e=>{if(!g.$b)return;const t=D-e.pageY<80;!t&&e.pageX<Y||!t&&e.pageX>O-Y||$(!_())}));if((0,Ce.Z)((()=>$(!0)),Pt),(0,a.d4)((()=>{const{scale:t,x:n,y:a}=A.current;0===n&&0===a&&1===t&&L(e)}),[e,L,A]),(0,a.bt)((()=>{const{x:e,y:t,scale:n}=N();j(1!==n),u.current&&(u.current.style.transform=Ct(-O+e-Zt)),m.current&&(m.current.style.transform=Ct(e,t,n)),h.current&&(h.current.style.transform=Ct(O+e+Zt))}),[N,j,O]),(0,a.d4)((()=>{if(!d.current||void 0===B.current||l||I)return;let e=Z.current;const n={x:0,y:0},a={x:0,y:0},s={x:0,y:0};let i,o=Date.now();const c=(0,ue.Ds)((()=>{o=Date.now()}),500,!1,!0),u=n=>{const a=t(B.current,n);if(void 0!==a){const t=(O+Zt)*n,s=A.current.x+t;return b(!1),L(a),H(a),z(!0),e={x:0,y:0,scale:1},r?(pt=(0,P.vr)({from:s,to:0,duration:Pt,timing:ut,onUpdate:e=>w({y:0,x:e,scale:1})}),!0):(w(e),!0)}return!1},h=e=>{const{scale:t}=A.current;if(1!==t)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let n=0;return D-e.pageY<80?[!1,!1]:(e.pageX<Y?n=-1:e.pageX>O-Y&&(n=1),[0!==n,u(n)])},C=e=>{const{scale:t}=A.current;if(1===t)switch(e.key){case"Left":case"ArrowLeft":u(-1);break;case"Right":case"ArrowRight":u(1)}},f=({x:e,y:t,scale:n},a=0)=>{const s=v.current;if(!s)return[{x:e,y:t,scale:n},!0,!0];let i=!0,o=!0;const r=(O-O*n)/2,l=(D-D*n)/2,c=Math.max(-s.left*n,r),d=O-s.right*n;i=(0,me.Kh)(e,d,c),e=(0,me.uZ)(e,d,c);const m=Math.max(-s.top*n+a,l),u=D-s.bottom*n;return o=(0,me.Kh)(t,u,m),[{x:e,y:t=(0,me.uZ)(t,u,m),scale:n},i,o]},y=i=>{if(E.current)return void(E.current=!1);"mouseup"===i.type&&k(!1);const r=A.current,{y:l,scale:c}=r;let d=r.x;const m=Math.abs(d),u=Math.abs(l);if(J(),z(!0),c<1)return e={x:0,y:0,scale:1},void(pt=(0,P.vr)({from:[d,l,c],to:[0,0,1],duration:Pt,timing:ut,onUpdate:e=>w({x:e[0],y:e[1],scale:e[2]})}));if(c>1){const t=Math.min(c,4),r=t/c;let m=d*r+(a.x-r*a.x),u=l*r+(a.y-r*a.y);const h=.15;if("wheel"!==i.type&&e.scale===c){const e=Math.abs(n.x)/(Date.now()-o),t=Math.abs(n.y)/(Date.now()-o);m-=Math.abs(n.x)*e*h*s.x,u-=Math.abs(n.y)*t*h*s.y}return[e]=f({x:m,y:u,scale:t},60),void(pt=(0,P.vr)({from:[d,l,c],to:[e.x,e.y,e.scale],duration:Pt,timing:ut,onUpdate:e=>w({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:d,y:l,scale:c},u>=50)return void V();if(u>0)return void(pt=(0,P.vr)({from:l,to:0,duration:Pt,timing:ut,onUpdate:e=>w({x:0,y:e,scale:c})}));const h=d<0?1:-1,Z=t(B.current,d<0?1:-1),p=s.x<0?-1:1;void 0!==Z&&m>=50&&h===p&&(d+=(O+Zt)*h,L(Z),H(Z)),pt=(0,P.vr)({from:d,to:0,duration:Pt,timing:ut,onUpdate:e=>w({y:0,x:e,scale:c??1})})},S=(0,de.sf)(d.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls, .VideoPlayerControls",minZoom:1,maxZoom:4,doubleTapZoom:3,withWheelDrag:!0,onCapture:e=>{if(ft(e))return;const{x:t,y:n,scale:a}=A.current;if("mousedown"!==e.type||(k(!0),1===a)){if(o=Date.now(),0===t&&0===n&&1===a){if(!m.current)return;if(i=m.current.querySelector("img, video"),!i)return;v.current=i.getBoundingClientRect()}}else e.preventDefault()},onDrag:(t,a,{dragOffsetX:i,dragOffsetY:o},r)=>{if(E.current||ft(t))return;if(g.cj&&"touchstart"===a.type){const{pageX:e}=a.touches[0];if(e<=de.vJ||e>=O-de.vJ)return}pt&&(pt(),pt=void 0),s.x=n.x-i,s.y=n.y-o,n.x=i,n.y=o;const l=Math.abs(i),d=Math.abs(o),{x:m,y:u,scale:h}=A.current;if(c(),1===h){if("mousemove"!==t.type){if(p.current!==gt.Vertical&&(p.current===gt.Horizontal||Math.abs(m)>de.QC||l/d>de.Vb)){p.current=gt.Horizontal,b(!1);const e=O+Zt,n=(0,me.uZ)(i,-e,e);return w({x:n,y:0,scale:h}),void("wheel"===t.type&&Math.abs(n)>100&&(y(t),E.current=!0))}if(p.current===gt.Vertical||Math.abs(u)>de.QC||d/l>de.Vb){p.current=gt.Vertical;const e=D,n=(0,me.uZ)(o,-e,e);w({x:0,y:n,scale:h}),"wheel"===t.type&&Math.abs(n)>100&&(y(t),E.current=!0)}}}else{const n=e.x+i,a=e.y+o;if(["wheel","mousemove"].includes(t.type)){const[e,t,s]=f({x:n,y:a,scale:h},60);return r&&r(!t,!s),void w(e)}"touches"in t&&1===t.touches.length&&w({x:n,y:a,scale:h})}},onZoom:(t,{zoom:n,zoomFactor:s,initialCenterX:i,initialCenterY:o,dragOffsetX:r,dragOffsetY:l,currentCenterX:c,currentCenterY:d})=>{pt&&pt(),i=i||O/2,o=o||D/2,c=c||O/2,d=d||D/2;const m=n??(0,me.uZ)(e.scale*s,.5,12),u=m/e.scale,h=Math.abs(Math.min(e.x,0)),Z=Math.abs(Math.min(e.y,0));a.x=c,a.y=d;const P=h+i,p=Z+o,v=P-u*P,g=p-u*p,[E]=f({x:e.x+v+r,y:e.y+g+l,scale:m});w(E)},onClick(t){k(!1);const[n,a]=h(t);if(n){if(t.preventDefault(),t.stopPropagation(),g.$b)return;a||V()}else 1!==e.scale||g.$b||!X&&bt(t.target,".VideoPlayer")||V()},onDoubleClick(t,{centerX:n,centerY:a}){const[s]=h(t);if(s)return t.preventDefault(),void t.stopPropagation();if(!g.$b&&"wheel"!==t.type)return;const{x:i,y:o,scale:r}=A.current;if(1===r){if(0!==i||0!==o)return;e=f({x:n-3*n,y:a-3*a,scale:3})[0]}else e={x:0,y:0,scale:1};pt=(0,P.vr)({from:[i,o,r],to:[e.x,e.y,e.scale],duration:Pt,timing:ut,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};w(t)}})},onRelease:y});return document.addEventListener("keydown",C,!1),()=>{S(),document.removeEventListener("keydown",C,!1)}}),[V,w,t,O,D,Y,X,H,z,J,r,k,b,l,I,A,L,B]),(0,a.d4)((()=>{const e=f(),t=void 0!==y.current&&y.current!==e;if(!d.current||!t||l||I)return;y.current=e;const{scale:n}=A.current,a=e>0?-1:1;let s=100,i=0;n<=.6&&a>0||n>=12&&a<0||(1===n&&a>0&&(s=20),vt&&vt(),vt=(0,P.vr)({from:a,to:a*s,duration:Pt,timing:ht,onUpdate:e=>{if(!d.current)return;const t=(0,me.NM)(e-i,2);i=e;const n=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});d.current.dispatchEvent(n)}}))}),[f,l,I,A]),void 0===x)return;const K=t(x,1),W=t(x,-1),Q=void 0!==W,te=void 0!==K,ne=S&&F;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:d},a.ZP.createElement("div",{className:"MediaViewerSlide",ref:u},Q&&!F&&!U&&a.ZP.createElement(ct,mt({},c,{withAnimation:r,isMoving:ne,mediaId:W}))),a.ZP.createElement("div",{className:(0,ce.Z)("MediaViewerSlide","MediaViewerSlide--active",ne&&"MediaViewerSlide--moving"),onClick:q,ref:m},a.ZP.createElement(ct,mt({},c,{mediaId:x,withAnimation:r,isActive:C,isMoving:ne}))),a.ZP.createElement("div",{className:"MediaViewerSlide",ref:h},te&&!F&&!U&&a.ZP.createElement(ct,mt({},c,{withAnimation:r,isMoving:ne,mediaId:K}))),Q&&!F&&!g.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${s&&!i&&"inline"}`,"aria-label":G("AccDescrPrevious"),dir:G.isRtl?"rtl":void 0}),te&&!F&&!g.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${s&&!i&&"inline"}`,"aria-label":G("Next"),dir:G.isRtl?"rtl":void 0}))}));function Ct(e=0,t=0,n=1){return`translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)})`}function bt(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function ft(e){const t=e.target;return!!bt(t,".VideoPlayerControls")&&(bt(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu, .SeekLine")||e.preventDefault(),!0)}var yt=n(70172);const It=(0,s.c$)(((e,{chatId:t,messageId:n,isAvatar:a})=>{if(a&&t)return{sender:(0,l.RGZ)(e,t)};if(!n||!t)return{};const s=(0,l.hjO)(e,t,n);return{message:s,sender:s&&(0,l.Urc)(e,s)}}))((({chatId:e,messageId:t,sender:n,isFallbackAvatar:i,isAvatar:o,message:l})=>{const{closeMediaViewer:c,focusMessage:d,toggleChatInfo:m}=(0,s.Sv)(),{isMobile:u}=(0,I.ZP)(),h=(0,T.Z)((()=>{c(),e&&t&&(u?setTimeout((()=>{m({force:!1},{forceSyncOnIOs:!0}),d({chatId:e,messageId:t})}),350):d({chatId:e,messageId:t}))})),Z=(0,M.Z)();if(!n||!l&&!o)return;const P=(0,r.OU)(Z,n);return a.ZP.createElement("div",{className:"SenderInfo",onClick:h},a.ZP.createElement(yt.Z,{key:n.id,size:"medium",peer:n}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},P&&(0,te.Z)(P)),a.ZP.createElement("div",{className:"date",dir:"auto"},o?Z(i?"lng_mediaview_profile_public_photo":"lng_mediaview_profile_photo"):(0,_e.ZK)(Z,1e3*l.date,!0))))})),St=250,kt=(0,a.X$)((0,s.c$)((e=>{const{mediaViewer:t,shouldSkipHistoryAnimations:n}=(0,l.jUK)(e),{chatId:a,threadId:s,mediaId:o,avatarOwnerId:c,origin:d,isHidden:m}=t,u=(0,l.$Yd)(e,"mediaViewerAnimations"),{currentUserId:h}=e;let Z,P,p,v=!!a&&(0,l.FM1)(e,a);if(d===i.bZ.SearchResult){if(!a||!o)return{withAnimation:u,shouldSkipHistoryAnimations:n};const t=(0,l.hjO)(e,a,o);return t?{chatId:a,mediaId:o,senderId:t.senderId,isChatWithSelf:v,origin:d,message:t,withAnimation:u,isHidden:m,shouldSkipHistoryAnimations:n}:{withAnimation:u,shouldSkipHistoryAnimations:n}}if(c){const t=(0,l.dyD)(e,c),a=(0,l.Z1J)(e,c);let s=!1;return t?s=c===h:a&&(s=(0,r.Nl)(a)),v=(0,l.FM1)(e,c),{mediaId:o,senderId:c,avatarOwner:t||a,avatarOwnerFallbackPhoto:t?(0,l.ccz)(e,c)?.fallbackPhoto:void 0,isChatWithSelf:v,canUpdateMedia:s,withAnimation:u,origin:d,shouldSkipHistoryAnimations:n,isHidden:m}}if(!(a&&s&&o))return{withAnimation:u,shouldSkipHistoryAnimations:n};if(Z=d&&[i.bZ.ScheduledAlbum,i.bZ.ScheduledInline].includes(d)?(0,l.TmO)(e,a,o):(0,l.hjO)(e,a,o),!Z)return{withAnimation:u,shouldSkipHistoryAnimations:n};if(P=d&&[i.bZ.ScheduledAlbum,i.bZ.ScheduledInline].includes(d)?(0,l.yBV)(e,a):(0,l.Zwk)(e,a),d===i.bZ.Inline||d===i.bZ.Album)p=(0,l.ofg)(e,a,s,Z.id)||(0,l.gbs)(e,a,s);else if(d===i.bZ.SharedMedia){const t=(0,l.weG)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};p=n}return{chatId:a,threadId:s,mediaId:o,senderId:Z.senderId,isChatWithSelf:v,origin:d,message:Z,chatMessages:P,collectionIds:p,withAnimation:u,isHidden:m,shouldSkipHistoryAnimations:n}}))((({chatId:e,threadId:t,mediaId:n,senderId:l,isChatWithSelf:v,canUpdateMedia:A,origin:R,avatarOwner:B,avatarOwnerFallbackPhoto:F,message:_,chatMessages:$,collectionIds:j,withAnimation:V,isHidden:G,shouldSkipHistoryAnimations:H})=>{const{openMediaViewer:J,closeMediaViewer:W,openForwardMenu:Q,focusMessage:ee,toggleChatInfo:te}=(0,s.Sv)(),ne=Boolean(B||n),{isMobile:ae}=(0,I.ZP)(),se=(0,a.sO)(),ie=(0,D.Z)(l),oe=V?"slideFade":"none",re=Boolean(V&&!H),[ce,de,me]=(0,k.Z)(),{webPagePhoto:ue,webPageVideo:he,isVideo:Ze,actionPhoto:Pe,isPhoto:pe,bestImageData:ve,bestData:ge,dimensions:Ee,isGif:Ce,isFromSharedMedia:be,avatarPhoto:fe,fileName:ye}=z({message:_,avatarOwner:B,mediaId:n,origin:R,delay:re&&St}),Ie=!!fe&&!v,Se=!G&&ne,ke=ue||he||Pe?n:void 0,Ne=(0,a.Ye)((()=>ke?[ke]:B?B.photos?.map(((e,t)=>t))||[]:(0,r.N0)($||{},j||[],be)),[ke,B,$,j,be]),we=n?Ne.indexOf(n):-1;!ne||ie&&ie===l&&se.current||(se.current=we);const[Me]=L;(0,a.d4)((()=>{if(!ne||Me())return;(0,m.l_)();const e=(0,O.pP)();return()=>{e(),(0,m.In)()}}),[ne,Me]),(0,a.d4)((()=>{Se&&x()}),[Se]),(0,a.d4)((()=>{ae&&document.body.classList.toggle("is-media-viewer-open",ne)}),[ae,ne]);const Te=(0,a.sO)(null);(0,S.Z)(Te);const Ae=(0,N.Z)();(0,a.d4)((()=>{const e=window.matchMedia(u.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",Ae):"function"==typeof e.addListener&&e.addListener(Ae),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",Ae):"function"==typeof e.removeListener&&e.removeListener(Ae)}}),[Ae]);const Re=(0,D.Z)(_),Le=(0,D.Z)(G),Be=(0,D.Z)(R),Fe=(0,D.Z)(n),xe=(0,D.Z)(B),De=(0,D.Z)(ve),Oe=_?(0,h.X)({message:_,forcePlayback:!0,isForMediaViewer:!0}):void 0,Ue=Boolean(Oe),_e=Le&&Fe!==n;(0,a.d4)((()=>{!re||!ne||Re&&!_e||xe||((0,w.YW)(St+o.fK3),function(e,t,n,a,s,r){const{mediaEl:l}=f(t,r);if(!l)return;const{width:c}=E.Z.get(),{width:d,height:m}=(0,u.fM)(e,s),{width:h,height:p}=(0,u.jg)(d,m,a.width,a.height),v=(c-h)/2,b=function(e){const t=window.matchMedia(u.L6);let n=4.125;return e&&!g.$b&&(n+=t.matches?.875:2.125),n*u.Gw}(e)+(m-p)/2;let{top:I,left:S,width:k,height:N}=l.getBoundingClientRect();if([i.bZ.SharedMedia,i.bZ.Album,i.bZ.ScheduledAlbum,i.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,i){if(e===t){const o=Math.max(s,i)*(e/t);a-=(o-s)/2,n-=(o-i)/2,s=o,i=o}else if(e>t){const n=s;a-=((s=i*(e/t))-n)/2}else if(t>e){const a=i;n-=((i=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:i}}(h,p,I,S,k,N);I=e.top,S=e.left,k=e.width,N=e.height}const w=S+k/2-(v+h/2),M=I+N/2-(b+p/2),T=k/h,A=N/p;(0,Z.WM)((()=>{const e=C(n||l);(0,P.Zs)(e,{top:`${b}px`,left:`${v}px`,width:`${h}px`,height:`${p}px`,transform:`translate3d(${w}px, ${M}px, 0) scale(${T}, ${A})`}),y(e,t),document.body.appendChild(e),document.body.classList.add("ghost-animating"),(0,Z.WM)((()=>{e.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(e),setTimeout((()=>{(0,Z.WM)((()=>{document.body.contains(e)&&document.body.removeChild(e),document.body.classList.remove("ghost-animating")}))}),200+o.fK3)}))}))}(Ue,R,ve,Ee,Ze,_)),re&&!ne&&(Re||xe)&&((0,w.YW)(St+o.fK3),function(e,t,n){const{container:a,mediaEl:s}=f(e,n);if(!s)return;const r=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!r||!s)return;const{top:l,left:c,width:d,height:m}=r.getBoundingClientRect(),{top:u,left:h,width:v,height:g}=s.getBoundingClientRect();let I=u;if(!(0,p.P)(a)){const{height:e}=E.Z.get();I=u<l?-g:e}const S=c+d/2-(h+v/2),k=l+m/2-(I+g/2);let N=d/v,w=m/g;const M=[i.bZ.Inline,i.bZ.ScheduledInline].includes(e)&&!b(a,s)||[i.bZ.Album,i.bZ.ScheduledAlbum].includes(e)&&!b(a,s);[i.bZ.SharedMedia,i.bZ.Album,i.bZ.ScheduledAlbum,i.bZ.SearchResult].includes(e)&&(N>w?N=w:w>N&&(w=N));const T=document.getElementsByClassName("ghost")[0],A=T||C(t||s,e);let R;if(T){const{top:e,left:t,width:n,height:a}=T.getBoundingClientRect();R={transition:"none",top:`${I}px`,left:`${h}px`,transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-I}px, 0) scale(${n/v}, ${a/g})`,width:`${v}px`,height:`${g}px`}}else R={top:`${I}px`,left:`${h}px`,width:`${v}px`,height:`${g}px`,transform:`translate3d(${S}px, ${k}px, 0) scale(${N}, ${w})`};(0,Z.WM)((()=>{(0,P.Zs)(A,R),T||document.body.appendChild(A),document.body.classList.add("ghost-animating"),(0,Z.WM)((()=>{T&&(T.style.transition=""),A.style.transform="",M&&(A.style.opacity="0"),y(A,e),setTimeout((()=>{(0,Z.WM)((()=>{document.body.contains(A)&&document.body.removeChild(A),document.body.classList.remove("ghost-animating")}))}),200+o.fK3)}))}))}(Be,De,Re||void 0))}),[re,ne,_e,R,Be,_,Re,xe,ve,De,Ee,Ze,Ue]);const $e=(0,T.Z)((()=>W())),je=(0,U.Y)(n),Ve=(0,T.Z)((()=>{$e();const n=je.current;e&&n&&(ae?setTimeout((()=>{te({force:!1},{forceSyncOnIOs:!0}),ee({chatId:e,threadId:t,messageId:n})}),St):ee({chatId:e,threadId:t,messageId:n}))})),Ge=(0,T.Z)((()=>{Q({fromChatId:e,messageIds:[n]})})),He=(0,T.Z)((n=>{J({chatId:e,threadId:t,mediaId:n,avatarOwnerId:B?.id,origin:R},{forceOnHeavyAnimation:!0})}));(0,a.d4)((()=>ne?(0,d.Z)((()=>{$e()})):void 0),[$e,ne]),(0,a.d4)((()=>{Ze&&!Ce&&(0,c.Es)()}),[Ce,Ze]);const Je=(0,U.Y)(Ne),ze=(0,T.Z)(((e,t)=>{if(void 0===e)return;const n=Je.current,a=n.indexOf(e);return-1===t&&a>0||1===t&&a<n.length-1?n[a+t]:void 0})),Xe=(0,T.Z)((()=>{if(Ne.length<=1)return void $e();let e=n?Ne.indexOf(n):-1;e=e>0?e-1:0,He(Ne[e])})),Ye=(0,M.Z)();return a.ZP.createElement(q.Z,{id:"MediaViewer",isOpen:ne,isHidden:G,shouldAnimateFirstRender:!0,noCloseTransition:H},a.ZP.createElement("div",{className:"media-viewer-head",dir:Ye.isRtl?"rtl":void 0,ref:Te},ae&&a.ZP.createElement(Y.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:Ye("Close"),onClick:$e},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement(K.ZP,{activeKey:se.current,name:oe},B?a.ZP.createElement(It,{key:n,chatId:B.id,isAvatar:!0,isFallbackAvatar:(0,r.YC)(B.id)&&B.photos?.[n]?.id===F?.id}):a.ZP.createElement(It,{key:n,chatId:e,messageId:n})),a.ZP.createElement(le,{mediaData:ge,isVideo:Ze,message:_,canUpdateMedia:A,avatarPhoto:fe,avatarOwner:B,fileName:ye,canReport:Ie,selectMedia:He,onBeforeDelete:Xe,onReport:de,onCloseMediaViewer:$e,onForward:Ge}),a.ZP.createElement(X.Z,{isOpen:ce,onClose:me,subject:"media",photo:fe,peerId:B?.id})),a.ZP.createElement(Et,{mediaId:n,getMediaId:ze,chatId:e,isPhoto:pe,isGif:Ce,threadId:t,avatarOwnerId:B?.id,origin:R,isOpen:ne,hasFooter:Ue,isVideo:Ze,withAnimation:V,onClose:$e,selectMedia:He,isHidden:G,onFooterClick:Ve}))})));var Nt=n(41372);const wt="gJ2Z_EQBnbDYMJ2NKHPj",Mt="F47ywnKRf0QnMNfkDAhN",Tt="aZegQFa4eGDydcez2hhX",At="tt0i3c46mBP8eper4sX9",Rt="qBNqjd4Jivn9JZM9LTR1",Lt="oHmnmRivkoOTtFlipOlm",Bt="tfRbD6UXCoHpURk9jkFs",Ft="KeE62xWk53FkLDgmLDHC",xt="u4UY_cga_HGYeSeXtJFy",Dt="AS2XHnign2xV16Kjj6bL",Ot="fMXsSVdwtbHbHVPe7TRY",Ut="RrR48bdsuf7ziCaT39SR",_t="DfZIQpvbsc1Lopohx81T",$t="E5huzrUvL4LEC9dx4KwW",jt="Xd5grwcEn6r_RQyYYwTw",Vt="fH5dgpor5kv4sjYevuiU",Gt="Cs943zlR1iWQhsSG8QUZ",Ht="UxBW6ApLLCk97qq1YxJH",Jt="tOO6t_Iv78rQnpDEOgh8",zt="IWB6V7TuwMQUqxdPJDKT",Xt="zX3llen5J3KlIJGrCz2u",Yt="Kcahvy487TvQIEvXamQu",qt="E1bHDTXle6dida5Kw_Ob",Kt="MtJgsqpsPRYORGENbJDM",Wt="h7HZqUP3UoB_TWRA3ien",Qt="N9xfCNDRX4SkiLZ4_S9E",en="_fljB0mSVyj1YctbrtIQ",tn="qiXq5_w5pl5BhuytgsUI",nn="rlPJs7dRj8mRAAzEoxxg",an="L2DlAgxoJ9gNRcSiZRkI",sn="uFpWDsHmcfI_qQSfKtph",on="Njk4jy0AOyHD31ABkS6M",rn="nqQ3MS3rHe4c00GJvtwh",ln="MnckwrDaIp2zIGy011sM",cn="jXIvfN5QPnrzWo9eANQf",dn="_nAzidGNr0mdSkqyvmj_",mn="ZsipcKd8hdBQ7muMSjLe",un="d3FJsMTVC2kORJMGxgbG",hn="zAH8_B8BrtyxRZR_iHvS",Zn="ZguPPKlRJgtkBr7ENcvT",Pn="XOq3cloVnzuYbz2bQw_b",pn="OIcA1buYWPCjn6NzLZJn",vn="nAa_W_FxKosbXRpB3tgu",gn="zwhGmE8SJA8XAnthasxt",En="a9J5InzXCE1XEX5m3A6J",Cn="lFdi4MIeHlnMCtiJbwTA",bn="zY4iKmbIIQ3TXtFU3PvS",fn="b1yiparcCewkKHh2aOHA",yn="rAlVsvmsoSnnvgZfAsc5",In="vPVaiaIOfZEhy_SOHHSA",Sn="J8NzxiUPqVRTJtAPvOyJ",kn="W_V_I0sahPT9FXCYnN8D",Nn="c7iY3_4QyqnNeSocMGQr",wn=3.5*u.Gw,Mn=.5*u.Gw;function Tn(e,t=!1,n=!1){const a=document.createElement("div");a.classList.add(n?fn:bn);const s=new Image;if(s.draggable=!1,s.oncontextmenu=v.Z,s.classList.add(yn),t){const t=document.createElement("canvas");t.classList.add(Cn),s.onload=()=>{const e=t.getContext("2d",{alpha:!1}),{width:n,height:a}=s;(0,Z.WM)((()=>{t.width=n,t.height=a,g.vX&&(e.filter="blur(2px)"),e.drawImage(s,-4,-4,n+8,a+8),g.vX||(0,$.Z)(e,0,0,n,a,2,2)}))},s.src=e,a.appendChild(t)}else s.src=e,a.appendChild(s);return a}function An(e,t){let n;const a=`#${(0,r.qI)(t)}`;switch(e){case i.ze.StoryRibbon:n=`#LeftColumn .${Nt.Z.root}`;break;case i.ze.MiddleHeaderAvatar:n=".MiddleHeader .Transition_slide-active .ChatInfo";break;case i.ze.ChatList:n="#LeftColumn .chat-list";break;case i.ze.SearchResult:n="#LeftColumn .LeftSearch"}const s=document.querySelector(n),o=s&&s.querySelectorAll(`${a} img`);return{container:s,mediaEl:o?.[0]}}const Rn=1200,Ln=800,Bn=405,Fn=720,xn=135,Dn=240;function On({scale:e,slideAmount:t,isActiveSlideSize:n,isMoveThroughActiveSlide:a,isBackward:s}){const i=40+(n?Bn:xn),o=(Math.abs(t)-1)*((a?Bn:xn)+40),r=(0,me.gO)((i+o)*e);return s?-r:r}function Un(){const{width:e,height:t}=(0,be.Z)();return(0,a.Ye)((()=>function(e,t){const n=function(e,t,n,a){const s=n/e,i=a/t;return Math.min(s,i)}(Rn,Ln,e,t),a=(0,me.gO)(Bn*n),s=(0,me.gO)(xn*n);return{activeSlide:{width:a,height:(0,me.gO)(Fn*n)},slide:{width:s,height:(0,me.gO)(Dn*n)},scale:n,toActiveScale:a/s,fromActiveScale:s/a}}(e,t)),[e,t])}function _n(e,t=!1,n=!1){const a=e&&"content"in e,s=e&&"isDeleted"in e,i=!!a&&(0,r.fY)(e),o=a&&Boolean(e.forwardInfo);let l;a&&(e.content.photo?.thumbnail&&(l=e.content.photo.thumbnail.dataUri),e.content.video?.thumbnail?.dataUri&&(l=e.content.video.thumbnail.dataUri));const c=a?(0,r.Cc)(e):void 0,d=(0,H.Z)(c),m=Boolean(a&&e.content.video),u=a&&e.content.video?.noSound,h=a?(0,r.Cc)(e,"full"):void 0,Z=(0,H.Z)(h,!e,m?_.IU.Progressive:_.IU.BlobUrl),P=m&&a?(0,r.Cc)(e,"full",!0):void 0,p=(0,H.Z)(P,!e,_.IU.Progressive),v=Boolean(Z||p),g=m?d:Z||d,E=!d&&!v,C=t&&a&&!e.noForwards,b=a?(0,r.Cc)(e,"download"):void 0;return{isLoadedStory:a,isDeletedStory:s,hasText:i,hasForwardInfo:o,thumbnail:l,previewHash:c,previewBlobUrl:d,isVideo:m,noSound:u,fullMediaHash:h,fullMediaData:Z,altMediaHash:P,altMediaData:p,hasFullData:v,bestImageData:g,hasThumb:E,canDownload:C,downloadMediaData:(0,H.Z)(b,!C&&!n)}}var $n=n(82267),jn=n(31876),Vn=n(4292);const Gn="P7J78AMcEBuYTdRnkNpv",Hn="cFpiujXxzIbtMShso6wr",Jn="ADx8YQgxcFasnFZ14Tcy",zn=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.jUK)(e);return{isOpen:t.storyViewer?.isStealthModalOpen,stealthMode:e.stories.stealthMode,isCurrentUserPremium:(0,l.wVz)(e)}}))((({isOpen:e,stealthMode:t,isCurrentUserPremium:n})=>{const{toggleStealthModal:i,activateStealthMode:o,showNotification:r,openPremiumModal:l}=(0,s.Sv)(),[c,d]=(0,a.eJ)(!1);(0,a.d4)((()=>{if(!t)return;const e=(0,$n.bp)();t.cooldownUntil&&t.cooldownUntil>e&&d(!0)}),[t,e]);const m=(0,M.Z)(),u=(0,T.Z)((()=>{d(!1)})),h=(0,T.Z)((()=>{i({isOpen:!1})})),Z=(0,T.Z)((()=>{n?(o(),r({title:m("StealthModeOn"),message:m("StealthModeOnHint")}),i({isOpen:!1})):l({initialSection:"stories"})}));return a.ZP.createElement(ne.Z,{className:"component-theme-dark",contentClassName:"GNraau1Tus9Dhh2t0acA",isOpen:e,isSlim:!0,onClose:h},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",className:"osHMUMN4HFvGPbQ6eYUw",ariaLabel:m("Close"),onClick:h},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("div",{className:"VLiBdviejkHCeGYNuGbe"},a.ZP.createElement("i",{className:"icon icon-eye-closed-outline"})),a.ZP.createElement("div",{className:"uEr8ArVuYRUD3Ca3K1Sr"},m("StealthMode")),a.ZP.createElement("div",{className:"uV7xfk10UeLETmkHjCSv"},m(n?"StealthModeHint":"StealthModePremiumHint")),a.ZP.createElement(jn.Z,{className:(0,ce.Z)(Gn,"smaller-icon"),multiline:!0,inactive:!0,leftElement:a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-stealth-past",Hn)})},a.ZP.createElement("span",{className:"title"},m("HideRecentViews")),a.ZP.createElement("span",{className:(0,ce.Z)("subtitle",Jn)},m("HideRecentViewsDescription"))),a.ZP.createElement(jn.Z,{className:(0,ce.Z)(Gn,"smaller-icon"),multiline:!0,inactive:!0,leftElement:a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-stealth-future",Hn),"aria-hidden":!0})},a.ZP.createElement("span",{className:"title"},m("HideNextViews")),a.ZP.createElement("span",{className:(0,ce.Z)("subtitle",Jn)},m("HideNextViewsDescription"))),a.ZP.createElement(Y.Z,{className:"z5JVVwDZqJmujLRuZYiL",size:"smaller",disabled:c,isShiny:!n,withPremiumGradient:!n,onClick:Z},n?c?a.ZP.createElement(Vn.Z,{langKey:"AvailableIn",endsAt:t.cooldownUntil,onEnd:u}):m("EnableStealthMode"):m("UnlockStealthMode")))})));var Xn=n(17551);const Yn=(0,a.X$)((function({isOpen:e,story:t,onClose:n}){const{deleteStory:i,openNextStory:o}=(0,s.Sv)(),r=(0,M.Z)(),l=(0,a.I4)((()=>{t&&(o(),i({peerId:t.peerId,storyId:t.id}),n())}),[n,t]);return a.ZP.createElement(Xn.Z,{isOpen:e,onClose:n,title:r("DeleteStoryTitle"),text:r("DeleteStorySubtitle"),confirmLabel:r("Delete"),confirmHandler:l,confirmIsDestructive:!0,className:"component-theme-dark"})}));var qn=n(83321),Kn=n(60782),Wn=n(70735),Qn=n(11820);const ea=(0,a.X$)((function({id:e,contactListIds:t,currentUserId:n,usersById:s,selectedIds:i,lockedIds:o,onSelect:l}){const c=(0,M.Z)(),[d,m]=(0,a.eJ)(""),u=(0,a.Ye)((()=>{const e=(t||[]).filter((e=>e!==n));return(0,Kn.Tw)((0,r.kK)([...i||[],...e],s,d))}),[t,n,d,i,s]);return a.ZP.createElement(Qn.Z,{key:e,itemIds:u,selectedIds:i??Wn.D,lockedIds:o,filterValue:d,filterPlaceholder:c("Search"),searchInputId:`${e}-picker-search`,isSearchable:!0,forceShowSelf:!0,onSelectedIdsChange:l,onFilterChange:m})}));var ta=n(274),na=n(41151);const aa=(0,a.X$)((function({isActive:e,contactListIds:t,usersById:n,currentUserId:i,onClose:o}){const{saveCloseFriends:l}=(0,s.Sv)(),c=(0,M.Z)(),[d,m]=(0,a.eJ)(""),[u,h]=(0,a.eJ)(!1),[Z,P]=(0,a.eJ)([]),p=(0,a.Ye)((()=>(t||[]).filter((e=>n[e]?.isCloseFriend))),[t,n]),v=(0,a.Ye)((()=>{const e=(t||[]).filter((e=>e!==i));return(0,Kn.Tw)((0,r.kK)([...p,...e],n,d))}),[p,t,i,d,n]);(0,ta.Z)((([t])=>{!t&&e&&(h(!1),P(p))}),[e,p]);const g=(0,a.I4)((e=>{P(e),h(!0)}),[]),E=(0,T.Z)((()=>{l({userIds:Z}),o()}));return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Qn.Z,{itemIds:v||[],selectedIds:Z,filterValue:d,filterPlaceholder:c("Search"),searchInputId:"close-friends-picker-search",isSearchable:!0,onSelectedIdsChange:g,onFilterChange:m}),a.ZP.createElement("div",{className:(0,ce.Z)("wU1uWdwnVeSGSB5gOjJ6",u&&"SlrHi8_ck8rgqhL48EhA")},a.ZP.createElement(na.Z,{isShown:u,onClick:E,ariaLabel:c("Save")},a.ZP.createElement("i",{className:"icon icon-check"}))))})),sa={modal:"Tc2kIulYTlFPvwfiTsFu",header:"JXAfpcoB9izWjIX_WP0Q",closeButton:"Hku60UdVn3LASgJdRQuw",headerTitle:"L0Y7Snis7FiIcjMWZBBV",content:"TBDaWd1Xw_wRqKUfj6IE",section:"aNUFlXJVOpJVBLust1Ow",title:"zNuDMViBzMNzGZxwFYGt",list:"uW2YeebP6I62I5STt6az",option:"CmouOddJNYo5qMb1eDhZ",checked:"PxjIam8OpB7IAvp7fByQ",input:"K9FImlb6XOJreshP5cfK",icon:"Wpl9IXFnTYZf8HWj8H7_",action:"oOUd_PRdTkIxpN_BekC1",optionContent:"BkziTDKbvbzgii4mPbsx",footer:"gH3hgLj6tnN_xhycOx0Q",info:"i2HOS8g2UGDP69ABnvAe",submit:"XwAIvijHgerStkRxm6rt"},ia=[{name:"StoryPrivacyOptionEveryone",value:"everybody",color:["#50ABFF","#007AFF"],icon:"channel-filled",actions:"blockUserIds"},{name:"StoryPrivacyOptionContacts",value:"contacts",color:["#C36EFF","#8B60FA"],icon:"user-filled",actions:"blockContactUserIds"},{name:"StoryPrivacyOptionCloseFriends",value:"closeFriends",color:["#88D93A","#30B73B"],icon:"favorite-filled",actions:"closeFriends"},{name:"StoryPrivacyOptionSelectedContacts",value:"nobody",color:["#FFB743","#F69A36"],icon:"group-filled",actions:"allowUserIds"}];var oa=function(e){return e[e.privacy=0]="privacy",e[e.allowList=1]="allowList",e[e.closeFriends=2]="closeFriends",e[e.denyList=3]="denyList",e}(oa||{});const ra=(0,a.X$)((0,s.c$)((e=>{const{storyViewer:{storyId:t,peerId:n}}=(0,l.jUK)(e),a=n&&t?(0,l.JrV)(e,n,t):void 0;return{story:a&&"content"in a?a:void 0,visibility:a&&"visibility"in a?a.visibility:void 0,contactListIds:e.contactList?.userIds,usersById:e.users.byId,currentUserId:e.currentUserId}}))((function({isOpen:e,story:t,visibility:n,contactListIds:i,usersById:o,currentUserId:l,onClose:c}){const{editStoryPrivacy:d,toggleStoryPinned:m}=(0,s.Sv)(),u=(0,M.Z)(),[h,Z,P]=(0,k.Z)(!1),[p,g]=(0,a.eJ)(n),[E,C]=(0,a.eJ)(t?.isPinned),[b,f]=(0,a.eJ)(oa.privacy),[y,I]=(0,a.eJ)("everybody"),S=b!==oa.privacy,N=(0,a.Ye)((()=>(i||[]).filter((e=>o[e]?.isCloseFriend))),[i,o]),w=(0,a.Ye)((()=>{if(b===oa.allowList&&(!p?.allowUserIds?.length||p.allowUserIds[0]===l))return[l]}),[b,l,p?.allowUserIds]),A=(0,a.Ye)((()=>y!==p?.visibility?[]:p?.blockUserIds||[]),[y,p?.blockUserIds,p?.visibility]),R=(0,T.Z)((e=>{g({...p,allowUserIds:e?.length?e?.filter((e=>e!==l)):[l]})})),L=(0,T.Z)((e=>{g({...p,blockUserIds:e,visibility:y})}));(0,a.d4)((()=>{e&&(f(oa.privacy),Z())}),[e]),(0,a.d4)((()=>{g(n)}),[n]);const B=(0,T.Z)((()=>{b!==oa.privacy?f(oa.privacy):P()})),F=(0,T.Z)((()=>{C(!E)})),x=(0,T.Z)((()=>{d({peerId:t.peerId,storyId:t.id,privacy:p}),t.isPinned!==E&&m({peerId:t.peerId,storyId:t.id,isPinned:E}),P()}));function D(e){switch(b){case oa.privacy:return function(){const e=t?function(e){const t=Math.floor(e/3600),n=e%3600;return Math.floor(n/60)>=30?t+1:t}(t.expireDate-t.date):0;return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:sa.section},a.ZP.createElement("h3",{className:sa.title},u("StoryPrivacyAlertSubtitleProfile")),a.ZP.createElement("div",{className:sa.list},ia.map((e=>{return a.ZP.createElement("label",{key:e.value,className:(0,ce.Z)(sa.option,e.value===p?.visibility&&sa.checked)},a.ZP.createElement("input",{type:"radio",name:"story_privacy",className:sa.input,value:e.value,checked:e.value===p?.visibility,onChange:()=>{return t=e.value,void g({...p,visibility:t});var t},teactExperimentControlled:!0}),a.ZP.createElement("span",{className:sa.icon,style:`--color-from: ${e.color[0]}; --color-to: ${e.color[1]}`},a.ZP.createElement("i",{className:`icon icon-${e.icon}`})),a.ZP.createElement("div",{className:sa.optionContent},a.ZP.createElement("span",{className:(0,ce.Z)(sa.option_name)},u(e.name)),e.actions&&a.ZP.createElement("div",{tabIndex:0,role:"button",className:sa.action,"aria-label":u("Edit"),onClick:t=>{!function(e,t){switch((0,v.Z)(e),t){case"closeFriends":f(oa.closeFriends);break;case"allowUserIds":f(oa.allowList);break;case"blockUserIds":f(oa.denyList),I("everybody");break;case"blockContactUserIds":f(oa.denyList),I("contacts")}}(t,e.actions)}},a.ZP.createElement("span",{className:sa.actionInner},"closeFriends"===(t=e.actions)?0===N.length?u("StoryPrivacyOptionCloseFriendsDetail"):1===N.length?(0,r.OU)(u,o[N[0]]):u("StoryPrivacyOptionPeople",N.length,"i"):"blockUserIds"===t&&"everybody"===p?.visibility||"blockContactUserIds"===t&&"contacts"===p?.visibility?p?.blockUserIds?.length?1===p.blockUserIds.length?u("StoryPrivacyOptionExcludePerson",(0,r.Js)(o[p.blockUserIds[0]])):u("StoryPrivacyOptionExcludePeople",p.blockUserIds.length,"i"):u("StoryPrivacyOptionContactsDetail"):p?.allowUserIds&&0!==p.allowUserIds.length?1===p.allowUserIds.length?(0,r.Js)(o[p.allowUserIds[0]]):u("StoryPrivacyOptionPeople",p.allowUserIds.length,"i"):u("StoryPrivacyOptionSelectedContactsDetail")),a.ZP.createElement("i",{className:"icon icon-next","aria-hidden":!0}))));var t})))),a.ZP.createElement("div",{className:sa.section},a.ZP.createElement(jn.Z,{ripple:!0,onClick:F},a.ZP.createElement("span",null,u("StoryKeep")),a.ZP.createElement(qn.Z,{id:"group-notifications",label:u("StoryKeep"),checked:E,inactive:!0}))),a.ZP.createElement("div",{className:sa.footer},a.ZP.createElement("div",{className:sa.info},u("StoryKeepInfo",e)),a.ZP.createElement("div",{className:sa.submit},a.ZP.createElement(Y.Z,{onClick:x},u("StoryPrivacyButtonSave")))))}();case oa.closeFriends:return a.ZP.createElement(aa,{key:"close-friends",isActive:e,contactListIds:i,currentUserId:l,usersById:o,onClose:B});case oa.denyList:return a.ZP.createElement(ea,{key:"deny-list",id:"deny-list",contactListIds:i,currentUserId:l,usersById:o,selectedIds:A,onSelect:L});case oa.allowList:return a.ZP.createElement(ea,{key:"allow-list",id:"allow-list",contactListIds:i,lockedIds:w,currentUserId:l,usersById:o,selectedIds:p?.allowUserIds,onSelect:R})}}return a.ZP.createElement(ne.Z,{isOpen:h,className:(0,ce.Z)(sa.modal,"component-theme-dark"),onClose:P,noBackdrop:!0,onCloseAnimationEnd:c},a.ZP.createElement("div",{className:sa.header},a.ZP.createElement(Y.Z,{className:(0,ce.Z)(sa.closeButton,"close-button"),round:!0,color:"translucent",size:"smaller",onClick:B,ariaLabel:u(S?"Common.Back":"Common.Close")},a.ZP.createElement("div",{className:(0,ce.Z)("animated-close-icon",S&&"state-back")})),a.ZP.createElement(K.ZP,{name:"slideFade",activeKey:b},function(){switch(b){case oa.privacy:return a.ZP.createElement("h3",{className:sa.headerTitle},u("StoryPrivacyAlertEditTitle"));case oa.allowList:return a.ZP.createElement("h3",{className:sa.headerTitle},u("StoryPrivacyAlertSelectContactsTitle"));case oa.closeFriends:return a.ZP.createElement("h3",{className:sa.headerTitle},u("CloseFriends"));case oa.denyList:return a.ZP.createElement("h3",{className:sa.headerTitle},u("StoryPrivacyAlertExcludedContactsTitle"))}}())),a.ZP.createElement(K.ZP,{activeKey:b,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",className:sa.content},D))})));var la=n(80036),ca=n(65723);let da,ma;const ua={Down:!0,ArrowDown:!0,Up:!0,ArrowUp:!0,Left:!0,ArrowLeft:!0,Right:!0,ArrowRight:!0," ":!0,PageUp:!0,PageDown:!0,End:!0,Home:!0,Tab:!0},ha=e=>{const t="deltaY"in e?e.deltaY:(e=>"changedTouches"in e?e.changedTouches[0].clientY:0)(e);if(!da||!da.contains(e.target)||da.scrollTop<=0&&t<=0||da.scrollTop>=da.scrollHeight-da.offsetHeight&&t>=0){if(ma&&e.target.closest(ma))return;e.preventDefault()}};function Za(e){ua[e.key]&&!function(e){if(!(e&&e instanceof HTMLElement))return!1;const t=e,n=t.tagName.toLowerCase();if("textarea"===n)return!0;if("input"!==n)return!1;const a=t.getAttribute("type");return!!a&&["text","password","number","email","tel","url","search","date","datetime","datetime-local","time","month","week"].indexOf(a.toLowerCase())>-1}(e.target)&&e.preventDefault()}function Pa(e,t){da=e,ma=t,document.addEventListener("wheel",ha,{passive:!1}),document.addEventListener("touchmove",ha,{passive:!1}),document.onkeydown=Za}function pa(){da=void 0,ma=void 0,document.removeEventListener("wheel",ha),document.removeEventListener("touchmove",ha),document.onkeydown=null}var va=n(18360),ga=n(517),Ea=n(6562),Ca=n(29497),ba=n(45332),fa=n(15866);var ya=n(70692),Ia=n(87712),Sa=n(19156),ka=n(36103),Na=n(65979),wa=n(57080),Ma=n(74607),Ta=n(42175),Aa=n(31664),Ra=n(52678),La=n(33780),Ba=n(4809),Fa=n(39415),xa=n(41278);const Da=(0,a.X$)((0,s.c$)(((e,{forwardInfo:t})=>({sender:t.fromPeerId?(0,l.RGZ)(e,t.fromPeerId):void 0,story:t.storyId&&t.fromPeerId?(0,l.JrV)(e,t.fromPeerId,t.storyId):void 0})))((({className:e,forwardInfo:t,sender:n,story:i})=>{const{openStoryViewer:o,loadPeerStoriesByIds:l,openChat:c}=(0,s.Sv)(),d=(0,a.sO)(null),m=(0,M.Z)();(0,a.d4)((()=>{!i&&t.fromPeerId&&t.storyId&&l({peerId:t.fromPeerId,storyIds:[t.storyId]})}),[t,i]);const u=n?(0,r.OU)(m,n):t.fromName,h=(0,T.Z)((()=>{const{fromPeerId:e,storyId:n}=t;e&&(!i||"isDeleted"in i&&i.isDeleted?c({id:e}):o({peerId:e,storyId:n,isSingleStory:!0}))})),{handleClick:Z,handleMouseDown:P}=(0,Fa.m)(h);return a.ZP.createElement("div",{ref:d,className:(0,ce.Z)("EmbeddedMessage",e,(0,La.D)(n,!0,!0)),dir:m.isRtl?"rtl":void 0,onClick:Z,onMouseDown:P},n?.color?.backgroundEmojiId&&a.ZP.createElement(xa.Z,{emojiDocumentId:n.color.backgroundEmojiId,className:"EmbeddedMessage--background-icons"}),a.ZP.createElement("div",{className:"message-text"},function(){if(i&&"content"in i&&i.content.text)return a.ZP.createElement("p",{className:"embedded-text-wrapper"},(0,Ba.H)(i.content.text))}(),a.ZP.createElement("div",{className:"message-title"},function(){if(!n||!u)return;const e=(0,r.YC)(n.id)?"user-filled":"channel-filled";return a.ZP.createElement(a.ZP.Fragment,null,e&&a.ZP.createElement(Na.Z,{name:e,className:"embedded-chat-icon"}),u&&(0,te.Z)(u))}())))})));var Oa=n(14612);const Ua=(0,a.X$)((function({story:e,isExpanded:t,className:n,onExpand:s,onFold:i}){const o=(0,M.Z)(),r=(0,a.sO)(null),l=(0,a.sO)(null),c=(0,a.sO)(null),d=(0,a.sO)(null),m=e.content.text,[u,h]=(0,a.eJ)(!1),P=(0,Ra.Z)(t||void 0,400),p=t||P;(0,a.d4)((()=>{(0,Z.WM)((()=>{l.current&&(t?(0,Aa.D_)(l.current,Zn):(0,Aa.mC)(l.current,Zn))}))}),[t]);const v=u&&!p,{shouldRender:g,transitionClassNames:E}=(0,Fe.Z)(v,void 0,!0,"slow",!0);(0,a.bt)((()=>{(0,Z.i$)((()=>{if(!d.current)return;const e=d.current,{offsetWidth:t}=e;(0,Z.WM)((()=>{e.style.setProperty("--expand-button-width",`${t}px`)}))}))}),[]),(0,a.bt)((()=>{(0,Z.lT)((()=>{if(!l.current||!c.current)return;const e=l.current,t=c.current,n=t.offsetTop,a=parseInt(getComputedStyle(t).lineHeight,10),s=t.clientHeight>3*a,i=n+3*a;return()=>{s&&((0,Aa.D_)(e,un),h(!0)),e.style.setProperty("--_overflow-shift",`${i}px`)}}))}),[m]),(0,a.d4)((()=>{t||r.current?.scrollTo({top:0})}),[t]);const C=(0,ce.Z)(dn,p&&hn,g&&Pn);return a.ZP.createElement("div",{className:(0,ce.Z)(_t,n)},a.ZP.createElement("div",{ref:l,className:C,role:v?"button":void 0,onClick:v?s:i},a.ZP.createElement("div",{ref:r,className:(0,ce.Z)(cn,"allow-selection","custom-scroll")},e.forwardInfo&&a.ZP.createElement(Da,{forwardInfo:e.forwardInfo,className:Nn}),a.ZP.createElement("div",{ref:c,className:mn},a.ZP.createElement(Oa.Z,{messageOrStory:e,withTranslucentThumbs:!0,forcePlayback:!0})))),g&&a.ZP.createElement("div",{ref:d,className:(0,ce.Z)(pn,E),onClick:s},o("Story.CaptionShowMore")))}));var _a=n(65351),$a=n(36368);const ja="SZ7yrkn5jnFJYa8rf9Lq",Va="HeAnIGNLSRuOeQHda2j9",Ga="nrvshNssU3J7YjDRMGJt",Ha=(0,a.X$)((({story:e,areViewsExpired:t,className:n})=>{const{openStoryViewModal:i,openForwardMenu:l,sendStoryReaction:c}=(0,s.Sv)(),d=(0,M.Z)(),{views:m,isOut:u,peerId:h,id:Z,sentReaction:P}=e,{viewsCount:p,forwardsCount:v,reactionsCount:g}=m||{},E=!(0,r.YC)(h),C=!(!P||!("emoticon"in P))&&P.emoticon===o.mzt.emoticon,b=Boolean((u||E)&&e.isPublic&&!e.noForwards),f=(0,r.hl)(h,Z),y=(0,a.Ye)((()=>{const{users:{byId:e}}=(0,s.Rd)(),t=m&&"recentViewerIds"in m?m.recentViewerIds:void 0;if(t)return t.map((t=>e[t])).filter(Boolean)}),[m]),I=(0,T.Z)((()=>{i({storyId:Z})})),S=(0,T.Z)((()=>{l({fromChatId:h,storyId:Z})})),k=(0,T.Z)((()=>{const e=P?void 0:o.mzt;c({peerId:h,storyId:Z,containerId:f,reaction:e})}));return p?a.ZP.createElement("div",{className:(0,ce.Z)(ja,n)},a.ZP.createElement("div",{className:(0,ce.Z)("sGmslpAUN8yKBOxe13Kg",!E&&"UfBe8dmqVfC7BCCMwpOI"),onClick:E?void 0:I},!t&&Boolean(y?.length)&&a.ZP.createElement(_a.Z,{size:"small",peers:y,className:"fx7W4KZAaiK5T2nIZL5c"}),E?a.ZP.createElement("span",{className:Ga},a.ZP.createElement(Na.Z,{name:"channelviews",className:"ALYrJzsIz00qOE3fZxAg"}),p):a.ZP.createElement("span",{className:Ga},d("Views",p,"i")),Boolean(g)&&!E&&a.ZP.createElement("span",{className:"be7sESSsLrdDEAFmfgN1"},a.ZP.createElement(Na.Z,{name:"heart",className:"j6UTHtXm5pGlZTUQtiNw"}),g)),a.ZP.createElement("div",{className:"SdmjC2sdiWVr6VAguB1N"}),b&&a.ZP.createElement(Y.Z,{color:"translucent",size:"smaller",round:!0,onClick:S,ariaLabel:d("Forward"),className:Va},a.ZP.createElement(Na.Z,{name:"forward"})),E&&a.ZP.createElement(a.ZP.Fragment,null,Boolean(v)&&a.ZP.createElement("div",{className:Va},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",nonInteractive:!0,ariaLabel:d("PublicShares")},a.ZP.createElement(Na.Z,{name:"loop"})),a.ZP.createElement("span",null,v)),a.ZP.createElement("div",{className:Va},a.ZP.createElement(Y.Z,{round:!0,className:"BnHCTCGK8AHZZfrBsrRz",color:"translucent",size:"smaller",onClick:k,ariaLabel:d("AccDescrLike")},P&&a.ZP.createElement($a.Z,{key:"documentId"in P?P.documentId:P.emoticon,containerId:f,reaction:P,withEffectOnly:C}),(!P||C)&&a.ZP.createElement(Na.Z,{name:C?"heart":"heart-outline",className:(0,ce.Z)(C&&"oDRgq62aSPNYamk9P2EV")})),Boolean(g)&&a.ZP.createElement("span",null,g)))):a.ZP.createElement("div",{className:(0,ce.Z)(ja,n)},d("NobodyViewed"))})),Ja=(0,a.X$)((function({isActive:e,isViewed:t,isVideo:n,duration:s=6,isPaused:i,onImageComplete:o}){const r=(0,T.Z)((e=>{n||"kvGsn6HE3seo_5jfVRs1"!==e.animationName||o()})),l=(0,ce.Z)("uXHBlEUDZKJr1u7dvj4k",t&&"GiJXPT0zbAmsx82Nm8ci",e&&"PaCfy7Nei0tOQAE9i0XV",i&&"J1oS3YeXCbdBhKm3eIBi");return a.ZP.createElement("span",{className:l,"aria-hidden":!0},e&&a.ZP.createElement("i",{style:`--progress-duration: ${s}s`,className:"goBtmBaUzEEUaT_NbrvT",onAnimationEnd:r}))})),za=(0,a.X$)((0,s.c$)(((e,{peerId:t,storyId:n,isPrivateStories:a,isArchivedStories:s,isReportModalOpen:i,isDeleteModalOpen:o})=>{const{appConfig:r}=e,c=(0,l.dyD)(e,t),d=(0,l.Z1J)(e,t),m=(0,l.jUK)(e),{storyViewer:{isMuted:u,viewModal:h,isPrivacyModalOpen:Z,isStealthModalOpen:P},forwardMessages:{storyId:p},premiumModal:v,safeLinkModalUrl:g,mapModal:E}=m,{isOpen:C}=v||{},{orderedIds:b,pinnedIds:f,archiveIds:y}=(0,l.nST)(e,t)||{},I=(0,l.JrV)(e,t,n),S=Boolean(h||p||m.reactionPicker?.storyId||i||Z||C||o||g||P||E),k=I&&"forwardInfo"in I?I.forwardInfo?.fromPeerId:void 0;return{peer:c||d,forwardSender:k?(0,l.RGZ)(e,k):void 0,story:I,orderedIds:s?y:a?f:b,isMuted:u,isCurrentUserPremium:(0,l.wVz)(e),shouldForcePause:S,storyChangelogUserId:r.storyChangelogUserId,viewersExpirePeriod:r.storyExpirePeriod+r.storyViewersExpirePeriod,isChatExist:Boolean(d),areChatSettingsLoaded:Boolean(d?.settings),stealthMode:e.stories.stealthMode}}))((function({peerId:e,storyId:t,peer:n,forwardSender:i,isMuted:l,isArchivedStories:c,isPrivateStories:d,story:m,orderedIds:u,isSingleStory:h,dimensions:Z,shouldForcePause:P,storyChangelogUserId:p,viewersExpirePeriod:v,isChatExist:g,areChatSettingsLoaded:E,getIsAnimating:C,isCurrentUserPremium:b,stealthMode:f,onDelete:y,onClose:S,onReport:N}){const{viewStory:w,setStoryViewerMuted:A,openPreviousStory:R,openNextStory:L,loadPeerSkippedStories:B,openForwardMenu:F,copyStoryLink:x,toggleStoryPinned:D,openChat:O,showNotification:U,openStoryPrivacyEditor:$,loadChatSettings:j,fetchChat:V,loadStoryViews:G,toggleStealthModal:H}=(0,s.Sv)(),J=(0,$n.bp)(),z=(0,M.Z)(),{isMobile:X}=(0,I.ZP)(),[,q]=Be(),[K,W,Q]=(0,k.Z)(!1),[ee,ne,ae]=(0,k.Z)(!1),[se,re,le]=(0,k.Z)(!1),[de,me,ue]=(0,k.Z)(!0),[he,Ze,Pe]=(0,k.Z)(!1),[pe,ve]=(0,a.eJ)(!1),[ge,Ee,Ce]=(0,k.Z)(!1),[be,fe,ye]=(0,k.Z)(!1),Ie=(0,a.sO)(null),{isDeletedStory:Se,hasText:ke,hasForwardInfo:Ne,thumbnail:we,previewBlobUrl:Me,isVideo:Ae,noSound:Re,fullMediaData:Le,altMediaHash:xe,altMediaData:De,hasFullData:Oe,hasThumb:Ue,canDownload:$e,downloadMediaData:je}=_n(m,b,be),Ve=m&&"content"in m,Ge=e===p,He=!(0,r.YC)(e),Je=Ve&&m.isOut,ze=(0,va.Z)(Je?!m.isPinned:void 0,!0),Xe=(0,va.Z)(Je?m.isPinned:void 0,!0),Ye=Boolean(Je&&m.date+v<(0,$n.bp)()),qe=i?(0,r.OU)(z,i):Ve&&m.forwardInfo?.fromName,Ke=Boolean(Ve&&m.isPublic&&!Ge&&n?.usernames?.length),We=Boolean(Ve&&m.isPublic&&!m.noForwards&&!Ge&&!he),Qe=Boolean(Oe&&!P&&de&&!K&&!he&&!pe&&!ge),et=Ve&&m.content.video?.duration?m.content.video.duration:void 0,tt=Ve&&(Je||He),{shouldRender:nt,transitionClassNames:at}=(0,Fe.Z)(!Oe),{transitionClassNames:st}=(0,Fe.Z)(Boolean(Le)),it=(0,fa.Z)(we,!Ue),ot=(0,ya.Z)(Me),{shouldRender:rt,transitionClassNames:lt}=(0,Fe.Z)(!Je&&!Ge&&!He),{shouldRender:ct,transitionClassNames:dt}=(0,Fe.Z)(ke&&he),{transitionClassNames:mt}=(0,Fe.Z)(!0);(0,Ia.F)(Ie,Le,Ca.M),(0,Sa.Z)(e,t),(0,a.d4)((()=>{t&&w({peerId:e,storyId:t})}),[t,e]),(0,a.d4)((()=>{B({peerId:e})}),[e]),(0,a.d4)((()=>{const t=(0,r.YC)(e);!g&&t&&V({chatId:e})}),[g,e]),(0,a.d4)((()=>{g&&!E&&j({chatId:e})}),[E,g,e]);const ut=(0,T.Z)((()=>{Ae&&Ie.current?.pause(),le(),ae()})),ht=(0,T.Z)((()=>{Qe&&(ne(),Ae||re())})),Zt=(0,T.Z)((()=>{Ee()})),Pt=(0,T.Z)((()=>{Ce()})),pt=(0,T.Z)((()=>{fe(),ut()})),vt=(0,T.Z)((()=>{ye(),ht()})),{onMouseDown:gt,onMouseUp:Et,onMouseLeave:Ct,onTouchStart:bt,onTouchEnd:ft}=function(e,t){const n=(0,a.sO)(!1),s=(0,a.sO)(!1),i=(0,a.sO)(void 0),o=(0,a.I4)((t=>{const a="button"in t&&0===t.button||"touches"in t&&t.touches.length>0;!s.current&&a&&(s.current=!0,i.current=window.setTimeout((()=>{e(),n.current=!0}),250))}),[e]),r=(0,a.I4)((()=>{n.current&&t(),n.current=!1,s.current=!1,window.clearTimeout(i.current)}),[t]);return(0,a.d4)((()=>()=>{window.clearTimeout(i.current)}),[]),{onMouseDown:o,onMouseUp:r,onMouseLeave:r,onTouchStart:o,onTouchEnd:r}}(Zt,Pt),It=(0,Te.Z)(Ie,void 0,!Ae||!Le),St=Le&&(!xe||De);(0,a.d4)((()=>{St&&!It&&ht()}),[St,It]),(0,ba.Z)(ue,me),(0,a.d4)((()=>{St&&Ie.current?.load()}),[St]),(0,a.d4)((()=>{!Je||Se||Ye||G({peerId:e,storyId:t,isPreload:!0})}),[Se,Ye,Je,e,t]),(0,a.d4)((()=>{P||!de||K||he||pe||ge?ut():ht()}),[ht,de,he,K,P,pe,ge]),(0,a.d4)((()=>{if(!(K||P||he))return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){32===e.keyCode&&(e.preventDefault(),ve(!pe))}}),[he,K,pe,P]),(0,ta.Z)((([e,t,n,a,s])=>{!pe||he||K||P||!de||ge||t===he&&e===K&&n===P&&a===de&&s===ge||ve(!1)}),[K,he,P,de,ge,pe]);const kt=(0,T.Z)((()=>{S(),O({id:e})})),Nt=(0,T.Z)((()=>{S(),O({id:i.id})})),wt=(0,T.Z)((()=>{q(0),R()})),Tt=(0,T.Z)((()=>{q(0),L()})),Rt=(0,T.Z)((e=>{const t=e.currentTarget;t.readyState>=4&&q(t.currentTime),et&&t.currentTime>=et&&Tt()}));(0,a.d4)((()=>C()||K?void 0:(0,ga.Z)({onRight:Tt,onLeft:wt})),[C,K]);const Lt=(0,T.Z)((()=>{x({peerId:e,storyId:t})})),Bt=(0,T.Z)((()=>{D({peerId:e,storyId:t,isPinned:!0})})),Ft=(0,T.Z)((()=>{D({peerId:e,storyId:t,isPinned:!1})})),xt=(0,T.Z)((()=>{q(0),y(m)})),Dt=(0,T.Z)((()=>{N()})),Ot=(0,T.Z)((()=>{F({fromChatId:e,storyId:t})})),_t=(0,T.Z)((()=>{$()})),jt=(0,T.Z)((()=>{const e=!Ve||m.isPublic?void 0:m.isForContacts?"contacts":m.isForCloseFriends?"closeFriends":"nobody";let t;const a=(0,r.OU)(z,n);switch(e){case"nobody":t=z("StorySelectedContactsHint",a);break;case"contacts":t=z("StoryContactsHint",a);break;case"closeFriends":t=z("StoryCloseFriendsHint",a);break;default:return}U({message:t})})),Vt=(0,T.Z)((()=>{Re?U({message:z("Story.TooltipVideoHasNoSound")}):(Ie.current.muted=!Ie.current.muted,A({isMuted:!l}))})),Gt=(0,T.Z)((()=>{if(f.activeUntil&&(0,$n.bp)()<f.activeUntil){const e=f.activeUntil-(0,$n.bp)();U({title:z("StealthModeOn"),message:z("Story.ToastStealthModeActiveText",(0,_e.k9)(e)),duration:4e3})}else H({isOpen:!0})})),Xt=(0,T.Z)((()=>{je&&(0,Ea.Z)(je,`story-${e}-${t}.${Ae?"mp4":"jpg"}`)}));(0,a.d4)((()=>{Se&&U({message:z("StoryNotFound")})}),[z,Se]);const cn=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{round:!0,ripple:!X,size:"tiny",color:"translucent-white",onClick:e,className:(0,ce.Z)(on,t&&"active"),ariaLabel:z("AccDescrOpenMenu2")},a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-more"),"aria-hidden":!0}))),[X,z]);return a.ZP.createElement("div",{className:(0,ce.Z)(Ht,"component-theme-dark"),onMouseDown:gt,onMouseUp:Et,onMouseLeave:Ct,onTouchStart:bt,onTouchEnd:ft},a.ZP.createElement("div",{className:(0,ce.Z)(Yt,mt)},a.ZP.createElement("div",{className:$t},(h?[t]:u??[]).map((e=>a.ZP.createElement(Ja,{key:`progress-${e}`,isActive:e===m?.id,isVideo:Ae,isViewed:Boolean(m?.id&&(d||c?e>m?.id:e<m?.id)),isPaused:!se,duration:et,onImageComplete:Tt})))),a.ZP.createElement("div",{className:qt},a.ZP.createElement(yt.Z,{peer:n,size:"tiny",onClick:kt}),a.ZP.createElement("div",{className:Kt},a.ZP.createElement("span",{onClick:kt,className:Wt},(0,te.Z)((0,r.OU)(z,n)||"")),a.ZP.createElement("div",{className:Qt},qe&&a.ZP.createElement("span",{className:(0,ce.Z)(en,In,i&&Sn),onClick:i?Nt:void 0},a.ZP.createElement(Na.Z,{name:"loop"}),a.ZP.createElement("span",{className:kn},(0,te.Z)(qe))),m&&"date"in m&&a.ZP.createElement("span",{className:en},(0,_e.SY)(z,J,m.date)),Ve&&m.isEdited&&a.ZP.createElement("span",{className:en},z("Story.HeaderEdited")))),a.ZP.createElement("div",{className:nn},function(){if(He)return;let e="channel-filled";const t={"channel-filled":["#50ABFF","#007AFF"],"user-filled":["#C36EFF","#8B60FA"],"favorite-filled":["#88D93A","#30B73B"],"group-filled":["#FFB743","#F69A36"]};if(Je){const{visibility:t}=m&&"visibility"in m&&m.visibility||{};switch(t){case"everybody":e="channel-filled";break;case"contacts":e="user-filled";break;case"closeFriends":e="favorite-filled";break;case"nobody":e="group-filled"}}else{if(!m||!("content"in m)||m.isPublic)return;e=m.isForCloseFriends?"favorite-filled":m.isForContacts?"user-filled":"group-filled"}return a.ZP.createElement("div",{className:(0,ce.Z)(an,Je&&sn),onClick:Je?_t:jt,style:`--color-from: ${t[e][0]}; --color-to: ${t[e][1]}`},a.ZP.createElement("i",{className:`icon icon-${e}`,"aria-hidden":!0}),Je&&a.ZP.createElement("i",{className:"icon icon-next","aria-hidden":!0}))}(),Ae&&a.ZP.createElement(Y.Z,{className:on,round:!0,ripple:!X,size:"tiny",color:"translucent-white",disabled:!Oe,onClick:Vt,ariaLabel:z("Volume")},a.ZP.createElement("i",{className:(0,ce.Z)("icon",l||Re?"icon-speaker-muted-story":"icon-speaker-story"),"aria-hidden":!0})),a.ZP.createElement(ie.Z,{className:rn,trigger:cn,positionX:"right",onOpen:pt,onClose:vt},Ke&&a.ZP.createElement(oe.Z,{icon:"copy",onClick:Lt},z("CopyLink")),ze&&a.ZP.createElement(oe.Z,{icon:"save-story",onClick:Bt},z("StorySave")),Xe&&a.ZP.createElement(oe.Z,{icon:"delete",onClick:Ft},z("ArchiveStory")),$e&&a.ZP.createElement(oe.Z,{icon:"download",disabled:!je,onClick:Xt},z("lng_media_download")),a.ZP.createElement(oe.Z,{icon:"eye-closed-outline",onClick:Gt},z("StealthMode")),!Je&&a.ZP.createElement(oe.Z,{icon:"flag",onClick:Dt},z("lng_report_story")),Je&&a.ZP.createElement(oe.Z,{icon:"delete",destructive:!0,onClick:xt},z("Delete"))),a.ZP.createElement(Y.Z,{className:(0,ce.Z)(on,tn),round:!0,size:"tiny",color:"translucent-white",ariaLabel:z("Close"),onClick:S},a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-close"),"aria-hidden":!0}))))),a.ZP.createElement("div",{className:Jt,style:`width: ${Z.width}px; height: ${Z.height}px`},a.ZP.createElement("canvas",{ref:it,className:Cn}),Me&&a.ZP.createElement("img",{src:Me,draggable:!1,alt:"",className:(0,ce.Z)(zt,ot)}),nt&&a.ZP.createElement(Ma.Z,{className:(0,ce.Z)(at,Mt)}),!Ae&&Le&&a.ZP.createElement("img",{src:Le,alt:"",className:(0,ce.Z)(zt,st),draggable:!1}),Ae&&Le&&a.ZP.createElement(wa.Z,{ref:Ie,className:(0,ce.Z)(zt,st),canPlay:ee,muted:l,draggable:!1,playsInline:!0,disablePictureInPicture:!0,isPriority:!0,onPlaying:re,onPause:le,onWaiting:le,disableRemotePlayback:!0,onTimeUpdate:Rt},a.ZP.createElement("source",{src:Le,type:Ca.M,width:"720"}),De&&a.ZP.createElement("source",{src:De,type:Ca.X,width:"480"})),!ge&&!K&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("button",{type:"button",className:(0,ce.Z)(vn,gn),onClick:wt,"aria-label":z("Previous")}),a.ZP.createElement("button",{type:"button",className:(0,ce.Z)(vn,En),onClick:Tt,"aria-label":z("Next")})),Ve&&Le&&a.ZP.createElement(Ta.Z,{story:m,isActive:!0})),tt&&a.ZP.createElement(Ha,{story:m,className:mt,areViewsExpired:Ye}),ct&&a.ZP.createElement("div",{tabIndex:0,role:"button",className:(0,ce.Z)(At,dt),onClick:()=>Pe(),"aria-label":z("Close")}),ke&&a.ZP.createElement("div",{className:ln}),(ke||Ne)&&a.ZP.createElement(Ua,{key:`caption-${t}-${e}`,story:m,isExpanded:he,onExpand:Ze,onFold:Pe,className:mt}),rt&&a.ZP.createElement(ka.Z,{type:"story",chatId:e,threadId:_._f,storyId:t,isReady:!Je,messageListType:"thread",isMobile:(0,I.W7)(),editableInputCssSelector:o.fw0,editableInputId:o.Cic,inputId:"story-input-text",className:(0,ce.Z)(Ut,lt),inputPlaceholder:z("ReplyPrivately"),onForward:We?Ot:void 0,onFocus:W,onBlur:Q}))}))),Xa=(0,a.X$)((0,s.c$)(((e,{peer:t})=>{const{storyViewer:{lastViewedByPeerIds:n,origin:a}}=(0,l.jUK)(e);return{lastViewedId:t?.id?n?.[t.id]:void 0,origin:a}}))((function({peer:e,peerStories:t,lastViewedId:n,origin:i}){const{openStoryViewer:o,loadPeerSkippedStories:l}=(0,s.Sv)(),c=(0,M.Z)(),d=(0,a.Ye)((()=>{if(!t)return;const{orderedIds:e,lastReadId:a,byId:s}=t,i=e[e.length-1]!==a,o=n??(i?a??-1:-1);return s[s[o]?.id||e[0]]}),[n,t]),m=d&&"content"in d;(0,a.d4)((()=>{d&&!m&&l({peerId:d.peerId})}),[d,m]);const u=m?d.content.video:void 0,h=m?(0,r.Cc)(d):void 0,Z=(0,H.Z)(h)||u?.thumbnail?.dataUri;if(e&&d&&!("isDeleted"in d))return a.ZP.createElement("div",{className:Ht,onClick:()=>{o({peerId:d.peerId,storyId:d.id,origin:i})}},Z&&a.ZP.createElement("img",{src:Z,alt:"",className:zt,draggable:!1}),m&&a.ZP.createElement(Ta.Z,{story:d}),a.ZP.createElement("div",{className:Dt},a.ZP.createElement(yt.Z,{peer:e,withStory:!0,storyViewerMode:"disabled"}),a.ZP.createElement("div",{className:Xt},(0,te.Z)((0,r.OU)(c,e)||""))))}))),Ya=350+(g.s$||g.D1?o.fK3:20);var qa=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(qa||{});const Ka=(0,a.X$)((0,s.c$)((e=>{const{storyViewer:{peerId:t,storyId:n,isSinglePeer:a,isSingleStory:s,isPrivate:i,isArchive:o}}=(0,l.jUK)(e),{byPeerId:r,orderedPeerIds:{archived:c,active:d}}=e.stories,m=t?(0,l.RGZ)(e,t):void 0;return{byPeerId:r,peerIds:m?.areStoriesHidden?c:d,currentPeerId:t,currentStoryId:n,isSinglePeer:a,isSingleStory:s,isPrivate:i,isArchive:o}}),(e=>(0,l.TuN)(e)))((function({peerIds:e,currentPeerId:t,currentStoryId:n,isOpen:i,isSinglePeer:c,isSingleStory:d,isPrivate:m,isArchive:u,byPeerId:h,isReportModalOpen:P,isDeleteModalOpen:p,onDelete:v,onClose:E,onReport:C}){const{stopActiveReaction:b}=(0,s.Sv)(),f=(0,a.sO)(null),[y,S]=(0,a.eJ)(t),[k,N]=(0,a.eJ)(n),w=(0,D.Z)(t),M=(0,va.Z)(u,!0),A=(0,va.Z)(m,!0),R=(0,va.Z)(c,!0),L=(0,va.Z)(d,!0),B=Un(),{height:F,width:x}=(0,be.Z)(),O=(0,a.sO)(void 0),U=(0,a.sO)(!1),{isMobile:_}=(0,I.ZP)(),$=_?0:Ya,j=(0,a.sO)({}),[V,G]=(0,ve.Z)(!1);function H(e,t){e&&(j.current[t]?j.current[t].current=e:j.current[t]={current:e})}(0,pe.Z)({isActive:i,onBack:E,shouldBeReplaced:!0});const J=(0,a.Ye)((()=>{if(y&&(R||L))return[y];const t=y?e.indexOf(y):-1;if(!y||-1===t)return[];const n=Math.max(t-4,0),a=Math.min(t+5,e.length);return e.slice(n,a)}),[L,R,y,e]),z=(0,a.Ye)((()=>J.length&&y?J.indexOf(y):-1),[y,J]),X=(0,a.Ye)((()=>J.length&&t?J.indexOf(t):-1),[t,J]);(0,a.d4)((()=>{const e=window.setTimeout((()=>{S(t)}),$);return()=>{window.clearTimeout(e)}}),[$,t]),(0,a.d4)((()=>{let e;return y!==t?e=window.setTimeout((()=>{N(n)}),$):n!==k&&N(n),()=>{window.clearTimeout(e)}}),[y,n,t,k,$]),(0,a.d4)((()=>{let e;return w&&w!==t&&(G(!0),e=window.setTimeout((()=>{G(!1)}),$)),()=>{G(!1),window.clearTimeout(e)}}),[w,t,G,$]),(0,a.d4)((()=>()=>{n&&t&&b({containerId:(0,r.hl)(t,n)})}),[n,t]);const Y=X-z,q=z>X,K=(0,T.Z)((()=>e.reduce(((n,a,s)=>{if(a===y)n[a]=On({scale:B.scale,slideAmount:Y,isBackward:q,isActiveSlideSize:q});else{let i=!1;!q&&s>0&&e[s-1]===y&&(i=!0),q&&s<e.length-1&&e[s+1]===y&&(i=!0),n[a]=On({scale:B.scale,slideAmount:Y,isBackward:q,isActiveSlideSize:t===a&&!q,isMoveThroughActiveSlide:i})}return n}),{})));return(0,a.d4)((()=>{if(!f.current||!i)return;let e=0;const t=()=>y?j.current[y]?.current:void 0,n=n=>{if(U.current)return void(U.current=!1);const a=t();if(a)if(e<-50){const e=document.getElementById(o.Cic);e&&(0,Z.WM)((()=>{(0,ca.Z)(e)}))}else e>50?(E(),"wheel"===n.type&&(Pa(),setTimeout(pa,1500))):(0,Z.WM)((()=>{a.style.setProperty("--slide-translate-y","0px")}))};return(0,de.sf)(f.current,{isNotPassive:!0,withNativeDrag:!0,withWheelDrag:!0,excludedClosestSelector:".Composer",onDrag:(a,s,{dragOffsetX:i,dragOffsetY:o})=>{if(U.current)return;if(g.cj&&"touchstart"===s.type){const{pageX:e}=s.touches[0];if(e<=de.vJ||e>=x-de.vJ)return}if("mousemove"===a.type)return;const r=Math.abs(i),l=Math.abs(o),c=t();if(c&&(O.current===qa.Vertical||Math.abs(l)>de.QC||l/r>de.Vb)){O.current=qa.Vertical;const t=F;e=(0,me.uZ)(o,-t,t),e>0&&(0,Z.WM)((()=>{c.style.setProperty("--slide-translate-y",-e+"px")})),"wheel"===a.type&&Math.abs(e)>100&&(n(a),U.current=!0)}},onRelease:n})}),[i,y,E,x,F]),(0,a.bt)((()=>{const e=K();Object.entries(j.current).forEach((([n,{current:a}])=>{if(!a)return;if(!V())return a.classList.remove(Ft,xt,Ot),a.style.setProperty("--slide-translate-x","0px"),a.style.setProperty("--slide-translate-y","0px"),void a.style.setProperty("--slide-translate-scale","1");let s=0;n===y&&(_||(s=-1.75*B.fromActiveScale),a.classList.add(Ot)),n===t&&(_||(s=1.75),a.classList.add(xt)),a.classList.add(Ft),a.style.setProperty("--slide-translate-x",`${e[n]||0}px`),a.style.setProperty("--slide-translate-y",`${s}rem`),a.style.setProperty("--slide-translate-scale",_?"1":t===n?String(B.toActiveScale):n===y?String(B.fromActiveScale):"1")}))}),[t,V,y,_,B]),a.ZP.createElement("div",{className:Bt,ref:f,style:`--story-viewer-scale: ${B.scale}`},a.ZP.createElement("div",{className:Mt,onClick:E}),J.length>1&&a.ZP.createElement("div",{className:Rt,style:`height: ${B.slide.height}px`}),J.map(((e,t)=>e===y?function(e){const t=(0,la.Z)(`width: ${B.activeSlide.width}px`,`--slide-media-height: ${B.activeSlide.height}px`);return a.ZP.createElement("div",{key:e,ref:t=>H(t,e),className:(0,ce.Z)(jt,Gt),style:t},a.ZP.createElement(za,{peerId:e,storyId:k,onDelete:v,dimensions:B.activeSlide,isPrivateStories:A,isArchivedStories:M,isReportModalOpen:P,isDeleteModalOpen:p,isSingleStory:d,getIsAnimating:V,onClose:E,onReport:C}))}(y):function(e,t,n){const i=(0,la.Z)(`width: ${B.slide.width}px`,`height: ${B.slide.height}px`),o=(0,ce.Z)(jt,Vt,`slide-${n}`);return a.ZP.createElement("div",{key:e,ref:t=>H(t,e),className:o,style:i},a.ZP.createElement(Xa,{peer:(0,l.RGZ)((0,s.Rd)(),e),peerStories:h?.[e]}))}(e,0,t-z))))})));function Wa(e=5){const[t,n]=(0,a.eJ)(!0),[s,i]=(0,a.eJ)(!0);return{isAtBeginning:t,isAtEnd:s,handleScroll:(0,T.Z)((t=>{const{scrollHeight:a,scrollTop:s,clientHeight:o}=t.target;n(s<e),i(a-s-o<e)}))}}var Qa=n(21273),es=n(78747),ts=n(69589),ns=n(6058),as=n(48198);const ss={"views-list":"hOwWWII6h241MvvB87N5",viewsList:"hOwWWII6h241MvvB87N5","views-list-loading":"ZaMMMcb_gGs7nmClMvzj",viewsListLoading:"ZaMMMcb_gGs7nmClMvzj",info:"Yt7QHLaCNE1N3OSWXa_n",centeredInfo:"vKqMQNiuvK152lO__j16","view-reaction":"x77ctFpUWd2rG2IUxz7y",viewReaction:"x77ctFpUWd2rG2IUxz7y",header:"oGYCTCHvXEkdIBMd0dHh",content:"NfqCS7dx9c9nxYXZc3p2","top-button":"hMKJ4bqsyGw0fQn5RwVQ",topButton:"hMKJ4bqsyGw0fQn5RwVQ","contact-filter":"RnVt9sK0OgnrHADARI9k",contactFilter:"RnVt9sK0OgnrHADARI9k",selected:"deHea5ii46_J57LhYmaj",sort:"Mq_j5_FRMS06qJcPCwmC","sort-button":"BYQ1X4iADCMrIUqdd3Lt",sortButton:"BYQ1X4iADCMrIUqdd3Lt","icon-sort":"yq5P30VXV4gSKmSHmXLL",iconSort:"yq5P30VXV4gSKmSHmXLL","icon-down":"mjcXdhEuASJWWO5Cqlxq",iconDown:"mjcXdhEuASJWWO5Cqlxq",search:"vs1AYj85WQxzI646EBZt","bottom-info":"sWTOVQoWoeNAu2G8kVOl",bottomInfo:"sWTOVQoWoeNAu2G8kVOl",scrolled:"knxco2DJ3lthvQo2SOG6",footer:"RqsPFLpLbJYFm50JYSiw",closeButton:"DonddSsGK4E9DM8F5ctU","opacity-fade-in":"h15igx036PH4epiXwUBg",opacityFadeIn:"h15igx036PH4epiXwUBg",fadeIn:"T9DzW6zCmxNgXv1YaUji",blocked:"EVxErnsRszao77tgwSaA",check:"HbQucamQwAYpvNnTqHVM",menuBubble:"Y3KJ1StmiJpvbpeqbMuv"},is=1.5*u.Gw,os=(0,a.X$)((0,s.c$)(((e,{storyView:t})=>({user:(0,l.dyD)(e,t.userId),availableReactions:e.availableReactions})))((({storyView:e,user:t,availableReactions:n})=>{const{openChat:i,closeStoryViewer:o,unblockUser:l,blockUser:c,deleteContact:d,updateStoryView:m}=(0,s.Sv)(),u=(0,M.Z)(),h=(0,T.Z)((()=>{o(),setTimeout((()=>{i({id:e.userId})}),100)})),Z=(0,a.Ye)((()=>{const{userId:n,areStoriesBlocked:a,isUserBlocked:s}=e,{isContact:i}=t||{},o=(0,r.Js)(t),h=[];return s||(a?h.push({handler:()=>{l({userId:n,isOnlyStories:!0}),m({userId:n,areStoriesBlocked:!1})},title:u("StoryShowBackTo",o),icon:"play-story"}):h.push({handler:()=>{c({userId:n,isOnlyStories:!0}),m({userId:n,areStoriesBlocked:!0})},title:u("StoryHideFrom",o),icon:"hand-stop"})),i?h.push({handler:()=>{d({userId:n})},title:u("DeleteContact"),icon:"delete-user",destructive:!0}):h.push({handler:()=>{s?(l({userId:n}),m({userId:n,isUserBlocked:!1})):(c({userId:n}),m({userId:n,isUserBlocked:!0}))},title:u(s?"Unblock":"BlockUser"),icon:s?"user":"delete-user",destructive:!s}),h}),[u,e,t]);return a.ZP.createElement(jn.Z,{key:e.userId,className:(0,ce.Z)("chat-item-clickable small-icon",ss.opacityFadeIn,(e.isUserBlocked||e.areStoriesBlocked)&&ss.blocked),onClick:()=>h(),rightElement:e.reaction?a.ZP.createElement(as.Z,{reaction:e.reaction,className:ss.viewReaction,size:is,availableReactions:n,withIconHeart:!0}):void 0,contextActions:Z,withPortalForMenu:!0,menuBubbleClassName:ss.menuBubble},a.ZP.createElement(ns.Z,{userId:e.userId,noStatusOrTyping:!0,status:(0,_e.$M)(u,1e3*e.date),statusIcon:"message-read",withStory:!0,forceShowSelf:!0}))}))),rs=(0,a.X$)((0,s.c$)((e=>{const{appConfig:t}=e,{storyViewer:{viewModal:n}}=(0,l.jUK)(e),{storyId:a,viewsById:s,nextOffset:i,isLoading:o}=n||{},r=a?(0,l.JrV)(e,e.currentUserId,a):void 0;return{storyId:a,viewsById:s,viewersExpirePeriod:t.storyExpirePeriod+t.storyViewersExpirePeriod,story:r&&"content"in r?r:void 0,nextOffset:i,isLoading:o,availableReactions:e.availableReactions,isCurrentUserPremium:(0,l.wVz)(e)}}))((function({story:e,viewersExpirePeriod:t,viewsById:n,nextOffset:i,isLoading:r,isCurrentUserPremium:l}){const{loadStoryViews:c,closeStoryViewModal:d,clearStoryViews:m}=(0,s.Sv)(),[u,h,Z]=(0,k.Z)(!1),[P,p,v]=(0,k.Z)(!0),[g,E]=(0,a.eJ)(""),C=(0,M.Z)(),b=Boolean(e),f=Boolean(e?.date)&&e.date+t<(0,$n.bp)(),{viewsCount:y=0,reactionsCount:I=0}=e?.views||{},S=e?.isPublic&&y>o.cG4,N=I>o.sXs,w=y>o.F9Q,A=S||N||w;(0,a.d4)((()=>{b||(E(""),Z(),p())}),[b]);const R=(0,he.Z)((()=>{m({isLoading:!0})}),[],250,!0);(0,a.d4)((()=>{R()}),[u,P,g,R]);const L=(0,a.Ye)((()=>{if(n)return Object.values(n).sort(function(e){return(t,n)=>{if(e){if(t.reaction&&!n.reaction)return-1;if(!t.reaction&&n.reaction)return 1}return n.date-t.date}}(P)).map((e=>e.userId))}),[P,n]),B=L?.length?1:Math.min(y,8),F=Boolean(L?.length)&&L.length<y&&f,x=(0,T.Z)((()=>{e?.id&&void 0!==i&&c({peerId:e.peerId,storyId:e.id,offset:i,areReactionsFirst:P||void 0,areJustContacts:u||void 0,query:g})})),{handleScroll:D,isAtBeginning:O}=Wa(),U=(0,T.Z)((()=>{d()})),_=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{fluid:!0,size:"tiny",color:"translucent",className:(0,ce.Z)(!t&&"active",ss.sortButton,ss.topButton),faded:t,onClick:e,ariaLabel:C("SortBy")},a.ZP.createElement("i",{className:(0,ce.Z)("icon",P?"icon-heart-outline":"icon-recent",ss.iconSort)}),a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-down",ss.iconDown)}))),[P,C]);return a.ZP.createElement(ne.Z,{isOpen:b,onClose:U,className:"component-theme-dark",contentClassName:ss.viewsList,isSlim:!0},A&&a.ZP.createElement("div",{className:ss.header},S&&a.ZP.createElement("div",{className:ss.contactFilter},a.ZP.createElement(Y.Z,{className:(0,ce.Z)(!u&&ss.selected,ss.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:Z},C("AllViewers")),a.ZP.createElement(Y.Z,{className:(0,ce.Z)(u&&ss.selected,ss.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:h},C("Contacts"))),N&&a.ZP.createElement(ie.Z,{className:ss.sort,trigger:_,positionX:"right"},a.ZP.createElement(oe.Z,{icon:"heart-outline",onClick:p},C("SortByReactions"),P&&a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-check",ss.check),"aria-hidden":!0})),a.ZP.createElement(oe.Z,{icon:"recent",onClick:v},C("SortByTime"),!P&&a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-check",ss.check),"aria-hidden":!0}))),w&&a.ZP.createElement(ts.Z,{className:ss.search,value:g,onChange:E})),a.ZP.createElement("div",{className:(0,ce.Z)(ss.content,!O&&ss.topScrolled,"custom-scroll"),onScroll:D},f&&!r&&!g&&Boolean(!L?.length)&&a.ZP.createElement("div",{className:(0,ce.Z)(ss.info,ss.centeredInfo)},(0,te.Z)(C(l?"ServerErrorViewers":"ExpiredViewsStub"),["simple_markdown","emoji"])),!r&&Boolean(g.length)&&!L?.length&&a.ZP.createElement("div",{className:ss.info},C("Story.ViewList.EmptyTextSearch")),a.ZP.createElement(Qa.Z,{items:L,onLoadMore:x},L?.map((e=>a.ZP.createElement(os,{key:e,storyView:n[e]}))),r&&Array.from({length:B}).map(((e,t)=>a.ZP.createElement(jn.Z,{key:`placeholder-${t}`,className:"chat-item-clickable contact-list-item scroll-item small-icon",disabled:!0},a.ZP.createElement(es.Z,null)))),F&&a.ZP.createElement("div",{key:"not-all-available",className:(0,ce.Z)(ss.info,ss.bottomInfo)},C("Story.ViewList.NotFullyRecorded")))),a.ZP.createElement("div",{className:(0,ce.Z)(ss.footer,"dialog-buttons")},a.ZP.createElement(Y.Z,{className:(0,ce.Z)("confirm-dialog-button",ss.close),isText:!0,onClick:U},C("Close"))))}))),ls=(0,a.X$)((0,s.c$)((e=>{const{shouldSkipHistoryAnimations:t,storyViewer:{storyId:n,peerId:a,isPrivacyModalOpen:s,origin:i}}=(0,l.jUK)(e),o=a&&n?(0,l.JrV)(e,a,n):void 0,r=(0,l.$Yd)(e,"mediaViewerAnimations");return{isOpen:(0,l.TuN)(e),shouldSkipHistoryAnimations:t,peerId:a,storyId:n,story:o,origin:i,withAnimation:r,isPrivacyModalOpen:s}}))((function({isOpen:e,peerId:t,storyId:n,story:i,origin:r,shouldSkipHistoryAnimations:l,withAnimation:c,isPrivacyModalOpen:u}){const{closeStoryViewer:h,closeStoryPrivacyEditor:p}=(0,s.Sv)(),v=(0,M.Z)(),[g,C]=(0,a.eJ)(void 0),[b,f,y]=(0,k.Z)(!1),[I,S,N]=(0,k.Z)(!1),{bestImageData:T,thumbnail:A}=_n(i),R=Un(),L=(0,D.Z)(e),B=(0,D.Z)(T),F=(0,D.Z)(t),x=(0,D.Z)(r),U=Boolean(c&&!l);(0,a.d4)((()=>{e||(C(void 0),N(),y())}),[e]),(0,a.d4)((()=>{if(!e)return;(0,m.l_)();const t=(0,O.pP)();return()=>{(0,m.In)(),t()}}),[e]);const _=(0,a.I4)((()=>{h()}),[h]),$=(0,a.I4)((e=>{C(e),f()}),[]),j=(0,a.I4)((()=>{y(),C(void 0)}),[]);return(0,a.d4)((()=>e?(0,d.Z)((()=>{_()})):void 0),[_,e]),(0,a.d4)((()=>{U&&!L&&e&&t&&A&&void 0!==r&&((0,w.YW)(250+o.fK3),function(e,t,n,a,s){const{mediaEl:i}=An(t,e);if(!i)return;const{width:r,height:l}=E.Z.get();let{width:c,height:d}=s;const m=r<=600;if(m){c=r-2*Mn,d=l-wn-2*Mn;const e=getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom");e&&(d-=parseFloat(e))}const u=m?Mn:(r-c)/2,h=m?Mn:(l-(d+wn))/2,{top:p,left:v,width:g,height:C}=i.getBoundingClientRect(),b=v+g/2-(u+c/2),f=p+C/2-(h+d/2),y=g/c,I=C/d;(0,Z.WM)((()=>{const e=Tn(a||n,!a);(0,P.Zs)(e,{top:`${h}px`,left:`${u}px`,width:`${c}px`,height:`${d}px`,transform:`translate3d(${b}px, ${f}px, 0) scale(${y}, ${I})`});const t=document.getElementById("StoryViewer");t.appendChild(e),document.body.classList.add("ghost-animating"),(0,Z.WM)((()=>{(0,P.Zs)(e,{transform:""}),setTimeout((()=>{(0,Z.WM)((()=>{t.contains(e)&&t.removeChild(e),document.body.classList.remove("ghost-animating")}))}),200+o.fK3)}))}))}(t,r,A,T,R.activeSlide)),U&&L&&!e&&F&&B&&void 0!==x&&((0,w.YW)(250+o.fK3),function(e,t,n){const{mediaEl:a}=An(t,e),s=document.getElementById("StoryViewer").querySelector(`.${Gt} .${zt}`);if(!s||!a)return;const{top:i,left:r,width:l,height:c}=s.getBoundingClientRect(),{top:d,left:m,width:u,height:h}=a.getBoundingClientRect(),p=m+u/2-(r+l/2),v=d+h/2-(i+c/2),g=u/l,E=h/c;(0,Z.WM)((()=>{const e=Tn(n);(0,P.Zs)(e,{top:`${i}px`,left:`${r}px`,width:`${l}px`,height:`${c}px`});const t=Tn(a.src,void 0,!0),s=i+c/2-l/2;(0,P.Zs)(t,{top:`${s}px`,left:`${r}px`,width:`${l}px`,height:`${l}px`});const d=document.getElementById("StoryViewer");d.appendChild(e),document.body.appendChild(t),document.body.classList.add("ghost-animating"),(0,Z.WM)((()=>{(0,P.Zs)(e,{transform:`translate3d(${p}px, ${v}px, 0) scale(${g}, ${E})`}),(0,P.Zs)(t,{transform:`translate3d(${p}px, ${v}px, 0) scale(${g})`,opacity:"1"}),setTimeout((()=>{(0,Z.WM)((()=>{d.contains(e)&&d.removeChild(e),document.body.contains(t)&&document.body.removeChild(t),document.body.classList.remove("ghost-animating")}))}),200+o.fK3)}))}))}(F,x,B))}),[U,T,B,e,L,R.activeSlide,A,t,F,r,x]),a.ZP.createElement(q.Z,{id:"StoryViewer",className:wt,isOpen:e,shouldAnimateFirstRender:!0,noCloseTransition:l},a.ZP.createElement("div",{className:Tt,onClick:_}),a.ZP.createElement(Y.Z,{className:Lt,round:!0,size:"smaller",color:"translucent-white",ariaLabel:v("Close"),onClick:_},a.ZP.createElement("i",{className:(0,ce.Z)("icon icon-close"),"aria-hidden":!0})),a.ZP.createElement(Ka,{isOpen:e,isReportModalOpen:I,isDeleteModalOpen:b,onReport:S,onClose:_,onDelete:$}),a.ZP.createElement(Yn,{isOpen:b,story:g,onClose:j}),a.ZP.createElement(rs,null),a.ZP.createElement(zn,null),a.ZP.createElement(ra,{isOpen:u,onClose:p}),a.ZP.createElement(X.Z,{isOpen:I,onClose:N,subject:"story",peerId:t,storyId:n}))})));var cs=n(27407),ds=n(12515),ms=n(72313),us=n(97687),hs=n(34288),Zs=n(98799),Ps=n(2995);const ps=2.75*u.Gw,vs=(0,a.X$)((({isOpen:e,currentUserId:t,chatOrUserIds:n,chatsById:i,search:l,searchPlaceholder:c,className:d,loadMore:m,onSearchChange:u,onSelectChatOrUser:h,onClose:Z,onCloseAnimationEnd:P})=>{const{loadTopics:p}=(0,s.Sv)(),v=(0,M.Z)(),g=(0,a.sO)(null),E=(0,a.sO)(null),C=(0,a.sO)(null),b=(0,a.sO)(null),[f,y]=(0,cs.Z)(m,n,Boolean(l)),[I,S]=(0,a.eJ)(void 0),[k,N]=(0,a.eJ)(""),w=I?1:0,A=n.indexOf(f[0]),R=(0,T.Z)((()=>{u("")}));(0,ds.Z)(C,e&&0===w,R),(0,ds.Z)(b,e&&1===w);const[L,B]=(0,a.Ye)((()=>{const e=I?i?.[I].topics:void 0;if(!e)return[void 0,void 0];const t=k.toLowerCase(),n=e?Object.values(e).reduce(((e,n)=>(!(0,r.Qm)(i[I],n.id)||t&&!n.title.toLowerCase().includes(t)||(e[n.id]=n),e)),{}):e;return[Object.keys(n).map(Number),n]}),[i,I,k]),F=(0,T.Z)((()=>{S(void 0),N("")})),x=(0,T.Z)((e=>{u(e.currentTarget.value)})),D=(0,T.Z)((e=>{N(e.currentTarget.value)})),O=(0,ms.Z)(g,e,(e=>{if(f&&f.length>0){const t=f[-1===e?0:e],n=i?.[t];n?.isForum?(n.topics||p({chatId:t}),S(t)):h(t)}}),".ListItem-button",!0),U=(0,ms.Z)(E,e,(e=>{L?.length&&h(I,L[-1===e?0:e])}),".ListItem-button",!0),_=(0,T.Z)(((e,t)=>{const n=i?.[t];n?.isForum?(n.topics||p({chatId:t}),S(t),R()):h(t)})),$=(0,T.Z)(((e,t)=>{h(I,t)}));return a.ZP.createElement(ne.Z,{isOpen:e,className:(0,ce.Z)("ChatOrUserPicker",d),onClose:Z,onCloseAnimationEnd:P},a.ZP.createElement(K.ZP,{activeKey:w,name:"slideFade",slideClassName:"ChatOrUserPicker_slide"},(()=>1===w?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"modal-header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:v("Back"),onClick:F},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),a.ZP.createElement(us.Z,{ref:b,value:k,onChange:D,onKeyDown:U,placeholder:c})),a.ZP.createElement(Qa.Z,{ref:E,className:"picker-list custom-scroll",items:L,withAbsolutePositioning:!0,maxHeight:L?L.length*o.rSj:0,onKeyDown:U},L?L.map(((e,t)=>a.ZP.createElement(jn.Z,{key:`${I}_${e}`,className:"chat-item-clickable force-rounded-corners small-icon topic-item",style:`top: ${t*o.rSj}px;`,onClick:$,clickArg:e},a.ZP.createElement(Ps.Z,{size:ps,topic:B[e],className:"topic-icon",letterClassName:"topic-icon-letter"}),a.ZP.createElement("div",{dir:"auto",className:"fullName"},(0,te.Z)(B[e].title))))):a.ZP.createElement(hs.Z,null))):a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"modal-header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:v("Close"),onClick:Z},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement(us.Z,{ref:C,value:l,onChange:x,onKeyDown:O,placeholder:c})),f?.length?a.ZP.createElement(Qa.Z,{ref:g,className:"picker-list custom-scroll",items:f,onLoadMore:y,withAbsolutePositioning:!0,maxHeight:n.length*o.rSj,onKeyDown:O},f.map(((e,n)=>a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable force-rounded-corners small-icon",style:`height: ${o.rSj}px; top: ${(A+n)*o.rSj}px;`,onClick:_,clickArg:e},(0,r.YC)(e)?a.ZP.createElement(ns.Z,{status:e===t?v("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Zs.Z,{chatId:e}))))):f&&!f.length?a.ZP.createElement("p",{className:"no-results"},v("lng_blocked_list_not_found")):a.ZP.createElement(hs.Z,null)))))})),gs=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t,listIds:n,orderedPinnedIds:a},currentUserId:s}=e;return{chatsById:t,activeListIds:n.active,archivedListIds:n.archived,pinnedIds:a.active,contactIds:e.contactList?.userIds,currentUserId:s}}))((({isOpen:e,currentUserId:t,chatsById:n,activeListIds:i,archivedListIds:c,pinnedIds:d,contactIds:m,filter:u=o.F9z,className:h,searchPlaceholder:Z,loadMore:P,onSelectRecipient:p,onClose:v,onCloseAnimationEnd:g})=>{const E=(0,M.Z)(),[C,b]=(0,a.eJ)(""),f=(0,a.Ye)((()=>{if(!e)return;let a=d||[];t&&(a=(0,Kn.Tw)([t,...a]));const o=(0,s.Rd)(),h=o.users.byId,Z=[...i||[],...C&&c||[]].filter((e=>{const t=n[e],a=h[e];return(!a||!(0,r.NB)(a))&&t&&(0,r.Qm)(t,_._f)})),P=(0,r.ih)((0,Kn.Tw)([...(0,r.$l)(E,Z,n,C,t),...m&&u.includes("users")?(0,r.kK)(m,h,C):[]]),n,void 0,a);return(0,l.JRp)(o,P,u)}),[d,t,i,C,c,E,n,m,u,e]),y=(0,va.Z)(f,!0);return a.ZP.createElement(vs,{isOpen:e,className:h,chatOrUserIds:y,chatsById:n,searchPlaceholder:Z,search:C,onSearchChange:b,loadMore:P,onSelectChatOrUser:p,onClose:v,onCloseAnimationEnd:g})}))),Es=(0,a.X$)((0,s.c$)((e=>{const{messageIds:t,storyId:n}=(0,l.jUK)(e).forwardMessages;return{currentUserId:e.currentUserId,isManyMessages:(t?.length||0)>1,isStory:Boolean(n)}}))((({isOpen:e,currentUserId:t,isManyMessages:n,isStory:i})=>{const{setForwardChatOrTopic:o,exitForwardMode:c,forwardToSavedMessages:d,forwardStory:m,showNotification:u}=(0,s.Sv)(),h=(0,M.Z)(),Z=(0,D.Z)(i,!0),[P,p,v]=(0,k.Z)();(0,a.d4)((()=>{e&&p()}),[e,p]);const g=(0,a.I4)(((e,a)=>{const c=e===t;if(i){m({toChatId:e});const t=(0,s.Rd)();if((0,r.YC)(e))u({message:c?h("Conversation.StoryForwardTooltip.SavedMessages.One"):h("StorySharedTo",(0,r.Vl)((0,l.dyD)(t,e)))});else{const n=(0,l.Z1J)(t,e);if(!n)return;u({message:h("StorySharedTo",(0,r.U)(h,n))})}}else if(c){const e=h(n?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One");d(),u({message:e})}else o({chatId:e,topicId:a})}),[t,n,i,h]),E=(0,a.I4)((()=>{c()}),[c]);if(e||P)return a.ZP.createElement(gs,{isOpen:e,className:Z?"component-theme-dark":void 0,searchPlaceholder:h("ForwardTo"),onSelectRecipient:g,onClose:E,onCloseAnimationEnd:v})}))),Cs=(0,a.X$)((({requestedDraft:e})=>{const t=Boolean(e&&!e.chatId),{openChatWithDraft:n,resetOpenChatWithDraft:i}=(0,s.Sv)(),o=(0,M.Z)(),[r,l,c]=(0,k.Z)();(0,a.d4)((()=>{t&&l()}),[t,l]);const d=(0,a.I4)(((t,a)=>{n({chatId:t,threadId:a,text:e.text,files:e.files})}),[n,e]),m=(0,a.I4)((()=>{i()}),[i]);if(t||r)return a.ZP.createElement(gs,{isOpen:t,searchPlaceholder:o("ForwardTo"),filter:e?.filter,onSelectRecipient:d,onClose:m,onCloseAnimationEnd:c})})),bs=(0,a.X$)((({requestedAttachBotInChat:e})=>{const{cancelAttachBotInChat:t,callAttachBot:n}=(0,s.Sv)(),i=(0,M.Z)(),o=Boolean(e),[r,l,c]=(0,k.Z)();(0,a.d4)((()=>{o&&l()}),[o,l]);const{bot:d,filter:m,startParam:u}=e||{},h=(0,a.I4)((e=>{n({bot:d,chatId:e,startParam:u}),t()}),[d,n,t,u]);if(o||r)return a.ZP.createElement(gs,{isOpen:o,searchPlaceholder:i("Search"),filter:m,onSelectRecipient:h,onClose:t,onCloseAnimationEnd:c})}));var fs=n(91947);function ys(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Is=(0,a.X$)((0,s.c$)((e=>({dialogs:(0,l.jUK)(e).dialogs,currentMessageList:(0,l.Btg)(e)})))((({dialogs:e,currentMessageList:t})=>{const{dismissDialog:n,acceptInviteConfirmation:i,sendMessage:o,showNotification:r}=(0,s.Sv)(),[l,c,d]=(0,k.Z)(),m=(0,M.Z)();var u,h,Z;if((0,a.d4)((()=>{e.length>0&&c()}),[e,c]),e.length)return Boolean(e.length)&&("hash"in(u=e[e.length-1])?(e=>{const{hash:t,title:s,about:o,participantsCount:c,isChannel:u,photo:h,isRequestNeeded:Z}=e,p=m(u?"Subscribers":"Members",c,"i"),v=m(u?"ChannelJoin":"JoinGroup"),g=m(u?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement(ne.Z,{isOpen:l,onClose:d,className:"error",header:P(s,h),onCloseAnimationEnd:n},void 0!==c&&a.ZP.createElement("p",{className:"modal-help"},p),o&&a.ZP.createElement("p",{className:"modal-about"},(0,te.Z)(o,["br"])),Z&&a.ZP.createElement("p",{className:"modal-help"},m(u?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{i({hash:t}),Z&&r({message:m(u?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),d()}},Z?g:v),a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",onClick:d},m("Cancel"))))})(u):"phoneNumber"in u?(h=u,a.ZP.createElement(ne.Z,{isOpen:l,onClose:d,className:"confirm",title:m("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:n},m("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{t&&(o({contact:(0,Kn.ei)(h,["firstName","lastName","phoneNumber"]),messageList:t}),d())}},m("OK")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},m("Cancel"))))):(Z=u,a.ZP.createElement(ne.Z,{isOpen:l,onClose:d,onCloseAnimationEnd:n,className:"error",title:ys(Z)},Z.hasErrorKey?(0,fs.ZP)(Z):(0,te.Z)(Z.message,["simple_markdown","emoji","br"]),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{isText:!0,onClick:d},m("OK"))))));function P(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(yt.Z,{size:"small",photo:t,withVideo:!0}),a.ZP.createElement("div",{className:"modal-title"},(0,te.Z)(e)),a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:d},a.ZP.createElement("i",{className:"icon icon-close"})))}})));var Ss=n(96937);const ks=(0,a.X$)((0,s.c$)((e=>(0,Kn.ei)((0,l.jUK)(e),["notifications"])))((({notifications:e})=>{const{dismissNotification:t}=(0,s.Sv)();if(e.length)return a.ZP.createElement("div",{id:"Notifications"},e.map((({message:e,className:n,localId:s,action:i,actionText:o,title:r,duration:l})=>a.ZP.createElement(Ss.Z,{title:r?(0,te.Z)(r,["simple_markdown","emoji","br","links"]):void 0,action:i,actionText:o,className:n,duration:l,message:(0,te.Z)(e,["simple_markdown","emoji","br","links"]),onDismiss:()=>t({localId:s})}))))})));var Ns=n(81396);const ws=(0,a.X$)((({url:e})=>{const{toggleSafeLinkModal:t}=(0,s.Sv)(),n=(0,M.Z)(),i=(0,a.I4)((()=>{window.open((0,Ns.X)(e),"_blank","noopener"),t({url:void 0})}),[t,e]),o=(0,a.I4)((()=>{t({url:void 0})}),[t]),r=(0,va.Z)(e);return a.ZP.createElement(Xn.Z,{isOpen:Boolean(e),onClose:o,title:n("OpenUrlTitle"),textParts:(0,te.Z)(n("OpenUrlAlert2",r),["links"]),confirmLabel:n("OpenUrlTitle"),confirmHandler:i})}));var Ms=n(91489);const Ts=(0,a.X$)((({geoPoint:e,zoom:t})=>{const{closeMapModal:n}=(0,s.Sv)(),i=(0,M.Z)(),o=Boolean(e),r=(0,T.Z)((()=>{n()})),[l,c,d,m]=(0,a.Ye)((()=>{if(!e)return[];const n=(0,Ms.zY)("google",e,t),a=(0,Ms.zY)("bing",e,t),s=(0,Ms.zY)("osm",e,t);return[n,a,(0,Ms.zY)("apple",e,t),s]}),[e,t]),u=(0,T.Z)((e=>{n(),window.open(e,"_blank","noopener")})),h=(0,T.Z)((()=>{u(l)})),Z=(0,T.Z)((()=>{u(c)})),P=(0,T.Z)((()=>{u(d)})),p=(0,T.Z)((()=>{u(m)}));return a.ZP.createElement(ne.Z,{contentClassName:"pZFkNPeaXsO10mdITSZR",title:i("OpenMapWith"),isOpen:o,onClose:r,isSlim:!0},a.ZP.createElement("div",{className:"bYI0Nm410CJjgAhnH3EL"},(g.cj||g.jm)&&a.ZP.createElement(Y.Z,{fluid:!0,size:"smaller",onClick:P},"Apple Maps"),a.ZP.createElement(Y.Z,{fluid:!0,size:"smaller",onClick:h},"Google Maps"),a.ZP.createElement(Y.Z,{fluid:!0,size:"smaller",onClick:Z},"Bing Maps"),a.ZP.createElement(Y.Z,{fluid:!0,size:"smaller",onClick:p},"Open Street Maps")),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},i("Cancel"))))}));var As=n(14605);const Rs="jztdH6qO5uz3c2muOpPT",Ls=(0,a.X$)((({urlAuth:e,currentUserName:t})=>{const{closeUrlAuthModal:n,acceptBotUrlAuth:i,acceptLinkUrlAuth:o}=(0,s.Sv)(),[l,c]=(0,a.eJ)(!0),[d,m]=(0,a.eJ)(!0),u=(0,va.Z)(e,!1),{domain:h,botId:Z,shouldRequestWriteAccess:P}=u?.request||{},p=Z?(0,s.Rd)().users.byId[Z]:void 0,v=(0,M.Z)(),g=(0,a.I4)((()=>{e?.url&&l?(e.button?i:o)({isWriteAllowed:d}):window.open((0,Ns.X)(u?.url),"_blank","noopener"),n()}),[e,l,n,i,o,d,u]),E=(0,a.I4)((()=>{n()}),[n]),C=(0,a.I4)((e=>{c(e),m(e)}),[c]);return(0,a.d4)((()=>{h&&(c(!0),m(Boolean(P)))}),[P,h]),a.ZP.createElement(Xn.Z,{isOpen:Boolean(e?.url),onClose:E,title:v("OpenUrlTitle"),confirmLabel:v("OpenUrlTitle"),confirmHandler:g},(0,te.Z)(v("OpenUrlAlert2",u?.url),["links"]),h&&a.ZP.createElement(As.Z,{checked:l,label:a.ZP.createElement(a.ZP.Fragment,null,(0,te.Z)(v("Conversation.OpenBotLinkLogin",[h,t]),["simple_markdown"])),onCheck:C,className:Rs}),P&&a.ZP.createElement(As.Z,{checked:d,label:a.ZP.createElement(a.ZP.Fragment,null,(0,te.Z)(v("Conversation.OpenBotLinkAllowMessages",(0,r.Js)(p)),["simple_markdown"])),onCheck:m,disabled:!l,className:Rs}))})),Bs=1e3*o.PT8,Fs=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function xs(e,t,n,a,s){const i=new Date(e,t,n),o=a&&(0,_e.$Y)(a),r=s&&(0,_e.$Y)(s);return!!(r&&i>r)||!!(o&&i<o)}function Ds(e){return String(e).padStart(2,"0")}function Os(e,t,n){return`${e}-${t+1}-${n}`}const Us=(0,a.X$)((({selectedAt:e,minAt:t,maxAt:n,isFutureMode:s,isPastMode:i,isOpen:o,withTimePicker:r,submitButtonLabel:l,secondButtonLabel:c,onClose:d,onSubmit:m,onSecondButtonClick:u})=>{const h=(0,M.Z)(),Z=new Date,P=(0,a.Ye)((()=>s&&!t?new Date:new Date(Math.max(t||0,0))),[s,t]),p=(0,a.Ye)((()=>i&&!n?new Date:new Date(Math.min(n||Bs,Bs))),[i,n]),v=(0,a.Ye)((()=>e?new Date(e):new Date),[e]),g=(0,D.Z)(o),[E,C,b]=(0,k.Z)(!1),[f,y]=(0,a.eJ)(v),[I,S]=(0,a.eJ)(new Date(f.getFullYear(),f.getMonth(),1)),[N,w]=(0,a.eJ)(Ds(v.getHours())),[T,A]=(0,a.eJ)(Ds(v.getMinutes())),R=Os(f.getFullYear(),f.getMonth(),f.getDate()),L=I.getFullYear(),B=I.getMonth();(0,a.d4)((()=>{!g&&o&&(y(v),S(new Date(v.getFullYear(),v.getMonth(),1)),r&&(w(Ds(v.getHours())),A(Ds(v.getMinutes()))))}),[v,o,g,r]),(0,a.d4)((()=>{s&&!E&&f.getTime()<P.getTime()&&(y(P),w(Ds(P.getHours())),A(Ds(P.getMinutes())))}),[s,E,P,f]),(0,a.d4)((()=>{i&&!E&&f.getTime()>p.getTime()&&(y(p),w(Ds(p.getHours())),A(Ds(p.getMinutes())))}),[s,i,E,p,P,f]),(0,a.d4)((()=>{if(e){const t=new Date(e);y(t),w(Ds(t.getHours())),A(Ds(t.getMinutes()))}}),[e]);const F=i&&L>=Z.getFullYear()&&B>=Z.getMonth()||p&&L>=p.getFullYear()&&B>=p.getMonth(),x=s&&L<=Z.getFullYear()&&B<=Z.getMonth(),{prevMonthGrid:O,currentMonthGrid:U,nextMonthGrid:_}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],i=new Date;i.setDate(1),i.setMonth(t),i.setFullYear(e);const o=i.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<o;e++)n.push(r-o+e+1);for(;i.getMonth()===t;){const e=i.getDate();a.push(e),i.setDate(e+1)}const l=(a.length+n.length)%7;if(l>0)for(let e=1;e<=7-l;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(L,B)),[B,L]),$=(0,a.Ye)((()=>l||function(e,t){const n=(0,_e.xH)(t,e.code);return n===(0,_e.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,_e.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,_e.mr)(e,t)])}(h,f)),[h,f,l]),j=(0,a.I4)((()=>{m(f)}),[m,f]),V=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return w(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(f.getTime());a.setHours(n),y(a);const s=Ds(n);w(s),e.target.value=s}),[f]),G=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return A(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(f.getTime());a.setMinutes(n),y(a);const s=Ds(n);A(s),e.target.value=s}),[f]);return a.ZP.createElement(ne.Z,{isOpen:o,onClose:d,className:"CalendarModal",onEnter:j},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:d},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("h4",null,h(`lng_month${B+1}`)," ",L),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",disabled:x,onClick:x?void 0:function(){S((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon icon-previous"})),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",disabled:F,onClick:F?void 0:function(){S((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))}},a.ZP.createElement("i",{className:"icon icon-next"})))),a.ZP.createElement("div",{className:"calendar-wrapper"},a.ZP.createElement("div",{className:"calendar-grid"},Fs.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,h(e))))),O.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),U.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void y((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(B),n.setFullYear(L),n}));var t},className:(0,ce.Z)("day-button","div-button",xs(L,B,e,P,p)?"disabled":e?"clickable":"",R===Os(L,B,e)&&"selected")},Boolean(e)&&a.ZP.createElement("span",null,e)))),_.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),r&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:N,onChange:V,onFocus:C,onBlur:b}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:T,onChange:G,onFocus:C,onBlur:b})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(Y.Z,{onClick:j},$),c&&a.ZP.createElement(Y.Z,{onClick:u,isText:!0},c)))})),_s=(0,a.X$)((0,s.c$)((e=>({selectedAt:(0,l.jUK)(e).historyCalendarSelectedAt})))((({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:n,closeHistoryCalendar:i}=(0,s.Sv)(),o=(0,a.I4)((e=>{n({timestamp:e.valueOf()/1e3}),i()}),[i,n]),r=(0,M.Z)();return a.ZP.createElement(Us,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:i,onSubmit:o})})));var $s=n(6272);const js=(0,a.X$)((0,s.c$)(((e,{userId:t})=>({user:t?(0,l.dyD)(e,t):void 0,userStatus:t?(0,l.ssc)(e,t):void 0,phoneCodeList:e.countryList.phoneCodes})))((({isOpen:e,userId:t,isByPhoneNumber:n,user:i,userStatus:o,phoneCodeList:l})=>{const{updateContact:c,importContact:d,closeNewContactDialog:m}=(0,s.Sv)(),u=(0,M.Z)(),h=(0,va.Z)(i),Z=(0,va.Z)(n),P=(0,a.sO)(null),[p,v,E]=(0,k.Z)(),[C,b]=(0,a.eJ)(h?.firstName??""),[f,y]=(0,a.eJ)(h?.lastName??""),[I,S]=(0,a.eJ)(h?.phoneNumber??""),[N,w]=(0,a.eJ)(!0),T=Boolean(C&&(!n||I));(0,a.d4)((()=>{e&&(v(),b(h?.firstName??""),y(h?.lastName??""),S(h?.phoneNumber??""),w(!0))}),[e,v,h?.firstName,h?.lastName,h?.phoneNumber]),(0,a.d4)((()=>{!g.$b&&p&&setTimeout((()=>{P.current?.focus()}),200)}),[p]);const A=(0,a.I4)((e=>{b(e.target.value)}),[]),R=(0,a.I4)((e=>{S((0,$s.WZ)(l,e.target.value))}),[l]),L=(0,a.I4)((e=>{y(e.target.value)}),[]),B=(0,a.I4)((()=>{m(),b(""),y(""),S("")}),[m]),F=(0,a.I4)((()=>{n||!t?d({firstName:C,lastName:f,phoneNumber:I}):c({userId:t,firstName:C,lastName:f,shouldSharePhoneNumber:N})}),[C,d,n,f,I,N,c,t]);if(e||p)return a.ZP.createElement(ne.Z,{className:"NewContactModal",title:u("NewContact"),isOpen:e,onClose:B,onCloseAnimationEnd:E},h&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"NewContactModal__profile",dir:u.isRtl?"rtl":void 0},a.ZP.createElement(yt.Z,{size:"jumbo",peer:h,text:`${C} ${f}`}),a.ZP.createElement("div",{className:"NewContactModal__profile-info"},a.ZP.createElement("p",{className:"NewContactModal__phone-number"},h?.phoneNumber?(0,$s.WZ)(l,h.phoneNumber):u("MobileHidden")),a.ZP.createElement("span",{className:"NewContactModal__user-status",dir:"auto"},(0,r.Tq)(u,h,o)))),a.ZP.createElement(us.Z,{ref:P,value:C,label:u("FirstName"),tabIndex:0,onChange:A}),a.ZP.createElement(us.Z,{value:f,label:u("LastName"),tabIndex:0,onChange:L}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,te.Z)(u("NewContact.Phone.Hidden.Text",h?.firstName||""),["emoji","simple_markdown"])),a.ZP.createElement(As.Z,{checked:N,tabIndex:0,onCheck:w,label:u("lng_new_contact_share")}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,te.Z)(u("AddContact.SharedContactExceptionInfo",h?.firstName)))),Z&&a.ZP.createElement("div",{className:"NewContactModal__new-contact",dir:u.isRtl?"rtl":void 0},a.ZP.createElement(yt.Z,{size:"jumbo",text:`${C} ${f}`}),a.ZP.createElement("div",{className:"NewContactModal__new-contact-fieldset"},a.ZP.createElement(us.Z,{ref:P,value:I,inputMode:"tel",label:u("lng_contact_phone"),tabIndex:0,onChange:R}),a.ZP.createElement(us.Z,{value:C,label:u("FirstName"),tabIndex:0,onChange:A}),a.ZP.createElement(us.Z,{value:f,label:u("LastName"),tabIndex:0,onChange:L}))),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",onClick:B},u("Cancel")),a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",disabled:!T,onClick:F},u("Done"))))})));var Vs=n(75851),Gs=n(27370),Hs=n(18629),Js=n(62357);const zs=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),Xs={ok:"OK",cancel:"Cancel",close:"Close"},Ys=(0,a.X$)((0,s.c$)(((e,{webApp:t})=>{const{botId:n}=t||{},a=n?e.attachMenu.bots[n]:void 0,s=n?(0,l.dyD)(e,n):void 0,i=(0,l.jrE)(e),o=(0,l.Puy)(e),{isPaymentModalOpen:r,status:c}=(0,l.jUK)(e).payment;return{attachBot:a,bot:s,chat:i,theme:o,isPaymentModalOpen:r,paymentStatus:c}}))((({webApp:e,chat:t,bot:n,attachBot:i,theme:l,isPaymentModalOpen:c,paymentStatus:d})=>{const{closeWebApp:m,sendWebViewData:u,prolongWebView:h,toggleAttachBot:Z,openTelegramLink:P,openChat:p,setWebAppPaymentSlug:v,switchBotInline:g,sharePhoneWithBot:E}=(0,s.Sv)(),[C,b]=(0,a.eJ)(),[f,y]=(0,a.eJ)(!1),[S,N]=(0,a.eJ)(!1),[w,A]=(0,a.eJ)(),[R,L]=(0,a.eJ)(),[B,F]=(0,a.eJ)(!1),[x,O,U]=(0,k.Z)(!1),[_,$,j]=(0,k.Z)(!1),[V,H]=(0,a.eJ)(),[J,z]=(0,a.eJ)(!1),[X,q]=(0,a.eJ)(!1),{unlockPopupsAt:K,handlePopupOpened:W,handlePopupClosed:Q}=function(e,t){const[n,s]=(0,a.eJ)(0),i=(0,a.sO)(0),o=(0,a.sO)(0),r=(0,T.Z)((()=>{const e=Date.now();e-o.current>2e3&&(i.current=0),i.current+=1,i.current>=3&&s(e+2e3)})),l=(0,T.Z)((()=>{n<Date.now()&&(o.current=Date.now())}));return{unlockPopupsAt:n,handlePopupOpened:r,handlePopupClosed:l}}(),{isMobile:ee}=(0,I.ZP)();(0,a.d4)((()=>{const e=(0,Hs.BS)();A(e.bg_color),L(e.bg_color)}),[]);const te=(0,a.sO)(null),ae=(0,M.Z)(),{url:se,buttonText:re,queryId:le,replyInfo:de}=e||{},me=Boolean(se),ue=Boolean(re),{reloadFrame:he,sendEvent:Ze,sendViewport:Pe,sendTheme:pe}=((e,t,n,i,o)=>{const{showNotification:r,setWebAppPaymentSlug:l,openInvoice:c,closeWebApp:d}=(0,s.Sv)(),m=(0,a.sO)(!1),u=(0,a.sO)(),h=(0,a.sO)(!1),Z=(0,a.sO)(),P=(0,be.Z)();(0,a.d4)((()=>{if(!e.current||!t)return;const n=()=>{o?.()},a=e.current;return a.addEventListener("load",n),()=>{a.removeEventListener("load",n)}}),[o,e,t]);const p=(0,a.I4)((t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")}),[e]),v=(0,T.Z)((t=>{if(!e.current)return;const n=e.current;n.src="about:blank",n.addEventListener("load",(()=>{n.src=t}),{once:!0})})),g=(0,a.I4)((e=>{if(m.current)return p({eventType:"reload_iframe"}),void(u.current=setTimeout((()=>{v(e)}),500));v(e)}),[p]),E=(0,a.I4)((t=>{if(!e.current)return;const{width:n,height:a}=e.current.getBoundingClientRect();p({eventType:"viewport_changed",eventData:{width:n,height:a,is_expanded:!0,is_state_stable:!t}})}),[p,e]),C=(0,a.I4)((()=>{p({eventType:"theme_changed",eventData:{theme_params:(0,Hs.BS)()}})}),[p]),b=(0,a.I4)((e=>{p({eventType:"set_custom_style",eventData:e})}),[p]),f=(0,a.I4)((e=>{if(!h.current)try{const t=JSON.parse(e.data),{eventType:a,eventData:s}=t;if("web_app_ready"===a&&o?.(),"web_app_close"===a&&d(),"web_app_request_viewport"===a&&E(P.isResizing),"web_app_request_theme"===a&&C(),"iframe_ready"===a){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");b("* {\n scrollbar-width: thin;\n scrollbar-color: %SCROLLBAR_COLOR% transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: %SCROLLBAR_COLOR%;\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}".replace(/%SCROLLBAR_COLOR%/g,e)),m.current=Boolean(s.reload_supported)}if("iframe_will_reload"===a&&clearTimeout(u.current),"web_app_data_send"===a){if(!n)return;h.current=!0}if("web_app_read_text_from_clipboard"===a&&(p({eventType:"clipboard_text_received",eventData:{req_id:s.req_id,data:null}}),r({message:"Clipboard access is not supported in this client yet"})),"web_app_open_scan_qr_popup"===a&&r({message:"Scanning QR code is not supported in this client yet"}),"web_app_open_invoice"===a&&(l({slug:s.slug}),c({slug:s.slug})),"web_app_open_link"===a){const e=s.url;window.open(e,"_blank","noreferrer")}i(t)}catch(e){}}),[n,p,i,b,C,E,o,P.isResizing]);return(0,a.d4)((()=>{const{width:e,height:t,isResizing:n}=P;Z.current&&Z.current.width===e&&Z.current.height===t&&!Z.current.isResizing||(Z.current={width:e,height:t,isResizing:n},E(n))}),[E,P]),(0,a.d4)((()=>(window.addEventListener("message",f),()=>window.removeEventListener("message",f))),[f]),(0,a.d4)((()=>{t&&e.current?.contentWindow?(E(),h.current=!1):Z.current=void 0}),[t,E,e]),{sendEvent:p,reloadFrame:g,sendViewport:E,sendTheme:C}})(te,me,ue,(function(e){const{eventType:t,eventData:a}=e;if("web_app_open_tg_link"===t&&!c){const e=o.zHP+a.path_full;P({url:e}),m()}if("web_app_setup_back_button"===t&&y(a.is_visible),"web_app_setup_settings_button"===t&&N(a.is_visible),"web_app_set_background_color"===t){const e=(0,Hs.BS)(),t=(0,Hs.Uq)(a.color)?a.color:e.bg_color;A(t)}if("web_app_set_header_color"===t){if(a.color_key){const e=(0,Hs.BS)()[a.color_key],t=(0,Hs.Uq)(e)?e:R;L(t)}if(a.color){const e=(0,Hs.Uq)(a.color)?a.color:R;L(e)}}if("web_app_data_send"===t&&(m(),u({bot:n,buttonText:re,data:a.data})),"web_app_setup_main_button"===t){const e=(0,Hs.BS)(),t=(0,Hs.Uq)(a.color)?a.color:e.button_color,n=(0,Hs.Uq)(a.text_color)?a.text_color:e.text_color;b({isVisible:a.is_visible&&Boolean(a.text?.trim().length),isActive:a.is_active,text:a.text||"",color:t,textColor:n,isProgressVisible:a.is_progress_visible})}if("web_app_setup_closing_behavior"===t&&F(a.need_confirmation),"web_app_open_popup"===t){if(V||!a.message.trim().length||!a.buttons?.length||a.buttons.length>3||J||X||K>Date.now())return void ye(void 0);H(a),W()}if("web_app_switch_inline_query"===t){const e=a.chat_types?.map(r.uF).filter(Boolean),t=!e?.length;g({botId:n.id,query:a.query,filter:e,isSamePeer:t}),m()}if("web_app_request_phone"===t){if(V||X||K>Date.now())return void Ne();z(!0),W()}if("web_app_request_write_access"===t){if(V||J||K>Date.now())return void Te();!async function(){const e=await(0,He.t9)("fetchBotCanSendMessage",{bot:n});e&&Ze({eventType:"write_access_requested",eventData:{status:"allowed"}}),q(!e)}(),W()}if("web_app_invoke_custom_method"===t){const{method:e,params:t,req_id:s}=a;!async function(e,t,a){const s=await(0,He.t9)("invokeWebViewCustomMethod",{bot:n,customMethod:t,parameters:a});Ze({eventType:"custom_method_invoked",eventData:{req_id:e,...s}})}(s,e,JSON.stringify(t))}}),$),ve=C?.isVisible&&C.text.trim().length>0;(0,Js.Z)((()=>{h({botId:n.id,queryId:le,peerId:t.id,replyInfo:de})}),le?45e3:void 0,!0);const ge=(0,T.Z)((()=>{Ze({eventType:"main_button_pressed"})})),Ee=(0,T.Z)((()=>{Ze({eventType:"settings_button_pressed"})})),Ce=(0,T.Z)((()=>{he(e.url)})),fe=(0,T.Z)((()=>{B?O():m()})),ye=(0,T.Z)((e=>{H(void 0),Q(),Ze({eventType:"popup_closed",eventData:{button_id:e}})})),Ie=(0,T.Z)((()=>{ye()}));(0,G.Z)((()=>{setTimeout((()=>{Pe()}),400)}),[C?.isVisible,Pe]),(0,G.Z)((()=>{setTimeout((()=>{pe()}),400)}),[l,pe]),(0,G.Z)((([t])=>{c!==t&&e?.slug&&!c&&d&&(Ze({eventType:"invoice_closed",eventData:{slug:e.slug,status:d}}),v({slug:void 0}))}),[c,d,Ze,v,e]);const Se=(0,T.Z)((()=>{Z({botId:n.id,isEnabled:!i})})),ke=(0,T.Z)((()=>{f?Ze({eventType:"back_button_pressed"}):fe()})),Ne=(0,T.Z)((()=>{z(!1),Q(),Ze({eventType:"phone_requested",eventData:{status:"cancelled"}})})),Me=(0,T.Z)((()=>{E({botId:n.id}),z(!1),Q(),Ze({eventType:"phone_requested",eventData:{status:"sent"}})})),Te=(0,T.Z)((()=>{Ze({eventType:"write_access_requested",eventData:{status:"cancelled"}}),q(!1),Q()})),Ae=(0,T.Z)((async()=>{await(0,He.t9)("allowBotSendMessages",{bot:n})?(Ze({eventType:"write_access_requested",eventData:{status:"allowed"}}),q(!1),Q()):Te()})),Re=(0,T.Z)((()=>{p({id:n.id}),m()}));(0,a.d4)((()=>{if(!me){const e=(0,Hs.BS)();F(!1),U(),H(void 0),z(!1),q(!1),b(void 0),y(!1),N(!1),A(e.bg_color),L(e.bg_color),j()}}),[U,me,j]);const Le=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{round:!0,ripple:!ee,size:"smaller",color:"translucent",className:(0,ce.Z)("_VJv8UKGVoUJKFRjrn8B",t&&"active"),onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon icon-more"}))),[ee]),Be=(0,ce.Z)("l4SsaN4Dx0bKGb83CYhA",f&&"jscxQ3PMmXnE2oWrMVBY"),Fe=(0,a.Ye)((()=>{if(!R)return;const{r:e,g:t,b:n}=(0,Gs.oo)(R),a=(0,Vs.rZ)([e,t,n]);return("dark"===l?255-a:a)>128?"color-text":"color-background"}),[R,l]),xe=(0,D.Z)(C?.color,!0),De=(0,D.Z)(C?.textColor,!0),Oe=(0,D.Z)(C&&Boolean(C.isActive),!0),Ue=(0,D.Z)(C?.text,!0),_e=C?.color||xe,$e=C?.textColor||De,je=void 0!==C?.isActive?C.isActive:Oe,Ve=C?.text||Ue,[Ge,Je]=(0,a.eJ)(!1),[ze,Xe]=(0,a.eJ)(!0),Ye=(0,a.sO)();return(0,a.d4)((()=>{Ye.current&&clearTimeout(Ye.current),ve?(Xe(!1),Ye.current=setTimeout((()=>{Je(!0)}),250)):(Je(!1),Ye.current=setTimeout((()=>{Xe(!0)}),250))}),[Je,ve]),a.ZP.createElement(ne.Z,{className:"CWJDTp88gsPYaq6de8yn",isOpen:me,onClose:fe,header:a.ZP.createElement("div",{className:"modal-header",style:(0,la.Z)(R&&`background-color: ${R}`,Fe&&`--color-header-text: var(--${Fe})`)},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:ae(f?"Back":"Close"),onClick:ke},a.ZP.createElement("div",{className:Be})),a.ZP.createElement("div",{className:"modal-title"},n?.firstName),a.ZP.createElement(ie.Z,{className:"web-app-more-menu with-menu-transitions",trigger:Le,positionX:"right"},t&&n&&t.id!==n.id&&a.ZP.createElement(oe.Z,{icon:"bots",onClick:Re},ae("BotWebViewOpenBot")),a.ZP.createElement(oe.Z,{icon:"reload",onClick:Ce},ae("WebApp.ReloadPage")),S&&a.ZP.createElement(oe.Z,{icon:"settings",onClick:Ee},ae("Settings")),n?.isAttachBot&&a.ZP.createElement(oe.Z,{icon:i?"stop":"install",onClick:Se,destructive:Boolean(i)},ae(i?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")))),style:`background-color: ${w}`},a.ZP.createElement(we.Z,{className:(0,ce.Z)("ElvN45roGsPDzZuJjk3H",_&&"L441lq9G5_x3lNeWNFlB")}),me&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("iframe",{className:(0,ce.Z)("uFAepVSf6dgEREGs6Kio",Ge&&"ruOZRuUOenMeQp5WIpy0"),src:se,title:`${n?.firstName} Web App`,sandbox:zs,allow:"camera; microphone; geolocation;",allowFullScreen:!0,ref:te}),a.ZP.createElement(Y.Z,{className:(0,ce.Z)("QoAHIcQHa0NNmR8fma3w",ve&&"OViz2KN7MjYjs1f5Z3JN",ze&&"IEfxtMw7c1U4BRBpulWm"),style:`background-color: ${_e}; color: ${$e}`,disabled:!je,onClick:ge},Ve,C?.isProgressVisible&&a.ZP.createElement(we.Z,{className:"e4f56fQ8AjPxn8H1Avdv",color:"white"}))),a.ZP.createElement(Xn.Z,{isOpen:J,onClose:Ne,title:ae("ShareYouPhoneNumberTitle"),text:ae("AreYouSureShareMyContactInfoBot"),confirmHandler:Me,confirmLabel:ae("ContactShare")}),a.ZP.createElement(Xn.Z,{isOpen:X,onClose:Te,title:ae("lng_bot_allow_write_title"),text:ae("lng_bot_allow_write"),confirmHandler:Ae,confirmLabel:ae("lng_bot_allow_write_confirm")}),V&&a.ZP.createElement(ne.Z,{isOpen:Boolean(V),title:V.title||" ",onClose:Ie,hasCloseButton:!0,className:(0,ce.Z)("afCqZ6iSD2Iw6bKyAKO1",!V.title?.trim().length&&"GuFs2OL_xXL5ODh10kTj")},V.message,a.ZP.createElement("div",{className:"dialog-buttons mt-2"},V.buttons.map((e=>a.ZP.createElement(Y.Z,{key:e.id||e.type,className:"confirm-dialog-button",color:"destructive"===e.type?"danger":"primary",isText:!0,size:"smaller",onClick:()=>ye(e.id)},e.text||ae(Xs[e.type])))))),a.ZP.createElement(Xn.Z,{isOpen:x,onClose:U,title:ae("lng_bot_close_warning_title"),text:ae("lng_bot_close_warning"),confirmHandler:m,confirmIsDestructive:!0,confirmLabel:ae("lng_bot_close_warning_sure")}))}))),qs=(0,a.X$)((({bot:e,type:t,shouldRequestWriteAccess:n})=>{const{cancelBotTrustRequest:i,markBotTrusted:o}=(0,s.Sv)(),[l,c]=(0,a.eJ)(n||!1),d=(0,M.Z)(),m=(0,a.I4)((()=>{o({botId:e.id,isWriteAllowed:l})}),[o,l,e]),u=(0,a.I4)((()=>{i()}),[]),h=d("game"===t?"AppName":"BotOpenPageTitle"),Z=(0,a.Ye)((()=>{switch(t){case"game":return d("BotPermissionGameAlert",(0,r.Js)(e));case"webApp":return d("BotOpenPageMessage",(0,r.Js)(e));default:return d("BotWebViewStartPermission")}}),[e,t,d]);return a.ZP.createElement(Xn.Z,{isOpen:Boolean(e),onClose:u,title:h,confirmHandler:m},(0,te.Z)(Z,["simple_markdown"]),n&&a.ZP.createElement(As.Z,{className:"dialog-checkbox",checked:l,label:(0,te.Z)(d("WebApp.AddToAttachmentAllowMessages",e?.firstName),["simple_markdown"]),onCheck:c}))})),Ks=(0,a.X$)((({bot:e})=>{const{confirmAttachBotInstall:t,cancelAttachBotInstall:n}=(0,s.Sv)(),[i,r]=(0,a.eJ)(!1),l=(0,M.Z)(),c=(0,a.I4)((()=>{t({isWriteAllowed:Boolean(e?.shouldRequestWriteAccess)})}),[t,e]);(0,a.d4)((()=>{e&&r(!1)}),[e]);const d=(0,a.Ye)((()=>{const e=l("lng_mini_apps_disclaimer_button").split("{link}"),t=l("lng_mini_apps_disclaimer_link");return[e[0],a.ZP.createElement("a",{href:o._NT,target:"_blank",rel:"noopener noreferrer"},t),e[1]]}),[l]);return a.ZP.createElement(Xn.Z,{isOpen:Boolean(e),onClose:n,title:l("lng_mini_apps_disclaimer_title"),confirmHandler:c,isConfirmDisabled:!i},(0,te.Z)(l("lng_mini_apps_disclaimer_text",e?.shortName),["simple_markdown"]),a.ZP.createElement(As.Z,{className:"dialog-checkbox",checked:i,label:d,onCheck:r}),e?.isInactive&&e.isForSideMenu&&(0,te.Z)(l("WebBot.Account.Desclaimer.Desc",e?.shortName),["simple_markdown"]))})),Ws=(0,a.X$)((({folder:e})=>{const{closeDeleteChatFolderModal:t,deleteChatFolder:n,openDeleteChatFolderModal:i}=(0,s.Sv)(),o=(0,M.Z)(),r=Boolean(e),l=(0,D.Z)(e)||e,c=l?.hasMyInvites,d=(0,a.I4)((()=>{t(),c?i({folderId:l.id,isConfirmedForChatlist:!0}):n({id:l.id})}),[c,l]);return a.ZP.createElement(Xn.Z,{isOpen:r,onClose:t,text:o(c?"FilterDeleteAlertLinks":"FilterDeleteAlert"),confirmLabel:o("Delete"),confirmHandler:d,confirmIsDestructive:!0})}));var Qs=n(9211),ei=n(9937),ti=n(96459);const ni={root:"PEnE7xWTMwTPGmhubmj6",text:"U4UYSH7uHW3k4FlqBefm",header:"Jdlm3dtJ8gOIY0x0u2d4",description:"cE44My72bdvMJna9mgoc",icon:"mxF3NdPgAi_H0ZFgNEtw","font-icon":"r6_o8xZKIo11QFFYm2Hv",fontIcon:"r6_o8xZKIo11QFFYm2Hv"},ai=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"].map(Gs.oo),si=(0,a.X$)((({icon:e,isFontIcon:t,title:n,text:s,index:i,count:o,onClick:r})=>{const l=i/o*ai.length,c=ai[Math.floor(l)],d=ai[Math.ceil(l)]??c,{r:m,g:u,b:h}=(0,Gs.qj)(c,d,.5);return a.ZP.createElement(jn.Z,{buttonClassName:ni.root,onClick:r,inactive:!r},t?a.ZP.createElement("i",{className:(0,ce.Z)(ni.fontIcon,`icon icon-${e}`),"aria-hidden":!0,style:`--item-color: rgb(${m},${u},${h})`}):a.ZP.createElement("img",{src:e,className:ni.icon,alt:"",style:`--item-color: rgb(${m},${u},${h})`,draggable:!1}),a.ZP.createElement("div",{className:ni.text},a.ZP.createElement("div",{className:ni.title},(0,te.Z)(n,["br"])),a.ZP.createElement("div",{className:ni.description},s)))}));var ii=n(8582);const oi="_rzXza87NHdAMH2TDKul",ri="qd3rvhZma3JJmhdt07Ig",li=(0,a.X$)((({length:e,active:t,onSelectSlide:n})=>{const s=Math.max(0,Math.min(e-8,t-4)),i=s===e-8-1,o=s===e-8,r=0===s,l=1===s,c=Math.min(e,8),d=(0,a.I4)((()=>{n(t+1)}),[t,n]),m=(0,a.I4)((()=>{n(t-1)}),[t,n]),u=Math.min(8,e);return a.ZP.createElement("div",null,!g.$b&&a.ZP.createElement(Y.Z,{className:(0,ce.Z)(oi,0===t&&ri),color:"translucent",disabled:0===t,round:!0,onClick:m},a.ZP.createElement("i",{className:"icon icon-previous"})),a.ZP.createElement("div",{className:"NtJc4bt94t9fklIWC6wF",style:`--start-from: ${s}; --length: ${e}; --count: ${u};`},Array(e).fill(void 0).map(((e,d)=>{const m=d,u=d===s+c-1&&!o&&!i,h=d===s+c-2&&!i&&!o||d===s+c-1&&i,Z=d===s&&!r&&!l,P=d===s+1&&!r&&!l||d===s&&l,p=d<s||d>=s+c;return a.ZP.createElement("div",{onClick:()=>n(d),className:(0,ce.Z)("eCgEFkp07vgaUGwymYAQ",m===t&&"nlCmVncFkKVtsawWqcfw",(h||P)&&"AIpVWjJc47egZ8ATaC3n",(u||Z)&&"MnRKztu0OZTyIywGLMc6",p&&"boSFbatyzatdw70J7mpu")})}))),!g.$b&&a.ZP.createElement(Y.Z,{className:(0,ce.Z)(oi,t===e-1&&ri,"J4UYbae0Frt01jIavpB0"),color:"translucent",round:!0,disabled:t===e-1,onClick:d},a.ZP.createElement("i",{className:"icon icon-next"})))})),ci="slESyAvUqizX4_EIX_yg",di=(0,a.X$)((({leftValue:e,rightValue:t,className:n,floatingBadgeIcon:s,rightStyle:i})=>{const o=(0,M.Z)();return a.ZP.createElement("div",{className:(0,ce.Z)("qiAkShre9E6R3S_XXL9S",n)},s&&a.ZP.createElement("div",{className:"gIcOQgrfw3soP3cK9s5Q"},a.ZP.createElement("i",{className:(0,ce.Z)("y7T3FpaFXDsnPGk6dPmg",`icon-${s}`,"icon")}),a.ZP.createElement("div",{className:"rQ6ZdKdWi4HVydX6qhWS",dir:o.isRtl?"rtl":void 0},e),a.ZP.createElement("div",{className:"Ip5PkcvyMOnN0RLpXLXO"},a.ZP.createElement("svg",{width:"26",height:"9",viewBox:"0 0 26 9",fill:"none"},a.ZP.createElement("path",{d:"M0 0H26H24.4853C22.894 0 21.3679 0.632141 20.2426 1.75736L14.4142 7.58579C13.6332 8.36684 12.3668 8.36683 11.5858 7.58579L5.75736 1.75736C4.63214 0.632139 3.10602 0 1.51472 0H0Z",fill:"#7E85FF"})))),a.ZP.createElement("div",{className:(0,ce.Z)(ci,"lQi3xqxjvl2Owb4ES2SM")},a.ZP.createElement("div",{className:"kuq7sjJF6mvCc4Y5CXpv X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR",dir:o.isRtl?"rtl":void 0},o("LimitFree")),!s&&a.ZP.createElement("div",{className:"FaVxkFCcMpBfLY74WJZv X0zFAEpRoPWj1yE904xR"},e)),a.ZP.createElement("div",{className:(0,ce.Z)(ci,"Dcv5uphsn2Sxpg3ROS_u"),style:i},a.ZP.createElement("div",{className:"QWqqObtxZyakBzakEoyh X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR",dir:o.isRtl?"rtl":void 0},o("LimitPremium")),a.ZP.createElement("div",{className:"TCdcdr_TxlgpCSBV0ePq X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR"},t)))})),mi=[91,160,255],ui=[197,100,243],hi=(0,a.X$)((({title:e,description:t,leftValue:n,rightValue:s,colorStepProgress:i})=>{const o=(0,a.Ye)((()=>mi.map(((e,t)=>(0,me.t7)(e,ui[t],i)))),[i]);return a.ZP.createElement("div",{className:"jeeOV_UYyl50GFLOzjGC"},a.ZP.createElement("div",{className:"SVqE3gr2ekQUWfFT_Mvg"},e),a.ZP.createElement("div",{className:"mCBNPstzrSlOQsz6rOtE"},t),a.ZP.createElement(di,{leftValue:n,rightValue:s,rightStyle:`background: rgb(${o.join(",")})`}))}));var Zi=n(3570),Pi=n(97799);const pi=({size:e,realIndex:t,canPlay:n,sticker:s,index:i,maxLength:o,onClick:r,onEnded:l})=>{const c=(0,H.Z)(`sticker${s.id}`),d=(0,H.Z)(`sticker${s.id}?size=f`),m=0===i,[u,h,Z]=(0,k.Z)(m),P=e-.6*e,p=3*P,v=3.2*P,g=i/o*(2*Math.PI),E=m?1:.66,C=Math.cos(g)*p-2.8*P,b=Math.sin(g)*v,f=(0,T.Z)((()=>{r(t)})),y=(0,T.Z)((()=>{Z(),l(t)}));return(0,a.d4)((()=>{m&&h()}),[m,h]),a.ZP.createElement(a.ZP.Fragment,null,m&&a.ZP.createElement(Pi.Z,{className:"JLzWnq8to4W24wBGmbyt PIYKt4xxOUBpRjRu0b4q",tgsUrl:d,play:n,isLowPriority:!0,noLoop:!0,size:.8*e,style:`--x: calc(${C}px - 10%); --y: ${b}px;`}),a.ZP.createElement(Pi.Z,{className:"PIYKt4xxOUBpRjRu0b4q",tgsUrl:c,play:n&&u,noLoop:!0,size:.6*e,style:`--x: ${C}px; --y: ${b}px; --opacity: ${E}`,onClick:f,onEnded:y}))},vi=(0,a.X$)((0,s.c$)((e=>({stickers:e.stickers.premium.stickers})))((({stickers:e,isActive:t})=>{const n=(0,a.sO)(null),[s,i]=(0,a.eJ)(0),[o,r]=(0,a.eJ)(0),l=e?.slice(0,15),c=(0,T.Z)((e=>{i(-e)})),d=(0,T.Z)((e=>{0===(0,Zi.Z)(l.length,e+s)&&setTimeout((()=>{i((e=>(0,Zi.Z)(l.length,e+1)))}),150)}));return(0,a.d4)((()=>{const e=n.current;e&&r(e.closest(".modal-dialog").clientWidth)}),[]),a.ZP.createElement("div",{className:"dVn5gk50tXn1EiI4kJFJ",ref:n},Boolean(o)&&l?.map(((e,n)=>a.ZP.createElement(pi,{size:o,sticker:e,realIndex:n,index:(n+s+l.length)%l.length,maxLength:l.length,onClick:c,onEnded:d,canPlay:t}))))})));var gi=n(99585);const Ei={stories_order:"PremiumStoriesPriority",stories_stealth:"PremiumStoriesStealth",stories_views:"PremiumStoriesViews",stories_timer:"lng_premium_stories_subtitle_expiration",stories_save:"PremiumStoriesSaveToGallery",stories_caption:"lng_premium_stories_subtitle_caption",stories_link:"lng_premium_stories_subtitle_links"},Ci={stories_order:"PremiumStoriesPriorityDescription",stories_stealth:"PremiumStoriesStealthDescription",stories_views:"PremiumStoriesViewsDescription",stories_timer:"PremiumStoriesExpirationDescription",stories_save:"PremiumStoriesSaveToGalleryDescription",stories_caption:"PremiumStoriesCaptionDescription",stories_link:"PremiumStoriesFormattingDescription"},bi={stories_order:"story-priority",stories_stealth:"eye-closed-outline",stories_views:"eye-outline",stories_timer:"timer",stories_save:"arrow-down-circle",stories_caption:"story-caption",stories_link:"link-badge"},fi=Object.keys(Ei),yi=5.25*g.cL*u.Gw,Ii=(0,a.X$)((0,s.c$)((e=>({currentUser:(0,l.dyD)(e,e.currentUserId)})))((({currentUser:e})=>{const t=(0,a.sO)(null),n=(0,M.Z)();(0,a.bt)((()=>{t.current&&(0,gi.T)({canvas:t.current,size:yi,segmentsCount:8,color:"purple",readSegmentsCount:0,readSegmentColor:"transparent"})}),[]);const{handleScroll:s,isAtBeginning:i}=Wa(),o=yi/g.cL;return a.ZP.createElement("div",{className:"dfgGrPUU6AC7NazJh8Ut"},a.ZP.createElement("div",{className:"Y9bbyTXeZIKzoa8wtnkn"},a.ZP.createElement(yt.Z,{forPremiumPromo:!0,peer:e,size:"giant"}),a.ZP.createElement("canvas",{className:"eTSbeIbZl_YRbAPcqHhQ",ref:t,style:`max-width: ${o}px; max-height: ${o}px`})),a.ZP.createElement("div",{className:"me5CfUvQ6RleMxtFjIaR"},n("UpgradedStories")),a.ZP.createElement("div",{className:(0,ce.Z)("ssjliTyWlTUXFLdz5NJd",!i&&"T0nWA26c2Q0j0Z_PpexK","custom-scroll"),onScroll:s},fi.map(((e,t)=>a.ZP.createElement(si,{key:e,title:n(Ei[e]),text:n(Ci[e]),icon:bi[e],isFontIcon:!0,index:t,count:fi.length}))),a.ZP.createElement("div",{className:"ckFVT8AXlwgCejTXWdfQ"},n("lng_premium_stories_about_mobile"))))}))),Si={root:"WHiQiGCtWfjSlEysEelB",wrapper:"WUpKHfqLbeZmhfYqqiko",down:"MiGmL4xqBPkxmLim4Ai0",frame:"xuhT9JHpFkVsTcUWeh4L",video:"sLLJqCkdSug4bzEQrACs"},ki=n.p+"DeviceFrame.79271ee0fa60a7b6a1aa.svg",Ni=(0,a.X$)((({videoId:e,isReverseAnimation:t,isDown:n,videoThumbnail:s,index:i,isActive:o})=>{const r=(0,H.Z)(`document${e}`),l=(0,fa.Z)(s.dataUri),c=(0,ya.Z)(r);return a.ZP.createElement("div",{className:Si.root},a.ZP.createElement("div",{className:(0,ce.Z)(Si.wrapper,t&&Si.reverse,n&&Si.down),id:`premium_feature_preview_video_${i}`},a.ZP.createElement("img",{src:ki,alt:"",className:Si.frame,draggable:!1}),a.ZP.createElement("canvas",{ref:l,className:Si.video}),a.ZP.createElement(wa.Z,{canPlay:o,className:(0,ce.Z)(Si.video,c),src:r,disablePictureInPicture:!0,playsInline:!0,muted:!0,loop:!0})))})),wi="fEQZ2fyO9g6L1v8QJUCJ",Mi="xkC9BFxv7RkSwbPe4RMb",Ti="eEYA2lXPy_DUKe8JKHiP",Ai="TVO7LjkV_yHUGIu5PXCA",Ri={double_limits:"PremiumPreviewLimits",infinite_reactions:"PremiumPreviewReactions2",premium_stickers:"PremiumPreviewStickers",animated_emoji:"PremiumPreviewEmoji",no_ads:"PremiumPreviewNoAds",voice_to_text:"PremiumPreviewVoiceToText",profile_badge:"PremiumPreviewProfileBadge",faster_download:"PremiumPreviewDownloadSpeed",more_upload:"PremiumPreviewUploads",advanced_chat_management:"PremiumPreviewAdvancedChatManagement",animated_userpics:"PremiumPreviewAnimatedProfiles",emoji_status:"PremiumPreviewEmojiStatus",translations:"PremiumPreviewTranslations",stories:"PremiumPreviewStories"},Li={double_limits:"PremiumPreviewLimitsDescription",infinite_reactions:"PremiumPreviewReactions2Description",premium_stickers:"PremiumPreviewStickersDescription",no_ads:"PremiumPreviewNoAdsDescription",animated_emoji:"PremiumPreviewEmojiDescription",voice_to_text:"PremiumPreviewVoiceToTextDescription",profile_badge:"PremiumPreviewProfileBadgeDescription",faster_download:"PremiumPreviewDownloadSpeedDescription",more_upload:"PremiumPreviewUploadsDescription",advanced_chat_management:"PremiumPreviewAdvancedChatManagementDescription",animated_userpics:"PremiumPreviewAnimatedProfilesDescription",emoji_status:"PremiumPreviewEmojiStatusDescription",translations:"PremiumPreviewTranslationsDescription",stories:"PremiumPreviewStoriesDescription"},Bi=["stories","double_limits","more_upload","faster_download","voice_to_text","no_ads","infinite_reactions","premium_stickers","animated_emoji","advanced_chat_management","profile_badge","animated_userpics","emoji_status","translations"],Fi=["faster_download","voice_to_text","advanced_chat_management","infinite_reactions","profile_badge","animated_userpics","emoji_status","translations"],xi=["channels","dialogFolderPinned","channelsPublic","savedGifs","stickersFaved","aboutLength","captionLength","dialogFilters","dialogFiltersChats"],Di={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle"},Oi={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle"},Ui=(0,a.X$)((({promo:e,initialSection:t,isPremium:n,limits:s,premiumPromoOrder:i,onBack:o,onClickSubscribe:r})=>{const l=(0,M.Z)(),c=(0,a.sO)(null),[d,m]=(0,a.eJ)(Bi.indexOf(t)),[u,h]=(0,a.eJ)(0),[Z,P,p]=(0,k.Z)(),[v,g]=(0,a.eJ)(!0),[E,C]=(0,a.eJ)(!1),b=(0,D.Z)(t),f=(0,a.Ye)((()=>i?i.filter((e=>Bi.includes(e))):Bi),[i]);function y(e){const{scrollTop:t,clientHeight:n,scrollHeight:a}=e.currentTarget;g(t<=20),C(t>=a-n-20)}(0,a.d4)((()=>{const e=c.current;if(!e||b===t)return;const n=f.indexOf(t);m(n),P(),(0,ii.Z)(e,e.clientWidth*n,0).then(p)}),[d,f,t,b]);const I=(0,a.I4)((async e=>{const t=c.current;t&&(m(e),P(),await(0,ii.Z)(t,t.clientWidth*e,800),p())}),[]),S=e.options.find((e=>1===e.months));return a.ZP.createElement("div",{className:"QfngIllOc1THaTQiJf7h"},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",className:(0,ce.Z)("ZTIpWD6Zrj1U7rnGvrlD",0!==d&&"E42Dy7DFLAxvj8HE4GAD"),color:0===d?"translucent":"translucent-white",onClick:o,ariaLabel:l("Back")},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),a.ZP.createElement("div",{className:"EXGFQjwHmQxjvMLbYtS9"}),a.ZP.createElement("div",{className:(0,ce.Z)("JMdhJYW94Mas4JDye486","no-scrollbar"),onScroll:function(e){const{clientWidth:t,scrollLeft:n}=e.currentTarget,a=Math.round(n),s=a%t/t;e.currentTarget.style.setProperty("--scroll-progress",s.toString()),e.currentTarget.style.setProperty("--abs-scroll-progress",Math.abs(s).toString());const i=Math.ceil((a+1)/t);h(i);const o=e.currentTarget.querySelector("#premium_feature_preview_video_"+(i-1)),r=e.currentTarget.querySelector(`#premium_feature_preview_video_${i}`);if(o?.classList.toggle("reverse",!1),r?.classList.toggle("reverse",!0),Z)return;const l=Math.round(a/t);m(l)},ref:c},f.map(((t,n)=>{if("double_limits"===t)return a.ZP.createElement("div",{className:(0,ce.Z)(Mi,"zngeFAwxdlVJZY876fHc")},a.ZP.createElement("h2",{className:(0,ce.Z)("Mw81cOCIGy8KGn9VokFA",v&&"tRvcw256KSHRqgSj5uGX")},l(Ri.double_limits)),a.ZP.createElement("div",{className:(0,ce.Z)("le7Qv9QkHlO3qdK0Hs_g","custom-scroll"),onScroll:y},xi.map(((e,t)=>{const n=s?.[e][0].toString(),i=s?.[e][1].toString();return a.ZP.createElement(hi,{title:l(Di[e]),description:l(Oi[e],i),leftValue:n,rightValue:i,colorStepProgress:t/(xi.length-1)})}))));if("premium_stickers"===t)return a.ZP.createElement("div",{className:Mi},a.ZP.createElement("div",{className:wi},a.ZP.createElement(vi,{isActive:d===n})),a.ZP.createElement("h1",{className:Ti},l(Ri.premium_stickers)),a.ZP.createElement("div",{className:Ai},(0,te.Z)(l(Li.premium_stickers),["br"])));if("stories"===t)return a.ZP.createElement("div",{className:(0,ce.Z)(Mi,"uOZMPO0FyBVTsM6ACXDw")},a.ZP.createElement(Ii,null));const i=e.videoSections.indexOf(t);return-1!==i?a.ZP.createElement("div",{className:Mi},a.ZP.createElement("div",{className:wi},a.ZP.createElement(Ni,{isActive:d===n,videoId:e.videos[i].id,videoThumbnail:e.videos[i].thumbnail,isDown:Fi.includes(t),index:n,isReverseAnimation:n===u})),a.ZP.createElement("h1",{className:Ti},l(Ri[e.videoSections[i]])),a.ZP.createElement("div",{className:Ai},(0,te.Z)(l(Li[e.videoSections[i]]),["br"]))):void 0}))),a.ZP.createElement("div",{className:(0,ce.Z)("EKr_FVmiDSwhUxouhaqB",(E||0!==d)&&"H8z5Q6gsuqeCy82HFlyX")},a.ZP.createElement(li,{length:Bi.length,active:d,onSelectSlide:I}),a.ZP.createElement(Y.Z,{className:(0,ce.Z)("n8tTb600de2uZKGkyw67"),isShiny:!n,withPremiumGradient:!n,onClick:n?o:function(){r(t)}},n?l("OK"):l("SubscribeToPremium",(0,ei.x)(Number(S.amount),S.currency,l.code)))))})),_i="yVkdTScCEhH3EQMQiA42",$i=n.p+"PremiumAds.a758f19ece91fe91318e.svg",ji=n.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",Vi=n.p+"PremiumChats.89d9d315638e283ca895.svg",Gi=n.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",Hi=n.p+"PremiumFile.884dd3865acfe594fc61.svg",Ji=n.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",zi=n.p+"PremiumLogo.a5c0e88cd478f4d76d82.svg",Xi=n.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",Yi=n.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",qi=n.p+"PremiumStatus.c42f9c4b68f9c2c4537a.svg",Ki=n.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",Wi=n.p+"PremiumTranslate.cb2dcbb898d96cb35469.svg",Qi=n.p+"PremiumVideo.288cb61931e33d913f0a.svg",eo=n.p+"PremiumVoice.b3a2893dbe481108ab94.svg",to=8*u.Gw,no={stories:qi,double_limits:Ji,infinite_reactions:Xi,premium_stickers:Ki,animated_emoji:Gi,no_ads:$i,voice_to_text:eo,profile_badge:ji,faster_download:Yi,more_upload:Hi,advanced_chat_management:Vi,animated_userpics:Qi,emoji_status:qi,translations:Wi},ao=(0,a.X$)((0,s.c$)((e=>{const{premiumModal:t}=(0,l.jUK)(e),n=t?.fromUserId?(0,l.dyD)(e,t.fromUserId):void 0,a=n?.emojiStatus?e.customEmojis.byId[n.emojiStatus.documentId]:void 0,s=a?(0,l.Ny0)(e,a.stickerSetInfo):void 0;return{currentUserId:e.currentUserId,promo:t?.promo,isClosing:t?.isClosing,isSuccess:t?.isSuccess,isGift:t?.isGift,monthsAmount:t?.monthsAmount,fromUser:n,fromUserStatusEmoji:a,fromUserStatusSet:s,toUser:t?.toUserId?(0,l.dyD)(e,t.toUserId):void 0,initialSection:t?.initialSection,isPremium:(0,l.wVz)(e),limitChannels:(0,Qs.P)(e,"channels"),limitFolders:(0,Qs.P)(e,"dialogFilters"),limitPins:(0,Qs.P)(e,"dialogFolderPinned"),limitLinks:(0,Qs.P)(e,"channelsPublic"),limits:e.appConfig?.limits,premiumSlug:e.appConfig?.premiumInvoiceSlug,premiumBotUsername:e.appConfig?.premiumBotUsername,premiumPromoOrder:e.appConfig?.premiumPromoOrder}}))((({isOpen:e,currentUserId:t,fromUser:n,fromUserStatusEmoji:i,fromUserStatusSet:l,promo:c,initialSection:d,isPremium:m,limitChannels:u,limitLinks:h,limitFolders:Z,limitPins:P,limits:p,premiumSlug:v,premiumBotUsername:g,isClosing:E,isSuccess:C,isGift:b,toUser:f,monthsAmount:y,premiumPromoOrder:I})=>{const S=(0,a.sO)(null),{closePremiumModal:k,openInvoice:N,requestConfetti:w,openTelegramLink:A,loadStickers:R,openStickerSet:L}=(0,s.Sv)(),B=(0,M.Z)(),[F,x]=(0,a.eJ)(!0),[D,O]=(0,a.eJ)(d),U=(0,a.I4)((e=>()=>{O(e)}),[]);function _(e){S.current&&(v?N({slug:v}):g&&(A({url:`${o.zHP}${g}?start=${e||"promo"}`}),k()))}const $=(0,T.Z)((()=>{_()})),j=(0,a.I4)((()=>{const t=S.current;if(t&&e){const{top:e,left:n,width:a,height:s}=t.querySelector(".modal-content").getBoundingClientRect();w({top:e,left:n,width:a,height:s})}}),[e,w]);(0,a.d4)((()=>{C&&j()}),[C,j]),(0,G.Z)((([e])=>{e!==m&&j()}),[m,j]);const V=(0,a.Ye)((()=>I?I.filter((e=>Bi.includes(e))):Bi),[I]);(0,a.d4)((()=>{i&&!l&&R({stickerSetInfo:i.stickerSetInfo})}),[R,i,l]);const H=(0,T.Z)((()=>{l&&L({stickerSetInfo:l})})),J=(0,a.Ye)((()=>{if(!l||!n)return;const e=B("lng_premium_emoji_status_title").replace("{user}",(0,r.Js)(n)),[t,s]=e.split("{link}"),i=l.thumbCustomEmojiId?a.ZP.createElement(ti.Z,{className:"vJ2GKZFltN22CJDw5Bdu",documentId:l.thumbCustomEmojiId}):void 0,o=a.ZP.createElement("span",{className:"_G_ogp7ec2JUxZUhoaAi",onClick:H},i,(0,te.Z)(l.title));return[(0,te.Z)(t),o,(0,te.Z)(s)]}),[n,l,B]);if(!c||i&&!l)return;const z=c.options.find((e=>1===e.months));return a.ZP.createElement(ne.Z,{className:"JJNHc_FZuydBNBIHK9xC",onCloseAnimationEnd:()=>k({isClosed:!0}),onClose:k,isOpen:e&&!E,dialogRef:S},a.ZP.createElement(K.ZP,{name:"slide",activeKey:D?1:0,className:"Q05gUm0HCMtSoeX2HVGw"},D?a.ZP.createElement(Ui,{initialSection:D,onBack:U(void 0),promo:c,onClickSubscribe:_,isPremium:m,limits:p,premiumPromoOrder:I}):a.ZP.createElement("div",{className:(0,ce.Z)("E9_LJ9RqAHTj8h84EROt","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;x(t<=150)}},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",className:"TyuYAZecpI2K_1i3B5XO",color:"translucent",onClick:()=>k(),ariaLabel:B("Close")},a.ZP.createElement("i",{className:"icon icon-close"})),i?a.ZP.createElement(ti.Z,{className:"ZDQ58Gu2MpISHIigNnCf",onClick:H,documentId:i.id,isBig:!0,size:to}):a.ZP.createElement("img",{className:"Vaf41aTAoSwl_e_cZhah",src:zi,alt:"",draggable:!1}),a.ZP.createElement("h2",{className:(0,ce.Z)("J2z1gqvfQu5kqV_UP8US",l&&"CCRIHzjKzzj6y3nYJQKk")},l?J:(0,te.Z)(b?n?.id===t?B("TelegramPremiumUserGiftedPremiumOutboundDialogTitle",[(0,r.Js)(f),y]):B("TelegramPremiumUserGiftedPremiumDialogTitle",[(0,r.Js)(n),y]):n?B("TelegramPremiumUserDialogTitle",(0,r.Js)(n)):B(m?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:"PXg8sU2cfdeysJXctlpB"},(0,te.Z)(b?n?.id===t?B("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,r.Js)(f)):B("TelegramPremiumUserGiftedPremiumDialogSubtitle"):B(l?"TelegramPremiumUserStatusDialogSubtitle":n?"TelegramPremiumUserDialogSubtitle":m?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:(0,ce.Z)("Rwuf1efaEfZ13AD5XbCB",F&&"NV7fN3j69oFZEJu7ejG8")},a.ZP.createElement("h2",{className:"jA_DV7G5VJo8xGOe0otF"},B("TelegramPremium"))),a.ZP.createElement("div",{className:(0,ce.Z)("LlPAfJpL066su4P2NFmh",m&&"wpPtJKCqTdOGkKoh7KTo")},V.map(((e,t)=>a.ZP.createElement(si,{key:e,title:B(Ri[e]),text:"double_limits"===e?B(Li[e],[u,Z,P,h,4]):B(Li[e]),icon:no[e],index:t,count:V.length,onClick:U(e)}))),a.ZP.createElement("div",{className:(0,ce.Z)(_i,"MQbFSG2o_R8rjKDsqs8R"),dir:B.isRtl?"rtl":void 0},a.ZP.createElement("p",null,(0,te.Z)(B("AboutPremiumDescription"),["simple_markdown"])),a.ZP.createElement("p",null,(0,te.Z)(B("AboutPremiumDescription2"),["simple_markdown"]))),function(){if(c&&(!b||n?.id!==t))return a.ZP.createElement("div",{className:_i,dir:B.isRtl?"rtl":void 0},(0,Ba.H)({text:c.statusText,entities:c.statusEntities}))}()),!m&&a.ZP.createElement("div",{className:"FApXoTPpasib6Np5Uxpt"},a.ZP.createElement(Y.Z,{className:"Fb3VVHNrypZ3lhYfSVI_",isShiny:!0,withPremiumGradient:!0,onClick:$},B("SubscribeToPremium",(0,ei.x)(Number(z.amount),z.currency,B.code)))))))})));var so=n(8337);const io=(0,a.X$)((({option:e,checked:t,fullMonthlyAmount:n,onChange:s})=>{const i=(0,M.Z)(),{months:o,amount:r,currency:l}=e,c=Math.floor(r/o),d=(0,a.Ye)((()=>n&&n>c?Math.ceil(100-c/(n/100)):void 0),[n,c]),m=(0,a.I4)((e=>{e.target.checked&&s(o)}),[o,s]);return a.ZP.createElement("label",{className:(0,ce.Z)("c43s0Q6_xgGlM8sZxQ7Q",t&&"PjYaF42Oe55WgPpTP6Od"),dir:i.isRtl?"rtl":void 0},a.ZP.createElement("input",{className:"r03M3Tzd52_D2GCAdabK",type:"radio",name:"gift_option",value:o,checked:t,onChange:m}),a.ZP.createElement("div",{className:"oL_26LDnHDwJRxqKF1Kn"},a.ZP.createElement("div",{className:"JmEuBQ4mFzu1MiFV5qSB"},i("Months",o)),a.ZP.createElement("div",{className:"hssGd7AUhDhhG2_aXqe9"},i("PricePerMonth",(0,ei.x)(c,l,i.code)),Boolean(d)&&a.ZP.createElement("span",{className:"WCXGWHYNQh8lg2rIWehC",title:i("GiftDiscount")}," −",d,"% ")),a.ZP.createElement("div",{className:"mhc9AgOUiNT2QMcErpQe"},(0,ei.x)(r,l,i.code))))})),oo=(0,a.X$)((0,s.c$)((e=>{const{forUserId:t,monthlyCurrency:n,monthlyAmount:a}=(0,l.jUK)(e).giftPremiumModal||{},s=t?(0,l.dyD)(e,t):void 0;return{user:s,gifts:s?(0,l.ccz)(e,s.id)?.premiumGifts:void 0,monthlyCurrency:n,monthlyAmount:a?Number(a):void 0}}))((({isOpen:e,user:t,gifts:n,monthlyCurrency:i,monthlyAmount:o})=>{const{openPremiumModal:l,closeGiftPremiumModal:c,openUrl:d}=(0,s.Sv)(),m=(0,M.Z)(),u=(0,va.Z)(t,!0),h=(0,va.Z)(n,!0),[Z,P]=(0,a.eJ)(),p=h?.[0],v=(0,a.Ye)((()=>{if(!h||0===h.length||!p)return;const e=h.reduce(((e,t)=>t.amount<p?.amount?t:p),p);return e.currency===i&&o?o:Math.floor(e.amount/e.months)}),[p,h,o,i]);(0,a.d4)((()=>{e&&P(p?.months)}),[p?.months,e]);const g=(0,a.Ye)((()=>h?.find((e=>e.months===Z))),[h,Z]),E=(0,a.I4)((()=>{g&&(c(),d({url:g.botUrl}))}),[c,d,g]),C=(0,a.I4)((()=>{l()}),[l]);return a.ZP.createElement(ne.Z,{onClose:c,isOpen:e,className:"K80So3B9potKGNvwdtYE"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",className:"dxx424IZDNuP1OLbUIve",color:"translucent",onClick:()=>c(),ariaLabel:m("Close")},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement(yt.Z,{peer:u,size:"jumbo",className:"qJgJ7R5NJVmAxBjT5LxT"}),a.ZP.createElement("h2",{className:"eqCNa8zBoMroKcepfXyE"},m("GiftTelegramPremiumTitle")),a.ZP.createElement("p",{className:"MtYhgDChavNfKIUAJPzt"},(0,te.Z)(m("GiftTelegramPremiumDescription",(0,r.Vl)(u)),["emoji","simple_markdown"])),a.ZP.createElement("div",{className:"HyfHjS1vAds31eFcSpDg"},h?.map((e=>a.ZP.createElement(io,{key:e.amount,option:e,fullMonthlyAmount:v,checked:e.months===Z,onChange:P})))),function(){const e=m("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return a.ZP.createElement("p",{className:"J0hST5xsC45ZolfGpbDc"},e[1],a.ZP.createElement(so.Z,{isPrimary:!0,onClick:C},e[2]),e[3])}()),a.ZP.createElement(Y.Z,{className:"sSXm9RjIQSsVFi0D1nEd",isShiny:!0,disabled:!Z,onClick:E},m("GiftSubscriptionFor",g&&(0,ei.x)(Number(g.amount),g.currency,m.code))))}))),ro={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities",chatlistInvites:"LimitReachedFolderLinks",chatlistJoined:"LimitReachedSharedFolders"},lo={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked",chatlistInvites:"LimitReachedFolderLinksLocked",chatlistJoined:"LimitReachedSharedFoldersLocked"},co={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium",chatlistInvites:"LimitReachedFolderLinksPremium",chatlistJoined:"LimitReachedSharedFoldersPremium"},mo={dialogFiltersChats:"chat-badge",uploadMaxFileparts:"file-badge",dialogFilters:"folder-badge",dialogFolderPinned:"pin-badge",channelsPublic:"link-badge",channels:"chats-badge",chatlistInvites:"link-badge",chatlistJoined:"folder-badge"},uo={uploadMaxFileparts:(e,t)=>8e3===t?e("FileSize.GB","4"):4e3===t?e("FileSize.GB","2"):(0,$e.sS)(e,t*o.pJM)},ho=(0,a.X$)((0,s.c$)(((e,{limit:t})=>{const{limits:n}=e.appConfig||{},a=(0,l.wVz)(e);return{defaultValue:t?n?.[t][0]:void 0,premiumValue:t?n?.[t][1]:void 0,canBuyPremium:!(0,l.oe5)(e),isPremium:a}}))((({defaultValue:e,premiumValue:t,limit:n,isPremium:i,canBuyPremium:o})=>{const{closeLimitReachedModal:r,openPremiumModal:l}=(0,s.Sv)(),c=(0,M.Z)(),[d,m,u]=(0,k.Z)(),h=(0,a.I4)((()=>{l(),m()}),[l,m]);(0,a.d4)((()=>{!n&&d&&u()}),[d,n,u]);const Z=c("LimitReached"),P=n&&uo[n],p=function({lang:e,limitType:t,isPremium:n,canBuyPremium:a,defaultValue:s,premiumValue:i,valueFormatter:o}){if(!t)return;const r=o?o(e,s):s,l=o?o(e,i):i;return n?e(co[t],l):a?e(ro[t],"channelsPublic"===t?l:[r,l]):e(lo[t],r)}({lang:c,limitType:n,isPremium:i,canBuyPremium:o,defaultValue:e,premiumValue:t,valueFormatter:P}),v=n&&mo[n],g=o&&!i;return a.ZP.createElement(ne.Z,{onClose:m,onCloseAnimationEnd:r,isOpen:Boolean(n)&&!d,title:Z,className:"iz5RJvcQyNNDQzKfXQbN"},!g&&a.ZP.createElement("div",{className:"womlEQglVV1w8ltVa6PQ"},a.ZP.createElement("i",{className:(0,ce.Z)("q8SgjqQqlOVMSofzhdwh",v,"icon")}),a.ZP.createElement("div",{className:"QC8Xe4ShGc_q82s4Tjmg"},P?.(c,i?t:e)||(i?t:e))),g&&a.ZP.createElement(di,{className:"az3lXhmlMfZfIQ_81jog",leftValue:P?.(c,e)||e?.toString(),rightValue:P?.(c,t)||t?.toString(),floatingBadgeIcon:v}),a.ZP.createElement("div",null,(0,te.Z)(p||"",["simple_markdown","br"])),a.ZP.createElement("div",{className:"DgRFl7StCs4fhROb7CKH"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:m,color:"primary"},c(g?"Cancel":"OK")),g&&a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:h,color:"primary"},c("IncreaseLimit"),a.ZP.createElement(Na.Z,{name:"double-badge",className:"MeIsw1Fm4WBqIZzbpS10"}))))})));var Zo=n(78781),Po=n(17891),po=n(81740),vo=n(3657);const go=350+o.fK3,Eo=.5*u.Gw;function Co(e,t,n,s){const i=(0,a.sO)([]),[o,r]=(0,a.eJ)(0),{observe:l,freeze:c,unfreeze:d}=(0,vo.S1)({rootRef:e},(e=>{const t=i.current;e.forEach((e=>{const a=Number(e.target.id.replace(`${n}-`,""));t[a]=e.isIntersecting}));const a=t.reduce(((e,t,n)=>t&&n<e?n:e),1/0);a!==1/0&&r(a)})),{observe:m,freeze:u,unfreeze:h}=(0,vo.S1)({rootRef:e,throttleMs:200,margin:100}),{observe:Z}=(0,vo.S1)({rootRef:e,throttleMs:200,margin:100}),{observe:P}=(0,vo.S1)({rootRef:t});return(0,G.Z)((()=>{s?(c(),u()):setTimeout((()=>{h(),d()}),go)}),[c,u,s,d,h]),{activeSetIndex:o,observeIntersectionForSet:l,observeIntersectionForShowingItems:m,observeIntersectionForPlayingItems:Z,observeIntersectionForCovers:P,selectStickerSet:(0,T.Z)((t=>{r((a=>{const s=document.getElementById(`${n}-${t}`),i=1===Math.abs(a-t);return(0,po.ZP)(e.current,s,"start",Eo,i?200:80),t}))}))}}var bo=n(22268),fo=n(92085),yo=n(45864),Io=n(60422);const So=(0,a.X$)((({stickerSet:e,size:t=o.DC_,noPlay:n,forcePlayback:i,observeIntersection:c,sharedCanvasRef:d})=>{const{loadStickers:m}=(0,s.Sv)(),u=(0,a.sO)(null),{hasThumbnail:h,thumbCustomEmojiId:Z,isLottie:P,isVideos:p}=e,{customEmoji:v}=(0,Io.Z)(Z),E=v?.shouldUseTextColor,C=(0,fo.Z)(u,!E),b=(0,bo.Z)(C),f=(0,vo.Op)(u,c),y=f&&!n,I=e.stickers&&p&&!g.Hh,S=I&&(0,r.RK)(e.stickers[0].id),k=(0,H.Z)(S,!f),N=(h&&!I||P)&&`stickerSet${e.id}`,w=(0,H.Z)(N,!f),M=w||k,T=(0,ya.Z)(M),A=(0,yo.Z)(u,d);return(0,a.d4)((()=>{f&&!e.stickers?.length&&m({stickerSetInfo:{id:e.id,accessHash:e.accessHash}})}),[f,m,e]),a.ZP.createElement("div",{ref:u,className:(0,ce.Z)("z2hl3sxq0tzStr0JpMxi","sticker-set-cover")},M?P?a.ZP.createElement(Pi.Z,{className:T,tgsUrl:w,size:t,play:y,isLowPriority:!(0,l.Si0)((0,s.Rd)(),e),sharedCanvas:d?.current||void 0,sharedCanvasCoords:A,forceAlways:i}):p&&!I?a.ZP.createElement(wa.Z,{className:(0,ce.Z)("h6jE3TEaqlzbs0ro0J2_",T),src:w,canPlay:y,style:b,isPriority:i,loop:!0,disablePictureInPicture:!0}):a.ZP.createElement("img",{src:w||k,style:b,className:(0,ce.Z)("ivo3DVINrp81Kb9ho9kA",T),alt:"",draggable:!1}):(0,$e.Xv)(e.title,2))}));var ko=n(30386),No=n(17240),wo=n(12644),Mo=n(36765);const To=[{title:"SetTimeoutFor.Hours",value:1,arg:3600},{title:"SetTimeoutFor.Hours",value:2,arg:7200},{title:"SetTimeoutFor.Hours",value:8,arg:28800},{title:"SetTimeoutFor.Days",value:1,arg:86400},{title:"SetTimeoutFor.Days",value:2,arg:172800}],Ao=(0,a.X$)((({sticker:e,size:t,noPlay:n,title:i,className:o,noContextMenu:r,isSavedMessages:l,isStatusPicker:c,canViewSet:d,observeIntersection:m,observeIntersectionForShowing:u,isSelected:h,isCurrentUserPremium:Z,noShowPremium:P,sharedCanvasRef:p,withTranslucentThumb:v,forcePlayback:E,onClick:C,clickArg:b,onFaveClick:f,onUnfaveClick:y,onRemoveRecentClick:I,onContextMenuOpen:S,onContextMenuClose:k,onContextMenuClick:N})=>{const{openStickerSet:w,openPremiumModal:A,setEmojiStatus:R}=(0,s.Sv)(),L=(0,a.sO)(null),B=(0,a.sO)(null),F=(0,M.Z)(),x=e.shouldUseTextColor,D=(0,fo.Z)(L,!x),{id:O,isCustomEmoji:U,hasEffect:_,stickerSetInfo:$}=e,j=!Z&&_,V=(0,vo.Op)(L,m),G=V,H=V&&!n,J=(0,vo.Op)(L,u),{isContextMenuOpen:z,contextMenuPosition:X,handleBeforeContextMenu:q,handleContextMenu:K,handleContextMenuClose:W,handleContextMenuHide:Q}=(0,No.Z)(L),ee=Boolean(!r&&X),te=(0,T.Z)((()=>L.current)),ne=(0,T.Z)((()=>L.current.closest(".custom-scroll, .no-scrollbar"))),ae=(0,T.Z)((()=>c?B.current:L.current.querySelector(".sticker-context-menu .bubble"))),{positionX:se,positionY:ie,transformOriginX:re,transformOriginY:le,style:de}=(0,wo.Z)(X,te,ne,ae,(()=>({withPortal:c,shouldAvoidNegativePosition:!0})));(0,a.d4)((()=>{z?S?.():k?.()}),[z,k,S]),(0,a.d4)((()=>{V||W()}),[W,V]);const me=(0,T.Z)((t=>{t.stopPropagation(),t.preventDefault(),I(e)})),ue=(0,T.Z)((()=>{I(e)})),he=(0,T.Z)((()=>{y(e)})),Ze=(0,T.Z)((()=>{f(e)})),Pe=(0,T.Z)((()=>{C?.(b,!0)})),pe=(0,T.Z)((()=>{C?.(b,void 0,!0)})),ve=(0,T.Z)((()=>{w({stickerSetInfo:$})})),ge=(0,T.Z)(((t,n=0)=>{t.preventDefault(),t.stopPropagation(),W(),N?.(),R({emojiStatus:e,expires:Date.now()/1e3+n+(0,$n.Qj)()})})),Ee=!g.$b&&I,Ce=(0,ce.Z)("StickerButton",C&&"interactive",h&&"selected",U&&"custom-emoji",o),be=(0,a.Ye)((()=>{if(!ee||r||U&&!c)return[];const e=[];return U?(To.forEach((t=>{e.push(a.ZP.createElement(oe.Z,{onClick:ge,clickArg:t.arg},F(t.title,t.value,"i")))})),e):(y&&e.push(a.ZP.createElement(oe.Z,{icon:"favorite",onClick:he},F("Stickers.RemoveFromFavorites"))),f&&e.push(a.ZP.createElement(oe.Z,{icon:"favorite",onClick:Ze},F("Stickers.AddToFavorites"))),!j&&C&&(l||e.push(a.ZP.createElement(oe.Z,{onClick:Pe,icon:"muted"},F("SendWithoutSound"))),e.push(a.ZP.createElement(oe.Z,{onClick:pe,icon:"calendar"},F(l?"SetReminder":"ScheduleMessage")))),d&&e.push(a.ZP.createElement(oe.Z,{onClick:ve,icon:"stickers"},F("ViewPackPreview"))),I&&e.push(a.ZP.createElement(oe.Z,{icon:"delete",onClick:ue},F("DeleteFromRecent"))),e)}),[ee,r,U,c,y,f,j,C,d,I,ge,F,he,Ze,l,pe,Pe,ve,ue]);return a.ZP.createElement("div",{ref:L,className:Ce,title:i||e?.emoji,"data-sticker-id":O,onMouseDown:e=>{(0,ko.b)(e),q(e)},onClick:()=>{z||(j?A({initialSection:"premium_stickers"}):C?.(b))},onContextMenu:K},J&&a.ZP.createElement(Mo.Z,{containerRef:L,sticker:e,isSmall:!0,size:t,shouldLoop:!0,shouldPreloadPreview:!0,noLoad:!G,noPlay:!H,withSharedAnimation:!0,sharedCanvasRef:p,withTranslucentThumb:v,customColor:D,forceAlways:E}),!P&&j&&a.ZP.createElement("div",{className:"sticker-locked"},a.ZP.createElement("i",{className:"icon icon-lock-badge"})),!P&&_&&!j&&a.ZP.createElement("div",{className:"sticker-premium"},a.ZP.createElement("i",{className:"icon icon-premium"})),Ee&&a.ZP.createElement(Y.Z,{className:"sticker-remove-button",color:"dark",round:!0,noFastClick:!0,onClick:me},a.ZP.createElement("i",{className:"icon icon-close"})),Boolean(be.length)&&a.ZP.createElement(je.Z,{ref:B,isOpen:z,transformOriginX:re,transformOriginY:le,positionX:se,positionY:ie,style:de,className:"sticker-context-menu",autoClose:!0,withPortal:c,onClose:W,onCloseAnimationEnd:Q},be))}));var Ro=n(78722),Lo=n(21179);const Bo=(0,a.X$)((({reaction:e,availableReactions:t,isSelected:n,loadAndPlay:s,observeIntersection:i,sharedCanvasRef:l,sharedCanvasHqRef:c,forcePlayback:d,onClick:m})=>{const u=(0,a.sO)(null),h="documentId"in e,Z=(0,a.Ye)((()=>t?.find((t=>(0,r.Hl)(t.reaction,e)))),[t,e]),P=Z?.staticIcon?.thumbnail?.dataUri,p=Z?.selectAnimation?.id,v=(0,yo.Z)(u,l),g=(0,H.Z)(Z?.selectAnimation?(0,r.ym)(Z.selectAnimation):void 0,!p),E=(0,T.Z)((()=>{m(e)})),C=(0,ya.Z)(g),b=(0,ce.Z)("xW0m4eR0ukCfRp6WS_Qd",n&&"XTCJlnWtVba28wuDmeBN",!h&&"sticker-reaction");return a.ZP.createElement("div",{ref:u,className:b,onClick:E,title:Z?.title,"data-sticker-id":h?e.documentId:void 0},h?a.ZP.createElement(ti.Z,{ref:u,documentId:e.documentId,size:o.eXY,noPlay:!s,observeIntersectionForPlaying:i,sharedCanvasRef:l,sharedCanvasHqRef:c,withTranslucentThumb:!0,forceAlways:d}):a.ZP.createElement(Lo.Z,{tgsUrl:g,thumbDataUri:P,play:s,noLoop:!1,size:o.eXY,isLowPriority:!0,className:C,sharedCanvas:l.current||void 0,sharedCanvasCoords:v,forceAlways:d}))}));var Fo=n(17017);const xo=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,idPrefix:i,isNearActive:c,favoriteStickers:d,availableReactions:m,isSavedMessages:u,isStatusPicker:h,isReactionPicker:Z,isCurrentUserPremium:P,shouldHideHeader:p,withDefaultTopicIcon:v,selectedReactionIds:g,withDefaultStatusIcon:E,isTranslucent:C,noContextMenus:b,forcePlayback:f,observeIntersection:y,observeIntersectionForPlayingItems:S,observeIntersectionForShowingItems:N,onReactionSelect:w,onStickerSelect:A,onStickerUnfave:R,onStickerFave:L,onStickerRemoveRecent:B,onContextMenuOpen:F,onContextMenuClose:x,onContextMenuClick:D})=>{const{clearRecentStickers:O,clearRecentCustomEmoji:U,clearRecentReactions:_,openPremiumModal:$,toggleStickerSet:j,loadStickers:V}=(0,s.Sv)(),G=(0,a.sO)(null),H=(0,a.sO)(null),J=(0,a.sO)(null),z=(0,M.Z)(),{width:X}=(0,be.Z)(),[q,K,W]=(0,k.Z)(),{isMobile:Q}=(0,I.ZP)(),[ee,te]=(0,a.eJ)(Do(X)),ne=(0,vo.Op)(G,y??N),ae=(0,ya.Z)(ne),se=c||ne,ie=Q?8:4,oe=Q?8:10,re=Q?8:4,le=e.id===o.s38,de=e.id===o.ka7,me=e.id===o.cPw,ue=e.isEmoji,he=!le&&(0,l.FWZ)(e),Ze=(0,T.Z)((()=>{Z?_():ue?U():O(),W()})),Pe=(0,T.Z)((()=>{he&&!P?$({initialSection:"animated_emoji"}):j({stickerSetId:e.id})})),pe=(0,T.Z)((()=>{A?.({id:o.Zkg,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})})),ve=(0,T.Z)((()=>{A?.({id:o.MW8,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})})),ge=ue?o.eXY:o.Qao,Ee=ue?oe:ie,Ce=ue?re:ie,fe=(0,T.Z)((e=>e?Math.floor((e+Ee)/(ge+Ee)):Do(X))),ye=(0,T.Z)((e=>{te(fe(e.contentRect.width))}));(0,Ro.Z)(G,ye),(0,a.d4)((()=>{G.current&&te(fe(G.current.clientWidth))}),[fe]),(0,a.d4)((()=>{se&&!e.stickers?.length&&!e.reactions?.length&&e.accessHash&&V({stickerSetInfo:{id:e.id,accessHash:e.accessHash}})}),[se,V,e]);const Ie=!u&&!P&&he,Se=e.installedDate&&!e.isArchived,ke=!Se&&e.id!==o.s38&&e.id!==o.cPw,[Ne,,we]=(0,k.Z)(ke),Me=3*ee-1,Te=v?e.count+1:e.count,Ae=ge+Ce,Re=Math.ceil(Math.min(Me,Te)/ee)*Ae-Ce,Le=Ne?Re:Math.ceil(Te/ee)*Ae-Ce,Be=(0,a.Ye)((()=>d?new Set(d.map((({id:e})=>e))):void 0),[d]),Fe=!p&&!le&&ue&&!me&&(!Se||!P&&!u),xe=(0,a.Ye)((()=>z(Ie?Se?"lng_emoji_premium_restore":"Unlock":"Add")),[Ie,z,Se]);return a.ZP.createElement("div",{ref:G,key:e.id,id:`${i}-${n}`,className:(0,ce.Z)("symbol-set",Ie&&"symbol-set-locked")},!p&&a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:(0,ce.Z)("symbol-set-name",Fe&&"symbol-set-name-external")},Ie&&a.ZP.createElement("i",{className:"symbol-set-locked-icon icon icon-lock-badge"}),e.title,Fe&&Boolean(e.stickers)&&a.ZP.createElement("span",{className:"symbol-set-amount"},z(ue?"EmojiCount":"Stickers",e.stickers.length,"i"))),le&&a.ZP.createElement("i",{className:"symbol-set-remove icon icon-close",onClick:K}),Fe&&a.ZP.createElement(Y.Z,{className:"symbol-set-add-button",withPremiumGradient:he&&!P,onClick:Pe,pill:!0,size:"tiny",fluid:!0},xe)),a.ZP.createElement("div",{className:(0,ce.Z)("symbol-set-container shared-canvas-container",ae),style:`height: ${Le}px;`},a.ZP.createElement("canvas",{ref:H,className:"shared-canvas",style:ke?`height: ${Re}px;`:void 0}),(le||de||ke)&&a.ZP.createElement("canvas",{ref:J,className:"shared-canvas"}),v&&a.ZP.createElement(Y.Z,{className:"StickerButton custom-emoji",color:"translucent",onClick:pe,key:"default-topic-icon"},a.ZP.createElement("img",{src:Fo,alt:"Reset",className:"sticker-media",draggable:!1})),E&&a.ZP.createElement(Y.Z,{className:"StickerButton custom-emoji status-default",color:"translucent",onClick:ve,key:"default-status-icon"},a.ZP.createElement("i",{className:"icon icon-premium"})),se&&e.reactions?.map((n=>{const s=(0,r.$d)(n),i=s?g?.includes(s):void 0;return a.ZP.createElement(Bo,{key:`${e.id}_${s}`,reaction:n,isSelected:i,loadAndPlay:t,availableReactions:m,observeIntersection:S,onClick:w,sharedCanvasRef:H,sharedCanvasHqRef:J,forcePlayback:f})})),se&&e.stickers?.slice(0,Ne?Me:e.stickers.length).map(((e,n)=>{const i=(le||de)&&(0,l.Si0)((0,s.Rd)(),e.stickerSetInfo),o=ke&&n>=Me||i?J:H,r=e.isCustomEmoji?e.id:e.emoji,c=r?g?.includes(r):void 0;return a.ZP.createElement(Ao,{key:e.id,sticker:e,size:ge,observeIntersection:S,observeIntersectionForShowing:N,noPlay:!t,isSavedMessages:u,isStatusPicker:h,canViewSet:!0,noContextMenu:b,isCurrentUserPremium:P,sharedCanvasRef:o,withTranslucentThumb:C,onClick:A,clickArg:e,isSelected:c,onUnfaveClick:de&&Be?.has(e.id)?R:void 0,onFaveClick:Be?.has(e.id)?void 0:L,onRemoveRecentClick:le?B:void 0,onContextMenuOpen:F,onContextMenuClose:x,onContextMenuClick:D,forcePlayback:f})})),Ne&&Te>Me&&a.ZP.createElement(Y.Z,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:we,key:"more"},"+",Te-Me)),le&&a.ZP.createElement(Xn.Z,{text:z(Z?"ClearRecentReactionsAlertMessage":"ClearRecentStickersAlertMessage"),isOpen:q,onClose:W,confirmHandler:Ze,confirmIsDestructive:!0}))}));function Do(e){return e>440?8:e<362?6:7}const Oo="cnWk4tq3tmB7r08ScyxQ",Uo="x0Qtu0yjl4v02fLLyxV1",_o="m4MXEae1lmdJZV64zN6b",$o="A5Fetmgo_VQRMWxFTV_v",jo="jNEbrwsYAlEp67HG75uy",Vo=2.5*u.Gw,Go=new Set([o.s38,o.ka7,o.cPw]),Ho=new Set([o.s38,o.ka7,o.cPw,o.dWG,o.BRs]),Jo=(0,a.X$)((0,s.c$)(((e,{chatId:t,isStatusPicker:n,isReactionPicker:a})=>{const{stickers:{setsById:s},customEmojis:{byId:i,featuredIds:o,statusRecent:{emojis:r}},recentCustomEmojis:c,recentReactions:d,topReactions:m}=e,u=Boolean(t&&(0,l.FM1)(e,t));return{customEmojisById:n?void 0:i,recentCustomEmojiIds:n?void 0:c,recentStatusEmojis:n?r:void 0,stickerSetsById:s,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:(0,l.W9H)(e),isSavedMessages:u,isCurrentUserPremium:(0,l.wVz)(e),customEmojiFeaturedIds:o,defaultTopicIconsId:e.defaultTopicIconsId,defaultStatusIconsId:e.defaultStatusIconsId,topReactions:a?m:void 0,recentReactions:a?d:void 0,availableReactions:a?e.availableReactions:void 0}}))((({className:e,pickerListClassName:t,isHidden:n,loadAndPlay:i,addedCustomEmojiIds:c,customEmojisById:d,recentCustomEmojiIds:m,selectedReactionIds:u,recentStatusEmojis:h,stickerSetsById:Z,topReactions:P,recentReactions:p,availableReactions:v,idPrefix:E="custom-emoji-set",customEmojiFeaturedIds:C,canAnimate:b,isReactionPicker:f,isStatusPicker:y,isTranslucent:S,isSavedMessages:k,isCurrentUserPremium:N,withDefaultTopicIcons:w,defaultTopicIconsId:A,defaultStatusIconsId:R,onCustomEmojiSelect:L,onReactionSelect:B,onContextMenuOpen:F,onContextMenuClose:x,onContextMenuClick:D})=>{const O=(0,a.sO)(null),U=(0,a.sO)(null),_=(0,a.sO)(null),$=(0,a.sO)(null),{isMobile:j}=(0,I.ZP)(),{handleScroll:V,isAtBeginning:G}=Wa(),H=(0,a.Ye)((()=>y?h:Object.values((0,Kn.q0)(d,m))),[d,y,m,h]),J=`${E}-custom-emoji`,{activeSetIndex:z,observeIntersectionForSet:X,observeIntersectionForPlayingItems:q,observeIntersectionForShowingItems:K,observeIntersectionForCovers:W,selectStickerSet:Q}=Co(O,U,J,n),ee=(0,M.Z)(),te=Boolean(c),ne=(0,a.Ye)((()=>{if(!c)return Wn.D;const e=[];if(f){const t=P?.slice(0,16)||[];t?.length&&e.push({id:o.aqU,accessHash:"",title:ee("Reactions"),reactions:t,count:t.length,isEmoji:!0});const n=(p||[]).filter((e=>!t.some((t=>(0,r.Hl)(t,e))))).slice(0,32),a=(v||[]).map((({reaction:e})=>e)).filter((e=>!t.some((t=>(0,r.Hl)(t,e)))&&!n.some((t=>(0,r.Hl)(t,e)))));if(a?.length||n?.length){const t=!n?.length,s=n.concat(a);e.push({id:t?o.cPw:o.s38,accessHash:"",title:ee(t?"PopularReactions":"RecentStickers"),reactions:s,count:s.length,isEmoji:!0})}}else if(y){const t=Z[R];if(t?.stickers?.length){const n=(t.stickers||[]).concat(H||[]);e.push({...t,stickers:n,count:n.length,id:o.s38,title:ee("RecentStickers")})}}else if(w){const t=Z[A];t.stickers?.length&&e.push({...t,id:o.s38,title:ee("RecentStickers")})}else H?.length&&e.push({id:o.s38,accessHash:"0",title:ee("RecentStickers"),stickers:H,count:H.length,isEmoji:!0});const t=(0,Kn.Tw)(c.concat(C||[])),n=Object.values((0,Kn.q0)(Z,t));return[...e,...n]}),[c,f,y,w,H,C,Z,P,v,ee,p,R,A]),ae=(0,a.Ye)((()=>te&&0===ne.filter((e=>e.stickers?.length)).length),[ne,te]),se=(0,Po.Z)([],o.Yan),ie=te&&se&&!ae;(0,Zo.Z)(U,j||!ie),(0,a.d4)((()=>{if(!te)return;const e=U.current;if(!e)return;const t=z*Vo-(e.offsetWidth/2-Vo/2);(0,ii.Z)(e,t)}),[te,z]);const oe=(0,T.Z)((e=>{L(e)})),re=(0,T.Z)((e=>{B?.(e)})),le=(0,ce.Z)("StickerPicker","z0kj3ATb_u7kBMYsqUpx",e);if(!ie)return a.ZP.createElement("div",{className:le},ae?a.ZP.createElement("div",{className:jo},ee("NoStickers")):a.ZP.createElement(hs.Z,null));const de=(0,ce.Z)(Uo,"no-scrollbar",!G&&_o),me=(0,ce.Z)(Oo,"UEOQzPhb8wS2YI61dKJE",g.$b?"no-scrollbar":"custom-scroll",t);return a.ZP.createElement("div",{className:le},a.ZP.createElement("div",{ref:U,className:de},a.ZP.createElement("div",{className:"shared-canvas-container"},a.ZP.createElement("canvas",{ref:_,className:"shared-canvas"}),a.ZP.createElement("canvas",{ref:$,className:"shared-canvas"}),ne.map((function(e,t){const n=e.stickers?.[0],r=(0,ce.Z)($o,t===z&&"sGL0teusRxo4NrXceldd"),c=t<o.uaz,d=(0,l.Si0)((0,s.Rd)(),e);if(e.id!==o.aqU){if(Ho.has(e.id)||e.hasThumbnail||!n){const n=e.id===o.s38||e.id===o.cPw,s=Go.has(e.id);return a.ZP.createElement(Y.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:s,color:"translucent",onClick:()=>Q(n?0:t)},n?a.ZP.createElement("i",{className:"icon icon-recent"}):a.ZP.createElement(So,{stickerSet:e,noPlay:!b||!i,forcePlayback:!0,observeIntersection:W,sharedCanvasRef:c?d?$:_:void 0}))}return a.ZP.createElement(Ao,{key:e.id,sticker:n,size:o.DC_,title:e.title,className:r,noPlay:!b||!i,observeIntersection:W,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:c?d?$:_:void 0,withTranslucentThumb:S,onClick:Q,clickArg:t,forcePlayback:!0})}})))),a.ZP.createElement("div",{ref:O,onScroll:V,className:me},ne.map(((e,t)=>{const n=e.id===o.aqU||e.id===o.s38&&(w||y);return a.ZP.createElement(xo,{key:e.id,stickerSet:e,loadAndPlay:Boolean(b&&i),index:t,idPrefix:J,observeIntersection:X,observeIntersectionForPlayingItems:q,observeIntersectionForShowingItems:K,isNearActive:z>=t-1&&z<=t+1,isSavedMessages:k,isStatusPicker:y,isReactionPicker:f,shouldHideHeader:n,withDefaultTopicIcon:w&&e.id===o.s38,withDefaultStatusIcon:y&&e.id===o.s38,isCurrentUserPremium:N,selectedReactionIds:u,availableReactions:v,isTranslucent:S,onReactionSelect:re,onStickerSelect:oe,onContextMenuOpen:F,onContextMenuClose:x,onContextMenuClick:D,forcePlayback:!0})}))))})));var zo=n(62898);const Xo=(0,a.X$)((0,s.c$)((e=>({areFeaturedStickersLoaded:Boolean(e.customEmojis.featuredIds?.length),isTranslucent:(0,l.QRV)(e)})))((({isOpen:e,statusButtonRef:t,areFeaturedStickersLoaded:n,isTranslucent:i,onEmojiStatusSelect:o,onClose:r})=>{const{loadFeaturedEmojiStickers:l}=(0,s.Sv)(),c=(0,a.sO)(),[d,m,u]=(0,k.Z)();(0,a.d4)((()=>{c.current=t.current.getBoundingClientRect().right}),[e,t]),(0,a.d4)((()=>{e&&!n&&l()}),[n,e,l]);const h=(0,a.I4)((e=>{o(e),r()}),[r,o]);return a.ZP.createElement(zo.Z,null,a.ZP.createElement(je.Z,{isOpen:e,noCompact:!0,positionX:"right",bubbleClassName:"XWSv0Pf1SKleWNyX04yO",onClose:r,transformOriginX:c.current,noCloseOnBackdrop:d},a.ZP.createElement(Jo,{idPrefix:"status-emoji-set-",loadAndPlay:e,isHidden:!e,isStatusPicker:!0,isTranslucent:i,onContextMenuOpen:m,onContextMenuClose:u,onCustomEmojiSelect:h,onContextMenuClick:r})))})));var Yo=n(4830),qo=n(66);function Ko(e,t){return e.find((e=>!e.chatId))||e.filter((e=>t&&e.chatId!==t)).sort(((e,t)=>e.date-t.date))[0]}const Wo=(0,a.X$)((0,s.c$)(((e,{info:t})=>{const n=t&&(0,l.Z1J)(e,t?.chatId),a=t?.myBoosts&&Ko(t.myBoosts,t.chatId);return{chat:n,boostedChat:a?.chatId?(0,l.Z1J)(e,a?.chatId):void 0,isCurrentUserPremium:(0,l.wVz)(e)}}))((({info:e,chat:t,boostedChat:n,isCurrentUserPremium:i})=>{const{applyBoost:o,closeBoostModal:l,requestConfetti:c,openPremiumModal:d}=(0,s.Sv)(),[m,u,h]=(0,k.Z)(),[Z,P,p]=(0,k.Z)(),[v,g,E]=(0,k.Z)(),C=Boolean(e),b=(0,M.Z)(),f=(0,a.Ye)((()=>{if(t)return(0,r.U)(b,t)}),[t,b]),y=(0,a.Ye)((()=>{if(n)return(0,r.U)(b,n)}),[n,b]),{isStatusLoaded:I,isBoosted:S,boost:N,title:w,leftText:A,rightText:R,value:L,progress:B,descriptionText:F,canBoostMore:x}=(0,a.Ye)((()=>{if(!e?.boostStatus||!t)return{isStatusLoaded:!1,title:b("Loading")};const{level:n,currentLevelBoosts:a,hasMyBoost:s}=e.boostStatus,i=e?.myBoosts&&Ko(e.myBoosts,t.id),o=e?.myBoosts&&(r=e.myBoosts,l=t.id,!r.every((e=>e.chatId===l)));var r,l;const{boosts:c,currentLevel:d,hasNextLevel:m,levelProgress:u,remainingBoosts:h}=(0,Yo.k)(e.boostStatus,!0),Z=s,P=c===a&&Z,p=b("BoostsLevel",d),v=m?b("BoostsLevel",d+1):void 0,g=b("ChannelBoost.MoreBoosts",h),E=b("ChannelBoost.StoriesPerDay",n),C=b("ChannelBoost.StoriesPerDay",n+1),y=Z?b("YouBoostedChannel2",f):b(0===n?"lng_boost_channel_title_first":"lng_boost_channel_title_more");let I;return I=0===n?Z?b("ChannelBoost.EnableStoriesMoreRequired",g):b("ChannelBoost.EnableStoriesForChannelText",[f,g]):P?1===n?b("ChannelBoost.EnabledStoriesForChannelText"):b("ChannelBoost.BoostedChannelReachedLevel",[n,E]):b("ChannelBoost.HelpUpgradeChannelText",[f,g,C]),{isStatusLoaded:!0,title:y,leftText:p,rightText:v,value:c.toString(),progress:u,remainingBoosts:h,descriptionText:I,boost:i,isBoosted:Z,canBoostMore:o}}),[t,f,e,b]),D=!e?.myBoosts?.length&&i,O=N?.chatId&&N.chatId!==e?.chatId,U=(0,T.Z)((()=>{h(),o({chatId:t.id,slots:[N.slot]}),c({})})),_=(0,T.Z)((()=>{d(),E(),l()})),$=(0,T.Z)((()=>{if(!N)return i||g(),void l();x?N.cooldownUntil?P():O?u():U():l()})),j=(0,T.Z)((()=>{l()}));return a.ZP.createElement(ne.Z,{isOpen:C,title:w,className:"Y9MSWZPXcoywEGAVkIGe",contentClassName:"qcaMioaPQuA3J2DdyYu6",onClose:l},I?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(qo.Z,{leftText:A,rightText:R,progress:B,floatingBadgeText:L,floatingBadgeIcon:"boost"}),a.ZP.createElement("div",{className:"kR5ezaKOBrU14CVmMWM0"},(0,te.Z)(F,["simple_markdown","emoji"])),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",disabled:D,onClick:$},x?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Na.Z,{name:"boost"}),b(S&&x?"BoostingBoostAgain":"ChannelBoost.BoostChannel")):b("OK")),a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",onClick:j},b("Cancel")))):a.ZP.createElement(hs.Z,{className:"rTu4qT5HMT5xEA0iBnQZ"}),O&&y&&a.ZP.createElement(ne.Z,{isOpen:m,className:"YoELl5NSlfGHhh0TV09C",contentClassName:"l39rkylGwQCNJD7zFGNp",onClose:h},a.ZP.createElement("div",{className:"tfMx99CifV4hYxg9MEqE"},a.ZP.createElement("div",{className:"Ylfk1xu6gEHr_yzPetrS"},a.ZP.createElement(yt.Z,{peer:n,size:"large"}),a.ZP.createElement(Na.Z,{name:"boostcircle",className:"WDTDg5KQT796SQTEgPpx"})),a.ZP.createElement(Na.Z,{name:"next",className:"f_dXofOOgJ37seFwxD55"}),a.ZP.createElement(yt.Z,{peer:t,size:"large"})),a.ZP.createElement("div",null,(0,te.Z)(b("ChannelBoost.ReplaceBoost",[y,f]),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",onClick:U},b("Replace")),a.ZP.createElement(Y.Z,{isText:!0,className:"confirm-dialog-button",onClick:h},b("Cancel")))),Boolean(N?.cooldownUntil)&&a.ZP.createElement(Xn.Z,{isOpen:Z,isOnlyConfirm:!0,confirmLabel:b("OK"),title:b("ChannelBoost.Error.BoostTooOftenTitle"),onClose:p,confirmHandler:p},(0,te.Z)(b("ChannelBoost.Error.BoostTooOftenText",(0,_e.G9)(b,(0,$n.bp)(),N.cooldownUntil)),["simple_markdown","emoji"])),!i&&a.ZP.createElement(Xn.Z,{isOpen:v,confirmLabel:b("Common.Yes"),title:b("PremiumNeeded"),onClose:E,confirmHandler:_},(0,te.Z)(b("PremiumNeededForBoosting"),["simple_markdown","emoji"])))})));var Qo=n(12007),er=n(49187);const tr="IHmQ6rmwk9lGyiwoN35E",nr="nAG11HvcI33XcEk6iXcE",ar="uLJj2XtrzUYpv4M5h2yc",sr=(0,a.X$)((({currentUserId:e,modal:t})=>{const{closeGiftCodeModal:n,openChat:i,applyGiftCode:r,focusMessage:l}=(0,s.Sv)(),c=(0,M.Z)(),d=Boolean(t),m=!(t?.info.toId&&t?.info.toId!==e||t?.info.usedAt),u=(0,T.Z)((e=>{i({id:e}),n()})),h=(0,T.Z)((()=>{t&&t.info.giveawayMessageId&&(l({chatId:t.info.fromId,messageId:t.info.giveawayMessageId}),n())})),Z=(0,T.Z)((()=>{m?r({slug:t.slug}):n()}));return a.ZP.createElement(ne.Z,{isOpen:d,hasCloseButton:!0,isSlim:!0,title:c("lng_gift_link_title"),contentClassName:"ZUq4brODsgpvaUsllahW",onClose:n},function(){if(!t)return;const{slug:e,info:n}=t;return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("img",{className:"bEdCD7KzsBds3j71NvqQ",src:zi,alt:"",draggable:!1}),a.ZP.createElement("p",{className:ar},(0,te.Z)(c("lng_gift_link_about"),["simple_markdown"])),a.ZP.createElement(Qo.Z,{title:"BoostingGiftLink",link:`${o.zHP}/giftcode/${e}`}),a.ZP.createElement("table",{className:"fjpN5AKMBNcmc1B8ZMV1"},a.ZP.createElement("tr",null,a.ZP.createElement("td",{className:tr},c("BoostingFrom")),a.ZP.createElement("td",null,n.fromId?a.ZP.createElement(er.Z,{peerId:n.fromId,className:nr,forceShowSelf:!0,fluid:!0,clickArg:n.fromId,onClick:u}):c("BoostingNoRecipient"))),a.ZP.createElement("tr",null,a.ZP.createElement("td",{className:tr},c("BoostingTo")),a.ZP.createElement("td",null,n.toId?a.ZP.createElement(er.Z,{peerId:n.toId,className:nr,forceShowSelf:!0,fluid:!0,clickArg:n.toId,onClick:u}):c("BoostingNoRecipient"))),a.ZP.createElement("tr",null,a.ZP.createElement("td",{className:tr},c("BoostingGift")),a.ZP.createElement("td",null,c("BoostingTelegramPremiumFor",c("Months",n.months,"i")))),a.ZP.createElement("tr",null,a.ZP.createElement("td",{className:tr},c("BoostingReason")),a.ZP.createElement("td",{className:(0,ce.Z)(n.giveawayMessageId&&"JJOxaAdgPS8KouI7ApuA"),onClick:h},n.isFromGiveaway&&!n.toId?c("BoostingIncompleteGiveaway"):c(n.isFromGiveaway?"BoostingGiveaway":"BoostingYouWereSelected"))),a.ZP.createElement("tr",null,a.ZP.createElement("td",{className:tr},c("BoostingDate")),a.ZP.createElement("td",null,(0,_e.SA)(1e3*n.date,c.code,!0)))),a.ZP.createElement("span",{className:ar},(0,te.Z)(n.usedAt?c("BoostingUsedLinkDate",(0,_e.SA)(1e3*n.usedAt,c.code,!0)):c("BoostingSendLinkToAnyone"),["simple_markdown"])),a.ZP.createElement(Y.Z,{onClick:Z},c(m?"BoostingUseLink":"Close")))}())}));var ir=n(53152),or=n(95481);const rr={description:"UwWVjbf4Ptl9vrrJPZon","picker-wrapper":"h97ntomDmLCVEoTjzCHi",pickerWrapper:"h97ntomDmLCVEoTjzCHi","picker-header":"Wz6C5rszlwOTdImks0cL",pickerHeader:"Wz6C5rszlwOTdImks0cL","picker-header-info":"OwAqbtXus5KwSxvNBKyu",pickerHeaderInfo:"OwAqbtXus5KwSxvNBKyu","selection-toggle":"s9Pgceru2c49SJ_hpk8Q",selectionToggle:"s9Pgceru2c49SJ_hpk8Q",foldersWrapper:"HFZAaai7bs4X21rCRSyQ",folders:"Xrr7zKG4KrVimUxojATI",folder:"_7YreahCXXe3zGG5sywZA","button-text":"K7T3MH1zL9aRmVFtTBBu",buttonText:"K7T3MH1zL9aRmVFtTBBu","button-badge":"_Z6IH9MHEorrdl7VDqJ2",buttonBadge:"_Z6IH9MHEorrdl7VDqJ2"},lr=(0,a.X$)((({invite:e,folder:t})=>{const{closeChatlistModal:n,joinChatlistInvite:i}=(0,s.Sv)(),o=(0,M.Z)(),[r,l]=(0,a.eJ)(e.missingPeerIds),c=Boolean(e.missingPeerIds.length),d=c?e.missingPeerIds.length:0,m=r.length?r.length.toString():void 0,u=c?o("FolderLinkSubtitleChats",[d,t.title],void 0,d):o("FolderLinkSubtitleAlready",t.title),h=(0,a.I4)((()=>{n(),r.length&&i({invite:e,peerIds:r})}),[e,r]),Z=(0,a.I4)((()=>{const t=r.length===e.missingPeerIds.length;l(t?[]:e.missingPeerIds)}),[e.missingPeerIds,r.length]);return a.ZP.createElement("div",{className:rr.content},a.ZP.createElement("div",{className:rr.description},(0,te.Z)(u,["simple_markdown","emoji"])),a.ZP.createElement("div",{className:(0,ce.Z)(rr.pickerWrapper,"custom-scroll")},Boolean(e.missingPeerIds.length)&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:rr.pickerHeader},a.ZP.createElement("div",{className:rr.pickerHeaderInfo},o("FolderLinkHeaderChatsJoin",r.length,"i")),a.ZP.createElement("div",{className:rr.selectionToggle,role:"button",tabIndex:0,onClick:Z},r.length===e.missingPeerIds.length?o("DeselectAll"):o("SelectAll"))),a.ZP.createElement(Qn.Z,{itemIds:e.missingPeerIds,onSelectedIdsChange:l,selectedIds:r})),a.ZP.createElement("div",{className:rr.pickerHeader},a.ZP.createElement("div",{className:rr.pickerHeaderInfo},o("FolderLinkHeaderAlready"))),a.ZP.createElement(Qn.Z,{itemIds:e.alreadyPeerIds,lockedIds:e.alreadyPeerIds,selectedIds:e.alreadyPeerIds})),a.ZP.createElement(Y.Z,{size:"smaller",onClick:h},a.ZP.createElement("div",{className:rr.buttonText},!r.length&&o("OK"),Boolean(r.length)&&a.ZP.createElement(a.ZP.Fragment,null,o("FolderLinkButtonJoinPlural",r.length,"i"),a.ZP.createElement(or.Z,{className:rr.buttonBadge,text:m,isAlternateColor:!0})))))})),cr=(0,a.X$)((({folder:e,suggestedPeerIds:t=Wn.D})=>{const{closeChatlistModal:n,leaveChatlist:i}=(0,s.Sv)(),o=(0,M.Z)(),[r,l]=(0,a.eJ)(t),c=r.length?r.length.toString():void 0,d=(0,a.I4)((()=>{const e=r.length===t.length;l(e?[]:t)}),[t,r.length]),m=(0,a.I4)((()=>{n(),i({folderId:e.id,peerIds:r})}),[e.id,r]);return a.ZP.createElement("div",{className:rr.content},Boolean(t?.length)&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:rr.description},(0,te.Z)(o("FolderLinkSubtitleRemove"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:(0,ce.Z)(rr.pickerWrapper,"custom-scroll")},a.ZP.createElement("div",{className:rr.pickerHeader},a.ZP.createElement("div",{className:rr.pickerHeaderInfo},o("FolderLinkHeaderChatsQuit",r.length,"i")),a.ZP.createElement("div",{className:rr.selectionToggle,role:"button",tabIndex:0,onClick:d},r.length===t.length?o("DeselectAll"):o("SelectAll"))),a.ZP.createElement(Qn.Z,{itemIds:t,onSelectedIdsChange:l,selectedIds:r}))),a.ZP.createElement(Y.Z,{size:"smaller",onClick:m},a.ZP.createElement("div",{className:rr.buttonText},!r.length&&o("FolderLinkButtonRemove"),Boolean(r.length)&&a.ZP.createElement(a.ZP.Fragment,null,o("FolderLinkButtonRemoveChats"),a.ZP.createElement(or.Z,{className:rr.buttonBadge,text:c,isAlternateColor:!0})))))})),dr=(0,a.X$)((({invite:e})=>{const{closeChatlistModal:t,joinChatlistInvite:n}=(0,s.Sv)(),i=(0,M.Z)(),[o,r]=(0,a.eJ)(e.peerIds),l=(0,a.Ye)((()=>{const t=(0,s.Rd)().chats.byId;return e.peerIds.filter((e=>!t[e].isNotJoined))}),[e.peerIds]),c=o.length-l.length,d=c?c.toString():void 0,m=(0,a.I4)((()=>{t(),n({invite:e,peerIds:o})}),[e,o]),u=(0,a.I4)((()=>{const t=o.length===e.peerIds.length;r(t?l:e.peerIds)}),[e.peerIds,l,o.length]);return a.ZP.createElement("div",{className:rr.content},a.ZP.createElement("div",{className:rr.description},(0,te.Z)(i("FolderLinkSubtitle",e.title),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:(0,ce.Z)(rr.pickerWrapper,"custom-scroll")},a.ZP.createElement("div",{className:rr.pickerHeader},a.ZP.createElement("div",{className:rr.pickerHeaderInfo},i("FolderLinkHeaderChatsJoin",c,"i")),a.ZP.createElement("div",{className:rr.selectionToggle,role:"button",tabIndex:0,onClick:u},o.length===e.peerIds.length?i("DeselectAll"):i("SelectAll"))),a.ZP.createElement(Qn.Z,{itemIds:e.peerIds,lockedIds:l,onSelectedIdsChange:r,selectedIds:o})),a.ZP.createElement(Y.Z,{onClick:m,size:"smaller",disabled:!o.length},a.ZP.createElement("div",{className:rr.buttonText},i("FolderLinkButtonAdd",e.title),a.ZP.createElement(or.Z,{className:rr.buttonBadge,text:d,isAlternateColor:!0}))))})),mr=(0,a.X$)((0,s.c$)(((e,{info:t})=>{const{invite:n,removal:a}=t||{},s=a?.folderId||(n&&"folderId"in n?n.folderId:void 0);return{folder:s?(0,l.MwT)(e,s):void 0}}))((({info:e,folder:t})=>{const{closeChatlistModal:n}=(0,s.Sv)(),i=(0,M.Z)(),o=Boolean(e),r=(0,D.Z)(e)||e,l=(0,D.Z)(t)||t,c=(0,a.Ye)((()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?e.missingPeerIds.length?i("FolderLinkTitleAddChats"):i("FolderLinkTitleAlready"):i("FolderLinkTitleAdd")}return r.removal?i("FolderLinkTitleRemove"):void 0}}),[i,r]),d=(0,a.Ye)((()=>l?l.title:r?.invite&&"title"in r.invite?r.invite.title:void 0),[l,r]),m=(0,a.Ye)((()=>{if(r?.invite)return"missingPeerIds"in r.invite?r.invite.missingPeerIds.length:void 0}),[r]),u=(0,a.I4)((()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?a.ZP.createElement(lr,{invite:e,folder:l}):a.ZP.createElement(dr,{invite:e})}return r.removal?a.ZP.createElement(cr,{folder:l,suggestedPeerIds:r.removal.suggestedPeerIds}):void 0}}),[l,r]);return a.ZP.createElement(ne.Z,{isOpen:o,title:c,onClose:n,isSlim:!0,hasCloseButton:!0},d&&(h=d,a.ZP.createElement("div",{className:rr.foldersWrapper},a.ZP.createElement("div",{className:rr.folders},a.ZP.createElement(ir.Z,{className:rr.folder,title:i("FolderLinkPreviewLeft")}),a.ZP.createElement(ir.Z,{className:rr.folder,isActive:!0,badgeCount:m,isBadgeActive:!0,title:h}),a.ZP.createElement(ir.Z,{className:rr.folder,title:i("FolderLinkPreviewRight")})))),u());var h})));var ur=n(10088);const hr=(0,a.X$)((({isOpen:e,onClose:t})=>{const n=(0,M.Z)();return a.ZP.createElement(ne.Z,{isOpen:e,onClose:t,hasCloseButton:!0,title:n("SponsoredMessageInfo")},a.ZP.createElement("p",null,(0,te.Z)(n("SponsoredMessageInfoDescription1"),["br"])),a.ZP.createElement("p",null,(0,te.Z)(n("SponsoredMessageInfoDescription2"),["br"])),a.ZP.createElement("p",null,(0,te.Z)(n("SponsoredMessageInfoDescription3"),["br"])),a.ZP.createElement("p",null,a.ZP.createElement(ur.Z,{url:n("SponsoredMessageAlertLearnMoreUrl"),text:n("SponsoredMessageAlertLearnMoreUrl")})),a.ZP.createElement("p",null,(0,te.Z)(n("SponsoredMessageInfoDescription4"),["br"])),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:t},n("Close"))))})),Zr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,r.YC)(t),a=(0,l.FM1)(e,t),s=(0,l.Z1J)(e,t),i=Boolean(s)&&(0,r.eA)(s),o=Boolean(s)&&(0,r.G9)(s),c=Boolean(s)&&(0,r.ZV)(s);return{isPrivateChat:n,isChatWithSelf:a,isChannel:i,isGroup:o,isSuperGroup:c,canPinForAll:n&&!a||c||o,contactName:s&&(0,r.YC)(s.id)?(0,r.Vl)((0,l.dyD)(e,(0,r.zX)(s))):void 0}}))((({isOpen:e,messageId:t,isChannel:n,isGroup:i,isSuperGroup:o,canPinForAll:r,contactName:l,onClose:c})=>{const{pinMessage:d}=(0,s.Sv)(),m=(0,a.I4)((()=>{d({messageId:t,isUnpin:!1}),c()}),[d,t,c]),u=(0,a.I4)((()=>{d({messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),c()}),[t,c,d]),h=(0,M.Z)();return a.ZP.createElement(ne.Z,{isOpen:e,onClose:c,className:"pin",title:h("PinMessageAlertTitle")},a.ZP.createElement("p",null,h(n?"PinMessageAlertChannel":i||o?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement("div",{className:"dialog-buttons-column"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:u},h("DialogPin")),r&&a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},l?(0,te.Z)(h("Conversation.PinMessagesFor",l)):h("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},h("Cancel"))))}))),Pr=(0,a.X$)((({isOpen:e,pinnedMessagesCount:t=0,onClose:n,onUnpin:s})=>{const i=(0,M.Z)();return a.ZP.createElement(ne.Z,{isOpen:e,onClose:n,className:"unpin-all",title:i("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,i("Chat.UnpinAllMessagesConfirmation",t,"i")),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},i("DialogUnpin")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},i("Cancel"))))}));var pr=n(73541);const vr=(0,a.X$)((0,s.c$)(((e,{isSchedule:t})=>{const{messageIds:n}=(0,l.jUK)(e).selectedMessages||{},{canDeleteForAll:a}=(0,l.xlD)(e),s=(0,l.jrE)(e);return{selectedMessageIds:n,canDeleteForAll:!t&&a,contactName:s&&(0,r.YC)(s.id)?(0,r.Vl)((0,l.dyD)(e,(0,r.zX)(s))):void 0,willDeleteForCurrentUserOnly:s&&(0,r.G9)(s)&&!a,willDeleteForAll:s&&(0,r.ZV)(s)}}))((({isOpen:e,isSchedule:t,selectedMessageIds:n,canDeleteForAll:i,contactName:o,willDeleteForCurrentUserOnly:r,willDeleteForAll:l,onClose:c})=>{const{deleteMessages:d,deleteScheduledMessages:m,exitMessageSelectMode:u}=(0,s.Sv)(),h=(0,D.Z)(e),Z=(0,T.Z)((()=>{c(),d({messageIds:n,shouldDeleteForAll:!0})})),P=(0,T.Z)((()=>{t?m({messageIds:n}):d({messageIds:n,shouldDeleteForAll:!1}),c()})),p=(0,M.Z)();if((0,a.d4)((()=>{!e&&h&&u()}),[u,e,h]),n)return a.ZP.createElement(ne.Z,{isOpen:e,onClose:c,onEnter:i?void 0:P,className:"delete",title:p("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,p("AreYouSureDeleteFewMessages")),r&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),l&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),a.ZP.createElement("div",{className:i?"dialog-buttons-column":"dialog-buttons"},i&&a.ZP.createElement(Y.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},o?(0,te.Z)(p("ChatList.DeleteForEveryone",o)):p("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(Y.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},p(i?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},p("Cancel"))))}))),gr=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.jUK)(e),{type:n,chatId:a}=(0,l.Btg)(e)||{},s="scheduled"===n,{canDelete:i}=(0,l.xlD)(e),o=Boolean(!s&&(0,l.nB8)(e)),r=(0,l.Nue)(e),{messageIds:c}=t.selectedMessages||{},d=!!a&&(0,l.ku0)(e,a,c),m=!(s||!a)&&(0,l.w9f)(e,a,c),u=t.forwardMessages.isModalShown,h=Boolean(u||t.requestedDraft||t.requestedAttachBotInChat||t.requestedAttachBotInstall);return{isSchedule:s,selectedMessagesCount:(0,l.D7c)(e),canDeleteMessages:i,canReportMessages:o,canDownloadMessages:r,canForwardMessages:m,selectedMessageIds:c,hasProtectedMessage:d,isAnyModalOpen:h}}))((({canPost:e,isActive:t,messageListType:n,isSchedule:i,selectedMessagesCount:o,canDeleteMessages:r,canReportMessages:l,canDownloadMessages:c,canForwardMessages:d,hasProtectedMessage:m,isAnyModalOpen:u,selectedMessageIds:h})=>{const{exitMessageSelectMode:Z,openForwardMenuForSelectedMessages:P,downloadSelectedMessages:p,copySelectedMessages:v,showNotification:g}=(0,s.Sv)(),E=(0,M.Z)(),[C,b,f]=(0,k.Z)(),[y,I,S]=(0,k.Z)();(e=>{(0,pr.y)(e?{"Mod+C":function(e){e.preventDefault(),(0,s.Sv)().copySelectedMessages()}}:void 0)})(t);const N=(0,T.Z)((()=>{Z()}));(0,a.d4)((()=>!t||C||y||u?void 0:(0,ga.Z)({onBackspace:r?b:void 0,onDelete:r?b:void 0,onEsc:N})),[t,C,y,b,N,u,r]);const w=(0,T.Z)((()=>{v(),g({message:E("Share.Link.Copied")}),Z()})),A=(0,T.Z)((()=>{p(),Z()})),R=(0,D.Z)(o||void 0,!0),L=E("VoiceOver.Chat.MessagesSelected",t?o:R,"i"),B=(0,ce.Z)("MessageSelectToolbar",e&&"with-composer",t&&"shown"),F=(e,t,n,s)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,ce.Z)("div-button","item",s&&"destructive"),onClick:n,title:t,"aria-label":t},a.ZP.createElement("i",{className:(0,ce.Z)("icon",`icon-${e}`)}));return a.ZP.createElement("div",{className:B},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(Y.Z,{color:"translucent",round:!0,onClick:N,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:L},L),Boolean(o)&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==n&&d&&F("forward",E("Chat.ForwardActionHeader"),P),l&&F("flag",E("Conversation.ReportMessages"),I),c&&!m&&F("download",E("lng_media_download"),A),!m&&F("copy",E("lng_context_copy_selected_items"),w),r&&F("delete",E("EditAdminGroupDeleteMessages"),b,!0))),a.ZP.createElement(vr,{isOpen:C,isSchedule:i,onClose:f}),a.ZP.createElement(X.Z,{isOpen:y,onClose:S,messageIds:h}))}))),Er=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,messageId:n}=(0,l.jUK)(e).seenByModal||{};return t&&n?{seenByDates:(0,l.hjO)(e,t,n)?.seenByDates}:{}}))((function({isOpen:e,seenByDates:t}){const{openChat:n,closeSeenByModal:i}=(0,s.Sv)(),o=(0,M.Z)(),r=(0,va.Z)(t,!0),l=(0,a.Ye)((()=>{if(!r)return;const e=Object.keys(r);return e.sort(((e,t)=>r[t]-r[e])),e}),[r]),c=(0,T.Z)((e=>{i(),setTimeout((()=>{n({id:e})}),100)})),d=(0,T.Z)((()=>{i()}));return a.ZP.createElement(ne.Z,{isOpen:e,onClose:i,className:(0,ce.Z)("phK_DdEImRiGA8z2FwyB","narrow"),title:`Seen by ${l?.length} users`},a.ZP.createElement("div",{dir:o.isRtl?"rtl":void 0},l&&l.map((e=>a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>c(e)},a.ZP.createElement(ns.Z,{userId:e,noStatusOrTyping:!0,status:(0,_e.$M)(o,1e3*r[e]),statusIcon:"message-read"}))))),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},o("Close"))))})));var Cr=n(2153);const br=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,messageId:n}=(0,l.jUK)(e).reactorModal||{},a=t&&n?(0,l.hjO)(e,t,n):void 0;return{chatId:t,messageId:n,reactions:a?.reactions,reactors:a?.reactors,seenByDates:a?.seenByDates,availableReactions:e.availableReactions}}))((({isOpen:e,reactors:t,reactions:n,chatId:o,messageId:l,seenByDates:c,availableReactions:d})=>{const{loadReactors:m,closeReactorListModal:u,openChat:h}=(0,s.Sv)(),Z=(0,s.Rd)().chats.byId,P=(0,s.Rd)().users.byId,p=(0,M.Z)(),[v,g,E]=(0,k.Z)(!1),[C,b]=(0,a.eJ)(void 0),f=t&&n&&t.count>=10&&n.results.length>1,y=(0,a.sO)();(0,a.d4)((()=>{e&&!v&&(y.current=void 0),v&&!e&&(E(),b(void 0))}),[v,e,E]);const I=(0,T.Z)((()=>{y.current&&h({id:y.current}),u()})),S=(0,T.Z)((()=>{g()})),N=(0,T.Z)((e=>{y.current=e,S()})),w=(0,T.Z)((()=>{m({chatId:o,messageId:l})})),A=(0,a.Ye)((()=>{const e=[];return t?.reactions?.forEach((({reaction:t})=>{e.some((e=>(0,r.Hl)(e,t)))||e.push(t)})),e}),[t]),R=(0,a.Ye)((()=>{if(C)return t?.reactions.filter((({reaction:e})=>(0,r.Hl)(e,C))).map((({peerId:e})=>e));const e=Object.keys(c||{});return(0,Kn.Tw)(t?.reactions.map((({peerId:e})=>e)).concat(e||[])||[])}),[C,t,c]),[L,B]=(0,cs.Z)(w,R,t&&void 0===t.nextOffset);return(0,a.d4)((()=>{B?.({direction:i.Uq.Backwards})}),[B]),a.ZP.createElement(ne.Z,{isOpen:e&&!v,onClose:S,className:"ReactorListModal narrow",title:p("Reactions"),onCloseAnimationEnd:I},f&&a.ZP.createElement("div",{className:"Reactions",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{className:(0,ce.Z)(!C&&"chosen"),size:"tiny",ripple:!0,onClick:()=>b(void 0)},a.ZP.createElement("i",{className:"icon icon-heart"}),Boolean(t?.count)&&(0,$e.bi)(t.count)),A.map((e=>{const t=n?.results.find((t=>(0,r.Hl)(t.reaction,e)))?.count;return a.ZP.createElement(Y.Z,{key:(0,r.$d)(e),className:(0,ce.Z)((0,r.Hl)(C,e)&&"chosen"),size:"tiny",ripple:!0,onClick:()=>b(e)},a.ZP.createElement(as.Z,{reaction:e,className:"reaction-filter-emoji",availableReactions:d}),Boolean(t)&&(0,$e.bi)(t))}))),a.ZP.createElement("div",{dir:p.isRtl?"rtl":void 0,className:"reactor-list-wrapper"},L?.length?a.ZP.createElement(Qa.Z,{className:"reactor-list custom-scroll",items:L,onLoadMore:B},L?.flatMap((e=>{const n=P[e]||Z[e],s=t?.reactions.filter((t=>t.peerId===e)),i=[],o=c?.[e];return s?.forEach((t=>{C&&!(0,r.Hl)(t.reaction,C)||i.push(a.ZP.createElement(jn.Z,{key:`${e}-${(0,r.$d)(t.reaction)}`,className:"chat-item-clickable reactors-list-item",onClick:()=>N(e)},a.ZP.createElement(yt.Z,{peer:n,size:"medium"}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement(Cr.Z,{peer:n,withEmojiStatus:!0}),a.ZP.createElement("span",{className:"status",dir:"auto"},a.ZP.createElement("i",{className:"icon icon-heart-outline status-icon"}),(0,_e.$M)(p,1e3*t.addedDate))),t.reaction&&a.ZP.createElement(as.Z,{className:"reactors-list-emoji",reaction:t.reaction,availableReactions:d})))})),C||s?.length||i.push(a.ZP.createElement(jn.Z,{key:`${e}-seen-by`,className:"chat-item-clickable scroll-item small-icon",onClick:()=>N(e)},a.ZP.createElement(ns.Z,{userId:e,noStatusOrTyping:!0,avatarSize:"medium",status:o?(0,_e.$M)(p,1e3*o):void 0,statusIcon:"message-read"}))),i}))):a.ZP.createElement(hs.Z,null)),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:S},p("Close")))}))),fr=(0,a.X$)((0,s.c$)(((e,{activeEmojiInteraction:t})=>{const n=void 0!==t.animatedEffect&&(0,l.tHA)(e,t.animatedEffect);return{effectAnimationId:n?n.id:void 0}}))((({effectAnimationId:e,activeEmojiInteraction:t})=>{const{stopActiveEmojiInteraction:n}=(0,s.Sv)(),[i,o]=(0,k.Z)(!1),[r,l]=(0,k.Z)(!1),c=(0,a.sO)(),d=(0,T.Z)((()=>{o(),c.current&&clearTimeout(c.current),setTimeout((()=>{n({id:t.id})}),250)})),m=(0,T.Z)((e=>{e.target?.closest(".AnimatedEmoji")||d()}));(0,a.d4)((()=>(document.addEventListener("touchstart",m),document.addEventListener("touchmove",m),document.addEventListener("mousedown",m),document.addEventListener("wheel",m),()=>{document.removeEventListener("touchstart",m),document.removeEventListener("touchmove",m),document.removeEventListener("mousedown",m),document.removeEventListener("wheel",m)})),[m]),(0,a.bt)((()=>{const e=(0,w.YW)();c.current=setTimeout((()=>{d(),e()}),3e3)}),[d]);const u=e&&`sticker${e}`,h=(0,H.Z)(u,!e);if(!t.startSize)return;const Z=(t.startSize||0)/309;return a.ZP.createElement("div",{className:(0,ce.Z)("EmojiInteractionAnimation",i&&"hiding",r&&"playing",t.isReversed&&"reversed"),style:`--scale: ${Z}; --start-x: ${t.x}px; --start-y: ${t.y}px;`},a.ZP.createElement(Pi.Z,{key:`effect_${e}`,size:309,tgsUrl:h,play:!0,quality:g.wZ?.5:void 0,forceAlways:!0,noLoop:!0,onLoad:l}))}))),yr=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,messageId:n}=(0,l.jUK)(e).chatLanguageModal||{},a=(0,l.rB0)(e);return{chatId:t,messageId:n,activeTranslationLanguage:t?n?(0,l.Bdn)(e,t,n):(0,l.lpX)(e,t):void 0,currentLanguageCode:a}}))((({isOpen:e,chatId:t,messageId:n,activeTranslationLanguage:i,currentLanguageCode:r})=>{const{requestMessageTranslation:l,closeChatLanguageModal:c,setSettingOption:d,requestChatTranslation:m}=(0,s.Sv)(),[u,h]=(0,a.eJ)(""),Z=(0,M.Z)(),P=(0,T.Z)((e=>{t&&(n?l({chatId:t,id:n,toLanguageCode:e}):(d({translationLanguage:e}),m({chatId:t,toLanguageCode:e})),c())})),p=(0,T.Z)((e=>{h(e.target.value)})),v=(0,a.Ye)((()=>o.D$f.map((e=>({langCode:e,translatedName:new Intl.DisplayNames([r],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})))),[r]);(0,a.d4)((()=>{e||h("")}),[e]);const g=(0,a.Ye)((()=>u.trim()?v.filter((({langCode:e,translatedName:t,originalName:n})=>t.toLowerCase().includes(u.toLowerCase())||n.toLowerCase().includes(u.toLowerCase())||e.toLowerCase().includes(u.toLowerCase()))):v),[v,u]);return a.ZP.createElement(ne.Z,{className:"syvgWO0b6lIEPd3iu1TA",isSlim:!0,isOpen:e,hasCloseButton:!0,title:Z("Language"),onClose:c},a.ZP.createElement(us.Z,{key:"search",value:u,onChange:p,placeholder:Z("Search"),teactExperimentControlled:!0}),a.ZP.createElement("div",{className:(0,ce.Z)("DiSTH_4CZnPK8Dh8Tpfq","custom-scroll")},g.map((({langCode:e,originalName:t,translatedName:n})=>a.ZP.createElement(jn.Z,{key:e,className:(0,ce.Z)("_nKqEo7SgYwpaclSSCIx","no-icon"),secondaryIcon:i===e?"check":void 0,disabled:i===e,multiline:!0,narrow:!0,onClick:()=>P(e)},a.ZP.createElement("span",{className:(0,ce.Z)("title","R7LNh8TMqiktRuTuESsf")},(0,te.Z)(t,["highlight"],{highlight:u})),a.ZP.createElement("span",{className:(0,ce.Z)("subtitle","so4259O2hcdGOxENXdqc")},(0,te.Z)(n,["highlight"],{highlight:u})))))))})));var Ir=n(31711);function Sr(e){return(t,n)=>{const a=(0,l.jUK)(t),{byId:s}=t.chats,{byId:i}=t.users,{fetchingStatus:o,resultsByType:r,chatId:c}=a.globalSearch,d="audio"!==e?e:n?.isVoice?"voice":"audio",{byChatId:m}=t.messages,u=r?.[d]?.foundIds,h=a.activeDownloads.byChatId;return{theme:(0,l.Puy)(t),isLoading:void 0===u||!!o&&Boolean(o.chats||o.messages),chatsById:s,usersById:i,globalMessagesByChatId:m,foundIds:u,searchChatId:c,activeDownloads:h,isChatProtected:c?(0,l.Z1J)(t,c)?.isProtected:void 0,shouldWarnAboutSvg:t.settings.byKey.shouldWarnAboutSvg}}}var kr=n(91),Nr=n(54752),wr=n(47262);const Mr=(0,ue.P2)((e=>e()),500,!0),Tr=(0,a.X$)((0,s.c$)(Sr("audio"))((({theme:e,isVoice:t,searchQuery:n,isLoading:r,chatsById:l,usersById:c,globalMessagesByChatId:d,foundIds:m,activeDownloads:u})=>{const{searchMessagesGlobal:h,focusMessage:Z,openAudioPlayer:P}=(0,s.Sv)(),p=(0,M.Z)(),v=t?"voice":"audio",g=(0,a.I4)((({direction:e})=>{e===i.Uq.Backwards&&Mr((()=>{h({type:v})}))}),[v,h,n]),E=(0,a.Ye)((()=>m&&d?m.map((e=>{const[t,n]=e.split("_");return d[t]?.byId[Number(n)]})).filter(Boolean):Wn.D),[d,m]),C=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),b=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),f=(0,Po.Z)([n],o.Yan)&&!r;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Qa.Z,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:g,noFastList:!0},!f&&a.ZP.createElement(hs.Z,null),f&&(!m||0===m.length)&&a.ZP.createElement(wr.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),f&&m&&m.length>0&&E.map(((t,n)=>{const s=0===n,o=s||(0,_e.kj)(t.date)!==(0,_e.kj)(E[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:t.id},o&&a.ZP.createElement("p",{className:(0,ce.Z)("section-heading",s&&"section-heading-first",!s&&"section-heading-with-border"),dir:p.isRtl?"rtl":void 0},(0,_e.np)(p,new Date(1e3*t.date))),a.ZP.createElement(Nr.ZP,{key:t.id,theme:e,message:t,origin:i.Cr.Search,senderTitle:(0,kr.F)(p,t,l,c),date:t.date,className:"scroll-item",onPlay:b,onDateClick:C,canDownload:!l[t.chatId]?.isProtected&&!t.isProtected,isDownloading:u[t.chatId]?.ids?.includes(t.id)}))}))))}))),Ar=e=>{const t=(0,a.sO)(null),n=(0,a.I4)((n=>{"Enter"===n.key&&t.current===document.activeElement&&e()}),[e]);return(0,a.d4)((()=>(window.addEventListener("keydown",n,!1),()=>window.removeEventListener("keydown",n,!1))),[n]),t},Rr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t);if(!n)return{};const a=(0,r.zX)(n),s=a?(0,l.dyD)(e,a):void 0;return{chat:n,...a&&{privateChatUser:s}}}))((({message:e,searchQuery:t,chatId:n,chat:i,privateChatUser:o})=>{const{focusMessage:l}=(0,s.Sv)(),{isMobile:c}=(0,I.ZP)(),d=(0,r.bf)(e)?void 0:(0,r.DH)(e),m=(0,H.Z)((0,r.Ti)(e,"micro")),u=Boolean((0,r.Y5)(e)),Z=(0,T.Z)((()=>{l({chatId:n,messageId:e.id,shouldReplaceHistory:!0})})),P=(0,M.Z)(),p=Ar(Z);if(!i)return;const v=o||i;return a.ZP.createElement(jn.Z,{className:"ChatMessage chat-item-clickable",ripple:!c,onClick:Z,buttonRef:p},a.ZP.createElement(yt.Z,{peer:v,isSavedMessages:o?.isSelf}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement(Cr.Z,{peer:v,withEmojiStatus:!0,isSavedMessages:n===o?.id&&o?.isSelf}),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(so.Z,{className:"date"},(0,_e.VX)(P,1e3*e.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,i){if(!n)return(0,h.e)(e,t,void 0,s);const o=(0,r.NE)(t);return a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,ce.Z)("media-preview--image",i&&"round",o&&"media-preview-spoiler"),draggable:!1}),(0,r.b7)(t)&&a.ZP.createElement("i",{className:"icon icon-play"}),(0,h.e)(e,t,!0,s))}(P,e,m||d,t,u)))))}))),Lr=(0,a.X$)((({searchDate:e,onSelect:t})=>{const n=(0,a.Ye)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,_e.xH)(t)}]}const t=[],n=new Date,a=n.getFullYear(),s=n.getTime()>new Date(`${a}-${e}`).getTime()?a:a-1;for(let n=0;n<8;n++){const a=new Date(`${s-n}-${e}`);t.push({date:a,text:(0,_e.xH)(a)})}return t}(e)),[e]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},n.map((({date:e,text:n})=>a.ZP.createElement("div",{onClick:()=>t(e),className:"date-item",key:n},a.ZP.createElement("i",{className:"icon icon-calendar"}),a.ZP.createElement("span",null,n)))))})),Br=2*u.Gw,Fr=(0,a.X$)((0,s.c$)(((e,{chatId:t,topicId:n})=>{const a=(0,l.Z1J)(e,t),s=a?.topics?.[n];return{topic:s}}))((({topicId:e,topic:t,onClick:n})=>{const s=(0,a.I4)((()=>{n(e)}),[e,n]),i=Ar(s);if(t)return a.ZP.createElement(jn.Z,{className:"chat-item-clickable search-result",onClick:s,buttonClassName:"topic-item",buttonRef:i},a.ZP.createElement(Ps.Z,{size:Br,topic:t,className:"topic-icon",letterClassName:"topic-icon-letter"}),a.ZP.createElement("div",{dir:"auto",className:"fullName"},(0,te.Z)(t.title)))}))),xr=(0,ue.P2)((e=>e()),500,!0),Dr=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a}}=e,{fetchingStatus:s,resultsByType:i,foundTopicIds:o,chatId:r}=(0,l.jUK)(e).globalSearch,{foundIds:c}=i?.text||{};return{currentUserId:n,foundIds:c,globalMessagesByChatId:a,chatsById:t,fetchingStatus:s,foundTopicIds:o,searchChatId:r}}))((({searchQuery:e,dateSearchQuery:t,foundIds:n,globalMessagesByChatId:o,chatsById:r,fetchingStatus:l,foundTopicIds:c,searchChatId:d,onSearchDateSelect:m,onReset:u})=>{const{searchMessagesGlobal:Z,openThread:P}=(0,s.Sv)(),p=(0,M.Z)(),{isMobile:v}=(0,I.ZP)(),g=(0,a.I4)((({direction:e})=>{e===i.Uq.Backwards&&xr((()=>{Z({type:"text"})}))}),[e]),E=(0,a.I4)((e=>{d&&(P({chatId:d,threadId:e,shouldReplaceHistory:!0}),v||u())}),[d,v,u]),C=(0,a.Ye)((()=>n&&0!==n.length?n.map((e=>{const[t,n]=e.split("_");return o?.[t]?.byId[Number(n)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Wn.D),[n,o]),b=l&&!l.chats&&!l.messages&&!C.length&&!c?.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Qa.Z,{className:"search-content custom-scroll chat-list",items:C,onLoadMore:g,noFastList:!0},t&&a.ZP.createElement("div",{className:"chat-selection no-scrollbar"},a.ZP.createElement(Lr,{searchDate:t,onSelect:m})),b&&a.ZP.createElement(wr.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),Boolean(c?.length)&&a.ZP.createElement("div",{className:"pb-2"},a.ZP.createElement("h3",{className:"section-heading topic-search-heading",dir:p.isRtl?"auto":void 0},p("Topics")),c.map((e=>a.ZP.createElement(Fr,{chatId:d,topicId:e,onClick:E})))),Boolean(C.length)&&a.ZP.createElement("div",{className:"pb-2"},a.ZP.createElement("h3",{className:"section-heading topic-search-heading",dir:p.isRtl?"auto":void 0},p("SearchMessages")),C.map((function(t){const n=(0,h.e)(p,t),s=r[t.chatId];if(n&&s)return a.ZP.createElement(Rr,{chatId:t.chatId,message:t,searchQuery:e})})))))})));var Or=n(16974),Ur=n(41470),_r=n(50742),$r=n(79347);const jr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),a=n&&(0,r.zX)(n);return{chat:n,user:a?(0,l.dyD)(e,a):void 0,isPinned:(0,l.epB)(e,t),isMuted:n?(0,r.i4)(n,(0,l.dZI)(e),(0,l.NJL)(e)):void 0,canChangeFolder:Boolean(e.chatFolders.orderedIds?.length)}}))((({chatId:e,withUsername:t,onClick:n,chat:s,user:o,isPinned:l,isMuted:c,canChangeFolder:d})=>{const[m,u,h]=(0,k.Z)(),[Z,P,p]=(0,k.Z)(),[v,g,E]=(0,k.Z)(),[C,b,f]=(0,k.Z)(),y=(0,a.I4)((()=>{g(),P()}),[g,P]),I=(0,a.I4)((()=>{b(),u()}),[b,u]),S=(0,Ur.Z)({chat:s,user:o,isPinned:l,isMuted:c,canChangeFolder:d,handleMute:I,handleChatFolderChange:y},!0),N=(0,a.I4)((()=>{n(e)}),[e,n]),w=Ar(N);if(s)return a.ZP.createElement(jn.Z,{className:"chat-item-clickable search-result",onClick:N,contextActions:S,buttonRef:w},(0,r.YC)(e)?a.ZP.createElement(ns.Z,{userId:e,withUsername:t,withStory:!0,avatarSize:"large",storyViewerOrigin:i.ze.SearchResult}):a.ZP.createElement(Zs.Z,{chatId:e,withUsername:t,avatarSize:"large",withStory:!0,storyViewerOrigin:i.ze.SearchResult}),C&&a.ZP.createElement($r.Z,{isOpen:m,onClose:h,onCloseAnimationEnd:f,chatId:e}),v&&a.ZP.createElement(_r.Z,{isOpen:Z,onClose:p,onCloseAnimationEnd:E,chatId:e}))}))),Vr=(0,ue.P2)((e=>e()),6e4,!0),Gr=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}))((({topUserIds:e,usersById:t,recentlyFoundChatIds:n,onReset:i})=>{const{loadTopUsers:o,openChat:l,addRecentlyFoundChatId:c,clearRecentlyFoundChats:d}=(0,s.Sv)(),m=(0,a.sO)(null);(0,a.d4)((()=>{Vr((()=>{o()}))}),[o]),(0,Zo.Z)(m,!e);const u=(0,a.I4)((e=>{l({id:e,shouldReplaceHistory:!0}),i(),setTimeout((()=>{c({id:e})}),250)}),[l,c,i]),h=(0,a.I4)((()=>{d()}),[d]),Z=(0,M.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},e&&a.ZP.createElement("div",{className:"top-peers-section",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:m,className:"top-peers"},e.map((e=>a.ZP.createElement("div",{key:e,className:"top-peer-item",onClick:()=>u(e),dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(yt.Z,{peer:t[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,te.Z)((0,r.Vl)(t[e])||" "))))))),n&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:(0,ce.Z)("section-heading mt-0 recent-chats-header",!e&&"without-border"),dir:Z.isRtl?"rtl":void 0},Z("Recent"),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:h,isRtl:Z.isRtl},a.ZP.createElement("i",{className:"icon icon-close"}))),n.map((e=>a.ZP.createElement(jr,{chatId:e,onClick:u})))))}))),Hr=(0,ue.P2)((e=>e()),500,!1),Jr=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{userIds:n}=e.contactList||{},{currentUserId:a,messages:s}=e;if(!n)return{chatsById:t};const{fetchingStatus:i,globalResults:o,localResults:r,resultsByType:c}=(0,l.jUK)(e).globalSearch,{chatIds:d,userIds:m}=o||{},{chatIds:u,userIds:h}=r||{},{byChatId:Z}=s,P=c?.text?.foundIds;return{currentUserId:a,contactIds:n,accountChatIds:u,accountUserIds:h,globalChatIds:d,globalUserIds:m,foundIds:P,globalMessagesByChatId:Z,chatsById:t,fetchingStatus:i}}))((({searchQuery:e,searchDate:t,dateSearchQuery:n,currentUserId:l,contactIds:c,accountChatIds:d,accountUserIds:m,globalChatIds:u,globalUserIds:Z,foundIds:P,globalMessagesByChatId:p,chatsById:v,fetchingStatus:g,onReset:E,onSearchDateSelect:C})=>{const{openChat:b,addRecentlyFoundChatId:f,searchMessagesGlobal:y,setGlobalSearchChatId:S}=(0,s.Sv)(),k=(0,a.sO)(null),N=(0,M.Z)(),{isMobile:w}=(0,I.ZP)(),[T,A]=(0,a.eJ)(!1),[R,L]=(0,a.eJ)(!1),B=(0,a.I4)((({direction:e})=>{e===i.Uq.Backwards&&Hr((()=>{y({type:"text"})}))}),[e]),F=(0,a.I4)((e=>{b({id:e,shouldReplaceHistory:!0}),e!==l&&f({id:e}),w||E()}),[b,l,w,f,E]),x=(0,a.I4)((e=>{S({id:e})}),[S]),D=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return Wn.D;const t=[...l?[l]:[],...c||[]],n=(0,s.Rd)().users.byId,a=(0,r.kK)(t,n,e,l,N("SavedMessages")),i=(0,Or.gO)(o.NfV)??[],u=(0,r.$l)(N,i,v,e,l),h=(0,Kn.Tw)([...a,...u]),Z=(0,Kn.Tw)([...d??[],...m??[]].filter((e=>!h.includes(e))));return[...(0,r.ih)(h,v,void 0,l?[l]:void 0),...(0,r.ih)(Z,v)]}),[e,l,c,N,d,m,v]);(0,Zo.Z)(k,!D.length,!0);const O=(0,a.Ye)((()=>!e||e.length<4||!u||!Z?Wn.D:(0,r.ih)((0,Kn.Tw)([...u,...Z]),v,!0)),[v,u,Z,e]),U=(0,a.Ye)((()=>(e||t)&&P&&0!==P.length?P.map((e=>{const[t,n]=e.split("_");return p?.[t]?.byId[Number(n)]})).filter(Boolean):Wn.D),[P,p,e,t]),_=(0,a.I4)((()=>{A(!T)}),[T]),$=(0,a.I4)((()=>{L(!R)}),[R]),j=g&&!g.chats&&!g.messages&&!D.length&&!O.length&&!U.length;return e||t?a.ZP.createElement(Qa.Z,{className:"LeftSearch custom-scroll",items:U,onLoadMore:B,noScrollRestoreOnTop:!0,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-scrollbar"},a.ZP.createElement(Lr,{searchDate:n,onSelect:C})),j&&a.ZP.createElement(wr.Z,{text:N("ChatList.Search.NoResults"),description:N("ChatList.Search.NoResultsDescription")}),Boolean(D.length)&&a.ZP.createElement("div",{className:"chat-selection no-scrollbar",dir:N.isRtl?"rtl":void 0,ref:k},D.map((e=>a.ZP.createElement(er.Z,{peerId:e,onClick:x,clickArg:e})))),Boolean(D.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:N.isRtl?"auto":void 0},D.length>5&&a.ZP.createElement(so.Z,{className:"Link",onClick:_},N(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),N("DialogList.SearchSectionDialogs")),D.map(((e,t)=>{if(T||!(t>=5))return a.ZP.createElement(jr,{chatId:e,onClick:F})}))),Boolean(O.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:N.isRtl?"auto":void 0},O.length>5&&a.ZP.createElement(so.Z,{className:"Link",onClick:$},N(R?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),N("DialogList.SearchSectionGlobal")),O.map(((e,t)=>{if(R||!(t>=5))return a.ZP.createElement(jr,{chatId:e,withUsername:!0,onClick:F})}))),Boolean(U.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:N.isRtl?"auto":void 0},N("SearchMessages")),U.map((function(t){const n=(0,h.e)(N,t),s=v[t.chatId];if(n&&s)return a.ZP.createElement(Rr,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(Gr,{onReset:E})})));var zr=n(82535);const Xr="documents",Yr=(0,ue.P2)((e=>e()),500,!0),qr=(0,a.X$)((0,s.c$)(Sr(Xr))((({searchQuery:e,isLoading:t,chatsById:n,usersById:l,globalMessagesByChatId:c,foundIds:d,activeDownloads:m,shouldWarnAboutSvg:u})=>{const{searchMessagesGlobal:h,focusMessage:Z}=(0,s.Sv)(),P=(0,a.sO)(null),p=(0,M.Z)(),{observe:v}=(0,vo.S1)({rootRef:P,throttleMs:500}),g=(0,a.I4)((({direction:e})=>{e===i.Uq.Backwards&&Yr((()=>{h({type:Xr})}))}),[e]),E=(0,a.Ye)((()=>d&&c?d.map((e=>{const[t,n]=e.split("_"),a=c[t]?.byId[Number(n)];return a&&(0,r.aE)(a)?a:void 0})).filter(Boolean):Wn.D),[c,d]),C=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),b=(0,Po.Z)([e],o.Yan)&&!t;return a.ZP.createElement("div",{ref:P,className:"LeftSearch"},a.ZP.createElement(Qa.Z,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:g,noFastList:!0},!b&&a.ZP.createElement(hs.Z,null),b&&(!d||0===d.length)&&a.ZP.createElement(wr.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),b&&d&&d.length>0&&E.map(((e,t)=>{const s=0===t,i=s||(0,_e.kj)(e.date)!==(0,_e.kj)(E[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},i&&a.ZP.createElement("p",{className:(0,ce.Z)("section-heading",s&&"section-heading-first",!s&&"section-heading-with-border"),dir:p.isRtl?"rtl":void 0},(0,_e.np)(p,new Date(1e3*e.date))),a.ZP.createElement(zr.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,kr.F)(p,e,n,l),className:"scroll-item",isDownloading:m[e.chatId]?.ids?.includes(e.id),shouldWarnAboutSvg:u,observeIntersection:v,onDateClick:C}))}))))})));var Kr=n(45418);const Wr="links",Qr=(0,ue.P2)((e=>e()),500,!0),el=(0,a.X$)((0,s.c$)(Sr(Wr))((({searchQuery:e,isLoading:t,chatsById:n,usersById:r,globalMessagesByChatId:l,foundIds:c,isChatProtected:d})=>{const{searchMessagesGlobal:m,focusMessage:u}=(0,s.Sv)(),h=(0,a.sO)(null),Z=(0,M.Z)(),{observe:P}=(0,vo.S1)({rootRef:h,throttleMs:500}),p=(0,a.I4)((({direction:e})=>{e===i.Uq.Backwards&&Qr((()=>{m({type:Wr})}))}),[e]),v=(0,a.Ye)((()=>c&&l?c.map((e=>{const[t,n]=e.split("_");return l[t]?.byId[Number(n)]})).filter(Boolean):Wn.D),[l,c]),g=(0,a.I4)(((e,t)=>{u({chatId:t,messageId:e})}),[u]),E=(0,Po.Z)([e],o.Yan)&&!t;return a.ZP.createElement("div",{ref:h,className:"LeftSearch"},a.ZP.createElement(Qa.Z,{className:"search-content documents-list custom-scroll",items:v,onLoadMore:p,noFastList:!0},!E&&a.ZP.createElement(hs.Z,null),E&&(!c||0===c.length)&&a.ZP.createElement(wr.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),E&&c&&c.length>0&&v.map(((e,t)=>{const s=0===t,i=s||(0,_e.kj)(e.date)!==(0,_e.kj)(v[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:Z.isRtl?"rtl":void 0,key:e.id},i&&a.ZP.createElement("p",{className:(0,ce.Z)("section-heading",s&&"section-heading-first",!s&&"section-heading-with-border"),dir:Z.isRtl?"rtl":void 0},(0,_e.np)(Z,new Date(1e3*e.date))),a.ZP.createElement(Kr.Z,{key:e.id,message:e,senderTitle:(0,kr.F)(Z,e,n,r),isProtected:d||e.isProtected,observeIntersection:P,onMessageClick:g}))}))))})));var tl=n(13709);const nl="media",al=(0,ue.P2)((e=>e()),500,!0),sl=(0,a.X$)((0,s.c$)(Sr(nl))((({searchQuery:e,isLoading:t,globalMessagesByChatId:n,foundIds:r,isChatProtected:l})=>{const{searchMessagesGlobal:c,openMediaViewer:d}=(0,s.Sv)(),m=(0,a.sO)(null),u=(0,M.Z)(),{observe:h}=(0,vo.S1)({rootRef:m,throttleMs:500}),Z=(0,a.I4)((({direction:e})=>{e===i.Uq.Backwards&&al((()=>{c({type:nl})}))}),[c,e]),P=(0,a.Ye)((()=>r&&n?r.map((e=>{const[t,a]=e.split("_");return n[t]?.byId[Number(a)]})).filter(Boolean):Wn.D),[n,r]),p=(0,a.I4)(((e,t)=>{d({chatId:t,mediaId:e,origin:i.bZ.SearchResult})}),[d]),v=(0,Po.Z)([e],o.Yan)&&!t,g=v&&r&&r.length>0&&!e,E=v&&r&&r.length>0&&e,C=(0,ce.Z)("search-content custom-scroll",E&&"chat-list");return a.ZP.createElement("div",{ref:m,className:"LeftSearch"},a.ZP.createElement(Qa.Z,{className:C,items:P,itemSelector:e?".ListItem":".Media",onLoadMore:Z,noFastList:!0},!v&&a.ZP.createElement(hs.Z,null),v&&(!r||0===r.length)&&a.ZP.createElement(wr.Z,{text:u("ChatList.Search.NoResults"),description:u("ChatList.Search.NoResultsDescription")}),g&&a.ZP.createElement("div",{className:"media-list",dir:u.isRtl?"rtl":void 0},P.map((e=>a.ZP.createElement(tl.Z,{key:`${e.chatId}-${e.id}`,idPrefix:"search-media",message:e,isProtected:l||e.isProtected,observeIntersection:h,onClick:p})))),E&&P.map((e=>a.ZP.createElement(Rr,{key:e.id,chatId:e.chatId,message:e})))))}))),il=[{type:i.nJ.ChatList,title:"SearchAllChatsShort"},{type:i.nJ.Media,title:"SharedMediaTab2"},{type:i.nJ.Links,title:"SharedLinksTab2"},{type:i.nJ.Files,title:"SharedFilesTab2"},{type:i.nJ.Music,title:"SharedMusicTab2"},{type:i.nJ.Voice,title:"SharedVoiceTab2"}],ol=[{type:i.nJ.ChatList,title:"All Messages"},...il.slice(1)],rl=Object.keys(i.nJ).length/2,ll=(0,a.X$)((0,s.c$)((e=>{const{currentContent:t,chatId:n}=(0,l.jUK)(e).globalSearch;return{currentContent:t,chatId:n}}))((({searchQuery:e,searchDate:t,isActive:n,currentContent:o=i.nJ.ChatList,chatId:r,onReset:l})=>{const{setGlobalSearchContent:c,setGlobalSearchDate:d}=(0,s.Sv)(),m=(0,M.Z)(),[u,h]=(0,a.eJ)(o),Z=(0,a.Ye)((()=>(0,_e.xk)(e)),[e]),P=(0,a.I4)((e=>{const t=il[e];c({content:t.type}),h(e)}),[c]),p=(0,a.I4)((e=>{d({date:e.getTime()/1e3})}),[d]);(0,pe.Z)({isActive:n,onBack:l});const v=(0,a.sO)(null),g=(0,ms.Z)(v,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:v,onKeyDown:g},a.ZP.createElement(Ir.Z,{activeTab:u,tabs:r?ol:il,onSwitchTab:P}),a.ZP.createElement(K.ZP,{name:m.isRtl?"slideOptimizedRtl":"slideOptimized",renderCount:rl,activeKey:o},(()=>{switch(o){case i.nJ.ChatList:return r?a.ZP.createElement(Dr,{searchQuery:e,dateSearchQuery:Z,onReset:l,onSearchDateSelect:p}):a.ZP.createElement(Jr,{searchQuery:e,searchDate:t,dateSearchQuery:Z,onReset:l,onSearchDateSelect:p});case i.nJ.Media:return a.ZP.createElement(sl,{searchQuery:e});case i.nJ.Links:return a.ZP.createElement(el,{searchQuery:e});case i.nJ.Files:return a.ZP.createElement(qr,{searchQuery:e});case i.nJ.Music:return a.ZP.createElement(Tr,{key:"audio",searchQuery:e});case i.nJ.Voice:return a.ZP.createElement(Tr,{key:"voice",isVoice:!0,searchQuery:e});default:return}})()))})));var cl=n(91090);const dl={currentPassword:"",password:"",hint:"",email:""},ml=(e,t)=>{switch(t.type){case"setCurrentPassword":return{...e,currentPassword:t.payload};case"setPassword":return{...e,password:t.payload};case"setHint":return{...e,hint:t.payload};case"setEmail":return{...e,email:t.payload};case"reset":return dl;default:return e}};var ul=n(53455),hl=n(95616);const Zl=(0,a.X$)((0,s.c$)((e=>({maxChats:(0,Qs.M)(e,"dialogFiltersChats")})))((({mode:e,chatIds:t,selectedIds:n,selectedChatTypes:i,filterValue:o,shouldHideChatTypes:l,onSelectedIdsChange:c,onSelectedChatTypesChange:d,onFilterChange:m,maxChats:u,onSaveFilter:h,isActive:P})=>{const{openLimitReachedModal:p}=(0,s.Sv)(),v=(0,a.sO)(null),g="included"===e?ul.fi:ul.Yy,E=n.length+i.length>10,[C,b]=(0,a.eJ)(!1);(0,a.d4)((()=>{P||b(!1)}),[P]),(0,a.d4)((()=>{setTimeout((()=>{(0,Z.WM)((()=>{v.current.focus()}))}),500)}),[]);const f=(0,a.I4)((t=>{const a=[...n];if(a.includes(t))a.splice(a.indexOf(t),1);else{if(n.length>=u&&"included"===e)return void p({limit:"dialogFiltersChats"});a.push(t)}b(!0),c(a)}),[n,c,u,e,p]),y=(0,a.I4)((e=>{const t=[...i];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),b(!0),d(t)}),[i,d]),I=(0,a.I4)((e=>{const{value:t}=e.currentTarget;m(t)}),[m]),S=(0,M.Z)(),[k,N]=(0,cs.Z)(void 0,t,Boolean(o));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},i.map((function(e){const t=g.find((({key:t})=>e===t));if(t)return a.ZP.createElement(er.Z,{icon:t.icon,title:S(t.title),isMinimized:E,canClose:!0,onClick:y,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(er.Z,{peerId:e,isMinimized:E&&t<n.length-5,canClose:!0,onClick:f,clickArg:e}))),a.ZP.createElement(us.Z,{ref:v,value:o,onChange:I,placeholder:S("Search")})),a.ZP.createElement(Qa.Z,{className:"picker-list custom-scroll fab-padding-bottom",itemSelector:".chat-item",items:k,onLoadMore:N},(!k||!k.length||k.includes(t[0]))&&a.ZP.createElement("div",{key:"header"},!l&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("FilterChatTypes")),g.map((function(e){return a.ZP.createElement(jn.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>y(e.key),ripple:!0},a.ZP.createElement("i",{className:(0,ce.Z)("icon",`icon-${e.icon}`)}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},S(e.title)),a.ZP.createElement(As.Z,{label:"",checked:i.includes(e.key),round:!0}))})),a.ZP.createElement("div",{className:"picker-list-divider"})),a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("FilterChats"))),k?.length?k.map((function(e){const t=n.includes(e);return a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>f(e),ripple:!0},(0,r.YC)(e)?a.ZP.createElement(ns.Z,{userId:e}):a.ZP.createElement(Zs.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(As.Z,{label:"",checked:t,round:!0}))})):k&&!k.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(hs.Z,{key:"loading"})),a.ZP.createElement(na.Z,{isShown:C,onClick:h,ariaLabel:S("Save")},a.ZP.createElement("i",{className:"icon icon-check"})))}))),Pl=(0,a.X$)((({mode:e,state:t,dispatch:n,isActive:i,onReset:l,onSaveFilter:c})=>{const{chatFilter:d}=t,{selectedChatIds:m,selectedChatTypes:u}=(0,ul.vb)(t,e,!0),h=(0,M.Z)(),Z=(0,hl.d7)(o.NfV),P=(0,hl.d7)(o.WSp),p=t.folder.isChatList,v=(0,a.Ye)((()=>{const e=(0,s.Rd)().chats.byId,t=[...Z||[],...P||[]];return(0,Kn.Tw)([...m,...(0,r.$l)(h,t,e,d)])}),[Z,P,m,h,d]),g=(0,a.I4)((e=>{n({type:"setChatFilter",payload:e})}),[n]),E=(0,a.I4)((a=>{n("included"===e?{type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:a}}:{type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:a}})}),[e,t,n]),C=(0,a.I4)((t=>{const a={};t.forEach((e=>{a[e]=!0})),n("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:m,...a}}:{type:"setExcludeFilters",payload:{excludedChatIds:m,...a}})}),[e,m,n]);return(0,pe.Z)({isActive:i,onBack:l}),v?a.ZP.createElement(Zl,{mode:e,chatIds:v,selectedIds:m,selectedChatTypes:u,filterValue:d,shouldHideChatTypes:p,onSelectedIdsChange:E,onSelectedChatTypesChange:C,onFilterChange:g,onSaveFilter:c,isActive:i}):a.ZP.createElement(hs.Z,null)}));var pl=n(57773),vl=n(58912),gl=n(61607);const El="Please provide a title for this folder.",Cl="ChatList.Filter.Error.Empty",bl=(0,a.X$)((0,s.c$)(((e,{state:t})=>{const{listIds:n}=e.chats,{byId:a,invites:s}=e.chatFolders,i=Object.values(a).reduce(((e,t)=>e+(t.isChatList?1:0)),0);return{loadedActiveChatIds:n.active,loadedArchivedChatIds:n.archived,invites:t.folderId?s[t.folderId]||Wn.D:void 0,isRemoved:void 0!==t.folderId&&!a[t.folderId],maxInviteLinks:(0,Qs.M)(e,"chatlistInvites"),maxChatLists:(0,Qs.M)(e,"chatlistJoined"),chatListCount:i}}))((({state:e,dispatch:t,onAddIncludedChats:n,onAddExcludedChats:i,onShareFolder:c,onOpenInvite:d,isActive:m,onReset:u,isRemoved:h,onBack:Z,loadedActiveChatIds:P,isOnlyInvites:p,loadedArchivedChatIds:v,invites:g,maxInviteLinks:E,maxChatLists:C,chatListCount:b,onSaveFolder:f})=>{const{loadChatlistInvites:y,openLimitReachedModal:I,showNotification:S}=(0,s.Sv)(),k="create"===e.mode,N=e.folder.isChatList,[w,T]=(0,a.eJ)(!1),[A,R]=(0,a.eJ)(!1);(0,a.d4)((()=>{h&&u()}),[h,u]),(0,a.d4)((()=>{m&&e.folderId&&e.folder.isChatList&&y({folderId:e.folderId})}),[m,e.folder.isChatList,e.folderId]);const{selectedChatIds:L,selectedChatTypes:B}=(0,ul.vb)(e,"included"),{selectedChatIds:F,selectedChatTypes:x}=(0,ul.vb)(e,"excluded");(0,a.d4)((()=>{T(!1),R(!1)}),[e.folderId]);const[D,O]=(0,a.Ye)((()=>{const e=new Set([...P||[],...v||[]]),t=(0,Kn.eL)(L,e),n=(0,Kn.eL)(F,e);return[w?t:t.slice(0,5-B.length),A?n:n.slice(0,5-x.length)]}),[F,L,B,x,A,w,P,v]),U=(0,M.Z)();(0,pe.Z)({isActive:m,onBack:Z});const _=(0,a.I4)((e=>{const{currentTarget:n}=e;t({type:"setTitle",payload:n.value.trim()})}),[t]),$=(0,a.I4)((()=>{t({type:"setIsLoading",payload:!0}),f((()=>{setTimeout((()=>{u()}),500)}))}),[t,f,u]),j=(0,a.I4)((()=>{g?(0,l.yEv)((0,s.Rd)(),e.folderId)?b>=C&&!e.folder.isChatList?I({limit:"chatlistJoined"}):g.length<E?e.isTouched?f(c):c():I({limit:"chatlistInvites"}):S({message:U("ChatList.Filter.InviteLink.IncludeExcludeError")}):k&&f(c)}),[g,e.folderId,e.isTouched,b,E,k,f,c,U,C,e.folder.isChatList]),V=(0,a.I4)(((t,n)=>{e.isTouched?f((()=>d(n))):d(n)}),[f,d,e.isTouched]);function G(e){const t="included"===e?B:x,n="included"===e?D:O,s="included"===e?w:A,i=("included"===e?L:F).length-n.length,o="included"===e?()=>T(!0):()=>R(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?ul.fi.find((({key:t})=>t===e)):ul.Yy.find((({key:t})=>t===e));if(n)return a.ZP.createElement(jn.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},U(n.title))}(t,e))),n.map((e=>a.ZP.createElement(jn.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,r.YC)(e)?a.ZP.createElement(ns.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Zs.Z,{avatarSize:"small",chatId:e})))),!s&&i>0&&a.ZP.createElement(gl.Z,{count:i,itemName:"chat",onClick:o}))}return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(vl.Z,{size:o.kuM,tgsUrl:pl.l.FoldersNew,play:String(e.folderId),className:"settings-content-icon"}),k&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:U.isRtl?"rtl":void 0},U("FilterIncludeInfo")),a.ZP.createElement(us.Z,{className:"mb-0",label:U("FilterNameHint"),value:e.folder.title,onChange:_,error:e.error&&e.error===El?El:void 0})),!p&&a.ZP.createElement("div",{className:"settings-item pt-3"},e.error&&e.error===Cl&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:U.isRtl?"rtl":void 0},U(e.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:U.isRtl?"rtl":void 0},U("FilterInclude")),a.ZP.createElement(jn.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:n},U("FilterAddChats")),G("included")),!p&&!N&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:U.isRtl?"rtl":void 0},U("FilterExclude")),a.ZP.createElement(jn.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:i},U("FilterAddChats")),G("excluded")),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:U.isRtl?"rtl":void 0},U("FolderLinkScreen.Title")),a.ZP.createElement(jn.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:j},U("ChatListFilter.CreateLinkNew")),g?.map((e=>a.ZP.createElement(jn.Z,{className:"settings-folders-list-item mb-0",icon:"link",multiline:!0,onClick:V,clickArg:e.url},a.ZP.createElement("span",{className:"title",dir:"auto"},e.title||e.url),a.ZP.createElement("span",{className:"subtitle"},U("ChatListFilter.LinkLabelChatCount",e.peerIds.length,"i"))))))),a.ZP.createElement(na.Z,{isShown:Boolean(e.isTouched),disabled:e.isLoading,onClick:$,ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))})));var fl=n(94913);const yl=(0,ue.P2)((e=>e()),6e4,!0),Il=(0,a.X$)((0,s.c$)((e=>{const{orderedIds:t,byId:n,recommended:a}=e.chatFolders;return{folderIds:t,foldersById:n,isPremium:(0,l.wVz)(e),recommendedChatFolders:a,maxFolders:(0,Qs.M)(e,"dialogFilters")}}))((({isActive:e,onCreateFolder:t,onEditFolder:n,onReset:i,folderIds:l,foldersById:c,isPremium:d,recommendedChatFolders:m,maxFolders:u})=>{const{loadRecommendedChatFolders:h,addChatFolder:Z,openLimitReachedModal:P,openDeleteChatFolderModal:p,sortChatFolders:v}=(0,s.Sv)(),[g,E]=(0,a.eJ)({orderedFolderIds:l,dragOrderIds:l,draggedIndex:void 0}),C=(0,D.Z)(l);(0,a.d4)((()=>{C!==l&&E({orderedFolderIds:l,dragOrderIds:l,draggedIndex:void 0})}),[C,l,g.orderedFolderIds?.length]),(0,a.d4)((()=>{yl((()=>{h()}))}),[h]);const b=(0,a.I4)((()=>{Object.keys(c).length>=u-1?P({limit:"dialogFilters"}):t()}),[c,u,t,P]),f=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:i});const y=(0,hl.mE)(),I=(0,a.Ye)((()=>{if(l)return l.length<=1?Wn.D:l.map((e=>{const t=c[e];return e===o.NfV?{id:e,title:f("FilterAllChats")}:{id:t.id,title:t.title,subtitle:(0,r.SB)(f,t,y[t.id]),isChatList:t.isChatList}}))}),[l,c,f,y]),S=(0,a.I4)((e=>{Object.keys(c).length>=u-1?P({limit:"dialogFilters"}):Z({folder:e})}),[c,u,Z,P]),k=(0,a.I4)(((e,t)=>{const n=Math.round(e.y/68),a=g.orderedFolderIds?.indexOf(t)||0,s=g.orderedFolderIds?.filter((e=>e!==t));s&&(0,me.Kh)(a+n,0,l?.length||0)&&(s.splice(a+n+(d?0:1),0,t),E((e=>({...e,draggedIndex:a,dragOrderIds:s}))))}),[l?.length,d,g.orderedFolderIds]),N=(0,a.I4)((()=>{E((e=>(v({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0})))}),[v]),w=(0,a.Ye)((()=>!d||Object.keys(c).length<u-1),[c,d,u]);return a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(vl.Z,{size:o.kuM,tgsUrl:pl.l.FoldersAll,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},f("CreateNewFilterInfo")),w&&a.ZP.createElement(Y.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:b,isRtl:f.isRtl},a.ZP.createElement("i",{className:"icon icon-add"}),f("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:f.isRtl?"rtl":void 0},f("Filters")),a.ZP.createElement("div",{className:"settings-sortable-container",style:`height: ${68*(l?.length||0)}px`},I?.length?I.map(((t,s)=>{const i=s>u-1,r=g.draggedIndex===s,l=68*(g.orderedFolderIds?.indexOf(t.id)??0),m=68*(g.dragOrderIds?.indexOf(t.id)??0);return t.id===o.NfV?a.ZP.createElement(fl.Z,{key:t.id,id:t.id,onDrag:k,onDragEnd:N,style:`top: ${r?l:m}px;`,knobStyle:(f.isRtl?"left":"right")+": 0.375rem;",isDisabled:!d||!e},a.ZP.createElement(jn.Z,{key:t.id,className:"drag-item mb-2 no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0},a.ZP.createElement("span",{className:"title"},t.title),a.ZP.createElement("span",{className:"subtitle"},f("FoldersAllChatsDesc")))):a.ZP.createElement(fl.Z,{key:t.id,id:t.id,onDrag:k,onDragEnd:N,style:`top: ${r?l:m}px;`,knobStyle:(f.isRtl?"left":"right")+": 3rem;",isDisabled:i||!e},a.ZP.createElement(jn.Z,{className:"drag-item mb-2 no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{p({folderId:t.id})},destructive:!0,title:f("Delete"),icon:"delete"}],onClick:()=>{i?P({limit:"dialogFilters"}):n(c[t.id])}},a.ZP.createElement("span",{className:"title"},(0,te.Z)(t.title,["emoji"]),i&&a.ZP.createElement("i",{className:"icon icon-lock-badge settings-folders-blocked-icon"})),a.ZP.createElement("span",{className:"subtitle"},t.isChatList&&a.ZP.createElement("i",{className:"icon icon-link mr-1"}),t.subtitle)))})):I&&!I.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(hs.Z,null))),m&&Boolean(m.length)&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:f.isRtl?"rtl":void 0},f("FilterRecommended")),m.map((e=>a.ZP.createElement(jn.Z,{className:"mb-2",narrow:!0,onClick:()=>S(e)},a.ZP.createElement("div",{className:"settings-folders-recommended-item"},a.ZP.createElement("div",{className:"multiline-item"},a.ZP.createElement("span",{className:"title"},(0,te.Z)(e.title,["emoji"])),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement(Y.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:f.isRtl},f("Add"))))))))}))),Sl=(0,a.X$)((0,s.c$)((e=>{const{folderId:t,url:n,isLoading:a}=(0,l.jUK)(e).shareFolderScreen||{},s=t?(0,l.MwT)(e,t):void 0,i=t?e.chatFolders.invites[t]?.find((e=>e.url===n)):void 0;return{folderId:t,title:s?.title,includedChatIds:s?.includedChatIds,pinnedChatIds:s?.pinnedChatIds,url:n,isLoading:a,peerIds:i?.peerIds}}))((({isActive:e,onReset:t,folderId:n,title:i,includedChatIds:c,pinnedChatIds:d,peerIds:m,url:u,isLoading:h})=>{const{createChatlistInvite:Z,deleteChatlistInvite:P,editChatlistInvite:p,showNotification:v}=(0,s.Sv)(),g=(0,M.Z)(),[E,C]=(0,a.eJ)(!1);(0,pe.Z)({isActive:e,onBack:t}),(0,a.d4)((()=>{h||C(!1)}),[h]),(0,a.d4)((()=>{!u&&n&&e&&Z({folderId:n})}),[n,e,u]);const b=(0,T.Z)((()=>{u&&n&&(P({folderId:n,url:u}),t())})),f=(0,a.Ye)((()=>(c||[]).concat(d||[])),[c,d]),[y,I]=(0,a.Ye)((()=>{const e=(0,s.Rd)();return(0,Kn.uK)(f,(t=>(0,l.CT6)(e,t)))}),[f]),[S,k]=(0,a.eJ)(m||[]),N=(0,a.sO)(!0);(0,ta.Z)((([e])=>{e!==u&&(N.current=!0),N.current&&(N.current=!1,u?m&&k(m):k(y))}),[u,y,m]);const w=(0,T.Z)((e=>{const t=(0,s.Rd)(),n=(0,l.dyD)(t,e),a=(0,l.Z1J)(t,e);n&&(0,r.cS)(n)?v({message:g("FolderLinkScreen.AlertTextUnavailableBot")}):n?v({message:g("FolderLinkScreen.AlertTextUnavailableUser")}):a&&(0,r.eA)(a)?v({message:g("FolderLinkScreen.AlertTextUnavailablePublicChannel")}):v({message:g("FolderLinkScreen.AlertTextUnavailablePublicGroup")})})),A=(0,T.Z)((e=>{k(e),C(!0)})),R=(0,T.Z)((()=>{n&&u&&E&&p({folderId:n,peerIds:S,url:u})})),L=S.length,B=!L||h;return a.ZP.createElement("div",{className:"settings-content no-border custom-scroll SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(vl.Z,{size:o.kuM,tgsUrl:pl.l.FoldersShare,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,te.Z)(g("FolderLinkScreen.TitleDescriptionSelected",[i,L]),["simple_markdown"]))),a.ZP.createElement(Qo.Z,{className:"settings-item",link:u||g("Loading"),withShare:!0,onRevoke:b,isDisabled:!L||E}),a.ZP.createElement("div",{className:"settings-item settings-item-chatlist"},a.ZP.createElement(Qn.Z,{itemIds:f,lockedIds:I,onSelectedIdsChange:A,selectedIds:S,onDisabledClick:w,isRoundCheckbox:!0})),a.ZP.createElement(na.Z,{isShown:h||E,disabled:B,onClick:R,ariaLabel:"Save changes"},h?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))}))),kl=(0,a.X$)((({currentScreen:e,shownScreen:t,state:n,dispatch:o,isActive:r,onScreenSelect:l,onReset:c})=>{const{openShareChatFolderModal:d,editChatFolder:m,addChatFolder:u}=(0,s.Sv)(),h=(0,a.I4)((()=>{e!==i.MT.FoldersCreateFolder&&e!==i.MT.FoldersEditFolder&&e!==i.MT.FoldersEditFolderFromChatList&&e!==i.MT.FoldersEditFolderInvites||setTimeout((()=>{o({type:"reset"})}),200),e!==i.MT.FoldersIncludedChats&&e!==i.MT.FoldersExcludedChats?c():"create"===n.mode?l(i.MT.FoldersCreateFolder):l(i.MT.FoldersEditFolder)}),[n.mode,o,e,c,l]),Z="create"===n.mode,P=(0,a.I4)((e=>{const{title:t}=e.folder;if(!t)return o({type:"setError",payload:El}),!1;const{selectedChatIds:n,selectedChatTypes:a}=(0,ul.vb)(e,"included");return n.length||Object.keys(a).length?(Z?u({folder:e.folder}):m({id:e.folderId,folderUpdate:e.folder}),o({type:"setError",payload:void 0}),o({type:"setIsTouched",payload:!1}),!0):(o({type:"setError",payload:Cl}),!1)}),[o,Z]),p=(0,a.I4)((e=>{P(n)&&e?.()}),[P,n]),v=(0,a.I4)((()=>{const e=o({type:"saveFilters"});h(),P(e)}),[o,h,P]),g=(0,a.I4)((()=>{o({type:"reset"}),l(i.MT.FoldersCreateFolder)}),[l,o]),E=(0,a.I4)((e=>{o({type:"editFolder",payload:e}),l(i.MT.FoldersEditFolder)}),[o,l]),C=(0,a.I4)((()=>{o({type:"editIncludeFilters"}),l(e===i.MT.FoldersEditFolderFromChatList?i.MT.FoldersIncludedChatsFromChatList:i.MT.FoldersIncludedChats)}),[e,o,l]),b=(0,a.I4)((()=>{o({type:"editExcludeFilters"}),l(e===i.MT.FoldersEditFolderFromChatList?i.MT.FoldersExcludedChatsFromChatList:i.MT.FoldersExcludedChats)}),[e,o,l]),f=(0,a.I4)((()=>{d({folderId:n.folderId,noRequestNextScreen:!0}),o({type:"setIsChatlist",payload:!0}),l(i.MT.FoldersShare)}),[o,l,n.folderId]),y=(0,a.I4)((e=>{d({folderId:n.folderId,url:e,noRequestNextScreen:!0}),l(i.MT.FoldersShare)}),[l,n.folderId]);switch(e){case i.MT.Folders:return a.ZP.createElement(Il,{onCreateFolder:g,onEditFolder:E,isActive:r||[i.MT.FoldersCreateFolder,i.MT.FoldersEditFolder,i.MT.FoldersIncludedChats,i.MT.FoldersExcludedChats].includes(t),onReset:c});case i.MT.FoldersCreateFolder:case i.MT.FoldersEditFolder:case i.MT.FoldersEditFolderFromChatList:case i.MT.FoldersEditFolderInvites:return a.ZP.createElement(bl,{state:n,dispatch:o,onAddIncludedChats:C,onAddExcludedChats:b,onShareFolder:f,onOpenInvite:y,onReset:h,isActive:r||[i.MT.FoldersIncludedChats,i.MT.FoldersExcludedChats].includes(t),isOnlyInvites:e===i.MT.FoldersEditFolderInvites,onBack:c,onSaveFolder:p});case i.MT.FoldersIncludedChats:case i.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(Pl,{mode:"included",state:n,dispatch:o,onReset:h,onSaveFilter:v,isActive:r});case i.MT.FoldersExcludedChats:case i.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Pl,{mode:"excluded",state:n,dispatch:o,onReset:h,onSaveFilter:v,isActive:r});case i.MT.FoldersShare:return a.ZP.createElement(Sl,{isActive:r,onReset:h});default:return}}));var Nl=n(95281),wl=n(99364),Ml=n(93490);const Tl=(0,a.X$)((({isActive:e,onReset:t,error:n,isLoading:s,shouldDisablePasswordManager:i,expectedPassword:o,placeholder:r="Current Password",hint:l,submitLabel:c,clearError:d,onSubmit:m})=>{const[u,h]=(0,a.eJ)(""),[Z,P]=(0,a.eJ)(!1),p=(0,a.I4)((e=>{o&&e!==o?h("Passwords Should Be Equal"):m(e)}),[m,o]),v=(0,a.I4)((()=>{d&&d(),h("")}),[d]),g=(0,M.Z)();return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content password-form custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Ml.Z,{isBig:!0,isPasswordVisible:Z})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(wl.Z,{error:u||n,hint:l,placeholder:r,shouldDisablePasswordManager:i,submitLabel:c||g("Next"),clearError:v,isLoading:s,isPasswordVisible:Z,shouldResetValue:e,onChangePasswordVisibility:P,onSubmit:p})))})),Al=(0,a.X$)((({isActive:e,onReset:t})=>{const n=(0,M.Z)(),s=(0,a.I4)((()=>{t(!0)}),[t]);return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(vl.Z,{size:o.moH,tgsUrl:pl.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Congratulations!"),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Now you can lock the app with a passcode so that others can't open it.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Y.Z,{onClick:s},n("Back"))))}));var Rl=n(2092);const Ll=(0,a.X$)((({isActive:e,onReset:t,onScreenSelect:n})=>{const s=(0,M.Z)();return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Lo.Z,{tgsUrl:pl.l.Lock,previewUrl:Rl,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Local passcode is enabled.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(jn.Z,{icon:"edit",onClick:()=>n(i.MT.PasscodeChangePasscodeCurrent)},s("Passcode.Change")),a.ZP.createElement(jn.Z,{icon:"password-off",onClick:()=>n(i.MT.PasscodeTurnOff)},s("Passcode.TurnOff"))))})),Bl=(0,a.X$)((({isActive:e,onReset:t,onStart:n})=>{const s=(0,M.Z)();return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Lo.Z,{tgsUrl:pl.l.Lock,previewUrl:Rl,size:o.moH,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description",dir:"auto"},"When you set up an additional passcode, a lock icon will appear on the chats page. Tap it to lock and unlock your Telegram Web A."),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},"Note: if you forget your local passcode, you'll need to log out of Telegram Web A and log in again.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Y.Z,{onClick:n},s("EnablePasscode"))))})),Fl=(0,a.X$)((0,s.c$)((e=>({...e.passcode})))((({passcode:e,currentScreen:t,shownScreen:n,error:o,isActive:r,isLoading:l,onScreenSelect:c,onSetPasscode:d,onReset:m})=>{const{setPasscode:u,clearPasscode:h,setPasscodeError:Z,clearPasscodeError:P}=(0,s.Sv)(),p=(0,M.Z)(),v=(0,a.I4)((()=>{d(""),c(i.MT.PasscodeNewPasscode)}),[c,d]),g=(0,a.I4)((e=>{d(e),c(i.MT.PasscodeNewPasscodeConfirm)}),[c,d]),E=(0,a.I4)((()=>{u({passcode:e}),d(""),c(i.MT.PasscodeCongratulations)}),[c,d,e,u]),C=(0,a.I4)((e=>{d(""),(0,Nl.so)(e).then((()=>{c(i.MT.PasscodeChangePasscodeNew)}),(()=>{Z({error:p("PasscodeController.Error.Current")})}))}),[p,c,d,Z]),b=(0,a.I4)((e=>{d(e),c(i.MT.PasscodeChangePasscodeConfirm)}),[c,d]),f=(0,a.I4)((e=>{(0,Nl.so)(e).then((()=>{h(),c(i.MT.Privacy)}),(()=>{Z({error:p("PasscodeController.Error.Current")})}))}),[h,p,c,Z]);switch(t){case i.MT.PasscodeDisabled:return a.ZP.createElement(Bl,{onStart:v,isActive:r||[i.MT.PasscodeNewPasscode,i.MT.PasscodeNewPasscodeConfirm,i.MT.PasscodeCongratulations].includes(n),onReset:m});case i.MT.PasscodeNewPasscode:return a.ZP.createElement(Tl,{shouldDisablePasswordManager:!0,placeholder:p("EnterNewPasscode"),submitLabel:p("Continue"),onSubmit:g,isActive:r||[i.MT.PasscodeNewPasscodeConfirm,i.MT.PasscodeCongratulations].includes(n),onReset:m});case i.MT.PasscodeNewPasscodeConfirm:return a.ZP.createElement(Tl,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:p("ReEnterYourPasscode"),submitLabel:p("Continue"),isLoading:l,onSubmit:E,isActive:r||[i.MT.PasscodeCongratulations].includes(n),onReset:m});case i.MT.PasscodeCongratulations:return a.ZP.createElement(Al,{isActive:r,onReset:m});case i.MT.PasscodeEnabled:return a.ZP.createElement(Ll,{onScreenSelect:c,isActive:r||[i.MT.PasscodeChangePasscodeCurrent,i.MT.PasscodeChangePasscodeNew,i.MT.PasscodeChangePasscodeConfirm,i.MT.PasscodeCongratulations,i.MT.PasscodeTurnOff].includes(n),onReset:m});case i.MT.PasscodeChangePasscodeCurrent:return a.ZP.createElement(Tl,{shouldDisablePasswordManager:!0,error:o,clearError:P,placeholder:p("PasscodeController.Current.Placeholder"),onSubmit:C,isActive:r||[i.MT.PasscodeChangePasscodeNew,i.MT.PasscodeChangePasscodeConfirm,i.MT.PasscodeCongratulations].includes(n),onReset:m});case i.MT.PasscodeChangePasscodeNew:return a.ZP.createElement(Tl,{shouldDisablePasswordManager:!0,placeholder:p("PleaseEnterNewFirstPassword"),onSubmit:b,isActive:r||[i.MT.PasscodeChangePasscodeConfirm,i.MT.PasscodeCongratulations].includes(n),onReset:m});case i.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement(Tl,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:p("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:l,onSubmit:E,isActive:r||[i.MT.PasscodeCongratulations].includes(n),onReset:m});case i.MT.PasscodeTurnOff:return a.ZP.createElement(Tl,{shouldDisablePasswordManager:!0,error:o?p(o):void 0,clearError:P,placeholder:p("PasscodeController.Current.Placeholder"),onSubmit:f,isActive:r,onReset:m});default:return}})));function xl(e){const t=e.platform.toLowerCase(),n=e.deviceModel.toLowerCase(),a=e.systemVersion.toLowerCase();return n.includes("xbox")?"xbox":n.includes("chrome")&&!n.includes("chromebook")?"chrome":n.includes("brave")?"brave":n.includes("vivaldi")?"vivaldi":n.includes("safari")?"safari":n.includes("firefox")?"firefox":n.includes("opera")?"opera":n.includes("samsungbrowser")?"samsung":t.includes("android")?"android":n.includes("iphone")||n.includes("ipad")||t.includes("ios")||t.includes("macos")||a.includes("macos")?"apple":t.includes("ubuntu")||a.includes("ubuntu")?"ubuntu":t.includes("linux")||a.includes("linux")?"linux":t.includes("windows")||a.includes("windows")?"windows":"unknown"}var Dl=n(14434);const Ol={SettingsActiveSession:"P9I8aybVU7NyFiMWiyU2",settingsActiveSession:"P9I8aybVU7NyFiMWiyU2",iconDevice:"a633Zas_0v2MAAY277vj",iconDevice__android:"GUI0ogXbRdxQ2RGy8fGv",iconDeviceAndroid:"GUI0ogXbRdxQ2RGy8fGv",iconDevice__apple:"emCcCPeQ7_9DHBonyO02",iconDeviceApple:"emCcCPeQ7_9DHBonyO02",iconDevice__brave:"OMEQQMEIcjln7GIyfO3Q",iconDeviceBrave:"OMEQQMEIcjln7GIyfO3Q",iconDevice__chrome:"XEQtza6nFt8ptPkvbi2w",iconDeviceChrome:"XEQtza6nFt8ptPkvbi2w",iconDevice__edge:"iHueuVDDSF_BaK2Wa06i",iconDeviceEdge:"iHueuVDDSF_BaK2Wa06i",iconDevice__firefox:"KM9rrbhNSrNOW8roXGo_",iconDeviceFirefox:"KM9rrbhNSrNOW8roXGo_",iconDevice__linux:"JzdHedSfMsVcaa8u4X6O",iconDeviceLinux:"JzdHedSfMsVcaa8u4X6O",iconDevice__opera:"McukeiFuIkeZbxMNzQKK",iconDeviceOpera:"McukeiFuIkeZbxMNzQKK",iconDevice__safari:"XGWuju_22haQw0Qraor7",iconDeviceSafari:"XGWuju_22haQw0Qraor7",iconDevice__samsung:"ZZGcTr3P3RJrOwOwFX6r",iconDeviceSamsung:"ZZGcTr3P3RJrOwOwFX6r",iconDevice__ubuntu:"OPtbMfpfiWN3dxilMOPX",iconDeviceUbuntu:"OPtbMfpfiWN3dxilMOPX",iconDevice__unknown:"xoc1kuf1XAKh_dhO758U",iconDeviceUnknown:"xoc1kuf1XAKh_dhO758U",iconDevice__vivaldi:"Y25gBvz9xzZicoJgQf8Y",iconDeviceVivaldi:"Y25gBvz9xzZicoJgQf8Y",iconDevice__windows:"dKbtoO2xjdhL8W2mqyxr",iconDeviceWindows:"dKbtoO2xjdhL8W2mqyxr",iconDevice__xbox:"FhLv8AIUHzsoTX8b0zdA",iconDeviceXbox:"FhLv8AIUHzsoTX8b0zdA",title:"b9iUjEhCpOrQ4dPhn2KU",note:"hTTCWbngkwJoEwtGFD9o",date:"pUv5oVVNDZ5lBRzNzx3X",box:"e32uLjclYAYuxxW1CAex",actionHeader:"xwSMwr4aHsrRVIVInLEo",actionName:"tSrCe7E_Iom1nGuh2Gs3",headerButton:"N0buK669iHOZ1hN_H7Ik"},Ul=(0,a.X$)((0,s.c$)(((e,{hash:t})=>({session:t?e.activeSessions.byHash[t]:void 0})))((({isOpen:e,session:t,onClose:n})=>{const{changeSessionSettings:i,terminateAuthorization:o}=(0,s.Sv)(),r=(0,M.Z)(),l=(0,va.Z)(t,!0),c=(0,a.I4)((()=>{i({hash:t.hash,areSecretChatsEnabled:!t.areSecretChatsEnabled})}),[i,t]),d=(0,a.I4)((()=>{i({hash:t.hash,areCallsEnabled:!t.areCallsEnabled})}),[i,t]),m=(0,a.I4)((()=>{o({hash:t.hash}),n()}),[n,t,o]);if(l)return a.ZP.createElement(ne.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:r("Close"),onClick:n},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("div",{className:"modal-title"},r("SessionPreview.Title")),a.ZP.createElement(Y.Z,{color:"danger",onClick:m,className:(0,ce.Z)("modal-action-button",Ol.headerButton)},r("SessionPreview.TerminateSession"))),isOpen:e,hasCloseButton:!0,onClose:n,className:Ol.SettingsActiveSession},a.ZP.createElement("div",{className:(0,ce.Z)(Ol.iconDevice,l&&Ol[`iconDevice__${xl(l)}`])}),a.ZP.createElement("h3",{className:Ol.title,dir:"auto"},l?.deviceModel),a.ZP.createElement("div",{className:Ol.date,"aria-label":r("PrivacySettings.LastSeen")},(0,_e.SA)(1e3*l.dateActive,r.code)),a.ZP.createElement("dl",{className:Ol.box},a.ZP.createElement("dt",null,r("SessionPreview.App")),a.ZP.createElement("dd",null,l?.appName," ",l?.appVersion,","," ",l?.platform," ",l?.systemVersion),a.ZP.createElement("dt",null,r("SessionPreview.Ip")),a.ZP.createElement("dd",null,l?.ip),a.ZP.createElement("dt",null,r("SessionPreview.Location")),a.ZP.createElement("dd",null,l&&function(e){return[e.region,e.country].filter(Boolean).join(", ")}(l))),a.ZP.createElement("p",{className:Ol.note},r("SessionPreview.IpDesc")),a.ZP.createElement("h4",{className:Ol.actionHeader},r("AuthSessions.View.AcceptTitle")),a.ZP.createElement(jn.Z,{onClick:c},a.ZP.createElement("span",{className:Ol.actionName},r("SessionPreview.Accept.Secret")),a.ZP.createElement(qn.Z,{id:"accept_secrets",label:"On",checked:l.areSecretChatsEnabled})),a.ZP.createElement(jn.Z,{onClick:d},a.ZP.createElement("span",{className:Ol.actionName},r("SessionPreview.Accept.Calls")),a.ZP.createElement(qn.Z,{id:"accept_calls",label:"On",checked:l.areCallsEnabled})))})));function _l(e){return[e.region,e.country].filter(Boolean).join(", ")}const $l=(0,a.X$)((0,s.c$)((e=>e.activeSessions))((({isActive:e,onReset:t,byHash:n,orderedHashes:i,ttlDays:o})=>{const{terminateAuthorization:r,terminateAllAuthorizations:l,changeSessionTtl:c}=(0,s.Sv)(),d=(0,M.Z)(),[m,u,h]=(0,k.Z)(),[Z,P]=(0,a.eJ)(),[p,v,g]=(0,k.Z)(),E=(0,a.Ye)((()=>{if(void 0!==o)return o<=7?"7":o<=30?"30":o<=93?"90":o<=183?"183":o>183?"365":void 0}),[o]),C=(0,a.Ye)((()=>{const e=[{label:d("Weeks",1,"i"),value:"7"},{label:d("Months",1,"i"),value:"30"},{label:d("Months",3,"i"),value:"90"},{label:d("Months",6,"i"),value:"183"}];return o&&o>=365&&e.push({label:d("Years",1,"i"),value:"365"}),e}),[d,o]),b=(0,a.I4)((e=>{r({hash:e})}),[r]),f=(0,a.I4)((()=>{h(),l()}),[h,l]),y=(0,a.I4)((e=>{P(e),v()}),[v]),I=(0,a.I4)((()=>{P(void 0),g()}),[g]),S=(0,a.I4)((e=>{c({days:Number(e)})}),[c]),N=(0,a.Ye)((()=>{const e=i.find((e=>n[e].isCurrent));return e?n[e]:void 0}),[n,i]),w=(0,a.Ye)((()=>i.filter((e=>!n[e].isCurrent))),[n,i]),T=Boolean(w.length);return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content custom-scroll SettingsActiveSessions"},N&&(R=N,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:d.isRtl?"rtl":void 0},d("AuthSessions.CurrentSession")),a.ZP.createElement(jn.Z,{narrow:!0,inactive:!0,icon:`device-${xl(R)}`,iconClassName:"icon-device"},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},R.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},R.appName," ",R.appVersion,", ",R.platform," ",R.systemVersion),a.ZP.createElement("span",{className:"subtitle"},R.ip," - ",_l(R)))),T&&a.ZP.createElement(jn.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:u},d("TerminateAllSessions")))),T&&(A=w,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:d.isRtl?"rtl":void 0},d("OtherSessions")),A.map((function(e){const t=n[e];return a.ZP.createElement(jn.Z,{key:t.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{b(t.hash)}}],icon:`device-${xl(t)}`,iconClassName:"icon-device",onClick:()=>{y(t.hash)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,_e.VX)(d,1e3*t.dateActive)),a.ZP.createElement("span",{className:"title"},t.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},t.appName," ",t.appVersion,", ",t.platform," ",t.systemVersion),a.ZP.createElement("span",{className:"subtitle"},t.ip," ",_l(t))))})))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:d.isRtl?"rtl":void 0},d("TerminateOldSessionHeader")),a.ZP.createElement("p",null,d("IfInactiveFor")),a.ZP.createElement(Dl.Z,{name:"session_ttl",options:C,selected:E,onChange:S})),T&&a.ZP.createElement(Xn.Z,{isOpen:m,onClose:h,text:d("AreYouSureSessions"),confirmLabel:d("TerminateAllSessions"),confirmHandler:f,confirmIsDestructive:!0,areButtonsInColumn:!0}),a.ZP.createElement(Ul,{isOpen:p,hash:Z,onClose:I}));var A,R}))),jl="TgiK64wG1hkOWSiXybQf",Vl=(0,a.X$)((0,s.c$)(((e,{hash:t})=>{const n=t?e.activeWebSessions.byHash[t]:void 0;return{session:n,bot:n?e.users.byId[n.botId]:void 0}}))((({isOpen:e,session:t,bot:n,onClose:i})=>{const{terminateWebAuthorization:o}=(0,s.Sv)(),r=(0,M.Z)(),l=(0,va.Z)(t,!0),c=(0,va.Z)(n,!0),d=(0,a.I4)((()=>{o({hash:t.hash}),i()}),[i,t,o]);if(l)return a.ZP.createElement(ne.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:r("Close"),onClick:i},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("div",{className:"modal-title"},r("WebSessionsTitle")),a.ZP.createElement(Y.Z,{color:"danger",onClick:d,className:(0,ce.Z)("modal-action-button","hlKLEbMQAsx572pUREy0")},r("AuthSessions.LogOut"))),isOpen:e,hasCloseButton:!0,onClose:i,className:"OeRWKjYQC6t7Uxv8I3j0"},a.ZP.createElement(yt.Z,{className:"oy_023CG29VsnL9L5ulf",peer:c,size:"large"}),c&&a.ZP.createElement(Cr.Z,{className:"bg8UD_Pu2JWogmjuvVXg",peer:c}),a.ZP.createElement("div",{className:jl},l?.domain),a.ZP.createElement("dl",{className:"HSyJbRkyhkeT0s2QA4Ku"},a.ZP.createElement("dt",null,r("AuthSessions.View.Browser")),a.ZP.createElement("dd",null,l?.browser),a.ZP.createElement("dt",null,r("SessionPreview.Ip")),a.ZP.createElement("dd",null,l?.ip),a.ZP.createElement("dt",null,r("SessionPreview.Location")),a.ZP.createElement("dd",null,l?.region)),a.ZP.createElement("p",{className:jl},r("AuthSessions.View.LocationInfo")))}))),Gl={avatar:"n3bBygyO4j5MQyJ70Twt","clear-help":"vUICy6ZQCYFSrvvxXe7f",clearHelp:"vUICy6ZQCYFSrvvxXe7f",subtitle:"t3PK9_nPdL12eMsiMNcM"},Hl=(0,a.X$)((0,s.c$)((e=>{const{byHash:t,orderedHashes:n}=e.activeWebSessions;return{byHash:t,orderedHashes:n}}))((({isActive:e,byHash:t,orderedHashes:n,onReset:i})=>{const{terminateWebAuthorization:o,terminateAllWebAuthorizations:r}=(0,s.Sv)(),l=(0,M.Z)(),[c,d,m]=(0,k.Z)(),[u,h]=(0,a.eJ)(),[Z,P,p]=(0,k.Z)(),v=(0,a.I4)((e=>{o({hash:e})}),[o]),g=(0,a.I4)((()=>{m(),r()}),[m,r]),E=(0,a.I4)((e=>{h(e),P()}),[P]),C=(0,a.I4)((()=>{h(void 0),p()}),[p]);var b;if((0,a.d4)((()=>{n.length||i()}),[i,n]),(0,pe.Z)({isActive:e,onBack:i}),n.length)return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(jn.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d},l("AuthSessions.LogOutApplications")),a.ZP.createElement("p",{className:(0,ce.Z)("settings-item-description",Gl.clearHelp)},l("ClearOtherWebSessionsHelp"))),(b=n,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:l.isRtl?"rtl":void 0},l("WebSessionsTitle")),b.map((function(e){const n=t[e],i=(0,s.Rd)().users.byId[n.botId];return a.ZP.createElement(jn.Z,{key:n.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{v(n.hash)}}],onClick:()=>E(n.hash)},a.ZP.createElement(yt.Z,{className:Gl.avatar,peer:i,size:"tiny"}),a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,_e.VX)(l,1e3*n.dateActive)),i&&a.ZP.createElement(Cr.Z,{className:Gl.title,peer:i}),a.ZP.createElement("span",{className:(0,ce.Z)("subtitle","black","tight",Gl.platform)},n.domain,", ",n.browser,", ",n.platform),a.ZP.createElement("span",{className:(0,ce.Z)("subtitle",Gl.subtitle)},n.ip," ",n.region)))})))),a.ZP.createElement(Xn.Z,{isOpen:c,onClose:m,title:l("AuthSessions.LogOutApplications"),text:l("AreYouSureWebSessions"),confirmHandler:g,confirmIsDestructive:!0}),a.ZP.createElement(Vl,{isOpen:Z,hash:u,onClose:C}))}))),Jl=(0,a.X$)((({stickerSet:e,noPlay:t,className:n,observeIntersection:s,onClick:i})=>{const r=(0,M.Z)(),l=e?.stickers?.[0],c=(0,a.I4)((()=>{l&&i(l)}),[l,i]);if(e&&e.stickers)return a.ZP.createElement(jn.Z,{narrow:!0,className:(0,ce.Z)("StickerSetCard",n),inactive:!l,onClick:c},function(){if(e)return e.hasThumbnail||!l?a.ZP.createElement(Y.Z,{ariaLabel:e.title,color:"translucent",isRtl:r.isRtl},a.ZP.createElement(So,{stickerSet:e,size:o.Mwe,noPlay:t,observeIntersection:s})):a.ZP.createElement(Ao,{sticker:l,size:o.Mwe,title:e.title,noPlay:t,observeIntersection:s,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i"))))})),zl=(0,a.X$)((0,s.c$)((e=>({...(0,Kn.ei)(e.settings.byKey,["shouldSuggestCustomEmoji"]),customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,canPlayAnimatedEmojis:(0,l.W9H)(e)})))((({isActive:e,customEmojiSetIds:t,stickerSetsById:n,shouldSuggestCustomEmoji:i,canPlayAnimatedEmojis:o,onReset:r})=>{const{openStickerSet:l,setSettingOption:c}=(0,s.Sv)(),d=(0,M.Z)(),m=(0,a.sO)(null),{observe:u}=(0,vo.S1)({rootRef:m});(0,pe.Z)({isActive:e,onBack:r});const h=(0,a.I4)((e=>{l({stickerSetInfo:e.stickerSetInfo})}),[l]),Z=(0,a.I4)((e=>{c({shouldSuggestCustomEmoji:e})}),[c]),P=(0,a.Ye)((()=>t&&Object.values((0,Kn.ei)(n,t))),[t,n]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},P&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(As.Z,{label:d("SuggestAnimatedEmoji"),checked:i,onCheck:Z}),a.ZP.createElement("div",{className:"mt-4",ref:m},P.map((e=>a.ZP.createElement(Jl,{key:e.id,stickerSet:e,observeIntersection:u,onClick:h,noPlay:!o})))),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},(0,te.Z)(d("EmojiBotInfo"),["links"]))))}))),Xl=(0,a.X$)((0,s.c$)((e=>(0,Kn.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","autoLoadFileMaxSizeMb"])))((({isActive:e,onReset:t,canAutoLoadPhotoFromContacts:n,canAutoLoadPhotoInPrivateChats:i,canAutoLoadPhotoInGroups:r,canAutoLoadPhotoInChannels:l,canAutoLoadVideoFromContacts:c,canAutoLoadVideoInPrivateChats:d,canAutoLoadVideoInGroups:m,canAutoLoadVideoInChannels:u,canAutoLoadFileFromContacts:h,canAutoLoadFileInPrivateChats:Z,canAutoLoadFileInGroups:P,canAutoLoadFileInChannels:p,autoLoadFileMaxSizeMb:v})=>{const{setSettingOption:g}=(0,s.Sv)(),E=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:t});const C=(0,a.I4)((e=>E("AutodownloadSizeLimitUpTo",E("FileSize.MB",String(o.byK[e]),"i"))),[E]),b=(0,a.I4)((e=>{g({autoLoadFileMaxSizeMb:o.byK[e]})}),[g]);function f(e,t,n,s,i,r){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0},e),a.ZP.createElement(As.Z,{label:E("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>g({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(As.Z,{label:E("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>g({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(As.Z,{label:E("AutoDownloadSettings.GroupChats"),checked:i,onCheck:e=>g({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(As.Z,{label:E("AutoDownloadSettings.Channels"),checked:r,onCheck:e=>g({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=o.byK.indexOf(v);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(Ve.Z,{label:E("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:C,onChange:b}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},f(E("AutoDownloadPhotosTitle"),"Photo",n,i,r,l),f(E("AutoDownloadVideosTitle"),"Video",c,d,m,u),f("Auto-download files","File",h,Z,P,p))}))),Yl=["af","als","am","an","ar","arz","as","ast","av","az","azb","ba","bar","bcl","be","bg","bh","bn","bo","bpy","br","bs","bxr","ca","cbk","ce","ceb","ckb","co","cs","cv","cy","da","de","diq","dsb","dty","dv","el","eml","en","eo","es","et","eu","fa","fi","fr","frr","fy","ga","gd","gl","gn","gom","gu","gv","he","hi","hif","hr","hsb","ht","hu","hy","ia","id","ie","ilo","io","is","it","ja","jbo","jv","ka","kk","km","kn","ko","krc","ku","kv","kw","ky","la","lb","lez","li","lmo","lo","lrc","lt","lv","mai","mg","mhr","min","mk","ml","mn","mr","mrj","ms","mt","mwl","my","myv","mzn","nah","nap","nds","ne","new","nl","nn","no","oc","or","os","pa","pam","pfl","pl","pms","pnb","ps","pt","qu","rm","ro","ru","rue","sa","sah","sc","scn","sco","sd","sh","si","sk","sl","so","sq","sr","su","sv","sw","ta","te","tg","th","tk","tl","tr","tt","tyv","ug","uk","ur","uz","vec","vep","vi","vls","vo","wa","war","wuu","xal","xmf","yi","yo","yue","zh"],ql=o.D$f.filter((e=>Yl.includes(e))),Kl=(0,a.X$)((0,s.c$)((e=>{const{language:t,doNotTranslate:n}=e.settings.byKey;return{language:t,doNotTranslate:n}}))((({isActive:e,language:t,doNotTranslate:n,onReset:i})=>{const{setSettingOption:o}=(0,s.Sv)(),r=(0,M.Z)(),[l,c]=(0,a.eJ)([]),[d,m]=(0,a.eJ)(""),u=(0,a.Ye)((()=>ql.map((e=>({langCode:e,translatedName:new Intl.DisplayNames([t],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)}))).map((({langCode:e,translatedName:t,originalName:n})=>({label:t,subLabel:n,value:e})))),[t]);(0,a.d4)((()=>{e||m("")}),[e]),(0,ta.Z)((([a])=>{if(a===e)return;if(e&&l.length)return;const s=u.find((e=>e.value===t)),i=u.filter((e=>e.value!==t)),[o,r]=(0,Kn.uK)(i,(e=>n.includes(e.value)));c([s,...o,...r])}),[e,n,l.length,t,u]);const h=(0,a.I4)((e=>{const{value:t,checked:a}=e.currentTarget;let s;s=a?(0,Kn.Tw)([...n,t]):n.filter((e=>e!==t)),o({doNotTranslate:s})}),[n,o]),Z=(0,a.I4)((e=>{m(e.target.value)}),[]),P=(0,a.Ye)((()=>d.trim()?l.filter((e=>e.label.toLowerCase().includes(d.toLowerCase())||e.subLabel?.toLowerCase().includes(d.toLowerCase())||e.value.toLowerCase().includes(d.toLowerCase()))):l),[l,d]);return(0,pe.Z)({isActive:e,onBack:i}),a.ZP.createElement("div",{className:(0,ce.Z)("obOZMv8VwZgTltdIBhFA","settings-content custom-scroll")},a.ZP.createElement("div",{className:(0,ce.Z)("lDWs17bpqtGWDX0EJr0y","settings-item")},a.ZP.createElement(us.Z,{key:"search",value:d,onChange:Z,placeholder:r("Search"),teactExperimentControlled:!0}),a.ZP.createElement("div",{className:(0,ce.Z)("whcbPSSJLGdGCaY66qfR","radio-group custom-scroll")},P.map((e=>a.ZP.createElement(As.Z,{className:"BShBwPkgjleuDsjyfnNk",label:e.label,subLabel:e.subLabel,checked:n.includes(e.value),value:e.value,key:e.value,onChange:h}))))))})));var Wl=n(64319);const Ql=(0,a.X$)((({chatId:e,usernames:t,onEditUsername:n})=>{const{showNotification:i,toggleUsername:o,toggleChatUsername:r,sortUsernames:l,sortChatUsernames:c}=(0,s.Sv)(),d=(0,M.Z)(),[m,u]=(0,a.eJ)(),h=(0,a.Ye)((()=>t.map((({username:e})=>e))),[t]),Z=(0,D.Z)(h),[P,p]=(0,a.eJ)({orderedUsernames:h,dragOrderUsernames:h,draggedIndex:void 0});(0,a.d4)((()=>{Z!==h&&p({orderedUsernames:h,dragOrderUsernames:h,draggedIndex:void 0})}),[Z,h]);const v=(0,a.I4)((e=>{(0,Wl.TE)(`@${e}`),i({message:d("UsernameCopied")})}),[d,i]),g=(0,a.I4)((e=>{e.isEditable?n(e.username):u(e)}),[n]),E=(0,a.I4)((()=>{u(void 0)}),[]),C=(0,a.I4)((()=>{m&&(e?r({chatId:e,username:m.username,isActive:!m.isActive}):o({username:m.username,isActive:!m.isActive}),E())}),[e,E,r,o,m]),b=(0,a.I4)(((e,t)=>{const n=Math.round(e.y/60),a=P.orderedUsernames?.indexOf(t)||0,s=P.orderedUsernames?.filter((e=>e!==t));s&&(0,me.Kh)(a+n,0,h.length)&&(s.splice(a+n,0,t),p((e=>({...e,draggedIndex:a,dragOrderUsernames:s}))))}),[P.orderedUsernames,h.length]),f=(0,a.I4)((()=>{p((t=>(e?c({chatId:e,usernames:t.dragOrderUsernames}):l({usernames:t.dragOrderUsernames}),{...t,orderedUsernames:t.dragOrderUsernames,draggedIndex:void 0})))}),[e,c,l]);return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"u8GGVdXgbKUMvoqqs0VJ"},a.ZP.createElement("h4",{className:"sPTmRsKHnc3FL9AubUaY",dir:d.isRtl?"rtl":void 0},d("lng_usernames_subtitle")),a.ZP.createElement("div",{className:"pWxbEJm12NZb25lGmdwA",style:`height: ${60*t.length}px`},t.map(((e,t)=>{const n=P.draggedIndex===t,s=60*(P.orderedUsernames?.indexOf(e.username)??0),i=60*(P.dragOrderUsernames?.indexOf(e.username)??0),o=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return a.ZP.createElement(fl.Z,{key:e.username,id:e.username,onDrag:b,onDragEnd:f,style:`top: ${n?s:i}px;`,knobStyle:(d.isRtl?"left":"right")+": 3rem;",isDisabled:!e.isActive},a.ZP.createElement(jn.Z,{key:e.username,className:(0,ce.Z)("drag-item mb-2 no-icon","AWgYeVXfLin4VAmQzhKQ"),narrow:!0,secondaryIcon:"more",icon:e.isActive?"link":"link-broken",multiline:!0,contextActions:[{handler:()=>{v(e.username)},title:d("Copy"),icon:"copy"}],onClick:()=>{g(e)}},a.ZP.createElement("span",{className:"title"},"@",e.username),a.ZP.createElement("span",{className:"subtitle"},d(o))))}))),a.ZP.createElement("p",{className:"YqnFSIc98kYMRge1RrlJ",dir:d.isRtl?"rtl":void 0},d("lng_usernames_description"))),a.ZP.createElement(Xn.Z,{isOpen:Boolean(m),onClose:E,title:d(m?.isActive?"Username.DeactivateAlertTitle":"Username.ActivateAlertTitle"),text:d(m?.isActive?"Username.DeactivateAlertText":"Username.ActivateAlertText"),confirmLabel:d(m?.isActive?"Username.DeactivateAlertHide":"Username.ActivateAlertShow"),confirmHandler:C,confirmIsDestructive:!m?.isActive}))}));var ec=n(49160);const tc=/https:\/\/t\.me\/?/i,nc=(0,ue.Ds)((e=>e()),250,!1),ac=(0,a.X$)((({currentUsername:e,asLink:t,isLoading:n,isUsernameAvailable:i,checkedUsername:r,onChange:l})=>{const{checkUsername:c,checkPublicLink:d}=(0,s.Sv)(),[m,u]=(0,a.eJ)(e||""),h=(0,M.Z)(),Z=t?"SetUrl":"Username",P=h(t?"SetUrlPlaceholder":"Username"),p=(0,D.Z)(i),v=e!==m?i??p:void 0,g=m&&e!==m&&r!==m,[E,C]=(0,a.Ye)((()=>m.length?m.length<ec.ZR?[void 0,h(`${Z}InvalidShort`)]:m.length>ec.Au?[void 0,h(`${Z}InvalidLong`)]:ec.ME.test(m)?void 0===v||g?[]:[v?h(`${Z}Available`,P):void 0,!1===v?h(`${Z}InUse`):void 0]:[void 0,h(`${Z}Invalid`)]:[]),[m,v,g,h,Z,P]);(0,a.d4)((()=>{u(e||"")}),[t,e]);const b=(0,a.I4)((n=>{const a=n.target.value.trim();if(t&&!a.match(tc))return void(a.length||(u(""),l?.("")));const s=a.replace(tc,"");u(s),(0,ec.js)(s)&&(l?.(s),nc((()=>{s!==e&&(t?d:c)({username:s})})))}),[t,d,c,e,l]);return a.ZP.createElement(us.Z,{value:`${t?o.zHP:""}${m}`,onChange:b,label:g?h("Checking"):P,error:C,success:E,readOnly:n,teactExperimentControlled:!0})}));var sc=n(90730),ic=n(59174);const oc=(0,ue.P2)((e=>e()),6e4,!0),rc="Please provide your first name",lc=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a,checkedUsername:s,error:i}=(0,l.jUK)(e).profileEdit||{},o=t?(0,l.dyD)(e,t):void 0,c=(0,Qs.M)(e,"aboutLength");if(!o)return{progress:n,checkedUsername:s,isUsernameAvailable:a,editUsernameError:i,maxBioLength:c};const{firstName:d,lastName:m,usernames:u}=o,h=t?(0,l.ccz)(e,t):void 0;return{currentAvatarHash:(0,r.RT)(o),currentFirstName:d,currentLastName:m,currentBio:h?.bio,progress:n,isUsernameAvailable:a,checkedUsername:s,editUsernameError:i,maxBioLength:c,usernames:u}}))((({isActive:e,currentAvatarHash:t,currentFirstName:n,currentLastName:r,currentBio:l,progress:c,checkedUsername:d,editUsernameError:m,isUsernameAvailable:u,maxBioLength:h,usernames:Z,onReset:P})=>{const{loadCurrentUser:p,updateProfile:v}=(0,s.Sv)(),g=(0,M.Z)(),E=(0,a.Ye)((()=>Z?.find((({isEditable:e})=>e))),[Z]),C=E?.username||"",[b,f]=(0,a.eJ)(!1),[y,I]=(0,a.eJ)(!1),[S,k]=(0,a.eJ)(),[N,w]=(0,a.eJ)(),[T,A]=(0,a.eJ)(n||""),[R,L]=(0,a.eJ)(r||""),[B,F]=(0,a.eJ)(l||""),[x,O]=(0,a.eJ)(C),U=(0,H.Z)(t,!1,_.IU.BlobUrl),$=c===i.rN.InProgress,j=!1===x,V=(0,D.Z)(u),G=u??V,J=Z&&Z.length>1,z=(0,a.Ye)((()=>!j&&(Boolean(N)||y||b&&!0===G)),[j,N,y,b,G]);(0,pe.Z)({isActive:e,onBack:P}),(0,a.d4)((()=>{oc((()=>{p()}))}),[p]),(0,a.d4)((()=>{w(void 0)}),[U]),(0,a.d4)((()=>{A(n||""),L(r||""),F(l||"")}),[n,r,l]),(0,a.d4)((()=>{O(C||"")}),[C]),(0,a.d4)((()=>{c===i.rN.Complete&&(I(!1),f(!1),k(void 0))}),[c]);const X=(0,a.I4)((e=>{w(e)}),[]),Y=(0,a.I4)((e=>{A(e.target.value),I(!0)}),[]),q=(0,a.I4)((e=>{L(e.target.value),I(!0)}),[]),K=(0,a.I4)((e=>{F(e.target.value),I(!0)}),[]),W=(0,a.I4)((e=>{O(e),f(C!==e)}),[C]),Q=(0,a.I4)((()=>{const e=T.trim(),t=R.trim(),n=B.trim();x&&(e.length?v({photo:N,...y&&{firstName:e,lastName:t,bio:n},...b&&{username:x}}):k(rc))}),[N,T,R,B,y,x,b,v]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile settings-item"},a.ZP.createElement(sc.Z,{currentAvatarBlobUrl:U,onChange:X,title:"Edit your profile photo",disabled:$}),a.ZP.createElement(us.Z,{value:T,onChange:Y,label:g("FirstName"),disabled:$,error:S===rc?S:void 0}),a.ZP.createElement(us.Z,{value:R,onChange:q,label:g("LastName"),disabled:$}),a.ZP.createElement(ic.Z,{value:B,onChange:K,label:g("UserBio"),disabled:$,maxLength:h,maxLengthIndicator:h?(h-B.length).toString():void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,te.Z)(g("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0},g("Username")),a.ZP.createElement(ac,{currentUsername:C,isLoading:$,isUsernameAvailable:u,checkedUsername:d,onChange:W}),m===o.WfZ&&function(){const e=`${o.zHP}${o.LlA}`;return a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},g("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map((t=>"PURCHASE_LINK"===t?a.ZP.createElement(ur.Z,{url:e,text:`@${o.LlA}`}):t)))}(),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,te.Z)(g("UsernameHelp"),["br","simple_markdown"])),x&&a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},g("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},o.zHP,x))),J&&a.ZP.createElement(Ql,{usernames:Z,onEditUsername:O})),a.ZP.createElement(na.Z,{isShown:z,onClick:Q,disabled:$,ariaLabel:g("Save")},$?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))})));var cc=n(30879);const dc=(0,a.X$)((0,s.c$)((e=>({shouldShowLoginCodeInChatList:e.settings.byKey.shouldShowLoginCodeInChatList,shouldForceHttpTransport:e.settings.byKey.shouldForceHttpTransport,shouldAllowHttpTransport:e.settings.byKey.shouldAllowHttpTransport,shouldCollectDebugLogs:e.settings.byKey.shouldCollectDebugLogs,shouldDebugExportedSenders:e.settings.byKey.shouldDebugExportedSenders})))((({isActive:e,onReset:t,shouldShowLoginCodeInChatList:n,shouldForceHttpTransport:i,shouldAllowHttpTransport:r,shouldCollectDebugLogs:l,shouldDebugExportedSenders:c})=>{const{requestConfetti:d,setSettingOption:m}=(0,s.Sv)(),u=(0,M.Z)(),[h,Z]=(0,a.eJ)(!1);(0,a.d4)((()=>{window.electron?.getIsAutoUpdateEnabled().then(Z)}),[]),(0,pe.Z)({isActive:e,onBack:t});const P=(0,T.Z)((()=>{const e=new File([(0,cc.aZ)()],o.Wpe,{type:"text/plain"}),t=URL.createObjectURL(e);(0,Ea.Z)(t,o.Wpe)})),p=(0,a.I4)((e=>{window.electron?.setIsAutoUpdateEnabled(e)}),[]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(vl.Z,{tgsUrl:pl.l.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),a.ZP.createElement("p",{className:"settings-item-description pt-3",dir:"auto"},u("lng_settings_experimental_about"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(jn.Z,{onClick:()=>d({}),icon:"animations"},a.ZP.createElement("div",{className:"title"},"Launch some confetti!")),a.ZP.createElement(As.Z,{label:"Show login code in chat list",checked:Boolean(n),onCheck:()=>m({shouldShowLoginCodeInChatList:!n})}),a.ZP.createElement(As.Z,{label:"Allow HTTP Transport",checked:Boolean(r),onCheck:()=>m({shouldAllowHttpTransport:!r})}),a.ZP.createElement(As.Z,{label:"Force HTTP Transport",disabled:!r,checked:Boolean(i),onCheck:()=>m({shouldForceHttpTransport:!i})}),a.ZP.createElement(As.Z,{label:u("DebugMenuEnableLogs"),checked:Boolean(l),onCheck:()=>m({shouldCollectDebugLogs:!l})}),a.ZP.createElement(As.Z,{label:"Enable exported senders debug",checked:Boolean(c),onCheck:()=>m({shouldDebugExportedSenders:!c})}),g.D$&&a.ZP.createElement(As.Z,{label:"Enable autoupdates",checked:Boolean(h),onCheck:p}),a.ZP.createElement(jn.Z,{onClick:P,icon:"bug"},a.ZP.createElement("div",{className:"title"},"Download log"))))})));var mc=n(59692),uc=n(29456);const hc=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],Zc=(0,a.X$)((0,s.c$)((e=>{const{theme:t,shouldUseSystemTheme:n}=e.settings.byKey;return{...(0,Kn.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","isSensitiveEnabled","canChangeSensitive","timeFormat"]),theme:t,shouldUseSystemTheme:n}}))((({isActive:e,onScreenSelect:t,onReset:n,messageTextSize:o,messageSendKeyCombo:r,timeFormat:l,theme:c,shouldUseSystemTheme:d})=>{const{setSettingOption:m}=(0,s.Sv)(),u=(0,M.Z)(),{isMobile:h}=(0,I.ZP)(),Z=h&&(g.cj||g.wZ),P=[{label:u("EmptyChat.Appearance.Light"),value:"light"},{label:u("EmptyChat.Appearance.Dark"),value:"dark"},{label:u("EmptyChat.Appearance.System"),value:"auto"}],p=Z?void 0:[{value:"enter",label:u("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:u(g.jm||g.cj?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],v=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,g.cj?16:15)}px`),document.documentElement.style.setProperty("--message-meta-height",`${Math.floor(1.3125*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),m({messageTextSize:e})}),[m]),E=(0,a.I4)((e=>{const t="auto"===e?(0,uc.v)():e;m({theme:t}),m({shouldUseSystemTheme:"auto"===e})}),[m]),C=(0,a.I4)((e=>{m({timeFormat:e}),m({wasTimeFormatSetManually:!0}),(0,mc.qf)(e)}),[m]),b=(0,a.I4)((e=>{m({messageSendKeyCombo:e})}),[m]),[f,y]=(0,a.eJ)(!1);(0,a.d4)((()=>{window.electron?.getIsTrayIconEnabled().then(y)}),[]);const S=(0,a.I4)((e=>{window.electron?.setIsTrayIconEnabled(e)}),[]);return(0,pe.Z)({isActive:e,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0},u("SETTINGS")),a.ZP.createElement(Ve.Z,{label:u("TextSize"),min:12,max:20,value:o,onChange:v}),a.ZP.createElement(jn.Z,{icon:"photo",onClick:()=>t(i.MT.GeneralChatBackground)},u("ChatBackground")),g.D$&&g.qB&&a.ZP.createElement(As.Z,{label:u("GeneralSettings.StatusBarItem"),checked:Boolean(f),onCheck:S})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0},u("Theme")),a.ZP.createElement(Dl.Z,{name:"theme",options:P,selected:d?"auto":c,onChange:E})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(Dl.Z,{name:"timeformat",options:hc,selected:l,onChange:C})),p&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:u.isRtl?"rtl":void 0},u("VoiceOver.Keyboard")),a.ZP.createElement(Dl.Z,{name:"keyboard-send-settings",options:p,onChange:b,selected:r})))})));var Pc=n(85655),pc=n(49524);const vc=(0,a.X$)((({wallpaper:e,theme:t,isSelected:n,onClick:s})=>{const{slug:r,document:l}=e,c=`wallpaper${l.id}`,d=l.previewBlobUrl,m=(0,H.Z)(`${c}?size=m`),u=(0,fa.Z)(l.thumbnail?.dataUri,Boolean(m),!0),{transitionClassNames:h}=(0,Fe.Z)(Boolean(m||d),void 0,void 0,"slow"),Z=(0,a.sO)(!1),[P,p]=(0,a.eJ)(!1),{mediaData:v,loadProgress:g}=(0,J.Z)(c,!P),E=!1===(0,D.Z)(P),{shouldRender:C,transitionClassNames:b}=(0,Fe.Z)(P&&!v||r===i.mp,void 0,E,"slow"),f=(0,a.sO)();f.current=t;const y=(0,a.I4)((()=>{(async()=>{const e=await(0,j.gm)(v);await pc.save(o.foQ,f.current,e),s(r)})()}),[v,s,r]);(0,a.d4)((()=>{v&&Z.current&&(y(),Z.current=!1)}),[v,y]);const I=(0,a.I4)((()=>{v?y():(Z.current=!0,p((e=>!e)))}),[v,y]),S=(0,ce.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:S,onClick:I},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:u,className:"thumbnail"}),a.ZP.createElement("img",{src:m||d,className:(0,ce.Z)("full-media",h),alt:"",draggable:!1}),C&&a.ZP.createElement("div",{className:(0,ce.Z)("spinner-container",b)},a.ZP.createElement(re.Z,{progress:g,onClick:I}))))})),gc=(0,ue.P2)((e=>e()),6e4,!0),Ec=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.Puy)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((({isActive:e,onScreenSelect:t,onReset:n,background:r,isBlurred:l,loadedWallpapers:c,theme:d})=>{const{loadWallpapers:m,uploadWallpaper:u,setThemeSettings:h}=(0,s.Sv)(),Z=(0,a.sO)();Z.current=d,(0,a.d4)((()=>{gc((()=>{m()}))}),[m]);const P=(0,a.I4)((e=>{const{files:t}=e.target,n=(0,j.ox)(t);n?.length&&u(n[0])}),[u]),p=(0,a.I4)((()=>{(0,Pc.g)("image/jpeg",P,!0)}),[P]),v=(0,a.I4)((()=>{t(i.MT.GeneralChatBackgroundColor)}),[t]),g=(0,a.I4)((()=>{h({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?o.Vvx:o.ga_})}),[h,d]),E=(0,a.I4)((e=>{h({theme:Z.current,background:e});const t=c&&c.find((t=>t.slug===e));t?.document.thumbnail&&(0,Vs.ix)(t.document.thumbnail.dataUri).then((e=>{const t=(0,Vs.uR)(e),n=`#${(0,Vs.CO)(e)}`;h({theme:Z.current,backgroundColor:n,patternColor:t})}))}),[c,h]),C=(0,a.I4)((e=>{h({theme:Z.current,isBlurred:e.target.checked})}),[h]),b=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:n});const f=c?.[0]&&c[0].slug===i.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(jn.Z,{icon:"camera-add",className:"mb-0",disabled:f,onClick:p},b("UploadImage")),a.ZP.createElement(jn.Z,{icon:"colorize",className:"mb-0",onClick:v},b("SetColor")),a.ZP.createElement(jn.Z,{icon:"favorite",onClick:g},b("ThemeResetToDefaults")),a.ZP.createElement(As.Z,{label:b("BackgroundBlurred"),checked:Boolean(l),onChange:C})),c?a.ZP.createElement("div",{className:"settings-wallpapers"},c.map((e=>a.ZP.createElement(vc,{key:e.slug,wallpaper:e,theme:d,isSelected:r===e.slug,onClick:E})))):a.ZP.createElement(hs.Z,null))}))),Cc=(0,Vs.xP)((0,Vs.wK)("e6ebee")),bc=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function fc(e,t){return{colorPosition:[Math.round(e[1]*(t.colorRect.width-1)),Math.round((1-e[2])*(t.colorRect.height-1))],huePosition:Math.round(e[0]*(t.hueRect.width-1))}}function yc({colorPosition:e,huePosition:t},n){return[t/(n.hueRect.width-1),e[0]/(n.colorRect.width-1),1-e[1]/(n.colorRect.height-1)]}const Ic=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.Puy)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((({isActive:e,onReset:t,theme:n,backgroundColor:i})=>{const{setThemeSettings:o}=(0,s.Sv)(),r=(0,a.sO)();r.current=n;const l=(0,a.sO)(null),c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(!0),[u,h]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?(0,Vs.xP)((0,Vs.wK)(e.replace("#",""))):Cc}(i)),Z=(0,a.sO)(u);(0,a.d4)((()=>{Z.current=u}),[u]);const[P,p,v]=(0,k.Z)(),[g,E]=(0,a.eJ)(""),[C,b]=(0,a.eJ)(""),f=(0,a.sO)(),y=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:c.current.offsetLeft,...(0,Kn.ei)(c.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:d.current.offsetLeft,...(0,Kn.ei)(d.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+l.current.scrollTop),e.height-1)],{huePosition:a}=fc(Z.current,f.current);return h(yc({colorPosition:n,huePosition:a},f.current)),p(),!0}function a(e){const{colorPosition:n}=fc(Z.current,f.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return h(yc({colorPosition:n,huePosition:a},f.current)),p(),!0}f.current={colorRect:e,hueRect:t},(0,de.sf)(c.current,{onCapture:n,onDrag:n,onRelease:v,onClick:v,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,de.sf)(d.current,{onCapture:a,onDrag:a,onRelease:v,onClick:v,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[p,v]);const{colorPosition:I=[0,0],huePosition:S=0}=f.current?fc(u,f.current):{},N=(0,Vs.CO)((0,Vs.eb)(u)),w=u[0],M=(0,Vs.CO)((0,Vs.eb)([w,1,1]));(0,a.d4)((()=>{const e=(0,Vs.eb)(u),t=`#${(0,Vs.CO)(e)}`;if(E(e.join(", ")),b(t),!m.current){const n=(0,Vs.uR)(e);o({theme:r.current,background:void 0,backgroundColor:t,patternColor:n})}m.current=!1}),[u,o]),(0,a.d4)((()=>{!function(e,t,n,a){let s,i,o;n.current&&a.current?(s=a.current.colorRect.width,i=a.current.colorRect.height,o=n.current):(s=e.offsetWidth,i=e.offsetHeight,o=e.getContext("2d"),e.width=s,e.height=i,n.current=o);const r=o.createImageData(s,i),l=r.data,c=(0,Vs.eb)([t,1,1]);let d=0;for(let e=0;e<i;e++){const t=1-e/(i-1),n=[255*t,255*t,255*t],a=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);l[d++]=n[0]+(a[0]-n[0])*t,l[d++]=n[1]+(a[1]-n[1])*t,l[d++]=n[2]+(a[2]-n[2])*t,l[d++]=255}}o.putImageData(r,0,0)}(c.current.firstChild,w,y,f)}),[w]),(0,a.d4)((()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const n=e.getContext("2d"),a=n.createImageData(t,1),s=a.data;let i=0;for(let e=0;e<t;e++){const n=e/(t-1),a=(0,Vs.eb)([n,1,1]);s[i++]=a[0],s[i++]=a[1],s[i++]=a[2],s[i++]=255}n.putImageData(a,0,0)}(d.current.firstChild)}),[]);const T=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^\d, ]/g,"").slice(0,13);if(t.match(/^\d{1,3},\s?\d{1,3},\s?\d{1,3}$/)){const e=t.split(",").map((e=>Number(e.trim())));h((0,Vs.xP)(e))}e.currentTarget.value=t}),[]),A=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&h((0,Vs.xP)((0,Vs.wK)(t.replace("#","")))),e.currentTarget.value=t}),[]),R=(0,a.I4)((e=>{h((0,Vs.xP)((0,Vs.wK)(e.currentTarget.dataset.color.replace("#",""))))}),[]),L=(0,ce.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",P&&"is-dragging");return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{ref:l,className:L},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:c,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${I[0]}px, ${I[1]}px); background-color: #${N};`})),a.ZP.createElement("div",{ref:d,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${S}px); background-color: #${M};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(us.Z,{value:C,label:"HEX",onChange:A}),a.ZP.createElement(us.Z,{value:g,label:"RGB",onChange:T}))),a.ZP.createElement("div",{className:"predefined-colors"},bc.map((e=>a.ZP.createElement("div",{className:(0,ce.Z)("predefined-color",e===`#${N}`?"active":void 0),"data-color":e,style:`background-color: ${e};`,onClick:R})))))}))),Sc=(0,a.X$)((({currentScreen:e,editedFolderId:t,onReset:n,onScreenSelect:o})=>{const{signOut:r,openDeleteChatFolderModal:l}=(0,s.Sv)(),{isMobile:c}=(0,I.ZP)(),[d,m]=(0,a.eJ)(!1),u=function(e,t){const n=(0,a.sO)(0),s=(0,a.sO)();return(0,a.I4)((()=>{if(n.current++,5===n.current)return n.current=0,void t();s.current&&clearTimeout(s.current),s.current=setTimeout((()=>{n.current=0}),300)}),[5,t])}(0,(()=>{o(i.MT.Experimental)})),h=(0,a.I4)((()=>{m(!0)}),[]),Z=(0,a.I4)((()=>{m(!1)}),[]),P=(0,a.I4)((()=>{t&&l({folderId:t})}),[t,l]),p=(0,a.I4)((()=>{Z(),r({forceInitApi:!0})}),[Z,r]),v=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{round:!0,ripple:!c,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon icon-more"}))),[c]),g=(0,M.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:g("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),function(){switch(e){case i.MT.EditProfile:return a.ZP.createElement("h3",null,g("lng_settings_information"));case i.MT.General:return a.ZP.createElement("h3",null,g("General"));case i.MT.QuickReaction:return a.ZP.createElement("h3",null,g("DoubleTapSetting"));case i.MT.CustomEmoji:return a.ZP.createElement("h3",null,g("Emoji"));case i.MT.Notifications:return a.ZP.createElement("h3",null,g("Notifications"));case i.MT.DataStorage:return a.ZP.createElement("h3",null,g("DataSettings"));case i.MT.Privacy:return a.ZP.createElement("h3",null,g("PrivacySettings"));case i.MT.Language:return a.ZP.createElement("h3",null,g("Language"));case i.MT.DoNotTranslate:return a.ZP.createElement("h3",null,g("DoNotTranslate"));case i.MT.Stickers:return a.ZP.createElement("h3",null,g("StickersName"));case i.MT.Experimental:return a.ZP.createElement("h3",null,g("lng_settings_experimental"));case i.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,g("ChatBackground"));case i.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,g("SetColor"));case i.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,g("PrivacyPhone"));case i.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,g("PrivacyLastSeen"));case i.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,g("Privacy.ProfilePhoto"));case i.MT.PrivacyBio:return a.ZP.createElement("h3",null,g("PrivacyBio"));case i.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,g("PrivacyForwards"));case i.MT.PrivacyVoiceMessages:return a.ZP.createElement("h3",null,g("PrivacyVoiceMessages"));case i.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,g("AutodownloadGroupChats"));case i.MT.PrivacyPhoneCall:return a.ZP.createElement("h3",null,g("Calls"));case i.MT.PrivacyPhoneNumberAllowedContacts:case i.MT.PrivacyLastSeenAllowedContacts:case i.MT.PrivacyProfilePhotoAllowedContacts:case i.MT.PrivacyBioAllowedContacts:case i.MT.PrivacyForwardingAllowedContacts:case i.MT.PrivacyVoiceMessagesAllowedContacts:case i.MT.PrivacyGroupChatsAllowedContacts:case i.MT.PrivacyPhoneCallAllowedContacts:case i.MT.PrivacyPhoneP2PAllowedContacts:return a.ZP.createElement("h3",null,g("AlwaysShareWith"));case i.MT.PrivacyPhoneNumberDeniedContacts:case i.MT.PrivacyLastSeenDeniedContacts:case i.MT.PrivacyProfilePhotoDeniedContacts:case i.MT.PrivacyBioDeniedContacts:case i.MT.PrivacyForwardingDeniedContacts:case i.MT.PrivacyVoiceMessagesDeniedContacts:case i.MT.PrivacyGroupChatsDeniedContacts:case i.MT.PrivacyPhoneCallDeniedContacts:case i.MT.PrivacyPhoneP2PDeniedContacts:return a.ZP.createElement("h3",null,g("NeverShareWith"));case i.MT.Performance:return a.ZP.createElement("h3",null,g("Animations and Performance"));case i.MT.ActiveSessions:return a.ZP.createElement("h3",null,g("SessionsTitle"));case i.MT.ActiveWebsites:return a.ZP.createElement("h3",null,g("OtherWebSessions"));case i.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,g("BlockedUsers"));case i.MT.TwoFaDisabled:case i.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,g("TwoStepVerification"));case i.MT.TwoFaNewPassword:case i.MT.TwoFaChangePasswordNew:case i.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,g("PleaseEnterCurrentPassword"));case i.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,g("PleaseReEnterPassword"));case i.MT.TwoFaNewPasswordHint:case i.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,g("PasswordHint"));case i.MT.TwoFaNewPasswordEmail:case i.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,g("RecoveryEmailTitle"));case i.MT.TwoFaNewPasswordEmailCode:case i.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case i.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,g("TwoStepVerificationPasswordSet"));case i.MT.TwoFaChangePasswordCurrent:case i.MT.TwoFaTurnOff:case i.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,g("PleaseEnterCurrentPassword"));case i.MT.PasscodeDisabled:case i.MT.PasscodeEnabled:case i.MT.PasscodeNewPasscode:case i.MT.PasscodeNewPasscodeConfirm:case i.MT.PasscodeCongratulations:return a.ZP.createElement("h3",null,g("Passcode"));case i.MT.PasscodeTurnOff:return a.ZP.createElement("h3",null,g("PasscodeController.Disable.Title"));case i.MT.PasscodeChangePasscodeCurrent:case i.MT.PasscodeChangePasscodeNew:return a.ZP.createElement("h3",null,g("PasscodeController.Change.Title"));case i.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement("h3",null,g("PasscodeController.ReEnterPasscode.Placeholder"));case i.MT.Folders:return a.ZP.createElement("h3",null,g("Filters"));case i.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,g("FilterNew"));case i.MT.FoldersShare:return a.ZP.createElement("h3",null,g("FolderLinkScreen.Title"));case i.MT.FoldersEditFolder:case i.MT.FoldersEditFolderFromChatList:case i.MT.FoldersEditFolderInvites:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,g("FilterEdit")),Boolean(t)&&a.ZP.createElement(ie.Z,{className:"settings-more-menu",trigger:v,positionX:"right"},a.ZP.createElement(oe.Z,{icon:"delete",destructive:!0,onClick:P},g("Delete"))));case i.MT.FoldersIncludedChats:case i.MT.FoldersIncludedChatsFromChatList:case i.MT.FoldersExcludedChats:case i.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("h3",null,g(e===i.MT.FoldersIncludedChats||e===i.MT.FoldersIncludedChatsFromChatList?"FilterInclude":"FilterExclude"));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",{onClick:u},g("SETTINGS")),a.ZP.createElement(Y.Z,{round:!0,ripple:!c,size:"smaller",color:"translucent",onClick:()=>o(i.MT.EditProfile),ariaLabel:g("lng_settings_information")},a.ZP.createElement("i",{className:"icon icon-edit"})),a.ZP.createElement(ie.Z,{className:"settings-more-menu",trigger:v,positionX:"right"},a.ZP.createElement(oe.Z,{icon:"logout",onClick:h},g("LogOutTitle"))))}}(),a.ZP.createElement(Xn.Z,{isOpen:d,onClose:Z,text:g("lng_sure_logout"),confirmLabel:g("AccountSettings.Logout"),confirmHandler:p,confirmIsDestructive:!0}))})),kc=(0,a.X$)((0,s.c$)((e=>{const{language:t,languages:n,canTranslate:a,canTranslateChats:s,doNotTranslate:i}=e.settings.byKey;return{isCurrentUserPremium:(0,l.wVz)(e),languages:n,language:t,canTranslate:a,canTranslateChats:s,doNotTranslate:i}}))((({isActive:e,isCurrentUserPremium:t,languages:n,language:o,canTranslate:r,canTranslateChats:l,doNotTranslate:c,onScreenSelect:d,onReset:m})=>{const{loadLanguages:u,loadAttachBots:h,setSettingOption:Z,openPremiumModal:P}=(0,s.Sv)(),[p,v]=(0,a.eJ)(o),[E,C,b]=(0,k.Z)(),f=t&&l,y=(0,M.Z)();(0,a.d4)((()=>{n?.length||u()}),[n]);const I=(0,T.Z)((e=>{v(e),C(),(0,mc.m0)(e,(()=>{b(),Z({language:e}),h()}))})),S=(0,a.Ye)((()=>n?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((({langCode:e,nativeName:t,name:n})=>({value:e,label:t,subLabel:n}))).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(n):void 0),[n]),N=(0,T.Z)((e=>{Z({canTranslate:e})})),w=(0,T.Z)((e=>{Z({canTranslateChats:e})})),A=(0,T.Z)((()=>{t||P({initialSection:"translations"})})),R=(0,a.Ye)((()=>{if(g.SX&&c.length)return 1===c.length?new Intl.DisplayNames([o],{type:"language"}).of(c[0]):y("Languages",c.length)}),[c,y,o]),L=(0,T.Z)((()=>{d(i.MT.DoNotTranslate)}));return(0,pe.Z)({isActive:e,onBack:m}),a.ZP.createElement("div",{className:"settings-content settings-language custom-scroll"},g.SX&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(As.Z,{label:y("ShowTranslateButton"),checked:r,onCheck:N}),a.ZP.createElement(As.Z,{className:"pb-2",label:y("ShowTranslateChatButton"),checked:f,disabled:!t,rightIcon:t?void 0:"lock",onClickLabel:A,onCheck:w}),(r||f)&&a.ZP.createElement(jn.Z,{onClick:L},y("DoNotTranslate"),a.ZP.createElement("span",{className:"settings-item__current-value"},R)),a.ZP.createElement("p",{className:"settings-item-description mb-0 mt-1"},y("lng_translate_settings_about"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4"},y("Localization.InterfaceLanguage")),S?a.ZP.createElement(Dl.Z,{name:"language-settings",options:S,selected:p,loadingOption:E?p:void 0,onChange:I}):a.ZP.createElement(hs.Z,null)))})));var Nc=n(70180),wc=n(4863),Mc=n(16568);const Tc=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e;return{sessionCount:e.activeSessions.orderedHashes.length,currentUserId:t,canBuyPremium:!(0,l.oe5)(e)}}))((({isActive:e,onScreenSelect:t,onReset:n,currentUserId:r,sessionCount:l,canBuyPremium:c})=>{const{loadProfilePhotos:d,openPremiumModal:m,openSupportChat:u,openUrl:h}=(0,s.Sv)(),[Z,P,p]=(0,k.Z)(!1),v=(0,M.Z)();(0,a.d4)((()=>{r&&d({profileId:r})}),[r,d]),(0,pe.Z)({isActive:e,onBack:n});const g=(0,T.Z)((()=>{u(),p()}));return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},r&&a.ZP.createElement(Mc.Z,{userId:r,canPlayVideo:Boolean(e),forceShowSelf:!0}),r&&a.ZP.createElement(Nc.Z,{chatOrUserId:r,forceShowSelf:!0}),a.ZP.createElement(jn.Z,{icon:"settings",onClick:()=>t(i.MT.General)},v("Telegram.GeneralSettingsViewController")),a.ZP.createElement(jn.Z,{icon:"animations",onClick:()=>t(i.MT.Performance)},v("Animations and Performance")),a.ZP.createElement(jn.Z,{icon:"unmute",onClick:()=>t(i.MT.Notifications)},v("Notifications")),a.ZP.createElement(jn.Z,{icon:"data",onClick:()=>t(i.MT.DataStorage)},v("DataSettings")),a.ZP.createElement(jn.Z,{icon:"lock",onClick:()=>t(i.MT.Privacy)},v("PrivacySettings")),a.ZP.createElement(jn.Z,{icon:"folder",onClick:()=>t(i.MT.Folders)},v("Filters")),a.ZP.createElement(jn.Z,{icon:"active-sessions",onClick:()=>t(i.MT.ActiveSessions)},v("SessionsTitle"),l>0&&a.ZP.createElement("span",{className:"settings-item__current-value"},l)),a.ZP.createElement(jn.Z,{icon:"language",onClick:()=>t(i.MT.Language)},v("Language"),a.ZP.createElement("span",{className:"settings-item__current-value"},v.langName)),a.ZP.createElement(jn.Z,{icon:"stickers",onClick:()=>t(i.MT.Stickers)},v("StickersName"))),a.ZP.createElement("div",{className:"settings-main-menu"},c&&a.ZP.createElement(jn.Z,{leftElement:a.ZP.createElement(wc.Z,{className:"icon",withGradient:!0,big:!0}),className:"settings-main-menu-premium",onClick:()=>m()},v("TelegramPremium"))),a.ZP.createElement("div",{className:"settings-main-menu"},a.ZP.createElement(jn.Z,{icon:"ask-support",onClick:P},v("AskAQuestion")),a.ZP.createElement(jn.Z,{icon:"help",onClick:()=>h({url:o.A1D})},v("TelegramFaq")),a.ZP.createElement(jn.Z,{icon:"privacy-policy",onClick:()=>h({url:o.Sbj})},v("PrivacyPolicy"))),a.ZP.createElement(Xn.Z,{isOpen:Z,confirmLabel:v("lng_settings_ask_ok"),title:v("AskAQuestion"),text:v("lng_settings_ask_sure"),confirmHandler:g,onClose:p}))})));var Ac=n(28406),Rc=n(88957);const Lc=(0,a.X$)((0,s.c$)((e=>({hasPrivateChatsNotifications:Boolean(e.settings.byKey.hasPrivateChatsNotifications),hasPrivateChatsMessagePreview:Boolean(e.settings.byKey.hasPrivateChatsMessagePreview),hasGroupNotifications:Boolean(e.settings.byKey.hasGroupNotifications),hasGroupMessagePreview:Boolean(e.settings.byKey.hasGroupMessagePreview),hasBroadcastNotifications:Boolean(e.settings.byKey.hasBroadcastNotifications),hasBroadcastMessagePreview:Boolean(e.settings.byKey.hasBroadcastMessagePreview),hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})))((({isActive:e,onReset:t,hasPrivateChatsNotifications:n,hasPrivateChatsMessagePreview:i,hasGroupNotifications:o,hasGroupMessagePreview:r,hasBroadcastNotifications:l,hasBroadcastMessagePreview:c,hasContactJoinedNotifications:d,hasPushNotifications:m,hasWebNotifications:u,notificationSoundVolume:h})=>{const{loadNotificationSettings:Z,updateContactSignUpNotification:P,updateNotificationSettings:p,updateWebNotificationSettings:v}=(0,s.Sv)();(0,a.d4)((()=>{Z()}),[Z]);const g=(0,Rc.Z)(500,!0),E=(0,Ac.ke)(),C=E&&!(0,Ac.fU)(),b=(0,a.I4)(((e,t,a)=>{const s="contact"===t?!n:!("group"===t?o:l),d="contact"===t?i:"group"===t?r:c;p({peerType:t,..."silent"===a&&{isSilent:!e.target.checked,shouldShowPreviews:d},..."showPreviews"===a&&{shouldShowPreviews:e.target.checked,isSilent:s}})}),[c,l,r,o,i,n,p]),f=(0,a.I4)((e=>{const t=e.target.checked;v({hasWebNotifications:t,...!t&&{hasPushNotifications:!1}})}),[v]),y=(0,a.I4)((e=>{v({hasPushNotifications:e.target.checked})}),[v]),I=(0,a.I4)((e=>{b(e,"contact","silent")}),[b]),S=(0,a.I4)((e=>{b(e,"contact","showPreviews")}),[b]),k=(0,a.I4)((e=>{b(e,"group","silent")}),[b]),N=(0,a.I4)((e=>{b(e,"group","showPreviews")}),[b]),w=(0,a.I4)((e=>{b(e,"broadcast","silent")}),[b]),T=(0,a.I4)((e=>{b(e,"broadcast","showPreviews")}),[b]),A=(0,a.I4)((e=>{P({isSilent:!e.target.checked})}),[P]),R=(0,a.I4)((e=>{v({notificationSoundVolume:e}),g((()=>(0,Ac.q3)(void 0,e)))}),[g,v]),L=(0,M.Z)();return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(As.Z,{label:"Web notifications",subLabel:L(u?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:u,disabled:!E,onChange:f}),a.ZP.createElement(As.Z,{label:"Offline notifications",disabled:!u||!C,subLabel:C?L(m?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"):"Not supported",checked:m,onChange:y}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(Ve.Z,{label:"Sound",min:0,max:10,disabled:!E,value:h,onChange:R}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("AutodownloadPrivateChats")),a.ZP.createElement(As.Z,{label:L("NotificationsForPrivateChats"),subLabel:L(n?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:n,onChange:I}),a.ZP.createElement(As.Z,{label:L("MessagePreview"),disabled:!n,subLabel:L(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:S})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("FilterGroups")),a.ZP.createElement(As.Z,{label:L("NotificationsForGroups"),subLabel:L(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:k}),a.ZP.createElement(As.Z,{label:L("MessagePreview"),disabled:!o,subLabel:L(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:N})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("FilterChannels")),a.ZP.createElement(As.Z,{label:L("NotificationsForChannels"),subLabel:L(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:w}),a.ZP.createElement(As.Z,{label:L("MessagePreview"),disabled:!l,subLabel:L(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:T})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:L.isRtl?"rtl":void 0},L("PhoneOther")),a.ZP.createElement(As.Z,{label:L("ContactJoined"),checked:d,onChange:A})))})));var Bc=n(35369),Fc=n(84112);const xc=["Power Saving","Nice and Fast","Lots of Stuff"],Dc=["Power Saving","Custom","Lots of Stuff"],Oc=[["LiteMode.Key.animations.Title",[{key:"pageTransitions",label:"Page Transitions"},{key:"messageSendingAnimations",label:"Message Sending Animation"},{key:"mediaViewerAnimations",label:"Media Viewer Animations"},{key:"messageComposerAnimations",label:"Message Composer Animations"},{key:"contextMenuAnimations",label:"Context Menu Animation"},{key:"contextMenuBlur",label:"Context Menu Blur",disabled:!g.gk},{key:"rightColumnAnimations",label:"Right Column Animation"}]],["Stickers and Emoji",[{key:"animatedEmoji",label:"Allow Animated Emoji"},{key:"loopAnimatedStickers",label:"Loop Animated Stickers"},{key:"reactionEffects",label:"Reaction Effects"},{key:"stickerEffects",label:"Full-Screen Sticker and Emoji Effects"}]],["AutoplayMedia",[{key:"autoplayGifs",label:"AutoplayGIF"},{key:"autoplayVideos",label:"AutoplayVideo"}]]],Uc=(0,a.X$)((0,s.c$)((e=>({performanceSettings:(0,l.yf2)(e)})))((function({isActive:e,performanceSettings:t,onReset:n}){const{setSettingOption:i,updatePerformanceSettings:r}=(0,s.Sv)();(0,pe.Z)({isActive:e,onBack:n});const l=(0,M.Z)(),[c,d]=(0,a.eJ)({}),m=(0,a.Ye)((()=>Oc.reduce(((e,[,n],a)=>(e[a]=n.every((({key:e})=>t[e])),e)),{})),[t]),u=(0,a.Ye)((()=>(0,Fc.A)(t,Bc.WD)?o.zy8:(0,Fc.A)(t,Bc.ww)?o.oBh:(0,Fc.A)(t,Bc.LN)?o.mzL:o.YBT),[t]),h=u===o.YBT?Dc:xc,Z=(0,a.I4)(((e,t)=>{e.preventDefault();const n=Number(t);d((e=>({...e,[n]:!e[n]})))}),[]),P=(0,a.I4)((e=>{const t=e===o.oBh?Bc.ww:e===o.mzL?Bc.LN:Bc.WD;i({animationLevel:e}),r(t)}),[i]),p=(0,a.I4)((e=>{const{name:t,checked:n}=e.target,a=Oc.find((([e])=>e===t));if(!a)return;const s=a[1].reduce(((e,{key:t})=>(e[t]=n,e)),{});r(s)}),[]),v=(0,a.I4)((e=>{const{name:t,checked:n}=e.target;r({[t]:n})}),[]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:l.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(Ve.Z,{options:h,value:u===o.YBT?o.mzL:u,onChange:P})),a.ZP.createElement("div",{className:"settings-item-simple settings-item__with-shifted-dropdown"},a.ZP.createElement("h3",{className:"settings-item-header",dir:"auto"},"Resource-Intensive Processes"),Oc.map((([e,n],s)=>a.ZP.createElement("div",{key:e,className:"settings-dropdown-section"},a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:e,value:s.toString(),checked:m[s],label:l(e),rightIcon:c[s]?"up":"down",onChange:p,onClickLabel:Z})),Boolean(c[s])&&a.ZP.createElement("div",{className:"DropdownList DropdownList--open"},n.map((({key:e,label:n,disabled:s})=>a.ZP.createElement(As.Z,{key:e,name:e,checked:t[e],label:l(n),disabled:s,onChange:v})))))))))}))),_c=(0,a.X$)((0,s.c$)((e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:n,canChangeSensitive:a,shouldArchiveAndMuteNewNonContact:s,canDisplayChatInTitle:i},privacy:o},blocked:r,passcode:{hasPasscode:c},appConfig:d}=e;return{isCurrentUserPremium:(0,l.wVz)(e),hasPassword:t,hasPasscode:Boolean(c),blockedCount:r.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:n,canDisplayAutoarchiveSetting:Boolean(d?.canDisplayAutoarchiveSetting),shouldArchiveAndMuteNewNonContact:s,canChangeSensitive:a,privacyPhoneNumber:o.phoneNumber,privacyLastSeen:o.lastSeen,privacyProfilePhoto:o.profilePhoto,privacyForwarding:o.forwards,privacyVoiceMessages:o.voiceMessages,privacyGroupChats:o.chatInvite,privacyPhoneCall:o.phoneCall,privacyBio:o.bio,canDisplayChatInTitle:i,canSetPasscode:(0,l.eB8)(e)}}))((({isActive:e,isCurrentUserPremium:t,hasPassword:n,hasPasscode:o,blockedCount:r,webAuthCount:l,isSensitiveEnabled:c,canChangeSensitive:d,canDisplayAutoarchiveSetting:m,shouldArchiveAndMuteNewNonContact:u,canDisplayChatInTitle:h,canSetPasscode:Z,privacyPhoneNumber:P,privacyLastSeen:p,privacyProfilePhoto:v,privacyForwarding:g,privacyVoiceMessages:E,privacyGroupChats:C,privacyPhoneCall:b,privacyBio:f,onScreenSelect:y,onReset:I})=>{const{loadPrivacySettings:S,loadBlockedUsers:k,loadContentSettings:N,updateContentSettings:w,loadGlobalPrivacySettings:T,updateGlobalPrivacySettings:A,loadWebAuthorizations:R,showNotification:L,setSettingOption:B}=(0,s.Sv)();(0,a.d4)((()=>{k(),S(),N(),R()}),[]),(0,a.d4)((()=>{e&&T()}),[e,T]);const F=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:I});const x=(0,a.I4)((e=>{A({shouldArchiveAndMuteNewNonContact:e})}),[A]),D=(0,a.I4)((()=>{t?y(i.MT.PrivacyVoiceMessages):L({message:F("PrivacyVoiceMessagesPremiumOnly")})}),[t,F,y,L]),O=(0,a.I4)((e=>{B({canDisplayChatInTitle:e})}),[]),U=(0,a.I4)((e=>{w(e)}),[w]);function _(e){const{visibility:t}=e||{},n=e?e.blockChatIds.length+e.blockUserIds.length:0,a=e?e.allowChatIds.length+e.allowUserIds.length:0,s=[];n&&s.push(`-${n}`),a&&s.push(`+${a}`);const i=s.length?`(${s.join(",")})`:"";switch(t){case"everybody":return`${F("P2PEverybody")} ${i}`;case"contacts":return`${F("P2PContacts")} ${i}`;case"nobody":return`${F("P2PNobody")} ${i}`}}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(jn.Z,{icon:"delete-user",onClick:()=>y(i.MT.PrivacyBlockedUsers)},F("BlockedUsers"),a.ZP.createElement("span",{className:"settings-item__current-value"},r||"")),Z&&a.ZP.createElement(jn.Z,{icon:"key",narrow:!0,onClick:()=>y(o?i.MT.PasscodeEnabled:i.MT.PasscodeDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("Passcode")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},F(o?"PasswordOn":"PasswordOff")))),a.ZP.createElement(jn.Z,{icon:"lock",narrow:!0,onClick:()=>y(n?i.MT.TwoFaEnabled:i.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},F(n?"PasswordOn":"PasswordOff")))),l>0&&a.ZP.createElement(jn.Z,{icon:"web",onClick:()=>y(i.MT.ActiveWebsites)},F("PrivacySettings.WebSessions"),a.ZP.createElement("span",{className:"settings-item__current-value"},l))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:F.isRtl?"rtl":void 0},F("PrivacyTitle")),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(P)))),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(p)))),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(v)))),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyBio)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyBio")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(f)))),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(g)))),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyPhoneCall)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("WhoCanCallMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(b)))),a.ZP.createElement(jn.Z,{narrow:!0,className:"no-icon",onClick:()=>y(i.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(C)))),a.ZP.createElement(jn.Z,{narrow:!0,disabled:!t,allowDisabledClick:!0,rightElement:!t&&a.ZP.createElement("i",{className:"icon icon-lock-badge settings-icon-locked"}),className:"no-icon",onClick:D},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyVoiceMessagesTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},_(E))))),m&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("NewChatsFromNonContacts")),a.ZP.createElement(As.Z,{label:F("ArchiveAndMute"),subLabel:F("ArchiveAndMuteInfo"),checked:Boolean(u),onCheck:x})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("lng_settings_window_system")),a.ZP.createElement(As.Z,{label:F("lng_settings_title_chat_name"),checked:Boolean(h),onCheck:O})),d&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("lng_settings_sensitive_title")),a.ZP.createElement(As.Z,{label:F("lng_settings_sensitive_disable_filtering"),subLabel:F("lng_settings_sensitive_about"),checked:Boolean(c),disabled:!d,onCheck:U})))}))),$c=(0,a.X$)((0,s.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:a?.userIds,localContactIds:(0,l.jUK)(e).userSearch.localUserIds,currentUserId:s}}))((({usersById:e,blockedIds:t,contactIds:n,localContactIds:i,currentUserId:o,isOpen:l,onClose:c})=>{const{setUserSearchQuery:d,blockUser:m}=(0,s.Sv)(),u=(0,M.Z)(),[h,Z]=(0,a.eJ)("");(0,a.d4)((()=>{d({query:h})}),[h,d]);const P=(0,a.Ye)((()=>{const a=(0,Kn.Tw)([...n||[],...i||[]].filter((e=>e!==o&&!t.includes(e))));return(0,r.kK)(a,e,h).sort(((t,n)=>{const a=(0,r.Js)(e[t])||"",s=(0,r.Js)(e[n])||"";return a.localeCompare(s)}))}),[t,n,o,h,i,e]),p=(0,a.I4)((e=>{m({userId:e}),c()}),[c]);return a.ZP.createElement(vs,{isOpen:l,chatOrUserIds:P,searchPlaceholder:u("BlockedUsers.BlockUser"),search:h,onSearchChange:Z,onSelectChatOrUser:p,onClose:c})}))),jc=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a,phoneCodeList:s}}))((({isActive:e,onReset:t,chatsByIds:n,usersByIds:i,blockedIds:l,phoneCodeList:c})=>{const{unblockUser:d}=(0,s.Sv)(),m=(0,M.Z)(),[u,h,Z]=(0,k.Z)(),P=(0,a.I4)((e=>{d({userId:e})}),[d]);(0,pe.Z)({isActive:e,onBack:t});const p=(0,a.Ye)((()=>l.reduce(((e,t)=>{const n=(0,r.YC)(t)?i[t]:void 0,a=n&&!n.phoneNumber&&(0,r.WS)(n);return a&&(e[t]=a),e}),{})),[l,i]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item no-border"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:m.isRtl?"rtl":void 0},m("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},l?.length?a.ZP.createElement("div",{className:"scroll-container settings-item"},l.map(((e,t)=>function(e,t,s){const l=(0,r.YC)(e),d=i[e],m=n[e],u=d||m,h=(0,ce.Z)("Chat chat-item-clickable blocked-list-item small-icon",l?"private":"group"),Z=p[e];return a.ZP.createElement(jn.Z,{key:`blocked_${e}`,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{P(e)}}],style:`top: ${(0+t)*o.rSj}px;`},a.ZP.createElement(yt.Z,{size:"medium",peer:u}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},u&&a.ZP.createElement(Cr.Z,{peer:u}),d?.phoneNumber&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,$s.WZ)(c,d.phoneNumber)),Z&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",Z)))}(e,t)))):l&&!l.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},m("NoBlocked")):a.ZP.createElement(hs.Z,{key:"loading"}))),a.ZP.createElement(na.Z,{isShown:!0,onClick:h,ariaLabel:m("BlockContact")},a.ZP.createElement("i",{className:"icon icon-add"})),a.ZP.createElement($c,{isOpen:u,onClose:Z}))})));function Vc(e){switch(e){case i.MT.PrivacyPhoneNumber:case i.MT.PrivacyPhoneNumberAllowedContacts:case i.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case i.MT.PrivacyLastSeen:case i.MT.PrivacyLastSeenAllowedContacts:case i.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case i.MT.PrivacyProfilePhoto:case i.MT.PrivacyProfilePhotoAllowedContacts:case i.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case i.MT.PrivacyBio:case i.MT.PrivacyBioAllowedContacts:case i.MT.PrivacyBioDeniedContacts:return"bio";case i.MT.PrivacyForwarding:case i.MT.PrivacyForwardingAllowedContacts:case i.MT.PrivacyForwardingDeniedContacts:return"forwards";case i.MT.PrivacyVoiceMessages:case i.MT.PrivacyVoiceMessagesAllowedContacts:case i.MT.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case i.MT.PrivacyGroupChats:case i.MT.PrivacyGroupChatsAllowedContacts:case i.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite";case i.MT.PrivacyPhoneCall:case i.MT.PrivacyPhoneCallAllowedContacts:case i.MT.PrivacyPhoneCallDeniedContacts:return"phoneCall";case i.MT.PrivacyPhoneP2P:case i.MT.PrivacyPhoneP2PAllowedContacts:case i.MT.PrivacyPhoneP2PDeniedContacts:return"phoneP2P";case i.MT.PrivacyAddByPhone:return"addByPhone"}}var Gc=n(66219);const Hc=(0,a.X$)((({currentUserId:e,hasCurrentUserFullInfo:t,currentUserFallbackPhoto:n})=>{const{loadFullUser:i,uploadProfilePhoto:o,deleteProfilePhoto:r,showNotification:l}=(0,s.Sv)(),c=(0,M.Z)(),[d,m,u]=(0,k.Z)(!1),h=(0,a.sO)(null);(0,a.d4)((()=>{t||i({userId:e})}),[t,e,i]);const Z=(0,a.I4)((e=>{o({file:e,isFallback:!0}),l({message:c("Privacy.ProfilePhoto.PublicPhotoSuccess")})}),[c,l,o]),P=(0,a.I4)((()=>{u(),r({photo:n})}),[u,r,n]),p=(0,a.I4)((()=>{h.current?.click()}),[]);return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(jn.Z,{icon:"camera-add",onClick:p},a.ZP.createElement(Gc.Z,{onChange:Z,inputRef:h}),c(n?"Privacy.ProfilePhoto.UpdatePublicPhoto":"Privacy.ProfilePhoto.SetPublicPhoto")),n&&a.ZP.createElement(jn.Z,{leftElement:a.ZP.createElement(yt.Z,{photo:n,size:"mini",className:"pqiopoENn7dO3E8DQI3e"}),onClick:m,destructive:!0},c(n.isVideo?"Privacy.ProfilePhoto.RemovePublicVideo":"Privacy.ProfilePhoto.RemovePublicPhoto"),a.ZP.createElement(Xn.Z,{isOpen:d,onClose:u,text:c("Privacy.ResetPhoto.Confirm"),confirmLabel:c("Delete"),confirmHandler:P,confirmIsDestructive:!0})),a.ZP.createElement("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0},c("Privacy.ProfilePhoto.PublicPhotoInfo")))}));function Jc({screen:e,privacy:t,onScreenSelect:n}){const{setPrivacyVisibility:o}=(0,s.Sv)(),r=(0,M.Z)(),l=(0,a.Ye)((()=>{const t=e!==i.MT.PrivacyAddByPhone,n=[{value:"everybody",label:r("P2PEverybody")},{value:"contacts",label:r("P2PContacts")}];return t&&n.push({value:"nobody",label:r("P2PNobody")}),n}),[r,e]),c=(0,a.Ye)((()=>e===i.MT.PrivacyAddByPhone?{shouldShowDenied:!1,shouldShowAllowed:!1}:{shouldShowDenied:"nobody"!==t?.visibility,shouldShowAllowed:"everybody"!==t?.visibility}),[t,e]),d=Vc(e),m=(0,a.Ye)((()=>{switch(e){case i.MT.PrivacyLastSeen:return r("CustomHelp");case i.MT.PrivacyAddByPhone:return r("everybody"===t?.visibility?"PrivacyPhoneInfo":"PrivacyPhoneInfo3");default:return}}),[r,e,t]),u=(0,a.Ye)((()=>{switch(e){case i.MT.PrivacyPhoneNumber:return r("PrivacyPhoneTitle");case i.MT.PrivacyAddByPhone:return r("PrivacyPhoneTitle2");case i.MT.PrivacyLastSeen:return r("LastSeenTitle");case i.MT.PrivacyProfilePhoto:return r("PrivacyProfilePhotoTitle");case i.MT.PrivacyBio:return r("PrivacyBioTitle");case i.MT.PrivacyForwarding:return r("PrivacyForwardsTitle");case i.MT.PrivacyVoiceMessages:return r("PrivacyVoiceMessagesTitle");case i.MT.PrivacyGroupChats:return r("WhoCanAddMe");case i.MT.PrivacyPhoneCall:return r("WhoCanCallMe");case i.MT.PrivacyPhoneP2P:return r("PrivacyP2P");default:return}}),[r,e]),h=(0,T.Z)(((e,t)=>{const n=e?.length||0,a=t?.length||0;return n||a?[n>0?r("Users",n):void 0,a>0?r("Chats",a):void 0].filter(Boolean).join(", "):r("EditAdminAddUsers")})),Z=(0,a.Ye)((()=>h(t?.allowUserIds,t?.allowChatIds)),[t]),P=(0,a.Ye)((()=>h(t?.blockUserIds,t?.blockChatIds)),[t]),p=(0,a.I4)((e=>{o({privacyKey:d,visibility:e})}),[d]),v=(()=>{switch(e){case i.MT.PrivacyPhoneNumber:return i.MT.PrivacyPhoneNumberAllowedContacts;case i.MT.PrivacyLastSeen:return i.MT.PrivacyLastSeenAllowedContacts;case i.MT.PrivacyProfilePhoto:return i.MT.PrivacyProfilePhotoAllowedContacts;case i.MT.PrivacyBio:return i.MT.PrivacyBioAllowedContacts;case i.MT.PrivacyForwarding:return i.MT.PrivacyForwardingAllowedContacts;case i.MT.PrivacyPhoneCall:return i.MT.PrivacyPhoneCallAllowedContacts;case i.MT.PrivacyPhoneP2P:return i.MT.PrivacyPhoneP2PAllowedContacts;case i.MT.PrivacyVoiceMessages:return i.MT.PrivacyVoiceMessagesAllowedContacts;default:return i.MT.PrivacyGroupChatsAllowedContacts}})(),g=(()=>{switch(e){case i.MT.PrivacyPhoneNumber:return i.MT.PrivacyPhoneNumberDeniedContacts;case i.MT.PrivacyLastSeen:return i.MT.PrivacyLastSeenDeniedContacts;case i.MT.PrivacyProfilePhoto:return i.MT.PrivacyProfilePhotoDeniedContacts;case i.MT.PrivacyBio:return i.MT.PrivacyBioDeniedContacts;case i.MT.PrivacyForwarding:return i.MT.PrivacyForwardingDeniedContacts;case i.MT.PrivacyPhoneCall:return i.MT.PrivacyPhoneCallDeniedContacts;case i.MT.PrivacyPhoneP2P:return i.MT.PrivacyPhoneP2PDeniedContacts;case i.MT.PrivacyVoiceMessages:return i.MT.PrivacyVoiceMessagesDeniedContacts;default:return i.MT.PrivacyGroupChatsDeniedContacts}})();return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:r.isRtl?"rtl":void 0},u),a.ZP.createElement(Dl.Z,{name:`visibility-${d}`,options:l,onChange:p,selected:t?.visibility}),m&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:r.isRtl?"rtl":void 0},m)),(c.shouldShowAllowed||c.shouldShowDenied)&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:r.isRtl?"rtl":void 0},r("PrivacyExceptions")),c.shouldShowAllowed&&a.ZP.createElement(jn.Z,{narrow:!0,icon:"add-user",onClick:()=>{n(v)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},a.ZP.createElement("span",{className:"title"},r("AlwaysAllow")),a.ZP.createElement("span",{className:"subtitle"},Z))),c.shouldShowDenied&&a.ZP.createElement(jn.Z,{narrow:!0,icon:"delete-user",onClick:()=>{n(g)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},a.ZP.createElement("span",{className:"title"},r("NeverAllow")),a.ZP.createElement("span",{className:"subtitle"},P)))))}const zc=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{let n,a;const{currentUserId:s,settings:{privacy:o}}=e,r=(0,l.ccz)(e,s);switch(t){case i.MT.PrivacyPhoneNumber:n=o.phoneNumber,a=o.addByPhone;break;case i.MT.PrivacyLastSeen:n=o.lastSeen;break;case i.MT.PrivacyProfilePhoto:n=o.profilePhoto;break;case i.MT.PrivacyBio:n=o.bio;break;case i.MT.PrivacyPhoneP2P:case i.MT.PrivacyPhoneCall:n=o.phoneCall,a=o.phoneP2P;break;case i.MT.PrivacyForwarding:n=o.forwards;break;case i.MT.PrivacyVoiceMessages:n=o.voiceMessages;break;case i.MT.PrivacyGroupChats:n=o.chatInvite}return n?{primaryPrivacy:n,secondaryPrivacy:a,currentUserId:s,hasCurrentUserFullInfo:Boolean(r),currentUserFallbackPhoto:r?.fallbackPhoto}:{currentUserId:s,hasCurrentUserFullInfo:Boolean(r),currentUserFallbackPhoto:r?.fallbackPhoto}}))((({screen:e,isActive:t,primaryPrivacy:n,secondaryPrivacy:s,currentUserId:o,hasCurrentUserFullInfo:r,currentUserFallbackPhoto:l,onScreenSelect:c,onReset:d})=>{(0,pe.Z)({isActive:t,onBack:d});const m=(0,a.Ye)((()=>{switch(e){case i.MT.PrivacyPhoneCall:return i.MT.PrivacyPhoneP2P;case i.MT.PrivacyPhoneNumber:return"nobody"===n?.visibility?i.MT.PrivacyAddByPhone:void 0;default:return}}),[n,e]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement(Jc,{screen:e,privacy:n,onScreenSelect:c}),e===i.MT.PrivacyProfilePhoto&&"everybody"!==n?.visibility&&a.ZP.createElement(Hc,{currentUserId:o,hasCurrentUserFullInfo:r,currentUserFallbackPhoto:l}),m&&a.ZP.createElement(Jc,{screen:m,privacy:s,onScreenSelect:c}))})));function Xc(e,t){const{privacy:n}=e.settings;switch(t){case i.MT.PrivacyPhoneNumberAllowedContacts:case i.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case i.MT.PrivacyLastSeenAllowedContacts:case i.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case i.MT.PrivacyProfilePhotoAllowedContacts:case i.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case i.MT.PrivacyBioAllowedContacts:case i.MT.PrivacyBioDeniedContacts:return n.bio;case i.MT.PrivacyPhoneCallAllowedContacts:case i.MT.PrivacyPhoneCallDeniedContacts:return n.phoneCall;case i.MT.PrivacyPhoneP2PAllowedContacts:case i.MT.PrivacyPhoneP2PDeniedContacts:return n.phoneP2P;case i.MT.PrivacyForwardingAllowedContacts:case i.MT.PrivacyForwardingDeniedContacts:return n.forwards;case i.MT.PrivacyVoiceMessagesAllowedContacts:case i.MT.PrivacyVoiceMessagesDeniedContacts:return n.voiceMessages;case i.MT.PrivacyGroupChatsDeniedContacts:case i.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const Yc=(0,a.X$)((0,s.c$)(((e,{screen:t})=>({currentUserId:e.currentUserId,settings:Xc(e,t)})))((({isAllowList:e,screen:t,isActive:n,currentUserId:l,settings:c,onScreenSelect:d,onReset:m})=>{const{setPrivacySettings:u}=(0,s.Sv)(),h=(0,M.Z)(),Z=(0,a.Ye)((()=>c?e?[...c.allowUserIds,...c.allowChatIds]:[...c.blockUserIds,...c.blockChatIds]:[]),[e,c]),[P,p]=(0,a.eJ)(""),[v,g]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(Z);(0,a.d4)((()=>{n||C(Z)}),[n,Z]);const b=(0,hl.d7)(o.NfV),f=(0,hl.d7)(o.WSp),y=(0,a.Ye)((()=>{const e=(0,s.Rd)().chats.byId,t=(0,Kn.Tw)([...b||[],...f||[]]).filter((e=>e!==l));return(0,Kn.Tw)([...Z,...(0,r.$l)(h,t,e,P)])}),[b,f,Z,h,P,l]),I=(0,a.I4)((e=>{C(e),g(!0)}),[]),S=(0,a.I4)((()=>{u({privacyKey:Vc(t),isAllowList:Boolean(e),updatedIds:E}),d(i.MT.Privacy)}),[e,E,d,t,u]);return(0,pe.Z)({isActive:n,onBack:m}),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Qn.Z,{itemIds:y||[],selectedIds:E,filterValue:P,filterPlaceholder:h(e?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),searchInputId:"new-group-picker-search",isSearchable:!0,onSelectedIdsChange:I,onFilterChange:p}),a.ZP.createElement(na.Z,{isShown:v,onClick:S,ariaLabel:h(e?"AlwaysAllow":"NeverAllow")},a.ZP.createElement("i",{className:"icon icon-check"})))}))),qc=(0,a.X$)((0,s.c$)((e=>{const{availableReactions:t,config:n}=e;return{availableReactions:t,selectedReaction:n?.defaultReaction}}))((({isActive:e,availableReactions:t,selectedReaction:n,onReset:i})=>{const{setDefaultReaction:o}=(0,s.Sv)();(0,pe.Z)({isActive:e,onBack:i});const r=(0,a.Ye)((()=>(t||[]).filter((e=>!e.isInactive)).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(as.Z,{reaction:e.reaction,availableReactions:t}),e.title),value:e.reaction.emoticon})))),[t]),l=(0,a.I4)((e=>{o({reaction:{emoticon:e}})}),[o]);return a.ZP.createElement("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction"},a.ZP.createElement(Dl.Z,{name:"quick-reaction-settings",options:r,selected:n,onChange:l}))}))),Kc=1.5*u.Gw,Wc=(0,a.X$)((0,s.c$)((e=>({...(0,Kn.ei)(e.settings.byKey,["shouldSuggestStickers","shouldUpdateStickerSetOrder"]),addedSetIds:e.stickers.added.setIds,customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:e.config?.defaultReaction,availableReactions:e.availableReactions,canPlayAnimatedEmojis:(0,l.W9H)(e)})))((({isActive:e,addedSetIds:t,customEmojiSetIds:n,stickerSetsById:o,defaultReaction:r,shouldSuggestStickers:l,shouldUpdateStickerSetOrder:c,availableReactions:d,canPlayAnimatedEmojis:m,onReset:u,onScreenSelect:h})=>{const{setSettingOption:Z,openStickerSet:P}=(0,s.Sv)(),p=(0,M.Z)(),v=(0,a.sO)(null),{observe:g}=(0,vo.S1)({rootRef:v}),E=(0,a.I4)((e=>{P({stickerSetInfo:e.stickerSetInfo})}),[P]),C=(0,a.I4)((e=>{Z({shouldUpdateStickerSetOrder:e})}),[Z]),b=(0,a.I4)((e=>{Z({shouldSuggestStickers:e})}),[Z]),f=(0,a.Ye)((()=>t&&Object.values((0,Kn.ei)(o,t))),[t,o]);return(0,pe.Z)({isActive:e,onBack:u}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(As.Z,{label:p("SuggestStickers"),checked:l,onCheck:b}),a.ZP.createElement(jn.Z,{className:"mt-4",onClick:()=>h(i.MT.CustomEmoji),icon:"smile"},p("StickersList.EmojiItem"),n&&a.ZP.createElement("span",{className:"settings-item__current-value"},n.length)),r&&a.ZP.createElement(jn.Z,{className:"SettingsDefaultReaction",onClick:()=>h(i.MT.QuickReaction)},a.ZP.createElement(as.Z,{reaction:r,className:"current-default-reaction",size:Kc,availableReactions:d}),a.ZP.createElement("div",{className:"title"},p("DoubleTapSetting")))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("InstalledStickers.DynamicPackOrder")),a.ZP.createElement(As.Z,{label:p("InstalledStickers.DynamicPackOrder"),checked:c,onCheck:C}),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},p("InstalledStickers.DynamicPackOrderInfo"))),f&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("ChooseStickerMyStickerSets")),a.ZP.createElement("div",{ref:v},f.map((e=>a.ZP.createElement(Jl,{key:e.id,stickerSet:e,observeIntersection:g,onClick:E,noPlay:!m})))),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},(0,te.Z)(p("StickersBotInfo"),["links"]))))}))),Qc=(0,a.X$)((({isActive:e,onReset:t,onScreenSelect:n})=>{const s=(0,M.Z)(),r=(0,a.I4)((()=>{n(i.MT.Privacy)}),[n]);return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(vl.Z,{size:o.K2q,tgsUrl:pl.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},s("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Y.Z,{onClick:r},s("TwoStepVerificationPasswordReturnSettings"))))}));var ed=n(45601);const td=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,l.zB_)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((({animatedEmoji:e,codeLength:t,isLoading:n,error:s,clearError:i,onSubmit:o,isActive:r,onReset:l})=>{const c=(0,a.sO)(null),{isMobile:d}=(0,I.ZP)(),m=d?550:400,[u,h]=(0,a.eJ)("");(0,a.d4)((()=>{g.$b||setTimeout((()=>{c.current.focus()}),m)}),[m]);const Z=(0,M.Z)();(0,pe.Z)({isActive:r,onBack:l});const P=(0,a.I4)((e=>{s&&i&&i();const n=e.target.value.slice(0,t);n.length===t&&o(n),h(n),e.target.value=n}),[i,t,s,o]);return a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ed.Z,{sticker:e,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(us.Z,{value:u,ref:c,inputMode:"decimal",label:Z("YourEmailCode"),error:s,onChange:P}),n&&a.ZP.createElement(hs.Z,null)))}))),nd=(0,a.X$)((({isActive:e,onReset:t,onScreenSelect:n})=>{const s=(0,M.Z)();return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Lo.Z,{tgsUrl:pl.l.Lock,previewUrl:Rl,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,te.Z)(s("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(jn.Z,{icon:"edit",onClick:()=>n(i.MT.TwoFaChangePasswordCurrent)},s("ChangePassword")),a.ZP.createElement(jn.Z,{icon:"password-off",onClick:()=>n(i.MT.TwoFaTurnOff)},s("TurnPasswordOff")),a.ZP.createElement(jn.Z,{icon:"email",onClick:()=>n(i.MT.TwoFaRecoveryEmailCurrentPassword)},s("SetRecoveryEmail"))))})),ad=(0,a.X$)((0,s.c$)(((e,{icon:t})=>({animatedEmoji:(0,l.zB_)(e,"email"===t?"💌":"💡")})))((({animatedEmoji:e,type:t="text",isLoading:n,error:s,placeholder:i,shouldConfirm:o,clearError:r,onSubmit:l,isActive:c,onReset:d})=>{const m=(0,a.sO)(null),{isMobile:u}=(0,I.ZP)(),h=u?550:400,[Z,P]=(0,a.eJ)(""),[p,v,E]=(0,k.Z)(!1);(0,a.d4)((()=>{g.$b||setTimeout((()=>{m.current.focus()}),h)}),[h]);const C=(0,a.I4)((e=>{s&&r&&r(),P(e.target.value)}),[r,s]),b=(0,a.I4)((()=>{l()}),[l]),f=(0,a.I4)((()=>{E(),l()}),[l,E]),y=(0,M.Z)();return(0,pe.Z)({isActive:c,onBack:d}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ed.Z,{sticker:e,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),m.current&&l(Z)}},a.ZP.createElement(us.Z,{ref:m,value:Z,inputMode:t,label:i,error:s,onChange:C}),Z?a.ZP.createElement(Y.Z,{type:"submit",isLoading:n,ripple:!0},y("Continue")):a.ZP.createElement(Y.Z,{isText:!0,isLoading:n,ripple:!0,onClick:o?v:b},y("YourEmailSkip"))),o&&a.ZP.createElement(ne.Z,{className:"narrow",isOpen:p,title:y("YourEmailSkipWarning"),onClose:E},(0,te.Z)(y("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:f},y("YourEmailSkip")),a.ZP.createElement(Y.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:E},y("Cancel"))))))}))),sd=(0,a.X$)((({isActive:e,onReset:t,onStart:n})=>{const s=(0,M.Z)();return(0,pe.Z)({isActive:e,onBack:t}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Lo.Z,{tgsUrl:pl.l.Lock,previewUrl:Rl,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},s("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Y.Z,{onClick:n},s("EditAdminTransferSetPassword"))))})),id=(0,a.X$)((0,s.c$)((e=>({...e.twoFaSettings})))((({currentScreen:e,shownScreen:t,state:n,hint:o,isLoading:r,error:l,waitingEmailCodeLength:c,dispatch:d,isActive:m,onScreenSelect:u,onReset:h})=>{const{updatePassword:Z,checkPassword:P,clearTwoFaError:p,updateRecoveryEmail:v,provideTwoFaEmailCode:g,clearPassword:E}=(0,s.Sv)();(0,a.d4)((()=>{c&&(e===i.MT.TwoFaNewPasswordEmail?u(i.MT.TwoFaNewPasswordEmailCode):e===i.MT.TwoFaRecoveryEmail&&u(i.MT.TwoFaRecoveryEmailCode))}),[e,u,c]);const C=(0,a.I4)((()=>{d({type:"reset"}),u(i.MT.TwoFaNewPassword)}),[d,u]),b=(0,a.I4)((e=>{d({type:"setPassword",payload:e}),u(i.MT.TwoFaNewPasswordConfirm)}),[d,u]),f=(0,a.I4)((()=>{u(i.MT.TwoFaNewPasswordHint)}),[u]),y=(0,a.I4)((e=>{d({type:"setHint",payload:e}),u(i.MT.TwoFaNewPasswordEmail)}),[d,u]),I=(0,a.I4)((e=>{d({type:"setEmail",payload:e}),Z({...n,email:e,onSuccess:()=>{u(i.MT.TwoFaCongratulations)}})}),[d,u,n,Z]),S=(0,a.I4)((e=>{d({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{u(i.MT.TwoFaChangePasswordNew)}})}),[P,d,u]),k=(0,a.I4)((e=>{d({type:"setPassword",payload:e}),u(i.MT.TwoFaChangePasswordConfirm)}),[d,u]),N=(0,a.I4)((()=>{u(i.MT.TwoFaChangePasswordHint)}),[u]),w=(0,a.I4)((e=>{d({type:"setHint",payload:e}),Z({...n,hint:e,onSuccess:()=>{u(i.MT.TwoFaCongratulations)}})}),[d,u,n,Z]),T=(0,a.I4)((e=>{E({currentPassword:e,onSuccess:()=>{u(i.MT.Privacy)}})}),[E,u]),A=(0,a.I4)((e=>{d({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{u(i.MT.TwoFaRecoveryEmail)}})}),[P,d,u]),R=(0,a.I4)((e=>{d({type:"setEmail",payload:e}),v({...n,email:e,onSuccess:()=>{u(i.MT.TwoFaCongratulations)}})}),[d,u,n,v]),L=(0,a.I4)((e=>{g({code:e})}),[g]),B=(0,M.Z)();switch(e){case i.MT.TwoFaDisabled:return a.ZP.createElement(sd,{onStart:C,isActive:m||[i.MT.TwoFaNewPassword,i.MT.TwoFaNewPasswordConfirm,i.MT.TwoFaNewPasswordHint,i.MT.TwoFaNewPasswordEmail,i.MT.TwoFaNewPasswordEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaNewPassword:return a.ZP.createElement(Tl,{placeholder:B("PleaseEnterPassword"),submitLabel:B("Continue"),onSubmit:b,isActive:m||[i.MT.TwoFaNewPasswordConfirm,i.MT.TwoFaNewPasswordHint,i.MT.TwoFaNewPasswordEmail,i.MT.TwoFaNewPasswordEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(Tl,{expectedPassword:n.password,placeholder:B("PleaseReEnterPassword"),submitLabel:B("Continue"),onSubmit:f,isActive:m||[i.MT.TwoFaNewPasswordHint,i.MT.TwoFaNewPasswordEmail,i.MT.TwoFaNewPasswordEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaNewPasswordHint:return a.ZP.createElement(ad,{icon:"hint",placeholder:B("PasswordHintPlaceholder"),onSubmit:y,isActive:m||[i.MT.TwoFaNewPasswordEmail,i.MT.TwoFaNewPasswordEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(ad,{icon:"email",type:"email",isLoading:r,error:l,clearError:p,placeholder:B("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:I,isActive:m||[i.MT.TwoFaNewPasswordEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(td,{isLoading:r,error:l,clearError:p,onSubmit:L,isActive:m||t===i.MT.TwoFaCongratulations,onReset:h});case i.MT.TwoFaCongratulations:return a.ZP.createElement(Qc,{onScreenSelect:u,isActive:m,onReset:h});case i.MT.TwoFaEnabled:return a.ZP.createElement(nd,{onScreenSelect:u,isActive:m||[i.MT.TwoFaChangePasswordCurrent,i.MT.TwoFaChangePasswordNew,i.MT.TwoFaChangePasswordConfirm,i.MT.TwoFaChangePasswordHint,i.MT.TwoFaTurnOff,i.MT.TwoFaRecoveryEmailCurrentPassword,i.MT.TwoFaRecoveryEmail,i.MT.TwoFaRecoveryEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(Tl,{isLoading:r,error:l,clearError:p,hint:o,onSubmit:S,isActive:m||[i.MT.TwoFaChangePasswordNew,i.MT.TwoFaChangePasswordConfirm,i.MT.TwoFaChangePasswordHint,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaChangePasswordNew:return a.ZP.createElement(Tl,{placeholder:B("PleaseEnterNewFirstPassword"),onSubmit:k,isActive:m||[i.MT.TwoFaChangePasswordConfirm,i.MT.TwoFaChangePasswordHint,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(Tl,{expectedPassword:n.password,placeholder:B("PleaseReEnterPassword"),onSubmit:N,isActive:m||[i.MT.TwoFaChangePasswordHint,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaChangePasswordHint:return a.ZP.createElement(ad,{isLoading:r,error:l,clearError:p,icon:"hint",placeholder:B("PasswordHintPlaceholder"),onSubmit:w,isActive:m||t===i.MT.TwoFaCongratulations,onReset:h});case i.MT.TwoFaTurnOff:return a.ZP.createElement(Tl,{isLoading:r,error:l,clearError:p,hint:o,onSubmit:T,isActive:m,onReset:h});case i.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(Tl,{isLoading:r,error:l,clearError:p,hint:o,onSubmit:A,isActive:m||[i.MT.TwoFaRecoveryEmail,i.MT.TwoFaRecoveryEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaRecoveryEmail:return a.ZP.createElement(ad,{icon:"email",type:"email",placeholder:B("RecoveryEmailTitle"),onSubmit:R,isActive:m||[i.MT.TwoFaRecoveryEmailCode,i.MT.TwoFaCongratulations].includes(t),onReset:h});case i.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(td,{isLoading:r,error:l,clearError:p,onSubmit:L,isActive:m||t===i.MT.TwoFaCongratulations,onReset:h});default:return}}))),od=Object.keys(i.MT).length/2,rd=[i.MT.TwoFaDisabled,i.MT.TwoFaNewPassword,i.MT.TwoFaNewPasswordConfirm,i.MT.TwoFaNewPasswordHint,i.MT.TwoFaNewPasswordEmail,i.MT.TwoFaNewPasswordEmailCode,i.MT.TwoFaCongratulations,i.MT.TwoFaEnabled,i.MT.TwoFaChangePasswordCurrent,i.MT.TwoFaChangePasswordNew,i.MT.TwoFaChangePasswordConfirm,i.MT.TwoFaChangePasswordHint,i.MT.TwoFaTurnOff,i.MT.TwoFaRecoveryEmailCurrentPassword,i.MT.TwoFaRecoveryEmail,i.MT.TwoFaRecoveryEmailCode],ld=[i.MT.PasscodeDisabled,i.MT.PasscodeEnabled],cd=[i.MT.Folders,i.MT.FoldersCreateFolder,i.MT.FoldersEditFolder,i.MT.FoldersEditFolderFromChatList,i.MT.FoldersEditFolderInvites,i.MT.FoldersIncludedChats,i.MT.FoldersIncludedChatsFromChatList,i.MT.FoldersExcludedChats,i.MT.FoldersExcludedChatsFromChatList,i.MT.FoldersShare],dd=[i.MT.PrivacyBlockedUsers,i.MT.ActiveWebsites],md=[i.MT.PrivacyPhoneNumberAllowedContacts,i.MT.PrivacyPhoneNumberDeniedContacts],ud=[i.MT.PrivacyLastSeenAllowedContacts,i.MT.PrivacyLastSeenDeniedContacts],hd=[i.MT.PrivacyProfilePhotoAllowedContacts,i.MT.PrivacyProfilePhotoDeniedContacts],Zd=[i.MT.PrivacyBioAllowedContacts,i.MT.PrivacyBioDeniedContacts],Pd=[i.MT.PrivacyPhoneCallAllowedContacts,i.MT.PrivacyPhoneCallDeniedContacts],pd=[i.MT.PrivacyPhoneP2PAllowedContacts,i.MT.PrivacyPhoneP2PDeniedContacts],vd=[i.MT.PrivacyForwardingAllowedContacts,i.MT.PrivacyForwardingDeniedContacts],gd=[i.MT.PrivacyVoiceMessagesAllowedContacts,i.MT.PrivacyVoiceMessagesDeniedContacts],Ed=[i.MT.PrivacyGroupChatsAllowedContacts,i.MT.PrivacyGroupChatsDeniedContacts],Cd=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:o,onScreenSelect:r,onReset:c,shouldSkipTransition:d})=>{const{closeShareChatFolderModal:m}=(0,s.Sv)(),[u,h]=(0,cl.Z)(ml,dl),[Z,P]=(0,a.eJ)(""),p=(0,T.Z)((e=>{const a=(0,l.jUK)((0,s.Rd)()).shareFolderScreen?.isFromSettings;t===i.MT.FoldersShare&&m(),!0===e||void 0!==a&&!a?c(!0):(t!==i.MT.FoldersCreateFolder&&t!==i.MT.FoldersEditFolder&&t!==i.MT.FoldersEditFolderFromChatList&&t!==i.MT.FoldersEditFolderInvites||setTimeout((()=>{o({type:"reset"})}),200),t!==i.MT.FoldersIncludedChats&&t!==i.MT.FoldersExcludedChats?c():"create"===n.mode?r(i.MT.FoldersCreateFolder):r(i.MT.FoldersEditFolder))}));function v(s,l,c,d){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Sc,{currentScreen:t,onReset:p,onScreenSelect:r,editedFolderId:n.folderId}),function(s,l){const c={[i.MT.PrivacyPhoneNumber]:md.includes(l),[i.MT.PrivacyLastSeen]:ud.includes(l),[i.MT.PrivacyProfilePhoto]:hd.includes(l),[i.MT.PrivacyBio]:Zd.includes(l),[i.MT.PrivacyPhoneCall]:Pd.includes(l),[i.MT.PrivacyPhoneP2P]:pd.includes(l),[i.MT.PrivacyForwarding]:vd.includes(l),[i.MT.PrivacyVoiceMessages]:gd.includes(l),[i.MT.PrivacyGroupChats]:Ed.includes(l)},d=rd.includes(l),m=ld.includes(l),v=cd.includes(l),g=dd.includes(l)||d||m||Object.keys(c).map(Number).includes(l)||Object.values(c).includes(!0);switch(t){case i.MT.Main:return a.ZP.createElement(Tc,{onScreenSelect:r,isActive:e,onReset:p});case i.MT.EditProfile:return a.ZP.createElement(lc,{isActive:e&&s,onReset:p});case i.MT.General:return a.ZP.createElement(Zc,{onScreenSelect:r,isActive:s||l===i.MT.GeneralChatBackgroundColor||l===i.MT.GeneralChatBackground||l===i.MT.QuickReaction||l===i.MT.CustomEmoji||g||v,onReset:p});case i.MT.QuickReaction:return a.ZP.createElement(qc,{isActive:s,onReset:p});case i.MT.CustomEmoji:return a.ZP.createElement(zl,{isActive:s,onReset:p});case i.MT.Notifications:return a.ZP.createElement(Lc,{isActive:s,onReset:p});case i.MT.DataStorage:return a.ZP.createElement(Xl,{isActive:s,onReset:p});case i.MT.Privacy:return a.ZP.createElement(_c,{onScreenSelect:r,isActive:s||g,onReset:p});case i.MT.Language:return a.ZP.createElement(kc,{isActive:s||l===i.MT.DoNotTranslate,onReset:p,onScreenSelect:r});case i.MT.DoNotTranslate:return a.ZP.createElement(Kl,{isActive:s,onReset:p});case i.MT.Stickers:return a.ZP.createElement(Wc,{isActive:s,onReset:p,onScreenSelect:r});case i.MT.Experimental:return a.ZP.createElement(dc,{isActive:s,onReset:p});case i.MT.GeneralChatBackground:return a.ZP.createElement(Ec,{onScreenSelect:r,isActive:s||l===i.MT.GeneralChatBackgroundColor,onReset:p});case i.MT.GeneralChatBackgroundColor:return a.ZP.createElement(Ic,{isActive:s,onReset:p});case i.MT.ActiveSessions:return a.ZP.createElement($l,{isActive:s,onReset:p});case i.MT.ActiveWebsites:return a.ZP.createElement(Hl,{isActive:s,onReset:p});case i.MT.PrivacyBlockedUsers:return a.ZP.createElement(jc,{isActive:s,onReset:p});case i.MT.PrivacyPhoneNumber:case i.MT.PrivacyLastSeen:case i.MT.PrivacyProfilePhoto:case i.MT.PrivacyBio:case i.MT.PrivacyPhoneCall:case i.MT.PrivacyForwarding:case i.MT.PrivacyVoiceMessages:case i.MT.PrivacyGroupChats:return a.ZP.createElement(zc,{screen:t,onScreenSelect:r,isActive:s||c[t],onReset:p});case i.MT.PrivacyPhoneNumberAllowedContacts:case i.MT.PrivacyLastSeenAllowedContacts:case i.MT.PrivacyProfilePhotoAllowedContacts:case i.MT.PrivacyBioAllowedContacts:case i.MT.PrivacyPhoneCallAllowedContacts:case i.MT.PrivacyPhoneP2PAllowedContacts:case i.MT.PrivacyForwardingAllowedContacts:case i.MT.PrivacyVoiceMessagesAllowedContacts:case i.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(Yc,{isAllowList:!0,screen:t,onScreenSelect:r,isActive:s||c[t],onReset:p});case i.MT.PrivacyPhoneNumberDeniedContacts:case i.MT.PrivacyLastSeenDeniedContacts:case i.MT.PrivacyProfilePhotoDeniedContacts:case i.MT.PrivacyBioDeniedContacts:case i.MT.PrivacyPhoneCallDeniedContacts:case i.MT.PrivacyPhoneP2PDeniedContacts:case i.MT.PrivacyForwardingDeniedContacts:case i.MT.PrivacyVoiceMessagesDeniedContacts:case i.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(Yc,{screen:t,onScreenSelect:r,isActive:s,onReset:p});case i.MT.Folders:case i.MT.FoldersCreateFolder:case i.MT.FoldersEditFolder:case i.MT.FoldersEditFolderFromChatList:case i.MT.FoldersEditFolderInvites:case i.MT.FoldersIncludedChats:case i.MT.FoldersIncludedChatsFromChatList:case i.MT.FoldersExcludedChats:case i.MT.FoldersExcludedChatsFromChatList:case i.MT.FoldersShare:return a.ZP.createElement(kl,{currentScreen:t,shownScreen:l,state:n,dispatch:o,isActive:s,onScreenSelect:r,onReset:p});case i.MT.TwoFaDisabled:case i.MT.TwoFaNewPassword:case i.MT.TwoFaNewPasswordConfirm:case i.MT.TwoFaNewPasswordHint:case i.MT.TwoFaNewPasswordEmail:case i.MT.TwoFaNewPasswordEmailCode:case i.MT.TwoFaCongratulations:case i.MT.TwoFaEnabled:case i.MT.TwoFaChangePasswordCurrent:case i.MT.TwoFaChangePasswordNew:case i.MT.TwoFaChangePasswordConfirm:case i.MT.TwoFaChangePasswordHint:case i.MT.TwoFaTurnOff:case i.MT.TwoFaRecoveryEmailCurrentPassword:case i.MT.TwoFaRecoveryEmail:case i.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(id,{currentScreen:t,state:u,dispatch:h,shownScreen:l,isActive:s,onScreenSelect:r,onReset:p});case i.MT.PasscodeDisabled:case i.MT.PasscodeNewPasscode:case i.MT.PasscodeNewPasscodeConfirm:case i.MT.PasscodeChangePasscodeCurrent:case i.MT.PasscodeChangePasscodeNew:case i.MT.PasscodeChangePasscodeConfirm:case i.MT.PasscodeCongratulations:case i.MT.PasscodeEnabled:case i.MT.PasscodeTurnOff:return a.ZP.createElement(Fl,{currentScreen:t,passcode:Z,onSetPasscode:P,shownScreen:l,isActive:s,onScreenSelect:r,onReset:p});case i.MT.Performance:return a.ZP.createElement(Uc,{isActive:s,onReset:p});default:return}}(s,d))}return a.ZP.createElement(K.ZP,{id:"Settings",name:d?"none":g.s0,activeKey:t,renderCount:od,shouldWrap:!0,withSwipeControl:!0},v)})),bd=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t}}))((({isActive:e,filter:t,usersById:n,userStatusesById:o,contactIds:l,onReset:c})=>{const{openChat:d,openNewContactDialog:m}=(0,s.Sv)(),u=(0,M.Z)(),{isMobile:h}=(0,I.ZP)();(0,pe.Z)({isActive:e,onBack:c});const Z=(0,a.I4)((e=>{d({id:e,shouldReplaceHistory:!0})}),[d]),P=(0,a.Ye)((()=>{if(!l)return;const e=(0,r.kK)(l,n,t);return(0,r.Z0)(e,n,o)}),[l,t,n,o]),[p,v]=(0,cs.Z)(void 0,P,Boolean(t));return a.ZP.createElement(Qa.Z,{items:p,onLoadMore:v,className:"chat-list custom-scroll"},p?.length?p.map((e=>a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable contact-list-item",onClick:()=>Z(e)},a.ZP.createElement(ns.Z,{userId:e,forceShowSelf:!0,avatarSize:"large",withStory:!0,storyViewerOrigin:i.ze.ChatList,ripple:!h})))):p&&!p.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},t.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(hs.Z,{key:"loading"}),a.ZP.createElement(na.Z,{key:"create-new-contact",isShown:!0,onClick:m,ariaLabel:u("CreateNewContact")},a.ZP.createElement("i",{className:"icon icon-add-user-filled"})))}))),fd=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:i,localResults:o}=(0,l.jUK)(e).globalSearch,{userIds:r}=i||{},{userIds:c}=o||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:s?.chats,globalUserIds:r,localUserIds:c}}))((({isChannel:e,isActive:t,selectedMemberIds:n,onSelectedMemberIdsChange:i,onNextStep:o,onReset:l,chatsById:c,localContactIds:d,searchQuery:m,isSearching:u,localUserIds:h,globalUserIds:Z})=>{const{setGlobalSearchQuery:P}=(0,s.Sv)(),p=(0,M.Z)();(0,pe.Z)({isActive:t,onBack:l});const v=(0,a.I4)((e=>{P({query:e})}),[]),g=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId,t=d?(0,r.kK)(d,e,m):[];return(0,r.ih)((0,Kn.Tw)([...t,...h||[],...Z||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,r.cS)(n))})),c,!1,n)}),[d,c,m,h,Z,n]),E=(0,a.I4)((()=>{P({query:""}),o()}),[o]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:l,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),a.ZP.createElement("h3",null,p("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Qn.Z,{itemIds:g,selectedIds:n,filterValue:m,filterPlaceholder:p("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:u,isSearchable:!0,onSelectedIdsChange:i,onFilterChange:v}),a.ZP.createElement(na.Z,{isShown:!0,onClick:E,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon icon-arrow-right"}))))}))),yd=(0,a.X$)((0,s.c$)((e=>{const{progress:t,error:n}=(0,l.jUK)(e).chatCreation||{};return{creationProgress:t,creationError:n,maxGroupSize:e.config?.maxGroupSize}}))((({isChannel:e,isActive:t,memberIds:n,maxGroupSize:o,creationProgress:l,creationError:c,onReset:d})=>{const{createGroupChat:m,createChannel:u}=(0,s.Sv)(),h=(0,M.Z)();(0,pe.Z)({isActive:t,onBack:d});const[Z,P]=(0,a.eJ)(""),[p,v]=(0,a.eJ)(""),[g,E]=(0,a.eJ)(),[C,b]=(0,a.eJ)(),f="Chat title can't be empty",y="Channel title can't be empty",I=l===i.Nh.InProgress;(0,a.d4)((()=>{if(e)return;if(!n.length||n.length>4)return void P("");const t=(0,s.Rd)(),a=t.users.byId,i=[t.currentUserId,...n].map((e=>(0,r.Vl)(a[e]))).filter(Boolean),o=i.slice(0,-1).join(", ")+h("CreateGroup.PeersTitleLastDelimeter")+i[i.length-1];P(o)}),[e,n,h]);const S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");P(n),n!==t&&(e.currentTarget.value=n)}),[]),k=(0,a.I4)((e=>{v(e.currentTarget.value)}),[]),N=(0,a.I4)((()=>{Z.length?o&&n.length>=o?b("Sorry, creating supergroups is not yet supported"):m({title:Z,photo:g,memberIds:n}):b(f)}),[Z,n,o,m,g]),w=(0,a.I4)((()=>{Z.length?u({title:Z,about:p,photo:g,memberIds:n}):b(y)}),[Z,u,p,g,n,y]);(0,a.d4)((()=>{l===i.Nh.Complete&&d(!0)}),[l,d]);const T=c&&h(c)||(C!==f&&C!==y?C:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>d(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),a.ZP.createElement("h3",null,h(e?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(sc.Z,{onChange:E,title:h("AddPhoto")}),a.ZP.createElement(us.Z,{value:Z,onChange:S,label:h(e?"EnterChannelName":"GroupName"),error:C===f||C===y?C:void 0}),e&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(us.Z,{value:p,onChange:k,label:h("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},h("DescriptionInfo"))),T&&a.ZP.createElement("p",{className:"error"},T),n.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},h("GroupInfo.ParticipantCount",n.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},n.map((e=>a.ZP.createElement(jn.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(ns.Z,{userId:e}))))))),a.ZP.createElement(na.Z,{isShown:0!==Z.length,onClick:e?w:N,disabled:I,ariaLabel:e?h("ChannelIntro.CreateChannel"):"Create Group"},I?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-arrow-right"})))}))),Id=Object.keys(i.du).length/2,Sd=(0,a.X$)((({isActive:e,isChannel:t=!1,content:n,onContentChange:s,onReset:o})=>{const[r,l]=(0,a.eJ)([]),c=(0,a.I4)((()=>{s(t?i.du.NewChannelStep2:i.du.NewGroupStep2)}),[t,s]);return a.ZP.createElement(K.ZP,{id:"NewChat",name:g.s0,renderCount:Id,activeKey:n},(s=>{switch(n){case i.du.NewChannelStep1:case i.du.NewGroupStep1:return a.ZP.createElement(fd,{isChannel:t,isActive:e,selectedMemberIds:r,onSelectedMemberIdsChange:l,onNextStep:c,onReset:o});case i.du.NewChannelStep2:case i.du.NewGroupStep2:return a.ZP.createElement(yd,{isChannel:t,isActive:s&&e,memberIds:r,onReset:o});default:return}}))}));var kd=n(32136),Nd=n(54416),wd=n(73217),Md=n(47505),Td=n(85194),Ad=n(40340),Rd=n(59690);const Ld=(0,a.X$)((({isActive:e,isForumPanelOpen:t,archiveSettings:n,isStoryRibbonShown:i,onReset:r,onTopicSearch:l,onSettingsScreenSelect:c,onLeftColumnContentChange:d,foldersDispatch:m})=>{const{updateArchiveSettings:u}=(0,s.Sv)(),h=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:r});const Z=(0,T.Z)((()=>{u({isHidden:!1})})),{shouldDisableDropdownMenuTransitionRef:P,handleDropdownMenuTransitionEnd:p}=(0,wd.Z)(t),{shouldRender:v,transitionClassNames:g}=(0,Fe.Z)(!t),{shouldRenderForumPanel:E,handleForumPanelAnimationEnd:C,handleForumPanelAnimationStart:b,isAnimationStarted:f}=(0,Nd.Z)(t),y=t&&f,{shouldRender:I,transitionClassNames:S,isClosing:k}=(0,Fe.Z)(i,void 0,void 0,"",!1,kd.zn+o.fK3);return a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:(0,ce.Z)("left-header",!I&&"left-header-shadow")},h.isRtl&&a.ZP.createElement("div",{className:"DropdownMenuFiller"}),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:r,ariaLabel:"Return to chat list",className:(0,ce.Z)(h.isRtl&&"rtl",y&&h.isRtl&&"right-aligned",P.current&&h.isRtl&&"disable-transition"),onTransitionEnd:p},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),v&&a.ZP.createElement("h3",{className:g},h("ArchivedChats")),a.ZP.createElement("div",{className:"story-toggler-wrapper"},a.ZP.createElement(Td.Z,{canShow:!0,isArchived:!0})),n.isHidden&&a.ZP.createElement(ie.Z,{className:"archived-chats-more-menu",positionX:"right",onTransitionEnd:h.isRtl?p:void 0},a.ZP.createElement(oe.Z,{icon:"archive-from-main",onClick:Z},h("lng_context_archive_to_list")))),a.ZP.createElement("div",{className:(0,ce.Z)("chat-list-wrapper",I&&"with-story-ribbon",S)},I&&a.ZP.createElement(Md.Z,{isArchived:!0,className:"left-header-shadow",isClosing:k}),a.ZP.createElement(Ad.Z,{folderType:"archived",isActive:e,isForumPanelOpen:y,onSettingsScreenSelect:c,onLeftColumnContentChange:d,foldersDispatch:m,archiveSettings:n})),E&&a.ZP.createElement(Rd.Z,{isOpen:t,onTopicSearch:l,onOpenAnimationStart:b,onCloseAnimationEnd:C}))}));var Bd=n(51218);const Fd=(0,a.X$)((0,s.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((({isOpen:e,chatId:t,foldersById:n,folderOrderedIds:i,onClose:r,onCloseAnimationEnd:l})=>{const{editChatFolders:c}=(0,s.Sv)(),d=(0,M.Z)(),m=(0,a.Ye)((()=>n?Object.keys(n).reduce(((e,a)=>{const{includedChatIds:s,pinnedChatIds:i}=n[Number(a)];return(s.includes(t)||i?.includes(t))&&e.push(a),e}),[]):[]),[t,n]),[u,h]=(0,a.eJ)(m),Z=(0,a.Ye)((()=>i?.filter((e=>e!==o.NfV)).map((e=>({label:n?n[e].title:"",value:String(e)})))||[]),[i,n]),P=(0,a.I4)((()=>{const e=m.filter((e=>!u.includes(e))).map(Number),n=u.filter((e=>!m.includes(e))).map(Number);c({chatId:t,idsToRemove:e,idsToAdd:n}),r()}),[t,c,m,r,u]);if(n&&i)return a.ZP.createElement(ne.Z,{isOpen:e,onClose:r,onCloseAnimationEnd:l,onEnter:P,className:"delete",title:d("FilterAddTo")},a.ZP.createElement(Bd.Z,{options:Z,selected:u,onChange:h,round:!0}),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:P},d("FilterAddTo")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},d("Cancel"))))})));var xd=function(e){return e.OneHour="3600",e.FourHours="14400",e.EightHours="28800",e.OneDay="86400",e.ThreeDays="259200",e.Forever="-1",e}(xd||{});const Dd=(0,a.X$)((({isOpen:e,chatId:t,topicId:n,onClose:i,onCloseAnimationEnd:r})=>{const[l,c]=(0,a.eJ)(xd.Forever),{updateChatMutedState:d,updateTopicMutedState:m}=(0,s.Sv)(),u=(0,M.Z)(),h=(0,a.Ye)((()=>[{label:u("MuteFor.Hours",1),value:xd.OneHour},{label:u("MuteFor.Hours",4),value:xd.FourHours},{label:u("MuteFor.Hours",8),value:xd.EightHours},{label:u("MuteFor.Days",1),value:xd.OneDay},{label:u("MuteFor.Days",3),value:xd.ThreeDays},{label:u("MuteFor.Forever"),value:xd.Forever}]),[u]),Z=(0,a.I4)((()=>{let e;e=l===xd.Forever?o.PT8:Math.floor(Date.now()/1e3)+Number(l),n?m({chatId:t,topicId:n,muteUntil:e}):d({chatId:t,muteUntil:e}),i()}),[t,l,i,n]);return a.ZP.createElement(ne.Z,{isOpen:e,onClose:i,onCloseAnimationEnd:r,onEnter:Z,className:"delete",title:u("Notifications")},a.ZP.createElement(Dl.Z,{name:"muteFor",options:h,selected:l,onChange:c}),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:Z},u("Common.Done")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:i},u("Cancel"))))}));var Od=n(89455);const Ud=document.createElement("div"),_d=new Set([_.Vv.Bold,_.Vv.Italic,_.Vv.Underline,_.Vv.Strike,_.Vv.Spoiler,_.Vv.CustomEmoji]);function $d(e){const t=function(e){const t=e.cloneContents();Ud.appendChild(t);const n=function(e,t){const n=e.commonAncestorContainer;if(n.nodeType===Node.ELEMENT_NODE&&n.classList.contains("text-content"))return t;let a=e.commonAncestorContainer.parentElement;for(;a&&!a.classList.contains("text-content");){const e=a.tagName.toLowerCase(),n=a.dataset.entityType;t=`<${e} ${n?`data-entity-type="${n}"`:""}>${t}</${e}>`,a=a.parentElement}return t}(e,Ud.innerHTML);return Ud.innerHTML="",n.replace(/<br\s*\/?>/gi,"\n").replace(/ /gi," ").replace(/\u00a0/gi," ")}(e);return function(e){if(!e.entities)return e;const t=e.entities.filter((e=>_d.has(e.type)));return{...e,entities:t.length?t:void 0}}((0,Od.ZP)(t,!1,!0))}var jd=n(33057),Vd=n(60998),Gd=n(40647);function Hd(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}var Jd=n(66902),zd=n(18428);const Xd=(0,a.X$)((({isReactionPickerOpen:e,availableReactions:t,topReactions:n,isOpen:i,message:o,isPrivate:l,isCurrentUserPremium:c,enabledReactions:d,maxUniqueReactions:m,anchor:Z,targetHref:P,canSendNow:p,canReschedule:v,canBuyPremium:g,canReply:E,canQuote:C,canEdit:b,noReplies:f,canPin:y,canUnpin:S,canDelete:N,canReport:w,canForward:A,canFaveSticker:R,canUnfaveSticker:L,canCopy:B,canCopyLink:F,canSelect:x,canDownload:D,canSaveGif:O,canRevote:U,canClosePoll:$,canTranslate:j,canShowOriginal:V,canSelectLanguage:G,isDownloading:H,repliesThreadInfo:J,canShowSeenBy:z,canShowReactionsCount:X,canShowReactionList:Y,seenByRecentPeers:q,hasCustomEmoji:K,customEmojiSets:W,canPlayAnimatedEmojis:Q,noTransition:ee,onReply:ne,onOpenThread:ae,onEdit:se,onPin:ie,onUnpin:re,onForward:le,onDelete:de,onReport:me,onFaveSticker:ue,onUnfaveSticker:he,onSelect:Ze,onSend:Pe,onReschedule:pe,onClose:ve,onCloseAnimationEnd:ge,onCopyLink:Ee,onCopyNumber:Ce,onDownload:be,onSaveGif:fe,onCancelVote:ye,onClosePoll:Ie,onShowSeenBy:Se,onShowReactors:ke,onToggleReaction:Ne,onCopyMessages:we,onAboutAds:Me,onSponsoredHide:Te,onSponsorInfo:Ae,onReactionPickerOpen:Re,onTranslate:Le,onShowOriginal:Be,onSelectLanguage:Fe})=>{const{showNotification:xe,openStickerSet:De,openCustomEmojiSets:Oe}=(0,s.Sv)(),Ue=(0,a.sO)(null),_e=(0,a.sO)(null),$e=(0,M.Z)(),Ve=Y&&!(!l&&!d),Ge=!("id"in o),He=Ge?"":o.id,Je=Ge?void 0:o.seenByDates,[ze,Xe]=(0,k.Z)(),[Ye,qe,Ke]=(0,k.Z)(),{isMobile:We,isDesktop:Qe}=(0,I.ZP)(),et=(0,a.Ye)((()=>Je?Object.keys(Je).length:0),[Je]),tt=(0,T.Z)((()=>{xe({message:$e("Share.Link.Copied")}),ve()}));(0,a.d4)((()=>{i&&ze&&!e&&ve()}),[ve,i,e,ze]);const nt=(0,T.Z)((()=>{W&&(1===W.length?De({stickerSetInfo:{shortName:W[0].shortName}}):Oe({setIds:W.map((e=>e.id))}),ve())})),at=Ge?[]:function(e,t,n,a,s,i,o){const l=[],c=(0,r.UD)(e),d=(0,r.O$)(e)||((0,r.Cg)(e)?void 0:(0,r.F$)(e)),m=(0,r.nl)(e),u=(0,r.Ti)(e,"inline"),Z=n&&d&&(u||(0,r.BM)(e))&&Wl.yl,P=window.getSelection();if(Z&&l.push({label:"lng_context_copy_image",icon:"copy-media",handler:()=>{Promise.resolve(u?Gd.he(u,_.IU.BlobUrl):d.blobUrl).then(Wl.VP),a?.()}}),n&&t)l.push({label:"lng_context_copy_link",icon:"copy",handler:()=>{(0,Wl.TE)(t),a?.()}});else if(n&&c){const t=Boolean(P?.anchorNode?.parentNode&&P.anchorNode.parentNode.closest(".Message .content-inner")&&""!==P.toString().replace(/(?:\r\n|\r|\n)/g,""));l.push({label:Hd(t),icon:"copy",handler:()=>{const n=(0,Vd.Z)();if(n?.length&&i)i(n);else if(t)document.execCommand("copy");else{const t=(0,h.X)({message:e,shouldRenderAsHtml:!0});t&&(0,Wl.qN)(t.join(""),(0,r.EU)(e))}a?.()}})}return s&&l.push({label:"lng_context_copy_message_link",icon:"link",handler:()=>{s(),a?.()}}),m&&o&&l.push({label:"lng_profile_copy_phone",icon:"copy",handler:()=>{o(),a?.()}}),l}(o,P,B,tt,F?Ee:void 0,we,Ce),st=(0,T.Z)((()=>Ge?document.querySelector(".Transition_slide-active > .MessageList .SponsoredMessage"):document.querySelector(`.Transition_slide-active > .MessageList div[data-message-id="${He}"]`))),it=(0,T.Z)((()=>document.querySelector(".Transition_slide-active > .MessageList"))),ot=(0,T.Z)((()=>document.querySelector(".MessageContextMenu .bubble"))),rt=(0,T.Z)((()=>{const e=We&&document.querySelector(".AudioPlayer-content")?.offsetHeight||0,t=document.querySelector(".HeaderPinnedMessageWrapper"),n=(We&&!e||!We&&t?.classList.contains("full-width"))&&t?.offsetHeight||0;return{extraPaddingX:10,extraTopPadding:document.querySelector(".MiddleHeader").offsetHeight,marginSides:Ve?32:void 0,extraMarginTop:n+e,shouldAvoidNegativePosition:!Qe,menuElMinWidth:Ve&&We?19.25*u.Gw:void 0}}));(0,a.d4)((()=>{i?setTimeout((()=>{qe()}),200):Ke()}),[i,qe,Ke]);const{positionX:lt,positionY:ct,transformOriginX:dt,transformOriginY:mt,style:ut,menuStyle:ht,withScroll:Zt}=(0,wo.Z)(Z,st,it,ot,rt);(0,a.d4)((()=>(Pa(Zt?_e.current:void 0,".ReactionPicker"),pa)),[Zt]);const Pt=(0,T.Z)((e=>{Re(e),Xe()}));return a.ZP.createElement(je.Z,{ref:Ue,isOpen:i,transformOriginX:dt,transformOriginY:mt,positionX:lt,positionY:ct,style:ut,bubbleStyle:ht,className:(0,ce.Z)("MessageContextMenu","fluid",Ve&&"with-reactions"),shouldSkipTransition:ee,onClose:ve,onCloseAnimationEnd:ge},Ve&&a.ZP.createElement(zd.Z,{enabledReactions:d,topReactions:n,allAvailableReactions:t,currentReactions:Ge?void 0:o.reactions?.results,maxUniqueReactions:m,onToggleReaction:Ne,isPrivate:l,isReady:Ye,canBuyPremium:g,isCurrentUserPremium:c,canPlayAnimatedEmojis:Q,onShowMore:Pt,className:(0,ce.Z)(ze&&"ReactionSelector-hidden")}),a.ZP.createElement("div",{className:(0,ce.Z)("MessageContextMenu_items scrollable-content custom-scroll",ze&&"MessageContextMenu_items-hidden"),style:ht,ref:_e},p&&a.ZP.createElement(oe.Z,{icon:"send-outline",onClick:Pe},$e("MessageScheduleSend")),v&&a.ZP.createElement(oe.Z,{icon:"schedule",onClick:pe},$e("MessageScheduleEditTime")),E&&a.ZP.createElement(oe.Z,{icon:"reply",onClick:ne},$e(C?"lng_context_quote_and_reply":"Reply")),!f&&Boolean(J?.messagesCount)&&a.ZP.createElement(oe.Z,{icon:"replies",onClick:ae},$e("Conversation.ContextViewReplies",J.messagesCount,"i")),b&&a.ZP.createElement(oe.Z,{icon:"edit",onClick:se},$e("Edit")),R&&a.ZP.createElement(oe.Z,{icon:"favorite",onClick:ue},$e("AddToFavorites")),L&&a.ZP.createElement(oe.Z,{icon:"favorite",onClick:he},$e("Stickers.RemoveFromFavorites")),j&&a.ZP.createElement(oe.Z,{icon:"language",onClick:Le},$e("TranslateMessage")),V&&a.ZP.createElement(oe.Z,{icon:"language",onClick:Be},$e("ShowOriginalButton")),G&&a.ZP.createElement(oe.Z,{icon:"web",onClick:Fe},$e("lng_settings_change_lang")),at.map((e=>a.ZP.createElement(oe.Z,{key:e.label,icon:e.icon,onClick:e.handler},$e(e.label)))),y&&a.ZP.createElement(oe.Z,{icon:"pin",onClick:ie},$e("DialogPin")),S&&a.ZP.createElement(oe.Z,{icon:"unpin",onClick:re},$e("DialogUnpin")),O&&a.ZP.createElement(oe.Z,{icon:"gifs",onClick:fe},$e("lng_context_save_gif")),U&&a.ZP.createElement(oe.Z,{icon:"revote",onClick:ye},$e("lng_polls_retract")),$&&a.ZP.createElement(oe.Z,{icon:"stop",onClick:Ie},$e("lng_polls_stop")),D&&a.ZP.createElement(oe.Z,{icon:"download",onClick:be},$e(H?"lng_context_cancel_download":"lng_media_download")),A&&a.ZP.createElement(oe.Z,{icon:"forward",onClick:le},$e("Forward")),x&&a.ZP.createElement(oe.Z,{icon:"select",onClick:Ze},$e("Common.Select")),w&&a.ZP.createElement(oe.Z,{icon:"flag",onClick:me},$e("lng_context_report_msg")),(z||X)&&!Ge&&a.ZP.createElement(oe.Z,{icon:X?"heart-outline":"group",onClick:X?ke:Se,disabled:!X&&!et},a.ZP.createElement("span",{className:"MessageContextMenu--seen-by-label-wrapper"},a.ZP.createElement("span",{className:"MessageContextMenu--seen-by-label",dir:$e.isRtl?"rtl":void 0},X&&o.reactors?.count?z&&et?$e("Chat.OutgoingContextMixedReactionCount",[o.reactors.count,et]):$e("Chat.ContextReactionCount",o.reactors.count,"i"):1===et&&q?(0,te.Z)((0,r.YC)(q[0].id)?(0,r.Js)(q[0]):q[0].title):et?$e("Conversation.ContextMenuSeen",et,"i"):$e("Conversation.ContextMenuNoViews"))),a.ZP.createElement(_a.Z,{className:"avatars",size:"micro",peers:q})),N&&a.ZP.createElement(oe.Z,{destructive:!0,icon:"delete",onClick:de},$e("Delete")),K&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Jd.Z,null),!W&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Ma.Z,{inline:!0,className:"menu-loading-row"}),a.ZP.createElement(Ma.Z,{inline:!0,className:"menu-loading-row"})),W&&1===W.length&&a.ZP.createElement(oe.Z,{withWrap:!0,onClick:nt,className:"menu-custom-emoji-sets"},(0,te.Z)($e("MessageContainsEmojiPack",W[0].title),["simple_markdown","emoji"])),W&&W.length>1&&a.ZP.createElement(oe.Z,{withWrap:!0,onClick:nt,className:"menu-custom-emoji-sets"},(0,te.Z)($e("MessageContainsEmojiPacks",W.length),["simple_markdown"]))),Ge&&o.sponsorInfo&&a.ZP.createElement(oe.Z,{icon:"channel",onClick:Ae},$e("SponsoredMessageSponsor")),Ge&&a.ZP.createElement(oe.Z,{icon:"help",onClick:Me},$e("SponsoredMessageInfo")),Ge&&Te&&a.ZP.createElement(oe.Z,{icon:"stop",onClick:Te},$e("HideAd"))))})),Yd=window.getSelection(),qd=(0,a.X$)((0,s.c$)(((e,{message:t,messageListType:n,detectedLanguage:a})=>{const{threadId:s}=(0,l.Btg)(e)||{},i=(0,l.f21)(e,t.chatId),c=(0,l.Z1J)(e,t.chatId),{seenByExpiresAt:d,seenByMaxChatMembers:m,maxUniqueReactions:u}=e.appConfig||{},{noOptions:h,canReply:Z,canPin:P,canUnpin:p,canDelete:v,canReport:g,canEdit:E,canForward:C,canFaveSticker:b,canUnfaveSticker:f,canCopy:y,canCopyLink:I,canSelect:S,canDownload:k,canSaveGif:N,canRevote:w,canClosePoll:M}=s&&(0,l._kf)(e,t,s)||{},T=c&&(0,r.YC)(c.id),A=(0,r.B4)(t),R="pinned"===n,L="scheduled"===n,B=c&&(0,r.eA)(c),F=(0,r.CI)(t),x=Boolean(!F&&c&&m&&d&&(0,r.Bf)(c)&&A&&!L&&c.membersCount&&c.membersCount<=m&&t.date>Date.now()/1e3-d),D=(0,r.FT)(t),O=T?void 0:(0,l.x67)(e,t.chatId),U=!F&&!B&&!L&&!D&&!T&&t.reactions&&!(0,r.JE)(t.reactions)&&t.reactions.canSeeList,_=(0,l.EVS)(e,t),$=Boolean(t.content.contact),j=(0,l.wVz)(e),V=(0,l.q_5)(e,t),G=V?.map((t=>(0,l.Ny0)(e,t))),H=G?.every(Boolean)?G:void 0,J=(0,l.Bdn)(e,t.chatId,t.id),z=J?Boolean((0,l.HGB)(e,t.chatId,J)[t.id]?.text):void 0,X=!z&&(0,l.VU8)(e,t,a),Y=(0,l.lpX)(e,t.chatId),q=(0,l.YQi)(e,t.chatId,s,t.id);return{availableReactions:e.availableReactions,topReactions:e.topReactions,noOptions:h,canSendNow:L,canReschedule:L,canReply:!R&&!L&&Z,canPin:!L&&P,canUnpin:!L&&p,canDelete:v,canReport:g,canEdit:!R&&E,canForward:!L&&C,canFaveSticker:!L&&b,canUnfaveSticker:!L&&f,canCopy:$||!_&&y,canCopyLink:!L&&I,canSelect:S,canDownload:!_&&k,canSaveGif:!_&&N,canRevote:w,canClosePoll:!L&&M,activeDownloads:i,canShowSeenBy:x,enabledReactions:c?.isForbidden?void 0:O?.enabledReactions,maxUniqueReactions:u,isPrivate:T,isCurrentUserPremium:j,hasFullInfo:Boolean(O),canShowReactionsCount:U,canShowReactionList:!F&&!D&&!L&&c?.id!==o.awM,canBuyPremium:!j&&!(0,l.oe5)(e),customEmojiSetsInfo:V,customEmojiSets:H,canScheduleUntilOnline:(0,l.Eh5)(e,t.chatId),canTranslate:X,canShowOriginal:z&&!Y,canSelectLanguage:z&&!Y,isMessageTranslated:z,canPlayAnimatedEmojis:(0,l.W9H)(e),isReactionPickerOpen:(0,l.Io8)(e),messageLink:q}}))((({availableReactions:e,topReactions:t,isOpen:n,messageListType:i,message:l,customEmojiSetsInfo:c,customEmojiSets:d,album:m,anchor:u,targetHref:h,noOptions:Z,canSendNow:P,hasFullInfo:p,canReschedule:v,canReply:g,canPin:E,repliesThreadInfo:C,canUnpin:b,canDelete:f,canReport:y,canShowReactionsCount:I,canShowReactionList:S,canEdit:N,enabledReactions:w,maxUniqueReactions:A,isPrivate:R,isCurrentUserPremium:L,canForward:B,canBuyPremium:F,canFaveSticker:x,canUnfaveSticker:D,canCopy:O,canCopyLink:U,canSelect:_,canDownload:$,canSaveGif:j,canRevote:V,canClosePoll:G,canPlayAnimatedEmojis:H,activeDownloads:J,noReplies:z,canShowSeenBy:Y,canScheduleUntilOnline:q,canTranslate:K,isMessageTranslated:W,canShowOriginal:Q,canSelectLanguage:ee,isReactionPickerOpen:te,messageLink:ne,onClose:se,onCloseAnimationEnd:ie})=>{const{openThread:oe,updateDraftReplyInfo:re,setEditingId:le,pinMessage:de,openForwardMenu:me,faveSticker:ue,unfaveSticker:he,toggleMessageSelection:Ze,sendScheduledMessages:Pe,rescheduleMessage:pe,downloadMessageMedia:ve,cancelMessageMediaDownload:ge,loadSeenBy:Ee,openSeenByModal:Ce,openReactorListModal:be,loadFullChat:fe,loadReactors:ye,copyMessagesByIds:Ie,saveGif:Se,loadStickers:ke,cancelPollVote:Ne,closePoll:we,toggleReaction:Me,requestMessageTranslation:Te,showOriginalMessage:Ae,openChatLanguageModal:Re,openMessageReactionPicker:Le}=(0,s.Sv)(),Be=(0,M.Z)(),{transitionClassNames:xe}=(0,Fe.Z)(n,ie,void 0,!1),[De,Oe]=(0,a.eJ)(!0),[Ue,_e]=(0,a.eJ)(!1),[$e,je]=(0,a.eJ)(!1),[Ve,Ge]=(0,a.eJ)(!1),[He,Je,ze]=(0,k.Z)(),[Xe,Ye]=(0,a.eJ)(!1),[qe,Ke]=(0,jd.Z)(q,se,l.date),We=void 0===c||Boolean(c.length);(0,a.d4)((()=>{Y&&n&&Ee({chatId:l.chatId,messageId:l.id})}),[Ee,n,l.chatId,l.id,Y]),(0,a.d4)((()=>{I&&n&&ye({chatId:l.chatId,messageId:l.id})}),[I,n,ye,l.chatId,l.id]),(0,a.d4)((()=>{c?.length&&d?.length!==c.length&&c.forEach((e=>{ke({stickerSetInfo:e})}))}),[c,d,ke]),(0,a.d4)((()=>{p||R||!n||fe({chatId:l.chatId})}),[p,n,R,fe,l.chatId]);const Qe=(0,a.Ye)((()=>{const e=(0,s.Rd)().chats.byId,t=(0,s.Rd)().users.byId;if(l.reactions?.recentReactions?.length){const n=new Set(l.reactions?.recentReactions?.map((({peerId:n})=>t[n]||e[n])));return Array.from(n).filter(Boolean).slice(0,o.Ob7)}if(l.seenByDates)return Object.keys(l.seenByDates).slice(0,o.Ob7).map((n=>t[n]||e[n])).filter(Boolean)}),[l.reactions?.recentReactions,l.seenByDates]),et=(0,a.Ye)((()=>m?m.messages.some((e=>J?.[l.isScheduled?"scheduledIds":"ids"]?.includes(e.id))):J?.[l.isScheduled?"scheduledIds":"ids"]?.includes(l.id)),[J,m,l]),tt=g&&Yd?.rangeCount?Yd.getRangeAt(0):void 0;(0,a.d4)((()=>{if(W)return void Ye(!1);if(!tt||tt.collapsed||!Boolean(l.content.text?.text)||!function(e){const t=e.commonAncestorContainer,n=t.nodeType===Node.TEXT_NODE?t.parentNode:t;return Boolean(n.closest(".message-content-wrapper .text-content"))&&!(Boolean(n.closest(".EmbeddedMessage"))||Boolean(n.closest(".WebPage")))}(tt))return void Ye(!1);const e=$d(tt);Ye(e.text.trim().length>0&&l.content.text.text.includes(e.text))}),[tt,tt?.collapsed,tt?.startOffset,tt?.endOffset,W,l.content.text]);const nt=(0,T.Z)((()=>{Oe(!1),_e(!0)})),at=(0,T.Z)((()=>{Oe(!1),je(!0)})),st=(0,T.Z)((()=>{Oe(!1),se()})),it=(0,T.Z)((()=>{_e(!1),se()})),ot=(0,T.Z)((()=>{je(!1),se()})),rt=(0,T.Z)((()=>{Ge(!1),se()})),lt=(0,T.Z)((()=>{re({replyToMsgId:l.id,quoteText:Xe&&tt?$d(tt):void 0}),st()})),ct=(0,T.Z)((()=>{oe({chatId:l.chatId,threadId:l.id}),st()})),dt=(0,T.Z)((()=>{le({messageId:l.id}),st()})),mt=(0,T.Z)((()=>{Oe(!1),Ge(!0)})),ut=(0,T.Z)((()=>{de({messageId:l.id,isUnpin:!0}),st()})),ht=(0,T.Z)((()=>{if(st(),m?.messages){const e=m.messages.map((({id:e})=>e));me({fromChatId:l.chatId,messageIds:e})}else me({fromChatId:l.chatId,messageIds:[l.id]})})),Zt=(0,T.Z)((()=>{st(),ue({sticker:l.content.sticker})})),Pt=(0,T.Z)((()=>{st(),he({sticker:l.content.sticker})})),pt=(0,T.Z)((()=>{st(),Ne({chatId:l.chatId,messageId:l.id})})),vt=(0,T.Z)((()=>{st(),we({chatId:l.chatId,messageId:l.id})})),gt=(0,T.Z)((()=>{const e=m?.messages?{messageId:l.id,childMessageIds:m.messages.map((({id:e})=>e)),withShift:!1}:{messageId:l.id,withShift:!1};Ze(e),st()})),Et=(0,T.Z)((()=>{Pe({chatId:l.chatId,id:l.id}),st()})),Ct=(0,T.Z)((e=>{pe({chatId:l.chatId,messageId:l.id,scheduledAt:e}),se()})),bt=(0,T.Z)((()=>{Oe(!1),qe(Ct)})),ft=(0,T.Z)((()=>{st(),Ce({chatId:l.chatId,messageId:l.id})})),yt=(0,T.Z)((()=>{st(),be({chatId:l.chatId,messageId:l.id})})),It=(0,T.Z)((e=>{Ie({messageIds:e}),st()})),St=(0,T.Z)((()=>{(0,Wl.TE)(ne),st()})),kt=(0,T.Z)((()=>{(0,Wl.TE)(l.content.contact.phoneNumber),st()})),Nt=(0,T.Z)((()=>{(m?.messages||[l]).forEach((e=>{et?ge({message:e}):ve({message:e})})),st()})),wt=(0,T.Z)((()=>{const e=(0,r.b7)(l);Se({gif:e}),st()})),Mt=(0,T.Z)((e=>{Me({chatId:l.chatId,messageId:l.id,reaction:e,shouldAddToRecent:!0}),st()})),Tt=(0,T.Z)((e=>{Le({chatId:l.chatId,messageId:l.id,position:e})})),At=(0,T.Z)((()=>{Te({chatId:l.chatId,id:l.id}),st()})),Rt=(0,T.Z)((()=>{Ae({chatId:l.chatId,id:l.id}),st()})),Lt=(0,T.Z)((()=>{Re({chatId:l.chatId,messageId:l.id}),st()})),Bt=(0,a.Ye)((()=>(m?m.messages:[l]).map((({id:e})=>e))),[m,l]);if(Z)return void st();const Ft=new Date;return Ft.setFullYear(Ft.getFullYear()+1),a.ZP.createElement("div",{className:(0,ce.Z)("ContextMenuContainer",xe)},a.ZP.createElement(Xd,{isReactionPickerOpen:te,availableReactions:e,topReactions:t,message:l,isPrivate:R,isCurrentUserPremium:L,canBuyPremium:F,isOpen:De,enabledReactions:w,maxUniqueReactions:A,anchor:u,targetHref:h,canShowReactionsCount:I,canShowReactionList:S,canSendNow:P,canReschedule:v,canReply:g,canQuote:Xe,canDelete:f,canReport:y,canPin:E,repliesThreadInfo:C,canUnpin:b,canEdit:N,canForward:B,canFaveSticker:x,canUnfaveSticker:D,canCopy:O,canCopyLink:U,canSelect:_,canDownload:$,canSaveGif:j,canRevote:V,canClosePoll:G,canShowSeenBy:Y,canTranslate:K,canShowOriginal:Q,canSelectLanguage:ee,canPlayAnimatedEmojis:H,hasCustomEmoji:We,customEmojiSets:d,isDownloading:et,seenByRecentPeers:Qe,noReplies:z,onOpenThread:ct,onReply:lt,onEdit:dt,onPin:mt,onUnpin:ut,onForward:ht,onDelete:nt,onReport:at,onFaveSticker:Zt,onUnfaveSticker:Pt,onSelect:gt,onSend:Et,onReschedule:bt,onClose:st,onCopyLink:St,onCopyMessages:It,onCopyNumber:kt,onDownload:Nt,onSaveGif:wt,onCancelVote:pt,onClosePoll:Je,onShowSeenBy:ft,onToggleReaction:Mt,onShowReactors:yt,onReactionPickerOpen:Tt,onTranslate:At,onShowOriginal:Rt,onSelectLanguage:Lt}),a.ZP.createElement(ae,{isOpen:Ue,isSchedule:"scheduled"===i,onClose:it,album:m,message:l}),a.ZP.createElement(X.Z,{isOpen:$e,onClose:ot,messageIds:Bt}),a.ZP.createElement(Zr,{isOpen:Ve,messageId:l.id,chatId:l.chatId,onClose:rt}),a.ZP.createElement(Xn.Z,{isOpen:He,onClose:ze,text:Be("lng_polls_stop_warning"),confirmLabel:Be("lng_polls_stop_sure"),confirmHandler:vt}),v&&Ke)}))),Kd=(0,a.X$)((0,s.c$)((e=>({canBuyPremium:!(0,l.wVz)(e)&&!(0,l.oe5)(e)})))((({message:e,anchor:t,onAboutAds:n,onClose:i,onCloseAnimationEnd:o,canBuyPremium:r})=>{const{openPremiumModal:l,showDialog:c}=(0,s.Sv)(),[d,,m]=(0,k.Z)(!0),{transitionClassNames:u}=(0,Fe.Z)(d,o,void 0,!1),h=(0,T.Z)((()=>{n(),m()})),Z=(0,T.Z)((()=>{m(),l(),i()})),P=(0,T.Z)((()=>{m(),c({data:{message:[e.sponsorInfo,e.additionalInfo].join("\n")}})}));if(t)return a.ZP.createElement("div",{className:(0,ce.Z)("ContextMenuContainer",u)},a.ZP.createElement(Xd,{isOpen:d,anchor:t,message:e,onClose:m,onCloseAnimationEnd:m,onAboutAds:h,onSponsoredHide:r?Z:void 0,onSponsorInfo:P}))}))),Wd=(0,a.X$)((0,s.c$)(((e,{fromSticker:t,stickerSetShortName:n})=>{const a=(0,l.Btg)(e),{chatId:s,threadId:i}=a||{},o=s&&(0,l.Z1J)(e,s),c=o?(0,r.H5)(o):void 0,d=s&&i?(0,l.tZg)(e,s,i):void 0,m=Boolean(!d?.isCommentsInfo&&d?.fromChannelId),u=Boolean(o&&i&&(0,r.Qm)(o,i,m)&&c?.canSendStickers),h=Boolean(s)&&(0,l.FM1)(e,s),Z=t?t.stickerSetInfo:n?{shortName:n}:void 0,P=Z?(0,l.Ny0)(e,Z):void 0;return{canScheduleUntilOnline:Boolean(s)&&(0,l.Eh5)(e,s),canSendStickers:u,isSavedMessages:h,shouldSchedule:(0,l.AqB)(e),stickerSet:P,isCurrentUserPremium:(0,l.wVz)(e),shouldUpdateStickerSetOrder:e.settings.byKey.shouldUpdateStickerSetOrder,currentMessageList:a}}))((({isOpen:e,fromSticker:t,stickerSetShortName:n,stickerSet:i,canSendStickers:r,canScheduleUntilOnline:l,shouldSchedule:c,isSavedMessages:d,isCurrentUserPremium:m,shouldUpdateStickerSetOrder:u,currentMessageList:h,onClose:Z})=>{const{loadStickers:P,toggleStickerSet:p,sendMessage:v,showNotification:g}=(0,s.Sv)(),E=(0,a.sO)(null),C=(0,a.sO)(null),b=(0,M.Z)(),{isMobile:f}=(0,I.ZP)(),y=(0,D.Z)(i),S=i||y,k=Boolean(!S?.isArchived&&S?.installedDate),N=S?.isEmoji,[w,T]=(0,jd.Z)(l),{handleScroll:A,isAtBeginning:R}=Wa(),{observe:L}=(0,vo.S1)({rootRef:E,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>{e&&!S?.stickers&&P({stickerSetInfo:t?t.stickerSetInfo:{shortName:n}})}),[e,t,P,n,S]);const B=(0,a.I4)(((e,t,n)=>{h&&(e={...e,isPreloadedGlobally:!0},c||n?w((n=>{v({messageList:h,sticker:e,isSilent:t,scheduledAt:n}),Z()})):(v({messageList:h,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:u&&k}),Z()))}),[h,c,w,Z,u,k]),F=(0,a.I4)((()=>{S&&(p({stickerSetId:S.id}),Z())}),[Z,S,p]),x=(0,a.I4)((()=>{if(!S)return;const{shortName:e}=S,t=N?"addemoji":"addstickers",n=`${o.zHP}${t}/${e}`;(0,Wl.TE)(n),g({message:b("LinkCopied")})}),[N,b,S,g]),O=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{round:!0,ripple:!f,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon icon-more"}))),[f]);return a.ZP.createElement(ne.Z,{className:(0,ce.Z)("StickerSetModal",N&&"custom-emoji"),isOpen:e,onClose:Z,header:function(){const e=(0,ce.Z)("modal-header",!R&&"with-top-border");return a.ZP.createElement("div",{className:e,dir:b.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:b("Close"),onClick:Z},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("div",{className:"modal-title"},S?(0,te.Z)(S.title,["emoji","links"]):b("AccDescrStickerSet")),a.ZP.createElement(ie.Z,{className:"stickers-more-menu with-menu-transitions",trigger:O,positionX:"right"},a.ZP.createElement(oe.Z,{icon:"copy",onClick:x},b("StickersCopy"))))}()},S?.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:E,className:"stickers custom-scroll",onScroll:A},a.ZP.createElement("div",{className:"shared-canvas-container stickers-grid"},a.ZP.createElement("canvas",{ref:C,className:"shared-canvas"}),S.stickers.map((e=>a.ZP.createElement(Ao,{sticker:e,size:N?o.lHp:o.yK2,observeIntersection:L,onClick:r&&!N?B:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:m,sharedCanvasRef:C}))))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(Y.Z,{size:"smaller",fluid:!0,color:k?"danger":"primary",onClick:F},(()=>{if(!S)return b("Loading");const e=N?"Emoji":"Sticker";return b(k?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,S.count,"i")})()))):a.ZP.createElement(hs.Z,null),T)}))),Qd={root:"Qzt_zq5gWHne6P2rw7Wj",sets:"Ay41sqhq2QmXdgDHnt2E"},em=(0,a.X$)((0,s.c$)(((e,{customEmojiSetIds:t})=>{const n=t?.map((t=>e.stickers.setsById[t]));return{customEmojiSets:n,canPlayAnimatedEmojis:(0,l.W9H)(e)}}))((({customEmojiSets:e,canPlayAnimatedEmojis:t,onClose:n})=>{const{openStickerSet:i}=(0,s.Sv)(),o=(0,M.Z)(),r=(0,a.sO)(null),{observe:l}=(0,vo.S1)({rootRef:r,isDisabled:!e}),c=(0,D.Z)(e),d=e||c,m=(0,a.I4)((e=>{i({stickerSetInfo:e.stickerSetInfo})}),[i]);return a.ZP.createElement(ne.Z,{isOpen:Boolean(e),className:Qd.root,onClose:n,hasCloseButton:!0,title:o("lng_custom_emoji_used_sets")},a.ZP.createElement("div",{className:(0,ce.Z)(Qd.sets,"custom-scroll"),ref:r,teactFastList:!0},d?.map((e=>a.ZP.createElement(Jl,{key:e.id,className:Qd.setCard,stickerSet:e,onClick:m,observeIntersection:l,noPlay:!t})))))})));var tm=n(40329);const nm={settings:{icon:"bots",label:"BotSettings"},privacy:{icon:"info",label:"Privacy"},help:{icon:"help",label:"BotHelp"}},am=(0,a.X$)((0,s.c$)(((e,{chatId:t,threadId:n})=>{const a=(0,l.Z1J)(e,t);if(!a||a.isRestricted)return{};const s=(0,r.YC)(a.id),i=s?(0,l.dyD)(e,t):void 0,c=i&&(0,r.kw)(i),d=n===_._f,m=(0,l.FM1)(e,t),u=d&&((0,r.eA)(a)||(0,r.Bf)(a)||i&&!i.isSelf),{chatId:h,threadId:Z}=(0,l.Btg)(e)||{},P=t!==o.FVh?(0,l.kBx)(e,t):void 0,p=s?(0,l.ccz)(e,t):void 0,v=s?void 0:(0,l.x67)(e,t),g=p||v,E=Boolean(p?.premiumGifts?.length&&!(0,l.oe5)(e)),C=a?.topics?.[n],b=a.isForum&&(a.isCreator||!(0,r.Mg)(a,"manageTopics")||(0,r.VE)(a,"manageTopics")),f=C&&(0,r.GU)(a,C),y=(0,l.Yo)(e,t),I=(0,l.GDM)(e,t)&&g?.isTranslationDisabled;return{chat:a,isMuted:(0,r.i4)(a,(0,l.dZI)(e),(0,l.NJL)(e)),isPrivate:s,isTopic:a?.isForum&&!d,isForum:a?.isForum,isForumAsMessages:a?.isForumAsMessages,canAddContact:c,canReportChat:u,canDeleteChat:(0,r.cc)(a),canGiftPremium:E,hasLinkedChat:Boolean(v?.linkedChatId),botCommands:P?p?.botInfo?.commands:void 0,isChatInfoShown:(0,l.jUK)(e).isChatInfoShown&&h===t&&Z===n,canCreateTopic:b,canEditTopic:f,canManage:y,isRightColumnShown:(0,l.Jf5)(e),canTranslate:I,isBlocked:p?.isBlocked,isBot:Boolean(P),isChatWithSelf:m}}))((({chatId:e,threadId:t,isOpen:n,withExtraActions:i,anchor:o,isChannel:r,botCommands:l,withForumActions:c,isTopic:d,isForum:m,isForumAsMessages:u,isChatInfoShown:h,canStartBot:Z,canSubscribe:P,canSearch:p,canCall:v,canMute:g,canViewStatistics:E,canViewBoosts:C,pendingJoinRequests:b,canLeave:f,canEnterVoiceChat:y,canCreateVoiceChat:S,chat:N,isPrivate:w,isMuted:A,canReportChat:R,canDeleteChat:L,canGiftPremium:B,hasLinkedChat:F,canAddContact:x,canCreateTopic:D,canEditTopic:O,canManage:U,isRightColumnShown:_,canTranslate:$,isBlocked:j,isBot:V,isChatWithSelf:G,onJoinRequestsClick:H,onSubscribeChannel:J,onSearchClick:z,onAsMessagesClick:Y,onClose:q,onCloseAnimationEnd:K})=>{const{updateChatMutedState:W,enterMessageSelectMode:Q,sendBotCommand:ee,restartBot:te,requestMasterAndJoinGroupCall:ne,createGroupCall:ae,openLinkedChat:se,openAddContactDialog:ie,requestMasterAndRequestCall:re,toggleStatistics:le,openBoostStatistics:ce,openGiftPremiumModal:de,openThreadWithInfo:me,openCreateTopicPanel:ue,openEditTopicPanel:he,openChat:Ze,toggleManagement:Pe,togglePeerTranslations:pe,blockUser:ve,unblockUser:ge,setViewForumAsMessages:Ee}=(0,s.Sv)(),{isMobile:Ce}=(0,I.ZP)(),[be,fe]=(0,a.eJ)(!0),[ye,Ie]=(0,a.eJ)(!1),[Se,ke]=(0,a.eJ)(!1),[Ne,we]=(0,a.eJ)(!1),[Me,Te]=(0,a.eJ)(!1),[Ae,Re,Le]=(0,k.Z)(),{x:Be,y:xe}=o;(0,Fe.Z)(n,K,void 0,!1);const De=(0,Ra.Z)(!(h||!m)||void 0,200),Oe=(0,T.Z)((()=>{fe(!1),we(!0)})),Ue=(0,T.Z)((()=>{we(!1),q()})),_e=(0,T.Z)((()=>{Te(!1),q()})),$e=(0,T.Z)((()=>{fe(!1),ke(!0)})),Ve=(0,T.Z)((()=>{fe(!1),q()})),Ge=(0,T.Z)((()=>{me({chatId:e,threadId:t}),Ie(!_),Ve()})),He=(0,T.Z)((()=>{ke(!1),q()})),Je=(0,T.Z)((()=>{ee({command:"/start"})})),ze=(0,T.Z)((()=>{te({chatId:e})})),Xe=(0,T.Z)((()=>{W({chatId:e,isMuted:!1}),Ve()})),Ye=(0,T.Z)((()=>{Re(),Te(!0),fe(!1)})),qe=(0,T.Z)((()=>{ue({chatId:e}),Ie(!_),Ve()})),Ke=(0,T.Z)((()=>{Pe({force:!0}),Ie(!_),Ve()})),We=(0,T.Z)((()=>{he({chatId:e,topicId:t}),Ie(!_),Ve()})),Qe=(0,T.Z)((()=>{Ze({id:void 0}),Ee({chatId:e,isEnabled:!1}),Ve()})),et=(0,T.Z)((()=>{S?ae({chatId:e}):ne({chatId:e}),Ve()})),tt=(0,T.Z)((()=>{se({id:e}),Ve()})),nt=(0,T.Z)((()=>{de({forUserId:e}),Ve()})),at=(0,T.Z)((()=>{ie({userId:e}),Ve()})),st=(0,T.Z)((()=>{J(),Ve()})),it=(0,T.Z)((()=>{re({userId:e,isVideo:!0}),Ve()})),ot=(0,T.Z)((()=>{re({userId:e}),Ve()})),rt=(0,T.Z)((()=>{z(),Ve()})),lt=(0,T.Z)((()=>{le(),Ie(!_),Ve()})),ct=(0,T.Z)((()=>{ce({chatId:e}),Ie(!_),Ve()})),dt=(0,T.Z)((()=>{pe({chatId:e,isEnabled:!0}),Ve()})),mt=(0,T.Z)((()=>{Q(),Ve()})),ut=(0,T.Z)((()=>{Y(),Ve()})),ht=(0,T.Z)((()=>{ve({userId:e}),Ve()})),Zt=(0,T.Z)((()=>{ge({userId:e}),Ve()}));(0,a.d4)((()=>(Pa(),pa)),[]);const Pt=(0,M.Z)(),pt=(0,a.Ye)((()=>l?.map((({command:e})=>{const t=nm[e];if(t)return a.ZP.createElement(oe.Z,{key:e,icon:t.icon,onClick:()=>{ee({command:`/${e}`}),Ve()}},Pt(t.label))}))),[l,Ve,Pt,ee]);return a.ZP.createElement(zo.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(je.Z,{isOpen:be,positionX:"right",style:`left: ${Be}px;top: ${xe}px;`,onClose:Ve,shouldCloseFast:ye},Ce&&p&&a.ZP.createElement(oe.Z,{icon:"search",onClick:rt},Pt("Search")),c&&D&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(oe.Z,{icon:"comments",onClick:qe},Pt("lng_forum_create_topic")),a.ZP.createElement(Jd.Z,null)),De&&a.ZP.createElement(oe.Z,{icon:"info",onClick:Ge},Pt(d?"lng_context_view_topic":"lng_context_view_group")),U&&!O&&a.ZP.createElement(oe.Z,{icon:"edit",onClick:Ke},Pt("Edit")),O&&a.ZP.createElement(oe.Z,{icon:"edit",onClick:We},Pt("lng_forum_topic_edit")),Ce&&!c&&m&&!d&&a.ZP.createElement(oe.Z,{icon:"forums",onClick:Qe},Pt("Chat.ContextViewAsTopics")),c&&Boolean(b)&&a.ZP.createElement(oe.Z,{icon:"user",onClick:H},Pt(r?"SubscribeRequests":"MemberRequests"),a.ZP.createElement("div",{className:"right-badge"},b)),c&&!d&&!u&&a.ZP.createElement(oe.Z,{icon:"message",onClick:ut},Pt("lng_forum_view_as_messages")),i&&Z&&a.ZP.createElement(oe.Z,{icon:"bots",onClick:Je},Pt("BotStart")),i&&P&&a.ZP.createElement(oe.Z,{icon:r?"channel":"group",onClick:st},Pt(r?"ProfileJoinChannel":"ProfileJoinGroup")),x&&a.ZP.createElement(oe.Z,{icon:"add-user",onClick:at},Pt("AddContact")),Ce&&v&&a.ZP.createElement(oe.Z,{icon:"phone",onClick:ot},Pt("Call")),v&&a.ZP.createElement(oe.Z,{icon:"video-outlined",onClick:it},Pt("VideoCall")),g&&(A?a.ZP.createElement(oe.Z,{icon:"unmute",onClick:Xe},Pt("ChatsUnmute")):a.ZP.createElement(oe.Z,{icon:"mute",onClick:Ye},Pt("ChatsMute"),"...")),(y||S)&&a.ZP.createElement(oe.Z,{icon:"voice-chat",onClick:et},Pt(S?"StartVoipChat":"VoipGroupJoinCall")),F&&a.ZP.createElement(oe.Z,{icon:r?"comments":"channel",onClick:tt},Pt(r?"ViewDiscussion":"lng_profile_view_channel")),!c&&a.ZP.createElement(oe.Z,{icon:"select",onClick:mt},Pt("ReportSelectMessages")),C&&a.ZP.createElement(oe.Z,{icon:"boost",onClick:ct},Pt("Boosts")),E&&a.ZP.createElement(oe.Z,{icon:"stats",onClick:lt},Pt("Statistics")),$&&a.ZP.createElement(oe.Z,{icon:"language",onClick:dt},Pt("lng_context_translate")),R&&a.ZP.createElement(oe.Z,{icon:"flag",onClick:Oe},Pt("ReportPeer.Report")),pt,B&&a.ZP.createElement(oe.Z,{icon:"gift",onClick:nt},Pt("GiftPremium")),V&&a.ZP.createElement(oe.Z,{icon:j?"bots":"hand-stop",onClick:j?ze:ht},Pt(j?"BotRestart":"Bot.Stop")),w&&!G&&!V&&a.ZP.createElement(oe.Z,{icon:j?"user":"hand-stop",onClick:j?Zt:ht},Pt(j?"Unblock":"BlockUser")),f&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Jd.Z,null),a.ZP.createElement(oe.Z,{destructive:!0,icon:"delete",onClick:$e},Pt(w?"DeleteChatUser":L?"GroupInfo.DeleteAndExit":r?"LeaveChannel":"Group.LeaveGroup")))),N&&a.ZP.createElement(tm.Z,{isOpen:Se,onClose:He,chat:N}),g&&Ae&&N?.id&&a.ZP.createElement($r.Z,{isOpen:Me,onClose:_e,onCloseAnimationEnd:Le,chatId:N.id}),R&&N?.id&&a.ZP.createElement(X.Z,{isOpen:Ne,onClose:Ue,subject:"peer",peerId:N.id})))}))),sm=(0,ue.Ds)((e=>e()),200,!1),im=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.jrE)(e);if(!t)return{};const{query:n,results:a}=(0,l.n5x)(e)||{},{threadId:s}=(0,l.Btg)(e)||{},{totalCount:i,foundIds:o}=a||{};return{chat:t,query:n,totalCount:i,threadId:s,foundIds:o,isHistoryCalendarOpen:Boolean((0,l.jUK)(e).historyCalendarSelectedAt)}}))((({isActive:e,chat:t,threadId:n,query:i,totalCount:o,foundIds:r,isHistoryCalendarOpen:l})=>{const{setLocalTextSearchQuery:c,searchTextMessagesLocal:d,focusMessage:m,closeLocalTextSearch:u,openHistoryCalendar:h}=(0,s.Sv)(),P=(0,a.sO)(null),[p,v]=(0,a.eJ)(0);(0,a.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),n=()=>{const{activeElement:n}=document;if(n&&n===P.current){const{pageTop:n,height:a}=e;(0,Z.WM)((()=>{t.style.transform=`translateY(${n}px)`,t.style.height=`${a}px`,document.documentElement.scrollTop=n}))}else(0,Z.WM)((()=>{t.style.transform="",t.style.height=""}))};return e.addEventListener("resize",n),()=>{e.removeEventListener("resize",n)}}),[]),(0,a.d4)((()=>{t?.id&&r?.length?(m({chatId:t.id,messageId:r[0],threadId:n}),v(0)):v(-1)}),[t?.id,m,r,n]),(0,a.bt)((()=>{g.cj&&Array.from(document.querySelectorAll("input")).forEach((t=>{t.disabled=Boolean(e&&t!==P.current)}))}),[e]),(0,a.d4)((()=>{e||P.current.blur()}),[e]),(0,a.d4)((()=>{document.querySelector("#MobileSearch input").blur()}),[l]);const E=(0,T.Z)((e=>{c({query:e}),e.length&&sm(d)})),C=(0,T.Z)((()=>{if(t&&r){const e=p+1;m({chatId:t.id,messageId:r[e],threadId:n}),v(e)}})),b=(0,T.Z)((()=>{if(t&&r){const e=p-1;m({chatId:t.id,messageId:r[e],threadId:n}),v(e)}})),f=(0,T.Z)((()=>{u()}));return a.ZP.createElement("div",{id:"MobileSearch",className:e?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(Y.Z,{size:"smaller",round:!0,color:"translucent",onClick:f},a.ZP.createElement("i",{className:"icon icon-arrow-left"})),a.ZP.createElement(ts.Z,{ref:P,value:i,onChange:E})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},i?r?.length?`${p+1} of ${o}`:r&&!r.length?"No results":"":a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>h({selectedAt:(0,_e._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon icon-calendar"}))),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:C,disabled:!r||!r.length||p===r.length-1},a.ZP.createElement("i",{className:"icon icon-up"})),a.ZP.createElement(Y.Z,{round:!0,size:"smaller",color:"translucent",onClick:b,disabled:!r||!r.length||0===p},a.ZP.createElement("i",{className:"icon icon-down"}))))})));var om=n(44139);const rm=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{availableReactions:n,topReactions:a}=e,{enabledReactions:s}=(0,l.x67)(e,t)||{};return{enabledReactions:s,availableReactions:n,topReactions:a}}))((({loadAndPlay:e,enabledReactions:t,availableReactions:n,topReactions:s,selectedReactionIds:i,onReactionSelect:o})=>{const l=(0,a.sO)(null),c=(0,a.sO)(null),{width:d}=(0,be.Z)(),{isTouchScreen:m}=(0,I.ZP)(),h=(0,a.Ye)((()=>t?"all"===t.type?(0,r.PO)((n||[]).map((({reaction:e})=>e)),s):(0,r.PO)(t.allowed,s):[]),[n,t,s]),Z=(0,a.Ye)((()=>{const e=Math.min(26.25*u.Gw,d),t=(d>600?.625:.5)*u.Gw,n=e-.5*u.Gw,a=Math.floor((n+t)/(36+t)),s=Math.ceil(h.length/a),i=36*s+(s-1)*t+.5*u.Gw*2;return Math.min(18*u.Gw,i)}),[h.length,d]);return a.ZP.createElement("div",{className:"vUbCal8_iSPkPVzQcz24",style:`height: ${Z}px`},a.ZP.createElement("div",{className:(0,ce.Z)("f4pTNqkRRCFtZzheXcV9",m?"no-scrollbar":"custom-scroll")},a.ZP.createElement("div",{className:"symbol-set-container shared-canvas-container"},a.ZP.createElement("canvas",{ref:l,className:"shared-canvas"}),a.ZP.createElement("canvas",{ref:c,className:"shared-canvas"}),h.map((t=>{const s=(0,r.$d)(t),d=s?i?.includes(s):void 0;return a.ZP.createElement(Bo,{key:s,reaction:t,isSelected:d,loadAndPlay:e,availableReactions:n,onClick:o,sharedCanvasRef:l,sharedCanvasHqRef:c})})))))}))),lm=16.375*u.Gw,cm=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.jUK)(e),{chatId:n,messageId:a,storyPeerId:s,storyId:i,position:o,sendAsMessage:c}=t.reactionPicker||{},d=s&&i?(0,l.JrV)(e,s,i):void 0,m=n?(0,l.Z1J)(e,n):void 0,u=n?(0,l.x67)(e,n):void 0,h=n&&a?(0,l.hjO)(e,n,a):void 0,Z=(0,r.YC)(n||s||""),P="some"===u?.enabledReactions?.type,p="all"===u?.enabledReactions?.type&&u?.enabledReactions?.areCustomAllowed;return{message:h,story:d,position:o,withCustomReactions:!m?.isForbidden&&!P&&(p||Z),isTranslucent:(0,l.QRV)(e),isCurrentUserPremium:(0,l.wVz)(e),sendAsMessage:c}}))((({isOpen:e,message:t,story:n,position:i,isTranslucent:o,isCurrentUserPremium:l,withCustomReactions:c,sendAsMessage:d})=>{const{toggleReaction:m,closeReactionPicker:u,sendMessage:h,showNotification:Z,sendStoryReaction:P}=(0,s.Sv)(),p=(0,M.Z)(),v=(0,va.Z)(t?.id,!0),g=(0,va.Z)(t?.chatId,!0),E=(0,va.Z)(n?.peerId,!0),C=(0,va.Z)(n?.id),b=(0,va.Z)(i,!0),f=(0,a.sO)(null),y=(0,a.Ye)((()=>{if(b)return C?b:{x:b.x+(c?-23:-21),y:b.y+(c?-64:-10)}}),[C,b,c]),S=(0,T.Z)((()=>f.current)),k=(0,T.Z)((()=>({withPortal:!0,isDense:!E,deltaX:!(0,I.W7)()&&f.current?-(f.current.offsetWidth-lm)/2- -11.5:0}))),{positionX:N,positionY:w,transformOriginX:A,transformOriginY:R,style:L}=(0,wo.Z)(y,dm,mm,S,k),B=(0,T.Z)((e=>{if(!g||!v)return;const t=e.isCustomEmoji?{documentId:e.id}:{emoticon:e.emoji};m({chatId:g,messageId:v,reaction:t,shouldAddToRecent:!0}),u()})),F=(0,T.Z)((e=>{g&&v&&(m({chatId:g,messageId:v,reaction:e,shouldAddToRecent:!0}),u())})),x=(0,T.Z)((e=>{const t="id"in e?{documentId:e.id}:e,n="documentId"in e?(0,s.Rd)().customEmojis.byId[e.documentId]:"emoticon"in e?void 0:e;if(n&&!n.isFree&&!l)return Z({message:p("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:p("PremiumMore")}),void u();if(!d)return P({peerId:E,storyId:C,containerId:(0,r.hl)(E,C),reaction:t,shouldAddToRecent:!0}),void u();let a,i;if("emoticon"in e)a=e.emoticon;else{const e=(0,Od.ZP)((0,om.yR)(n));a=e.text,i=e.entities}h({text:a,entities:i,isReaction:!0}),u()})),D=(0,a.Ye)((()=>(t?.reactions?.results||[]).reduce(((e,{chosenOrder:t,reaction:n})=>(void 0!==t&&e.push("emoticon"in n?n.emoticon:n.documentId),e)),[])),[t?.reactions?.results]);return a.ZP.createElement(je.Z,{isOpen:e,ref:f,className:(0,ce.Z)("s4eo5UICU4xBMDvMxWU_","ReactionPicker"),bubbleClassName:(0,ce.Z)("Q2c4gWaMXfXzLL_Jbbjr",!c&&!C&&"rWa1hIFdrb4U0xFrHLic",C&&"nwZabdh1rB72Eb1x64Og"),withPortal:!0,noCompact:!0,positionX:N,positionY:w,transformOriginX:A,transformOriginY:R,style:L,backdropExcludedSelector:".Modal.confirm",onClose:u},a.ZP.createElement(Jo,{idPrefix:"message-emoji-set-",isHidden:!e||!(c||C),loadAndPlay:Boolean(e&&c),isReactionPicker:!0,className:c||C?void 0:"P95Gk2sUhvBJ70LKg_vc",selectedReactionIds:D,isTranslucent:o,onCustomEmojiSelect:C?x:B,onReactionSelect:C?x:F}),!c&&Boolean(g)&&a.ZP.createElement(rm,{chatId:g,loadAndPlay:e,onReactionSelect:C?x:F,selectedReactionIds:D}))})));function dm(){return document.querySelector("body")}function mm(){return document.querySelector("body")}var um=n(41098),hm=n(21262);const Zm=document.createElement("div");var Pm=n(69156),pm=n(60130),vm=n(28353),gm=n(29295),Em=n(15376),Cm=n(47002),bm=n(62230);const fm="FfTpBGrctDEiFLXC4aqP",ym="y5JLmIFtCzK05l40rdHJ",Im=15*u.Gw,Sm=(0,a.X$)((({attachment:e,className:t,isSingle:n,shouldDisplayCompressed:s,shouldDisplayGrouped:i,index:r,onDelete:l,onToggleSpoiler:c})=>{const d=function(e,t){if(t&&e.quick){if(o.oGt.has(e.mimeType))return"image";if(o.wGh.has(e.mimeType))return"video"}return"file"}(e,s),m=(0,T.Z)((()=>{c?.(r)})),u=(0,a.Ye)((()=>{switch(d){case"image":return a.ZP.createElement("img",{className:fm,src:e.blobUrl,alt:"",draggable:!1});case"video":return a.ZP.createElement(a.ZP.Fragment,null,Boolean(e.quick?.duration)&&a.ZP.createElement("div",{className:"Igo3Vsou5areTsmh2Ng3"},(0,_e.k9)(e.quick.duration)),a.ZP.createElement("video",{className:fm,src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0}));default:return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Cm.Z,{className:"QAlzNLWBYdWR4UMMaiGm",name:e.filename,extension:(0,Em.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}),l&&a.ZP.createElement("i",{className:(0,ce.Z)("icon","icon-delete",ym,"Qqp72_dWGSui9ORCN3MT"),onClick:()=>l(r)}))}}),[e,d,r,l]),h="file"===d||!i,Z=e.mimeType!==o.s11,P=Boolean("file"!==d&&Z&&e.shouldSendAsSpoiler),p="file"!==d,v=(0,ce.Z)(t,"ZqafRENXro3B4A2UTp9s",n&&"ZJNnn8HUzq8cC3WwTzY0",h&&"Aj1qc6z4t_pSWrsXi0qf");return a.ZP.createElement("div",{className:v},u,a.ZP.createElement(bm.Z,{isVisible:P,thumbDataUri:e.previewBlobUrl||e.blobUrl,width:Im,height:Im}),p&&a.ZP.createElement("div",{className:"YOoQRXIFINVsu3FFIKR0"},Z&&a.ZP.createElement("i",{className:(0,ce.Z)("icon",e.shouldSendAsSpoiler?"icon-spoiler-disable":"icon-spoiler",ym),onClick:m}),l&&a.ZP.createElement("i",{className:(0,ce.Z)("icon","icon-delete",ym),onClick:()=>l(r)})))}));var km=n(93219),Nm=n(67146),wm=n(19830);function Mm(e,t,n=0,a=!1,s=!1,i=!1){const o=e[i?"scrollLeft":"scrollTop"],r=o+e[i?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let m=!1;for(let e=0;e<c;e++){const t=l[e],c=t[i?"offsetLeft":"offsetTop"],u=c+t[i?"offsetWidth":"offsetHeight"];if(s?u>=o-n&&u<=r+n:c<=r+n&&u>=o-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:l,visibleIndexes:d}}const Tm=function(e,t,n=!1){const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],i=t[n?"offsetLeft":"offsetTop"],o=i+t[n?"offsetWidth":"offsetHeight"];return i>a&&o<s};function Am(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:i}=Mm(a,e,8,!0,!0);if(!i.length||!i[t])return;const o=s[0];if(!s.includes(t)||t===o&&!Tm(a,i[o])){const e=t>s[s.length-1]?"start":"end";(0,po.ZP)(a,i[t],e,10)}}function Rm({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:n,shouldRemoveSelectionOnReset:s,noArrowNavigation:i,items:o,shouldSelectOnTab:r,onSelect:l,onClose:c}){const[d,m]=(0,a.eJ)(-1),u=(0,T.Z)((e=>o?(0,Zi.Z)(o.length,e):-1)),h=(0,T.Z)(((e,t)=>{t.preventDefault(),m((t=>u(t+e)))})),Z=(0,T.Z)((t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return!1;if(!e)return!1;if(o&&o.length&&d>-1){const e=o[d];if(e){if(!1===l(e))return!1;t.preventDefault()}}return!0})),P=!o||d>o.length-1;return(0,a.d4)((()=>{n&&!P||m(s?-1:0)}),[P,s,n]),(0,a.d4)((()=>e?(0,ga.Z)({onEsc:c,onUp:i||t?void 0:e=>h(-1,e),onDown:i||t?void 0:e=>h(1,e),onLeft:i||!t?void 0:e=>h(-1,e),onRight:i||!t?void 0:e=>h(1,e),onTab:r?Z:void 0,onEnter:Z}):void 0),[i,h,Z,e,t,c,r]),d}const Lm=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,filteredUsers:i})=>{const o=(0,a.sO)(null),{shouldRender:r,transitionClassNames:l}=(0,Fe.Z)(e,void 0,void 0,!1),c=(0,T.Z)(((e,t=!1)=>{const a=(0,s.Rd)().users.byId[e];a&&n(a,t)})),d=(0,T.Z)(((e,t)=>{e.preventDefault(),c(t)})),m=(0,T.Z)((e=>{c(e.id,!0)})),u=Rm({isActive:e,items:i,onSelect:m,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,a.d4)((()=>{Am(".chat-item-clickable",u,o)}),[u]),(0,a.d4)((()=>{i&&!i.length&&t()}),[i,t]);const h=(0,D.Z)(i?.length?i:void 0,r),Z=i&&!i.length?h:i;if(!r||Z&&!Z.length)return;const P=(0,ce.Z)("MentionTooltip composer-tooltip custom-scroll",l);return a.ZP.createElement("div",{className:P,ref:o},Z?.map((({id:e},t)=>a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable scroll-item smaller-icon",onClick:d,clickArg:e,focus:u===t},a.ZP.createElement(ns.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var Bm=n(49841),Fm=n(23522);const xm="iWmxxlUXOjTzbvJzWF8g",Dm="B5wzgwCPupbnO1XB5Rwc",Om="caption-input-text",Um=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{currentUserId:n,recentEmojis:a,customEmojis:s,attachmentSettings:i}=e,c=(0,r.YC)(t)?void 0:(0,l.x67)(e,t),d=(0,l.FM1)(e,t),{language:m,shouldSuggestCustomEmoji:u}=e.settings.byKey,h=e.emojiKeywords[o.pRL],Z=m!==o.pRL?e.emojiKeywords[m]:void 0;return{isChatWithSelf:d,currentUserId:n,groupChatMembers:c?.members,recentEmojis:a,baseEmojiKeywords:h?.keywords,emojiKeywords:Z?.keywords,shouldSuggestCustomEmoji:u,customEmojiForEmoji:s.forEmoji.stickers,captionLimit:(0,Qs.M)(e,"captionLength"),attachmentSettings:i}}))((({chatId:e,threadId:t,attachments:n,getHtml:i,canShowCustomSendMenu:r,captionLimit:l,isReady:c,isChatWithSelf:m,currentUserId:u,groupChatMembers:h,recentEmojis:P,baseEmojiKeywords:p,emojiKeywords:v,isForMessage:g,shouldSchedule:E,shouldSuggestCustomEmoji:C,customEmojiForEmoji:b,attachmentSettings:f,shouldSuggestCompression:y,shouldForceCompression:S,shouldForceAsFile:N,isForCurrentMessageList:w,forceDarkTheme:A,onAttachmentsUpdate:R,onCaptionUpdate:L,onSend:B,onFileAppend:F,onClear:x,onSendSilent:O,onSendScheduled:U,onCustomEmojiSelect:_,onRemoveSymbol:$,onEmojiSelect:V})=>{const{addRecentCustomEmoji:G,addRecentEmoji:H,updateAttachmentSettings:J}=(0,s.Sv)(),z=(0,M.Z)(),X=(0,a.sO)(null),q=(0,a.sO)(null),K=(0,a.sO)(),W=(0,D.Z)(n),Q=n.length?n:W,{isMobile:ee}=(0,I.ZP)(),[te,ae,se]=(0,k.Z)(),[re,le]=(0,a.eJ)(y??f.shouldCompress),de=Boolean((re||S)&&!N),[me,ue]=(0,a.eJ)(f.shouldSendGrouped),{handleScroll:he,isAtBeginning:Pe,isAtEnd:pe}=Wa(),{handleScroll:ve,isAtBeginning:ge}=Wa(),Ee=Boolean(n.length),Ce=Boolean(Q?.length),[be,fe,ye]=(0,k.Z)();(0,a.d4)((()=>{Ee||se()}),[se,Ee]);const[Ie,Se]=(0,a.Ye)((()=>Boolean(Q?.every((e=>e.quick||e.audio)))?[!0,!0]:[Boolean(Q?.some((e=>e.quick||e.audio))),!1]),[Q]),[ke,Ne]=(0,a.Ye)((()=>Boolean(Q?.every((e=>e.shouldSendAsSpoiler)))?[!0,!0]:[Boolean(Q?.some((e=>e.shouldSendAsSpoiler))),!1]),[Q]),we=(0,Pm.Z)(`#${o.nYf}`),{isEmojiTooltipOpen:Me,filteredEmojis:Te,filteredCustomEmojis:Ae,insertEmoji:Re,closeEmojiTooltip:Le}=(0,vm.Z)(Boolean(c&&(w||!g)&&Ce),i,L,o.nYf,P,p,v),{isCustomEmojiTooltipOpen:Be,insertCustomEmoji:Fe,closeCustomEmojiTooltip:xe}=(0,pm.Z)(Boolean(c&&(w||!g)&&Ce&&C),i,L,we,q,b),{isMentionTooltipOpen:De,closeMentionTooltip:Oe,insertMention:Ue,mentionFilteredUsers:_e}=(0,gm.Z)(Boolean(c&&w&&Ce),i,L,we,q,h,void 0,u);(0,a.d4)((()=>Ee?(0,d.Z)(x):void 0),[Ee,x]),(0,a.d4)((()=>{Ee&&(le(y??f.shouldCompress),ue(f.shouldSendGrouped))}),[f,Ee,y]),(0,a.d4)((()=>{Ee&&ee&&(0,um.dG)()}),[ee,Ee]);const{isContextMenuOpen:$e,handleContextMenu:je,handleContextMenuClose:Ve,handleContextMenuHide:Ge}=(0,No.Z)(X,!r||!Ee),He=(0,T.Z)(((e,t)=>{Ee&&(((E||t)&&g?U:e?O:B)(de,me),J({shouldCompress:void 0===y?de:void 0,shouldSendGrouped:me}))})),Je=(0,T.Z)((()=>{He(!0)})),ze=(0,T.Z)((()=>{He()})),Xe=(0,T.Z)((()=>{He(!1,!0)})),Ye=(0,T.Z)((async e=>{e.preventDefault(),ye();const{dataTransfer:t}=e,n=await(0,hm.Z)(t.items);n?.length&&F(n,Ne)})),qe=(0,T.Z)((e=>{const{files:t}=e.target,n=(0,j.ox)(t);n?.length&&F(n,Ne)})),Ke=(0,T.Z)((()=>{(0,Pc.g)("*",(e=>qe(e)))})),We=(0,T.Z)((e=>{R(n.filter(((t,n)=>n!==e)))})),Qe=(0,T.Z)((()=>{R(n.map((e=>({...e,shouldSendAsSpoiler:e.mimeType!==o.s11||void 0}))))})),et=(0,T.Z)((()=>{R(n.map((e=>({...e,shouldSendAsSpoiler:void 0}))))})),tt=(0,T.Z)((e=>{R(n.map(((t,n)=>n===e?{...t,shouldSendAsSpoiler:!t.shouldSendAsSpoiler||void 0}:t)))}));(0,a.d4)((()=>{const e=X.current,t=document.getElementById(Om);if(!e||!t)return;const{width:n}=e.getBoundingClientRect();(0,Z.WM)((()=>{t.style.setProperty("--margin-for-scrollbar",`${n}px`)}))}),[z,Ee]);const nt=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(Y.Z,{round:!0,ripple:!ee,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon icon-more"}))),[ee]),at=(0,Ze.Z)((()=>{if(!Ce)return;const e=l-(t=i(),Zm.innerHTML=t,(0,Od.fu)(Zm),Zm.querySelectorAll("br").forEach((e=>{e.replaceWith("\n")})),Zm.textContent?.trim().length||0);var t;return e<=100?e:void 0}),[l,i,Ce]),st=de&&Se,[it,ot,rt]=(0,a.Ye)((()=>st&&Q?[Q.every((e=>o.oGt.has(e.mimeType))),Q.every((e=>o.wGh.has(e.mimeType))),Q.every((e=>o.e74.has(e.mimeType)))]:[!1,!1,!1]),[Q,st]),lt=(0,a.Ye)((()=>!!Q&&Q.some((e=>e.mimeType!==o.s11&&!o.e74.has(e.mimeType)))),[Q]);if(!Q)return;const ct=Q.length>1;let dt="";dt=z(it?"PreviewSender.SendPhoto":ot?"PreviewSender.SendVideo":rt?"PreviewSender.SendAudio":"PreviewSender.SendFile",Q.length,"i");const mt=!pe||!ge;return a.ZP.createElement(ne.Z,{isOpen:Ee,onClose:x,header:function(){if(Q)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:z.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:x},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("div",{className:"modal-title"},dt),a.ZP.createElement(ie.Z,{className:"attachment-modal-more-menu with-menu-transitions",trigger:nt,positionX:"right"},a.ZP.createElement(oe.Z,{icon:"add",onClick:Ke},z("Add")),Ie&&a.ZP.createElement(a.ZP.Fragment,null,!N&&!S&&(de?a.ZP.createElement(oe.Z,{icon:"document",onClick:()=>le(!1)},z(ct?"Attachment.SendAsFiles":"Attachment.SendAsFile")):a.ZP.createElement(oe.Z,{icon:"photo",onClick:()=>le(!0)},ct?"Send All as Media":"Send as Media")),de&<&&(ke?a.ZP.createElement(oe.Z,{icon:"spoiler-disable",onClick:et},z("Attachment.DisableSpoiler")):a.ZP.createElement(oe.Z,{icon:"spoiler",onClick:Qe},z("Attachment.EnableSpoiler")))),ct&&(me?a.ZP.createElement(oe.Z,{icon:"grouped-disable",onClick:()=>ue(!1)},"Ungroup All Media"):a.ZP.createElement(oe.Z,{icon:"grouped",onClick:()=>ue(!0)},"Group All Media"))))}(),className:(0,ce.Z)("VncEpkgqABgA8MUCarxh",be&&Dm,!Pe&&"u08mL9ikB7S0oRZKxvsA",ee&&"EBYYWwiG6Uj4Aqt4DKGy",te&&"eVLBe8iLKwjR6B31YwJj",A&&"component-theme-dark"),noBackdropClose:!0},a.ZP.createElement("div",{className:xm,onDragEnter:fe,onDrop:Ye,onDragOver:function(e){e.preventDefault(),K.current&&(window.clearTimeout(K.current),K.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(`.${xm}`)&&!t&&(K.current=window.setTimeout(ye,150)),n&&n.closest(`.${Dm}`)||(t&&e.stopPropagation(),ye())},onClick:ye,"data-attach-description":z("Preview.Dragging.AddItems",10),"data-dropzone":!0},a.ZP.createElement("div",{className:(0,ce.Z)("d_uMaJ26HlkCfSn5XiQp","custom-scroll",mt&&"DUGHCuTKi7H5d_1_vYqj"),onScroll:he},Q.map(((e,t)=>a.ZP.createElement(Sm,{attachment:e,shouldDisplayCompressed:de,shouldDisplayGrouped:me,isSingle:1===Q.length,index:t,key:e.uniqueId||t,onDelete:We,onToggleSpoiler:tt})))),a.ZP.createElement("div",{className:(0,ce.Z)("BKyeut4mBbq_uw8uGfSU",mt&&"UrYInfws7roRktEiMxvT")},a.ZP.createElement(Lm,{isOpen:De,filteredUsers:_e,onInsertUserName:Ue,onClose:Oe}),a.ZP.createElement(wm.Z,{isOpen:Me,emojis:Te,customEmojis:Ae,addRecentEmoji:H,addRecentCustomEmoji:G,onEmojiSelect:Re,onCustomEmojiSelect:Re,onClose:Le}),a.ZP.createElement(km.Z,{chatId:e,isOpen:Be,addRecentCustomEmoji:G,onCustomEmojiSelect:Fe,onClose:xe}),a.ZP.createElement("div",{className:"c4dyk1Emgpla8BvDJMAz"},a.ZP.createElement(Fm.Z,{chatId:e,threadId:t,isMobile:ee,isReady:c,isSymbolMenuOpen:te,openSymbolMenu:ae,closeSymbolMenu:se,onCustomEmojiSelect:_,onRemoveSymbol:$,onEmojiSelect:V,isAttachmentModal:!0,canSendPlainText:!0,className:"attachment-modal-symbol-menu with-menu-transitions",idPrefix:"attachment",forceDarkTheme:A}),a.ZP.createElement(Bm.Z,{ref:q,id:Om,chatId:e,threadId:t,isAttachmentModalInput:!0,customEmojiPrefix:"attachment",isReady:c,isActive:Ee,getHtml:i,editableInputId:o.nYf,placeholder:z("AddCaption"),onUpdate:L,onSend:ze,onScroll:ve,canAutoFocus:Boolean(c&&w&&n.length),captionLimit:at,shouldSuppressFocus:ee&&te,onSuppressedFocus:se}),a.ZP.createElement("div",{className:"z4wF5bBjL74eNUj_UYeu"},a.ZP.createElement(Y.Z,{ref:X,className:"eFD46lVH5GCILXEOx9BO",onClick:ze,onContextMenu:r?je:void 0},z(E?"Next":"Send")),r&&a.ZP.createElement(Nm.Z,{isOpen:$e,canSchedule:g,onSendSilent:m?void 0:Je,onSendSchedule:Xe,onClose:Ve,onCloseAnimationEnd:Ge,isSavedMessages:m}))))))}))),_m=(0,a.X$)((({isOpen:e,isQuiz:t,shouldBeAnonymous:n,onSend:s,onClear:i})=>{const o=(0,a.sO)(null),r=(0,a.sO)(null),[l,c]=(0,a.eJ)(""),[m,u]=(0,a.eJ)([""]),[h,P]=(0,a.eJ)(!0),[p,v]=(0,a.eJ)(!1),[g,E]=(0,a.eJ)(t||!1),[C,b]=(0,a.eJ)(""),[f,y]=(0,a.eJ)(),[I,S]=(0,a.eJ)(!1),k=(0,M.Z)(),N=(0,T.Z)((e=>{b(e.target.value)})),w=(0,T.Z)((t=>{e&&t.current&&t.current.focus()}));(0,a.d4)((()=>e?(0,d.Z)(i):void 0),[e,i]),(0,a.d4)((()=>{e||(c(""),u([""]),P(!0),v(!1),E(t||!1),b(""),y(void 0),S(!1))}),[t,e]),(0,a.d4)((()=>w(o)),[w,e]);const A=(0,T.Z)(((e=[])=>{u([...e,""]),(0,Z.Yq)((()=>{const e=r.current;e&&(0,Z.i$)((()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}))}))})),R=(0,T.Z)((()=>{if(S(!1),!e)return;const t=g&&(void 0===f||!m[f].trim()),n=m.map(((e,t)=>{if(e=e.trim())return{text:e,option:String(t),...t===f&&{correct:!0}}})).filter(Boolean),a=l.trim().substring(0,255);if(!a||n.length<2){if(c(a),n.length){const e=m.map((e=>e.trim().substring(0,100))).filter(Boolean);e.length<2?A(e):u(e)}else A();return void S(!0)}if(t)return void S(!0);const i={summary:{question:a,answers:n,...!h&&{isPublic:!0},...p&&{multipleChoice:!0},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=C&&(0,Od.ZP)(C.substring(0,200))||{};i.quiz={correctAnswers:[String(f)],...e&&{solution:e},...t&&{solutionEntities:t}}}s(i)})),L=(0,T.Z)(((e,t)=>{const n=[...m];n[e]=t,n[n.length-1].trim().length&&n.length<10?A(n):u(n)})),B=(0,T.Z)((e=>{const t=[...m];t.splice(e,1),u(t),void 0!==f&&(f===e?y(void 0):e<f&&y(f-1)),(0,Z.Yq)((()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)}))})),F=(0,T.Z)((e=>{y(Number(e))})),x=(0,T.Z)((e=>{P(e.target.checked)})),D=(0,T.Z)((e=>{v(e.target.checked)})),O=(0,T.Z)((e=>{E(e.target.checked)})),U=(0,T.Z)((e=>{13===e.keyCode&&R()})),_=(0,T.Z)((e=>{c(e.target.value)})),$=(0,T.Z)((()=>{if(I&&!l.trim().length)return k("lng_polls_choose_question")})),j=(0,T.Z)((e=>{const t=m.map((e=>e.trim())).filter((e=>e.length));if(I&&t.length<2&&!m[e].trim().length)return k("lng_polls_choose_answers")}));function V(){return m.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(us.Z,{label:t!==m.length-1||10===m.length?k("OptionHint"):k("CreatePoll.AddOption"),error:j(t),value:e,onChange:e=>L(t,e.currentTarget.value),onKeyPress:U}),t!==m.length-1&&a.ZP.createElement(Y.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:k("Delete"),onClick:()=>B(t)},a.ZP.createElement("i",{className:"icon icon-close"})))))}return a.ZP.createElement(ne.Z,{isOpen:e,onClose:i,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(Y.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:i},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("div",{className:"modal-title"},k("NewPoll")),a.ZP.createElement(Y.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:R},k("Create"))),className:"PollModal"},a.ZP.createElement(us.Z,{ref:o,label:k("AskAQuestion"),value:l,error:$(),onChange:_,onKeyPress:U}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:r},a.ZP.createElement("h3",{className:"options-header"},k("PollOptions")),I&&function(){const e=m.map((e=>e.trim())).filter((e=>e.length));return g&&(void 0===f||!e[f])&&a.ZP.createElement("p",{className:"poll-error"},k("lng_polls_choose_correct"))}(),g?a.ZP.createElement(Dl.Z,{name:"correctOption",options:V().map(((e,t)=>({value:String(t),label:e,hidden:!m[t].trim()}))),selected:String(f),onChange:F}):V()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},!n&&a.ZP.createElement(As.Z,{label:k("PollAnonymous"),checked:h,onChange:x}),a.ZP.createElement(As.Z,{label:k("PollMultiple"),checked:p,disabled:g,onChange:D}),a.ZP.createElement(As.Z,{label:k("PollQuiz"),checked:g,disabled:p||void 0!==t,onChange:O}),g&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},k("lng_polls_solution_title")),a.ZP.createElement(ic.Z,{value:C,onChange:N,noReplaceNewlines:!0}),a.ZP.createElement("div",{className:"note"},k("CreatePoll.ExplanationInfo")))))}));var $m=n(56503),jm=n(34284);const Vm=(0,a.X$)((({emoji:e,focus:t,onClick:n})=>{const s=(0,T.Z)((t=>{t.preventDefault(),n(e.native,e.id)})),i=(0,ce.Z)("EmojiButton",t&&"focus"),r=`${o.v5x?o._nY:"."}/img-apple-64/${e.image}.png`,l=jm.Uz.has(r);return a.ZP.createElement("div",{className:i,onMouseDown:s,title:`:${e.names[0]}:`},g.op?e.native:a.ZP.createElement("img",{src:r,className:l?void 0:"opacity-transition shown",alt:e.native,loading:"lazy","data-path":r,onLoad:l?void 0:jm.mE,draggable:!1}))})),Gm=.625*u.Gw,Hm=.25*u.Gw,Jm=.5*u.Gw,zm=.5*u.Gw,Xm=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:i,onEmojiSelect:r})=>{const l=(0,a.sO)(null);(0,vo._N)(l,s);const c=(0,ya.Z)(i),d=(0,M.Z)(),{isMobile:m}=(0,I.ZP)(),u=m?Math.floor((E.Z.get().width-zm+Gm)/(o.eXY+Gm)):8,h=Math.ceil(e.emojis.length/u)*(o.eXY+(m?Jm:Hm));return a.ZP.createElement("div",{ref:l,key:e.id,id:`emoji-category-${t}`,className:"symbol-set"},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},d(e.id===o.s38?"RecentStickers":`Emoji${t}`))),a.ZP.createElement("div",{className:(0,ce.Z)("symbol-set-container",c),style:`height: ${h}px;`,dir:d.isRtl?"rtl":void 0},i&&e.emojis.map((e=>{const t=n[e];if(!t)return;const s="id"in t?t:t[1];return a.ZP.createElement(Vm,{key:s.id,emoji:s,onClick:r})}))))})),Ym={recent:"icon-recent",people:"icon-smile",nature:"icon-animals",foods:"icon-eats",activity:"icon-sport",places:"icon-car",objects:"icon-lamp",symbols:"icon-language",flags:"icon-flag"},qm=3.25*u.Gw,Km=2.625*u.Gw,Wm=[];let Qm,eu,tu;const nu=(0,a.X$)((0,s.c$)((e=>(0,Kn.ei)(e,["recentEmojis"])))((({className:e,recentEmojis:t,onEmojiSelect:s})=>{const i=(0,a.sO)(null),r=(0,a.sO)(null),[l,c]=(0,a.eJ)(),[d,m]=(0,a.eJ)(),[u,h]=(0,a.eJ)(0),{isMobile:Z}=(0,I.ZP)(),{handleScroll:P,isAtBeginning:p}=Wa(),{observe:v}=(0,vo.S1)({rootRef:i,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const n=Number(t.replace("emoji-category-",""));Wm[n]=e.isIntersecting}));const t=Wm.reduce(((e,t,n)=>t&&n<e?n:e),1/0);t!==1/0&&h(t)})),E=(0,Po.Z)([],o.kUR),C=d&&E;(0,Zo.Z)(r,!(Z&&C)),(0,a.d4)((()=>{if(!l)return;const e=r.current;if(!e)return;const t=u*Km-e.offsetWidth/2+Km/2;(0,ii.Z)(e,t)}),[l,u]);const b=(0,M.Z)(),f=(0,a.Ye)((()=>{if(!l)return Wn.D;const e=[...l];return t?.length&&e.unshift({id:o.s38,name:b("RecentStickers"),emojis:t}),e}),[l,b,t]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c(tu.categories),m(tu.emojis)};tu?e():async function(){return Qm||(Qm=n.e(7501).then(n.t.bind(n,47501,19)),eu=(await Qm).default,tu=(0,jm.NM)(eu)),Qm}().then(e)}),200)}),[]);const y=(0,T.Z)((e=>{h(e);const t=i.current.closest(".SymbolMenu-main").querySelector(`#emoji-category-${e}`);(0,po.ZP)(i.current,t,"start",qm,100)})),S=(0,T.Z)(((e,t)=>{s(e,t)})),k=(0,ce.Z)("EmojiPicker",e);if(!C)return a.ZP.createElement("div",{className:k},a.ZP.createElement(hs.Z,null));const N=(0,ce.Z)("EmojiPicker-header",!p&&"with-top-border");return a.ZP.createElement("div",{className:k},a.ZP.createElement("div",{ref:r,className:N,dir:b.isRtl?"rtl":void 0},f.map((function(e,t){const n=Ym[e.id];return n&&a.ZP.createElement(Y.Z,{className:"symbol-set-button "+(t===u?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>y(t),ariaLabel:e.name},a.ZP.createElement("i",{className:(0,ce.Z)("icon",n)}))}))),a.ZP.createElement("div",{ref:i,onScroll:P,className:(0,ce.Z)("EmojiPicker-main",g.$b?"no-scrollbar":"custom-scroll")},f.map(((e,t)=>a.ZP.createElement(Xm,{category:e,index:t,allEmojis:d,observeIntersection:v,shouldRender:u>=t-1&&u<=t+1,onEmojiSelect:S})))))})));function au(){return au=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},au.apply(this,arguments)}const su=(0,a.X$)((({gif:e,isDisabled:t,className:n,observeIntersection:s,onClick:i,onUnsaveClick:o,isSavedMessages:r})=>{const l=(0,a.sO)(null),c=(0,M.Z)(),d=`gif${e.id}`,m=(0,vo.Op)(l,s)&&!t,u=(0,H.Z)(`${d}?size=m`,!m,_.IU.BlobUrl),[h]=(0,a.eJ)(e.thumbnail?.dataUri&&!u),Z=(0,fa.Z)(e.thumbnail?.dataUri,!h),P=(0,H.Z)(d,!m,_.IU.BlobUrl),p=Boolean(m&&P),{isBuffered:v,bufferingHandlers:E}=(0,Ae.Z)(!0),C=m&&!v,b=m&&v,{isContextMenuOpen:f,contextMenuPosition:y,handleBeforeContextMenu:I,handleContextMenu:S,handleContextMenuClose:k,handleContextMenuHide:N}=(0,No.Z)(l),w=(0,T.Z)((()=>l.current)),A=(0,T.Z)((()=>l.current.closest(".custom-scroll, .no-scrollbar"))),R=(0,T.Z)((()=>l.current.querySelector(".gif-context-menu .bubble"))),{positionX:L,positionY:B,transformOriginX:F,transformOriginY:x,style:D}=(0,wo.Z)(y,w,A,R),O=(0,T.Z)((()=>{!f&&i&&i({...e,blobUrl:P})})),U=(0,T.Z)((t=>{t.stopPropagation(),t.preventDefault(),o(e)})),$=(0,T.Z)((()=>{o?.(e)})),j=(0,T.Z)((()=>{i({...e,blobUrl:P},!0)})),V=(0,T.Z)((()=>{i({...e,blobUrl:P},void 0,!0)})),G=(0,T.Z)((e=>{(0,ko.b)(e),I(e)}));(0,a.d4)((()=>{t&&k()}),[k,t]);const J=(0,ce.Z)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",i&&"interactive",d,n);return a.ZP.createElement("div",{ref:l,className:J,onMouseDown:G,onClick:O,onContextMenu:S},!g.$b&&o&&a.ZP.createElement(Y.Z,{className:"gif-unsave-button",color:"dark",pill:!0,noFastClick:!0,onClick:U},a.ZP.createElement("i",{className:"icon icon-close gif-unsave-button-icon"})),h&&a.ZP.createElement("canvas",{ref:Z,className:"thumbnail",style:b?"display: none;":void 0}),u&&!b&&a.ZP.createElement("img",{src:u,alt:"",className:"preview",draggable:!1}),p&&a.ZP.createElement(wa.Z,au({canPlay:!0,src:P,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none"},E)),C&&a.ZP.createElement(we.Z,{color:u||h?"white":"black"}),i&&void 0!==y&&a.ZP.createElement(je.Z,{isOpen:f,transformOriginX:F,transformOriginY:x,positionX:L,positionY:B,style:D,className:"gif-context-menu",autoClose:!0,onClose:k,onCloseAnimationEnd:N},!r&&a.ZP.createElement(oe.Z,{onClick:j,icon:"mute"},c("SendWithoutSound")),a.ZP.createElement(oe.Z,{onClick:V,icon:"calendar"},c(r?"SetReminder":"ScheduleMessage")),o&&a.ZP.createElement(oe.Z,{destructive:!0,icon:"delete",onClick:$},c("Delete"))))})),iu=(0,a.X$)((0,s.c$)((e=>{const{chatId:t}=(0,l.Btg)(e)||{},n=Boolean(t)&&(0,l.FM1)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:n}}))((({className:e,loadAndPlay:t,canSendGifs:n,savedGifs:i,isSavedMessages:r,onGifSelect:l})=>{const{loadSavedGifs:c,saveGif:d}=(0,s.Sv)(),m=(0,a.sO)(null),{observe:u}=(0,vo.S1)({rootRef:m,debounceMs:300});(0,a.d4)((()=>{t&&c()}),[t,c]);const h=(0,T.Z)((e=>{d({gif:e,shouldUnsave:!0})})),Z=(0,Po.Z)([],o.Yan);return a.ZP.createElement("div",null,a.ZP.createElement("div",{ref:m,className:(0,ce.Z)("GifPicker",e,g.$b?"no-scrollbar":"custom-scroll")},n?Z&&i&&i.length?i.map((e=>a.ZP.createElement(su,{key:e.id,gif:e,observeIntersection:u,isDisabled:!t,onClick:n?l:void 0,onUnsaveClick:h,isSavedMessages:r}))):Z&&i?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(hs.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat.")))})));var ou=n(56389);const ru=2.5*u.Gw,lu=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{setsById:n,added:a,recent:s,favorite:i,premiumSet:o}=e.stickers,c=(0,l.FM1)(e,t),d=(0,l.Z1J)(e,t),m=(0,r.YC)(t)?void 0:(0,l.x67)(e,t)?.stickerSet?.id;return{chat:d,recentStickers:s.stickers,favoriteStickers:i.stickers,premiumStickers:o.stickers,stickerSetsById:n,addedSetIds:a.setIds,canAnimate:(0,l.yBd)(e),isSavedMessages:c,isCurrentUserPremium:(0,l.wVz)(e),chatStickerSetId:m}}))((({chat:e,threadId:t,className:n,isHidden:i,isTranslucent:r,loadAndPlay:l,canSendStickers:c,recentStickers:d,favoriteStickers:m,premiumStickers:u,addedSetIds:h,stickerSetsById:Z,chatStickerSetId:P,canAnimate:p,isSavedMessages:v,isCurrentUserPremium:E,noContextMenus:C,idPrefix:b,onStickerSelect:f})=>{const{loadRecentStickers:y,addRecentSticker:I,unfaveSticker:S,faveSticker:k,removeRecentSticker:N}=(0,s.Sv)(),w=(0,a.sO)(null),A=(0,a.sO)(null),R=(0,a.sO)(null),{handleScroll:L,isAtBeginning:B}=Wa(),F=(0,ou.Z)(e.id,t),x=`${b}-sticker-set`,{activeSetIndex:D,observeIntersectionForSet:O,observeIntersectionForPlayingItems:U,observeIntersectionForShowingItems:_,observeIntersectionForCovers:$,selectStickerSet:j}=Co(w,A,x,i),V=(0,M.Z)(),G=Boolean(h),H=(0,a.Ye)((()=>{if(!h)return Wn.D;const e=[],t=Object.values((0,Kn.q0)(Z,h));if(m.length&&e.push({id:o.ka7,accessHash:"0",title:V("FavoriteStickers"),stickers:m,count:m.length}),d.length&&e.push({id:o.s38,accessHash:"0",title:V("RecentStickers"),stickers:d,count:d.length}),E){const n=t.map((({stickers:e})=>e?.filter((e=>e.hasEffect)))).flat().filter(Boolean),a=(0,Kn.od)([...n,...u],"id");a.length&&e.push({id:o.BRs,accessHash:"0",title:V("PremiumStickers"),stickers:a,count:a.length})}if(P){const t=Z[P];t&&e.push({id:o.dWG,accessHash:t.accessHash,title:V("GroupStickers"),stickers:t.stickers,count:t.stickers.length})}return[...e,...t]}),[h,Z,m,d,E,P,V,u]),J=(0,a.Ye)((()=>G&&0===H.filter((e=>e.stickers?.length)).length),[H,G]);(0,a.d4)((()=>{l&&(y(),c&&F({type:"chooseSticker"}))}),[c,l,y,F]);const z=(0,Po.Z)([],o.Yan),X=G&&z&&!J&&c;(0,Zo.Z)(A,!X||!A.current),(0,a.d4)((()=>{if(!G)return;const e=A.current;if(!e)return;const t=D*ru-(e.offsetWidth/2-ru/2);(0,ii.Z)(e,t)}),[G,D]);const q=(0,T.Z)(((e,t,n)=>{f(e,t,n,!0),I({sticker:e})})),K=(0,T.Z)((e=>{S({sticker:e})})),W=(0,T.Z)((e=>{k({sticker:e})})),Q=(0,T.Z)((()=>{c&&F({type:"chooseSticker"})})),ee=(0,T.Z)((e=>{N({sticker:e})})),te=(0,ce.Z)("gsyAr7lPlzHWUF_aYaVa",n);if(!X)return a.ZP.createElement("div",{className:te},c?J?a.ZP.createElement("div",{className:jo},V("NoStickers")):a.ZP.createElement(hs.Z,null):a.ZP.createElement("div",{className:jo},V("ErrorSendRestrictedStickersAll")));const ne=(0,ce.Z)(Uo,"no-scrollbar",!B&&_o);return a.ZP.createElement("div",{className:te},a.ZP.createElement("div",{ref:A,className:ne},a.ZP.createElement("div",{className:"shared-canvas-container"},a.ZP.createElement("canvas",{ref:R,className:"shared-canvas"}),H.map((function(t,n){const s=t.stickers?.[0],i=(0,ce.Z)($o,n===D&&"yiTAGOkL3Hgb0VXRPy46"),c=n<o.uaz;return t.id===o.s38||t.id===o.ka7||t.id===o.dWG||t.id===o.BRs||t.hasThumbnail||!s?a.ZP.createElement(Y.Z,{key:t.id,className:i,ariaLabel:t.title,round:!0,faded:t.id===o.s38||t.id===o.ka7,color:"translucent",onClick:()=>j(n)},t.id===o.BRs?a.ZP.createElement(wc.Z,{withGradient:!0,big:!0}):t.id===o.s38?a.ZP.createElement("i",{className:"icon icon-recent"}):t.id===o.ka7?a.ZP.createElement("i",{className:"icon icon-favorite"}):t.id===o.dWG?a.ZP.createElement(yt.Z,{peer:e,size:"small"}):a.ZP.createElement(So,{stickerSet:t,noPlay:!p||!l,observeIntersection:$,sharedCanvasRef:c?R:void 0,forcePlayback:!0})):a.ZP.createElement(Ao,{key:t.id,sticker:s,size:o.DC_,title:t.title,className:i,noPlay:!p||!l,observeIntersection:$,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:c?R:void 0,withTranslucentThumb:r,onClick:j,clickArg:n,forcePlayback:!0})})))),a.ZP.createElement("div",{ref:w,onMouseMove:Q,onScroll:L,className:(0,ce.Z)(Oo,g.$b?"no-scrollbar":"custom-scroll")},H.map(((e,t)=>a.ZP.createElement(xo,{key:e.id,stickerSet:e,loadAndPlay:Boolean(p&&l),noContextMenus:C,index:t,idPrefix:x,observeIntersection:O,observeIntersectionForPlayingItems:U,observeIntersectionForShowingItems:_,isNearActive:D>=t-1&&D<=t+1,favoriteStickers:m,isSavedMessages:v,isCurrentUserPremium:E,isTranslucent:r,onStickerSelect:q,onStickerUnfave:K,onStickerFave:W,onStickerRemoveRecent:ee,forcePlayback:!0})))))})));let cu=function(e){return e[e.Emoji=0]="Emoji",e[e.CustomEmoji=1]="CustomEmoji",e[e.Stickers=2]="Stickers",e[e.GIFs=3]="GIFs",e}({});const du={[cu.Emoji]:"Emoji",[cu.CustomEmoji]:"StickersList.EmojiItem",[cu.Stickers]:"AccDescrStickers",[cu.GIFs]:"GifsTab"},mu={[cu.Emoji]:"icon-smile",[cu.CustomEmoji]:"icon-favorite",[cu.Stickers]:"icon-stickers",[cu.GIFs]:"icon-gifs"},uu=(0,a.X$)((({activeTab:e,onSwitchTab:t,onRemoveSymbol:n,onSearchOpen:s,isAttachmentModal:i,canSendPlainText:o,canSearch:r})=>{const l=(0,M.Z)();function c(n){return a.ZP.createElement(Y.Z,{className:"symbol-tab-button "+(e===n?"activated":""),onClick:()=>t(n),ariaLabel:l(du[n]),round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:(0,ce.Z)("icon",mu[n])}))}const d=(0,T.Z)((()=>{s(e===cu.Stickers?"stickers":"gifs")}));return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:l.isRtl?"rtl":void 0},e!==cu.Emoji&&e!==cu.CustomEmoji&&r&&a.ZP.createElement(Y.Z,{className:"symbol-search-button",ariaLabel:e===cu.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:d},a.ZP.createElement("i",{className:"icon icon-search"})),o&&c(cu.Emoji),o&&c(cu.CustomEmoji),!i&&c(cu.Stickers),!i&&c(cu.GIFs),(e===cu.Emoji||e===cu.CustomEmoji)&&a.ZP.createElement(Y.Z,{className:"symbol-delete-button",onClick:n,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon icon-delete-left"})))}));let hu=!1;const Zu=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:(0,l.jUK)(e).isLeftColumnShown,isBackgroundTranslucent:(0,l.QRV)(e)})))((({chatId:e,threadId:t,isOpen:n,canSendStickers:s,canSendGifs:i,isMessageComposer:o,isLeftColumnShown:r,idPrefix:l,isAttachmentModal:c,canSendPlainText:d,className:m,positionX:u,positionY:h,transformOriginX:P,transformOriginY:p,style:v,isBackgroundTranslucent:E,onLoad:C,onClose:b,onEmojiSelect:f,onCustomEmojiSelect:y,onStickerSelect:S,onGifSelect:k,onRemoveSymbol:N,onSearchOpen:w,addRecentEmoji:A,addRecentCustomEmoji:R})=>{const[L,B]=(0,a.eJ)(0),[F,x]=(0,a.eJ)([]),[D,O]=(0,a.eJ)([]),{isMobile:U}=(0,I.ZP)(),[_,$]=(0,$m.Z)(n,b,void 0,U),{shouldRender:j,transitionClassNames:V}=(0,Fe.Z)(n,b,!1,!1),G=(0,M.Z)();!hu&&n&&(hu=!0),(0,a.d4)((()=>{C()}),[C]),(0,a.d4)((()=>{d||B(2)}),[d]),(0,a.bt)((()=>{if(U&&n&&!c)return document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open"),()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{(0,Z.WM)((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}))}),350)}}),[c,U,n]);const H=(0,a.sO)(F);H.current=F,(0,a.d4)((()=>{H.current.length&&!n&&(H.current.forEach((e=>{A({emoji:e})})),x([]))}),[n,A]);const J=(0,T.Z)(((e,t)=>{x((e=>[...e,t])),f(e)})),z=(0,a.sO)(D);z.current=D,(0,a.d4)((()=>{z.current.length&&!n&&(z.current.forEach((e=>{R({documentId:e})})),x([]))}),[n,R]);const X=(0,T.Z)((e=>{O((t=>[...t,e.id])),y(e)})),q=(0,T.Z)((e=>{b(),w(e)})),W=(0,T.Z)(((e,t,n,a)=>{S?.(e,t,n,!0,a)}));function Q(r,c){switch(L){case cu.Emoji:return a.ZP.createElement(nu,{className:"picker-tab",onEmojiSelect:J});case cu.CustomEmoji:return a.ZP.createElement(Jo,{className:"picker-tab",isHidden:!n||!r,idPrefix:l,loadAndPlay:n&&(r||c),chatId:e,isTranslucent:!U&&E,onCustomEmojiSelect:X});case cu.Stickers:return a.ZP.createElement(lu,{className:"picker-tab",isHidden:!n||!r,loadAndPlay:!!s&&n&&(r||c),idPrefix:l,canSendStickers:s,noContextMenus:!o,chatId:e,threadId:t,isTranslucent:!U&&E,onStickerSelect:W});case cu.GIFs:return a.ZP.createElement(iu,{className:"picker-tab",loadAndPlay:!!i&&n&&(r||c),canSendGifs:i,onGifSelect:k})}}const ee=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},hu&&a.ZP.createElement(K.ZP,{name:"slide",activeKey:L,renderCount:Object.values(du).length},Q)),U&&a.ZP.createElement(Y.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:G("Close"),className:"symbol-close-button",size:"tiny",onClick:b},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement(uu,{activeTab:L,onSwitchTab:B,onRemoveSymbol:N,canSearch:o,onSearchOpen:q,isAttachmentModal:c,canSendPlainText:d}));if(U){if(!j)return;const e=(0,ce.Z)("SymbolMenu mobile-menu",V,r&&"left-column-open",c&&"in-attachment-modal",o&&"in-middle-column");return c?a.ZP.createElement("div",{className:e},ee):a.ZP.createElement(zo.Z,null,a.ZP.createElement("div",{className:e},ee))}return a.ZP.createElement(je.Z,{isOpen:n,positionX:c?u:"left",positionY:c?h:"bottom",onClose:b,withPortal:c,className:(0,ce.Z)("SymbolMenu",m),onCloseAnimationEnd:b,onMouseEnter:g.$b?void 0:_,onMouseLeave:g.$b?void 0:$,noCloseOnBackdrop:!g.$b,noCompact:!0,transformOriginX:P,transformOriginY:p,style:v},ee)}))),Pu=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:i})=>a.ZP.createElement(jn.Z,{key:n.command,className:(0,ce.Z)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:()=>i(n),focus:t},e&&a.ZP.createElement(yt.Z,{size:"small",peer:s}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",n.command),a.ZP.createElement("span",{className:"subtitle"},(0,te.Z)(n.description)))))),pu=(0,a.X$)((({isOpen:e,withUsername:t,botCommands:n,getHtml:i,onClick:o,onClose:r})=>{const{sendBotCommand:l}=(0,s.Sv)(),c=(0,a.sO)(null),{shouldRender:d,transitionClassNames:m}=(0,Fe.Z)(e,void 0,void 0,!1),u=(0,T.Z)((({botId:e,command:n})=>{const a=(0,s.Rd)().users.byId[e];l({command:`/${n}${t&&a?`@${a.usernames[0].username}`:""}`}),o()})),h=(0,T.Z)((e=>!!e.command.startsWith(i().slice(1))&&(u(e),!0))),Z=Rm({isActive:e,items:n,onSelect:h,onClose:r});(0,a.d4)((()=>{n&&!n.length&&r()}),[n,r]),(0,a.d4)((()=>{Am(".chat-item-clickable",Z,c)}),[Z]);const P=(0,D.Z)(n&&n.length?n:void 0,d),p=n&&!n.length?P:n;if(!d||p&&!p.length)return;const v=(0,ce.Z)("BotCommandTooltip composer-tooltip custom-scroll",m);return a.ZP.createElement("div",{className:v,ref:c},p&&p.map(((e,t)=>a.ZP.createElement(Pu,{key:`${e.botId}_${e.command}`,botCommand:e,bot:(0,s.Rd)().users.byId[e.botId],withAvatar:!0,onClick:u,focus:Z===t}))))})),vu=(0,a.X$)((({isOpen:e,botCommands:t,onClose:n})=>{const{sendBotCommand:i}=(0,s.Sv)(),{isMobile:o}=(0,I.ZP)(),[r,l]=(0,$m.Z)(e,n,void 0,o),c=(0,T.Z)((e=>{i({command:`/${e.command}`}),n()}));return a.ZP.createElement(je.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:n,className:"BotCommandMenu",onCloseAnimationEnd:n,onMouseEnter:g.$b?void 0:r,onMouseLeave:g.$b?void 0:l,noCloseOnBackdrop:!g.$b,noCompact:!0},t.map((e=>a.ZP.createElement(Pu,{key:e.command,botCommand:e,onClick:c}))))})),gu=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{stickers:n}=e.stickers.forEmoji;return{stickers:n,isSavedMessages:(0,l.FM1)(e,t),isCurrentUserPremium:(0,l.wVz)(e)}}))((({chatId:e,threadId:t,isOpen:n,onStickerSelect:s,onClose:i,stickers:r,isSavedMessages:l,isCurrentUserPremium:c})=>{const m=(0,a.sO)(null),{shouldRender:u,transitionClassNames:h}=(0,Fe.Z)(n,void 0,void 0,!1),Z=(0,D.Z)(r,!0),P=r||Z,p=(0,ou.Z)(e,t),{observe:v}=(0,vo.S1)({rootRef:m,throttleMs:200});(0,a.d4)((()=>n?(0,d.Z)(i):void 0),[n,i]);const g=(0,ce.Z)("StickerTooltip composer-tooltip custom-scroll",h,!P?.length&&"hidden");return a.ZP.createElement("div",{ref:m,className:g,onMouseMove:()=>{p({type:"chooseSticker"})}},u&&P?P.map((e=>a.ZP.createElement(Ao,{key:e.id,sticker:e,size:o.Qao,observeIntersection:v,onClick:n?s:void 0,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c}))):u?a.ZP.createElement(hs.Z,null):void 0)}))),Eu={root:"o7fHB9vMHP_k5l9rZC2R",emojiButton:"LzdBMbvLbmND0s2zfaff"},Cu=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{stickers:n}=e.customEmojis.forEmoji;return{customEmoji:n,isSavedMessages:(0,l.FM1)(e,t),isCurrentUserPremium:(0,l.wVz)(e)}}))((({isOpen:e,addRecentCustomEmoji:t,onCustomEmojiSelect:n,onClose:i,customEmoji:r,isSavedMessages:l,isCurrentUserPremium:c,noPlay:m})=>{const{clearCustomEmojiForEmoji:u}=(0,s.Sv)(),h=(0,a.sO)(null),{shouldRender:Z,transitionClassNames:P}=(0,Fe.Z)(e,void 0,void 0,!1),p=(0,D.Z)(r,!0),v=r||p;(0,Zo.Z)(h);const{observe:g}=(0,vo.S1)({rootRef:h,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>e?(0,d.Z)(i):void 0),[e,i]);const E=(0,T.Z)((a=>{e&&(n(a),t({documentId:a.id}),u())})),C=(0,ce.Z)(Eu.root,"composer-tooltip custom-scroll-x",P,!v?.length&&Eu.hidden);return a.ZP.createElement("div",{ref:h,className:C},Z&&v?v.map((e=>a.ZP.createElement(Ao,{key:e.id,sticker:e,className:Eu.emojiButton,size:o.NjN,observeIntersection:g,onClick:E,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c,noPlay:m}))):Z?a.ZP.createElement(hs.Z,null):void 0)}))),bu=(0,a.X$)((({isOpen:e,isOpenToBottom:t=!1,isSavedMessages:n,canSchedule:s,canScheduleUntilOnline:i,onSendSilent:o,onSendSchedule:r,onSendWhenOnline:l,onClose:c,onCloseAnimationEnd:d})=>{const[m,u]=(0,$m.Z)(e,c),[h,Z]=(0,a.eJ)(!1),P=(0,M.Z)();return(0,ta.Z)((([t])=>{e&&!t&&Z(Boolean(i))}),[e,i]),a.ZP.createElement(je.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:t?"top":"bottom",className:"CustomSendMenu with-menu-transitions",onClose:c,onCloseAnimationEnd:d,onMouseEnter:g.$b?void 0:m,onMouseLeave:g.$b?void 0:u,noCloseOnBackdrop:!g.$b},o&&a.ZP.createElement(oe.Z,{icon:"mute",onClick:o},P("SendWithoutSound")),s&&r&&a.ZP.createElement(oe.Z,{icon:"schedule",onClick:r},P(n?"SetReminder":"ScheduleMessage")),s&&r&&h&&a.ZP.createElement(oe.Z,{icon:"user-online",onClick:l},P("SendWhenOnline")))}));var fu=n(12420),yu=n(72087);const Iu=(0,a.X$)((({emoji:e,focus:t,onClick:n,observeIntersection:s})=>{const i=(0,T.Z)((t=>{t.preventDefault(),n?.(e)})),o=(0,ce.Z)("EmojiButton",t&&"focus");return a.ZP.createElement("div",{className:o,onMouseDown:i,title:e.emoji},a.ZP.createElement(ti.Z,{documentId:e.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0,observeIntersectionForPlaying:s}))})),Su=(0,a.X$)((({isOpen:e,emojis:t,customEmojis:n,onClose:s,onEmojiSelect:i,onCustomEmojiSelect:o,addRecentEmoji:r,addRecentCustomEmoji:l})=>{const c=(0,a.sO)(null),{shouldRender:d,transitionClassNames:m}=(0,Fe.Z)(e,void 0,void 0,!1),u=(0,Ra.Z)(t.length?[...n,...t]:void 0,350)||[];(0,Zo.Z)(c);const{observe:h}=(0,vo.S1)({rootRef:c,throttleMs:200,isDisabled:!e}),Z=(0,T.Z)((e=>{i(e.native),r({emoji:e.id})})),P=(0,T.Z)((e=>{o(e),l({documentId:e.id})})),p=(0,T.Z)((e=>{"native"in e?Z(e):P(e)})),v=(0,T.Z)(((e,t)=>{i(e),r({emoji:t})})),g=(0,T.Z)((e=>{o(e),l({documentId:e.id})})),E=Rm({isActive:e,isHorizontal:!0,items:u,shouldRemoveSelectionOnReset:!0,onSelect:p,onClose:s});(0,ta.Z)((([e])=>{void 0!==e&&-1!==e&&function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=Mm(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const i=a[0];if(!a.includes(e)||e===i&&!Tm(n,s[i],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,ii.Z)(n,t)}}(E,c)}),[E]);const C=(0,ce.Z)("EmojiTooltip composer-tooltip custom-scroll-x",m);return a.ZP.createElement("div",{ref:c,className:C},d&&u?u.map(((e,t)=>"native"in e?a.ZP.createElement(Vm,{key:e.id,emoji:e,focus:E===t,onClick:v}):a.ZP.createElement(Iu,{key:e.id,emoji:e,focus:E===t,onClick:g,observeIntersection:h}))):d?a.ZP.createElement(hs.Z,null):void 0)})),ku=(0,a.X$)((({title:e,description:t,thumbnail:n,thumbUrl:s,focus:i,transitionClassNames:o="",onClick:r})=>{let l;const c=(0,H.Z)(n?`webDocument:${n.url}`:void 0);return(s=s||c)?l=a.ZP.createElement("img",{src:s,className:o,alt:"",decoding:"async",draggable:!1}):e&&(l=(0,$e.Xv)(e,1)),a.ZP.createElement(jn.Z,{focus:i,className:"BaseResult chat-item-clickable",onMouseDown:ko.b,onClick:r},a.ZP.createElement("span",{className:"thumb"},"string"==typeof l?(0,te.Z)(l):l),a.ZP.createElement("div",{className:"content-inner"},e&&a.ZP.createElement("div",{className:"title"},e),t&&a.ZP.createElement("div",{className:"description"},t)))})),Nu=(0,a.X$)((({focus:e,inlineResult:t,onClick:n})=>{const{title:s,url:i,description:o,webThumbnail:r}=t,l=(0,T.Z)((()=>{n(t)}));return a.ZP.createElement(ku,{focus:e,thumbnail:r,title:s||i,description:o,onClick:l})})),wu=(0,a.X$)((({inlineResult:e,isSavedMessages:t,canSendGifs:n,observeIntersection:s,onClick:i})=>{const{gif:o}=e,r=(0,T.Z)(((t,n,a)=>{i(e,n,a)}));if(o)return a.ZP.createElement(su,{gif:o,observeIntersection:s,className:"chat-item-clickable",onClick:n?r:void 0,isSavedMessages:t})})),Mu=(0,a.X$)((({focus:e,isForGallery:t,inlineResult:n,onClick:s})=>{let i,o,r;"photo"in n&&(i=n.photo),"thumbnail"in n&&(o=n.thumbnail),"webThumbnail"in n&&t&&(r=n.webThumbnail);const l=(0,H.Z)(r?`webDocument:${r.url}`:void 0),c=(0,H.Z)(i&&`photo${i.id}?size=m`),d=(0,ya.Z)(c),m=(0,T.Z)((()=>{s(n)}));if(t)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:m},a.ZP.createElement("img",{src:i?.thumbnail?.dataUri||l,alt:"",draggable:!1}),a.ZP.createElement("img",{src:c,className:(0,ce.Z)("full-media",d),alt:"",draggable:!1}));const{title:u,description:h}=n;return a.ZP.createElement(ku,{focus:e,thumbUrl:c||o?.dataUri||l,transitionClassNames:d,title:u,description:h,onClick:m})})),Tu=(0,a.X$)((({inlineResult:e,isSavedMessages:t,observeIntersection:n,onClick:s,isCurrentUserPremium:i})=>{const{sticker:r}=e;if(r)return a.ZP.createElement(Ao,{sticker:r,size:o.zqK,observeIntersection:n,title:r.emoji,className:"chat-item-clickable",onClick:s,clickArg:e,isSavedMessages:t,canViewSet:!0,noShowPremium:!0,isCurrentUserPremium:i})})),Au=(0,ue.P2)((e=>e()),500,!0),Ru=(0,a.X$)((({isOpen:e,botId:t,isGallery:n,inlineBotResults:o,switchPm:r,switchWebview:l,isSavedMessages:c,canSendGifs:d,loadMore:m,onClose:u,onSelectResult:h,isCurrentUserPremium:Z})=>{const{openChat:P,startBot:p,requestSimpleWebView:v}=(0,s.Sv)(),E=(0,a.sO)(null),{shouldRender:C,transitionClassNames:b}=(0,Fe.Z)(e,void 0,void 0,!1),f=(0,va.Z)(n,C),{observe:y}=(0,vo.S1)({rootRef:E,debounceMs:200,isDisabled:!e}),I=(0,T.Z)((({direction:e})=>{e===i.Uq.Backwards&&Au(m)})),S=Rm({isActive:e,shouldRemoveSelectionOnReset:f,noArrowNavigation:f,items:o,onSelect:h,onClose:u});(0,a.d4)((()=>{Am(".chat-item-clickable",S,E)}),[S]);const k=(0,T.Z)((()=>{P({id:t}),p({botId:t,param:r.startParam})})),N=(0,T.Z)((()=>{const e=(0,Hs.BS)();v({botId:t,url:l.url,buttonText:l.text,theme:e,isFromSwitchWebView:!0})})),w=(0,D.Z)(o?.length?o:void 0,C),M=o?.length?o:w;if(!C||!M?.length&&!r)return;const A=(0,ce.Z)("InlineBotTooltip composer-tooltip",g.$b?"no-scrollbar":"custom-scroll",f&&"gallery",b);return a.ZP.createElement(Qa.Z,{ref:E,className:A,items:M,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:I,sensitiveArea:160},r&&a.ZP.createElement(jn.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:k},a.ZP.createElement("span",{className:"title"},r.text)),l&&a.ZP.createElement(jn.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:N},a.ZP.createElement("span",{className:"title"},l.text)),Boolean(M?.length)&&M.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(wu,{key:e.id,inlineResult:e,observeIntersection:y,onClick:h,isSavedMessages:c,canSendGifs:d});case"photo":return a.ZP.createElement(Mu,{key:e.id,isForGallery:f,inlineResult:e,onClick:h});case"sticker":return a.ZP.createElement(Tu,{key:e.id,inlineResult:e,observeIntersection:y,onClick:h,isSavedMessages:c,isCurrentUserPremium:Z});case"video":case"file":case"game":return a.ZP.createElement(Mu,{key:e.id,focus:S===t,inlineResult:e,onClick:h});case"article":case"audio":case"voice":return a.ZP.createElement(Nu,{key:e.id,focus:S===t,inlineResult:e,onClick:h});default:return}})))})),Lu=(0,a.X$)((({isOpen:e,chatId:t,selectedSendAsId:n,sendAsPeerIds:i,isCurrentUserPremium:o,onClose:r})=>{const{saveDefaultSendAs:l,showNotification:c}=(0,s.Sv)(),d=(0,s.Rd)().users.byId,m=(0,s.Rd)().chats.byId,u=(0,M.Z)(),h=(0,a.sO)(null),[Z,P,p]=(0,$m.Z)(e,r,void 0);(0,a.d4)((()=>{e&&p()}),[e,p]);const v=(0,T.Z)((e=>{r(),l({chatId:t,sendAsId:e})})),E=Rm({isActive:e,items:i,onSelect:v,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:r});return(0,a.d4)((()=>{Am(".chat-item-clickable",E,h)}),[E]),(0,a.d4)((()=>{i&&!i.length&&r()}),[i,r]),a.ZP.createElement(je.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SendAsMenu",onCloseAnimationEnd:r,onMouseEnter:g.$b?void 0:Z,onMouseLeave:g.$b?void 0:P,noCloseOnBackdrop:!g.$b,noCompact:!0},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},u("SendMessageAsTitle")),d&&m&&i?.map((({id:e,isPremium:t},s)=>{const i=d[e],r=m[e],l=i||r,h=(0,ce.Z)(n===e&&"selected");return a.ZP.createElement(jn.Z,{key:e,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!t||o?v(e):c({message:u("SelectSendAsPeerPremiumHint"),actionText:u("Open"),action:{action:"openPremiumModal",payload:{}}})},focus:E===s,rightElement:!o&&t&&a.ZP.createElement("i",{className:"icon icon-lock-badge send-as-icon-locked"})},a.ZP.createElement(yt.Z,{size:"small",peer:l,className:h}),a.ZP.createElement("div",{className:"info"},l&&a.ZP.createElement(Cr.Z,{peer:l,noFake:!0}),a.ZP.createElement("span",{className:"subtitle"},i?u("VoipGroupPersonalAccount"):u("Subscribers",r?.membersCount,"i"))))})))}));var Bu=n(76844);const Fu=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Zwk)(e,t);if(!n)return{};const{query:a,results:s}=(0,l.n5x)(e)||{},{totalCount:i,foundIds:o}=s||{};return{messagesById:n,query:a,totalCount:i,foundIds:o}}))((({chatId:e,threadId:t,isActive:n,messagesById:i,query:o,totalCount:r,foundIds:c,onClose:d})=>{const{searchTextMessagesLocal:u,focusMessage:Z}=(0,s.Sv)(),P=(0,a.sO)(null),p=(0,M.Z)();(0,pe.Z)({isActive:n,onBack:d}),(0,a.d4)((()=>{if(n)return(0,m.l_)(),m.In}),[n]);const v=(0,a.I4)((()=>{u()}),[u]),[g,E]=(0,cs.Z)(v,c),C=(0,a.Ye)((()=>o&&g?.length&&i?g.map((n=>{const a=i[n];if(!a)return;const o=(0,s.Rd)();let r=a.senderId?(0,l.dyD)(o,a.senderId)||(0,l.Z1J)(o,a.senderId):void 0;if(!r&&a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo,n=e&&t?(0,l.Z1J)(o,t):void 0;n&&(r=n)}return r?{message:a,senderPeer:r,onClick:()=>Z({chatId:e,threadId:t,messageId:n})}:void 0})).filter(Boolean):Wn.D),[o,g,i,Z,e,t]),b=(0,ms.Z)(P,!0,(e=>{const t=C?.[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0),f=g?.[0]===c?.[0];return a.ZP.createElement(Qa.Z,{ref:P,className:"RightSearch custom-scroll",items:C,preloadBackwards:0,onLoadMore:E,onKeyDown:b},f&&a.ZP.createElement("p",{key:"helper-text",className:"helper-text",dir:"auto"},o?0!==r&&C.length?1===r?"1 message found":`${C.length&&(r||C.length)} messages found`:p("lng_search_no_results"):p("lng_dlg_search_for_messages")),C.map((({message:e,senderPeer:t,onClick:n})=>{const s=(0,h.e)(p,e,void 0,o);return a.ZP.createElement(jn.Z,{key:e.id,teactOrderKey:-e.date,className:"chat-item-clickable search-result-message m-0",onClick:n},a.ZP.createElement(yt.Z,{peer:t}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"search-result-message-top"},a.ZP.createElement(Cr.Z,{peer:t,withEmojiStatus:!0}),a.ZP.createElement(Bu.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},s)))})))}))),xu=(0,a.X$)((0,s.c$)(((e,{stickerSetId:t})=>({set:(0,l.Ny0)(e,t),shouldPlay:(0,l.yBd)(e),isCurrentUserPremium:(0,l.wVz)(e)})))((({stickerSetId:e,observeIntersection:t,set:n,shouldPlay:i,isModalOpen:r,isCurrentUserPremium:l})=>{const{loadStickers:c,toggleStickerSet:d,openStickerSet:m}=(0,s.Sv)(),u=(0,a.sO)(null),h=(0,M.Z)(),Z=n&&!n.isArchived&&Boolean(n.installedDate),P=Boolean(n?.stickers),p=(0,a.Ye)((()=>{if(!n)return[];const e=(n.stickers?.filter((({hasEffect:e})=>e))??[]).slice(0,3),t=(n.covers||[]).map((({id:e})=>e)),a=n.stickers?n.stickers.filter((({id:e})=>!t.includes(e))):[];return[...e,...n.covers||[],...a].slice(0,5)}),[n]);(0,a.d4)((()=>{!P&&p.length<5&&n&&c({stickerSetInfo:{shortName:n.shortName}})}),[P,p.length,c,n,e]);const v=(0,a.I4)((()=>{d({stickerSetId:e})}),[d,e]),g=(0,a.I4)((e=>{m({stickerSetInfo:e.stickerSetInfo})}),[m]);if(!n)return;const E=p.length>0;return a.ZP.createElement("div",{key:n.id,className:"sticker-set",dir:h.isRtl?"rtl":void 0},a.ZP.createElement("div",{className:"sticker-set-header"},a.ZP.createElement("div",{className:"title-wrapper"},a.ZP.createElement("h3",{className:"title",dir:"auto"},n.title),a.ZP.createElement("p",{className:"count",dir:"auto"},h("Stickers",n.count,"i"))),a.ZP.createElement(Y.Z,{className:Z?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:v},h(Z?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main shared-canvas-container"},a.ZP.createElement("canvas",{ref:u,className:"shared-canvas"}),!E&&a.ZP.createElement(we.Z,null),E&&p.map((e=>a.ZP.createElement(Ao,{sticker:e,size:o.Y7U,observeIntersection:t,noPlay:!i||r,clickArg:e,onClick:g,noContextMenu:!0,isCurrentUserPremium:l,sharedCanvasRef:u})))))}))),Du=(0,ue.P2)((e=>e()),6e4,!0),Ou=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.y5E)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a,isModalOpen:Boolean((0,l.jUK)(e).openedStickerSetShortName)}}))((({isActive:e,query:t,featuredIds:n,resultIds:i,isModalOpen:o,onClose:r})=>{const{loadFeaturedStickers:l}=(0,s.Sv)(),c=(0,a.sO)(null),d=(0,M.Z)(),{observe:m}=(0,vo.S1)({rootRef:c,throttleMs:200});return(0,a.d4)((()=>{Du((()=>{l()}))})),(0,pe.Z)({isActive:e,onBack:r}),a.ZP.createElement("div",{ref:c,className:"StickerSearch custom-scroll",dir:d.isRtl?"rtl":void 0},function(){if(void 0!==t)return!t&&n?n.map((e=>a.ZP.createElement(xu,{key:e,stickerSetId:e,observeIntersection:m,isModalOpen:o}))):i?i.length?i.map((e=>a.ZP.createElement(xu,{key:e,stickerSetId:e,observeIntersection:m,isModalOpen:o}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(hs.Z,null)}())}))),Uu=(0,a.X$)((0,s.c$)((e=>{const t=(0,l.yNS)(e),{query:n,results:a}=t||{},{chatId:s,threadId:i}=(0,l.Btg)(e)||{},o=s?(0,l.Z1J)(e,s):void 0,c=o?(0,l.xoo)(e,o):void 0,d=Boolean(s)&&(0,l.FM1)(e,s),m=s&&i?(0,l.tZg)(e,s,i):void 0,u=Boolean(!m?.isCommentsInfo&&m?.fromChannelId);return{query:n,results:a,chat:o,isChatWithBot:c,isSavedMessages:d,canPostInChat:Boolean(o)&&Boolean(i)&&(0,r.Qm)(o,i,u),canScheduleUntilOnline:Boolean(s)&&(0,l.Eh5)(e,s),currentMessageList:(0,l.Btg)(e)}}))((({isActive:e,query:t,results:n,chat:i,isChatWithBot:o,canScheduleUntilOnline:l,isSavedMessages:c,canPostInChat:d,currentMessageList:m,onClose:u})=>{const{searchMoreGifs:h,sendMessage:Z,setGifSearchQuery:P}=(0,s.Sv)(),p=(0,a.sO)(null),[v,E]=(0,jd.Z)(l),{observe:C}=(0,vo.S1)({rootRef:p,debounceMs:300}),b=d&&(0,r.H5)(i,o).canSendGifs,f=(0,a.I4)(((e,t,n)=>{if(b){if(!m)return;n?v((n=>{Z({messageList:m,gif:e,scheduledAt:n,isSilent:t})})):Z({messageList:m,gif:e,isSilent:t})}g.$b&&P({query:void 0})}),[b,m,v]),y=(0,a.I4)((()=>{h()}),[h]),I=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:u});const S=Boolean(void 0!==t&&n&&n.length);return a.ZP.createElement("div",{className:"GifSearch",dir:I.isRtl?"rtl":void 0},a.ZP.createElement(Qa.Z,{ref:p,className:(0,ce.Z)("gif-container custom-scroll",S&&"grid"),items:n,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:y},function(){if(void 0!==t)return n?n.length?n.map((e=>a.ZP.createElement(su,{key:e.id,gif:e,observeIntersection:C,onClick:b?f:void 0,isSavedMessages:c}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},I("NoGIFsFound")):a.ZP.createElement(hs.Z,null)}()),E)})));var _u=n(16289);const $u="negbFsRwvclNi7mcE4f2",ju="pF4WlPXCdaZYVz0V_2Wl",Vu="_XCCw8_mY2kZEbx6xsPK",Gu="CRlJlHM_Jj7X_MAvbjMT",Hu="eDChvxtpOXbftlqg8jkq",Ju="GHQJ90L0qjbdPR5X98J2",zu="OprPkOPHUsPsNrMbkQfF",Xu="pZVpWgP0EEneLYcMoGnl",Yu="R56P3w_l10Hu_feFCGh6",qu="lY77txbsPNP_XswjRvfu",Ku="F1eH9URbEybEvAQFxscw",Wu="VSrVWNhSLVjueuOkAcN5",Qu="Fbn0GqXAXveknzDnwuIu",eh="Xqmbl3P_X9DSqlW2joQr",th=(0,a.X$)((function({postStatistic:e}){const t=(0,M.Z)();return a.ZP.createElement("div",{className:Ku},e.reactionsCount>0&&a.ZP.createElement("span",{className:Wu},a.ZP.createElement(Na.Z,{name:"heart-outline",className:Qu}),(0,$e.bi)(e.reactionsCount)),e.forwardsCount>0&&a.ZP.createElement("span",{className:Wu},a.ZP.createElement(Na.Z,{name:"forward",className:Qu}),(0,$e.bi)(e.forwardsCount)),!e.forwardsCount&&!e.reactionsCount&&t("ChannelStats.SharesCount_ZeroValueHolder"))})),nh=(0,a.X$)((({postStatistic:e,message:t})=>{const n=(0,M.Z)(),{toggleMessageStatistics:i}=(0,s.Sv)(),o=(0,r.DH)(t),l=(0,H.Z)((0,r.Ti)(t,"micro")),c=Boolean((0,r.Y5)(t)),d=(0,a.I4)((()=>{i({messageId:t.id})}),[i,t.id]);return a.ZP.createElement("div",{className:(0,ce.Z)($u,Boolean(l||o)&&ju),onClick:d},a.ZP.createElement("div",{className:Yu},a.ZP.createElement("div",{className:Xu},function(e,t,n,s){return n?a.ZP.createElement("span",null,a.ZP.createElement("img",{src:n,alt:"",draggable:!1,className:(0,ce.Z)(Gu,s&&Hu)}),(0,r.b7)(t)&&a.ZP.createElement(Na.Z,{name:"play"}),(0,h.e)(e,t,!0)):(0,h.e)(e,t)}(n,t,l||o,c)),a.ZP.createElement("div",{className:Ku},n("ChannelStats.ViewsCount",e.viewsCount,"i"))),a.ZP.createElement("div",{className:qu},a.ZP.createElement("div",{className:eh},(0,_e.SA)(1e3*t.date,n.code)),a.ZP.createElement(th,{postStatistic:e})))})),ah=(0,a.X$)((function({chat:e,story:t,postStatistic:n}){const i=(0,M.Z)(),{toggleStoryStatistics:o}=(0,s.Sv)(),l=t&&"content"in t,c=l?t.content.video:void 0,d=l?(0,r.Cc)(t):void 0,m=(0,H.Z)(d),u=m||c?.thumbnail?.dataUri,h=(0,T.Z)((()=>{o({storyId:n.storyId})}));return a.ZP.createElement("div",{className:(0,ce.Z)($u,ju),onClick:h},a.ZP.createElement("div",{className:Yu},a.ZP.createElement("div",{className:Xu},function(e,t,n){return a.ZP.createElement("span",null,n?a.ZP.createElement("span",{className:Vu},a.ZP.createElement("img",{src:n,alt:"",draggable:!1,className:(0,ce.Z)(Gu,Ju,zu)})):a.ZP.createElement(yt.Z,{peer:t,size:"small-mobile",className:Gu,withStorySolid:!0,forceUnreadStorySolid:!0}),e("Story"))}(i,e,m||u)),a.ZP.createElement("div",{className:Ku},i("ChannelStats.ViewsCount",n.viewsCount,"i"))),a.ZP.createElement("div",{className:qu},a.ZP.createElement("div",{className:eh},l&&Boolean(t.date)&&(0,_e.SA)(1e3*t.date,i.code)),a.ZP.createElement(th,{postStatistic:n})))})),sh="UVY7Yw7FZIXqiQz310aE",ih="LHsus1ITUb_QhEm_uAl8",oh="L_AoFaFttdXFpHyqlOb1",rh="bjHXcNGdDCoKJZ5bnKww",lh="zotml6OW8tvxvArOWgzD",ch="Z3t1TaWlpk0w5KB9PanI";let dh,mh;const uh={growthGraph:"ChannelStats.Graph.Growth",followersGraph:"ChannelStats.Graph.Followers",muteGraph:"ChannelStats.Graph.Notifications",topHoursGraph:"ChannelStats.Graph.ViewsByHours",viewsBySourceGraph:"ChannelStats.Graph.ViewsBySource",newFollowersBySourceGraph:"ChannelStats.Graph.NewFollowersBySource",languagesGraph:"ChannelStats.Graph.Language",interactionsGraph:"ChannelStats.Graph.Interactions",reactionsByEmotionGraph:"ChannelStats.Graph.Reactions",storyInteractionsGraph:"ChannelStats.Graph.Stories",storyReactionsByEmotionGraph:"ChannelStats.Graph.StoriesReactions"},hh=Object.keys(uh),Zh={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},Ph=Object.keys(Zh),ph=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.aT_)(e,t),a=(0,l.Z1J)(e,t),s=(0,l.x67)(e,t)?.statisticsDcId,i="chatTypeSuperGroup"===a?.type,o=(0,l.Zwk)(e,t),r=(0,l.nST)(e,t)?.byId;return{statistics:n,dcId:s,isGroup:i,chat:a,messagesById:o,storiesById:r}}))((({chatId:e,chat:t,statistics:i,dcId:o,isGroup:r,messagesById:l,storiesById:c})=>{const d=(0,M.Z)(),m=(0,a.sO)(null),[u,h]=(0,a.eJ)(!1),Z=(0,a.sO)([]),{loadStatistics:P,loadStatisticsAsyncGraph:p}=(0,s.Sv)(),v=(0,N.Z)();(0,a.d4)((()=>{P({chatId:e,isGroup:r})}),[e,P,r]);const g=(0,a.Ye)((()=>r?Ph:hh),[r]),E=(0,a.Ye)((()=>r?Zh:uh),[r]);return(0,a.d4)((()=>{i&&g.forEach((t=>{const n=i[t];"string"==typeof n&&p({name:t,chatId:e,token:n,isPercentage:"languagesGraph"===t})}))}),[g,e,i,p]),(0,a.d4)((()=>{(async()=>{await async function(){return dh||(dh=n.e(8878).then(n.bind(n,18878)),mh=await dh),dh}(),u?i&&m.current&&(g.forEach(((e,t)=>{const n=i[e];if("string"==typeof n||Z.current.includes(e))return;if(!n)return void Z.current.push(e);const{zoomToken:a}=n;mh.create(m.current.children[t],{title:d(E[e]),...a?{onZoom:e=>(0,He.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:o}),zoomOutLabel:d("Graph.ZoomOut")}:{},...n}),Z.current.push(e),m.current.children[t].classList.remove(ch)})),v()):h(!0)})()}),[g,E,u,i,d,e,p,o,v]),u&&i?a.ZP.createElement("div",{className:(0,ce.Z)(sh,"custom-scroll",u&&rh)},a.ZP.createElement(_u.Z,{statistics:i,type:r?"group":"channel",title:d("StatisticOverview")}),!Z.current.length&&a.ZP.createElement(hs.Z,null),a.ZP.createElement("div",{ref:m},g.map((e=>a.ZP.createElement("div",{key:e,className:(0,ce.Z)(lh,ch)})))),Boolean(i.recentPosts?.length)&&a.ZP.createElement("div",{className:"lCCeuYH8gfegCu3fmxME"},a.ZP.createElement("h2",{className:"_4XlhRzwPDhLoDu5duJbU"},d("ChannelStats.Recent.Header")),i.recentPosts.map((e=>{if("msgId"in e){const t=l[e.msgId];if(!t||!("content"in t))return;return a.ZP.createElement(nh,{key:`statistic_message_${e.msgId}`,message:t,postStatistic:e})}if("storyId"in e&&t){const n=c?.[e.storyId];return a.ZP.createElement(ah,{key:`statistic_story_${e.storyId}`,chat:t,story:n,postStatistic:e})}})))):a.ZP.createElement(hs.Z,null)}))),vh="cQYi9REIkDGmDa3wl8h0",gh="L3EjdT2D9WVH82czad4K",Eh="cMiQQIlRC4JJ_GUZ1JUr",Ch=(0,a.X$)((({data:e})=>{const t=(0,M.Z)(),{openChatByUsername:n}=(0,s.Sv)(),i=(0,a.Ye)((()=>e.chat?(0,r.WS)(e.chat):void 0),[e.chat]),o=(0,a.I4)((()=>{n({username:i,messageId:e.messageId})}),[e.messageId,n,i]);return a.ZP.createElement("div",{className:(0,ce.Z)(vh,"statistic-public-forward"),onClick:o},a.ZP.createElement(yt.Z,{size:"medium",peer:e.chat}),a.ZP.createElement("div",null,a.ZP.createElement("div",{className:gh},e.title),a.ZP.createElement("div",{className:Eh},t("ChannelStats.ViewsCount",e.views,"i"))))}));let bh,fh;const yh={viewsGraph:"Stats.MessageInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},Ih=Object.keys(yh),Sh=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.x67)(e,t)?.statisticsDcId,a=(0,l.jUK)(e);return{statistics:a.statistics.currentMessage,dcId:n,messageId:a.statistics.currentMessageId}}))((function({chatId:e,isActive:t,statistics:r,dcId:l,messageId:c}){const d=(0,M.Z)(),m=(0,a.sO)(null),[u,h]=(0,a.eJ)(!1),Z=(0,a.sO)([]),{loadMessageStatistics:P,loadMessagePublicForwards:p,loadStatisticsAsyncGraph:v}=(0,s.Sv)(),g=(0,N.Z)();(0,a.d4)((()=>{c&&P({chatId:e,messageId:c})}),[e,P,c]),(0,a.d4)((()=>{t&&!c||(Z.current=[],h(!1))}),[t,c]),(0,a.d4)((()=>{r&&Ih.forEach((t=>{const n=r[t];"string"==typeof n&&v({name:t,chatId:e,token:n})}))}),[e,r,v]),(0,a.d4)((()=>{(async()=>{await async function(){return bh||(bh=n.e(8878).then(n.bind(n,18878)),fh=await bh),bh}(),u?r&&m.current&&(Ih.forEach(((e,t)=>{const n=r[e];if("string"==typeof n||Z.current.includes(e))return;if(!n)return void Z.current.push(e);const{zoomToken:a}=n;fh.create(m.current.children[t],{title:d(yh[e]),...a?{onZoom:e=>(0,He.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:l}),zoomOutLabel:d("Graph.ZoomOut")}:{},...n}),Z.current.push(e)})),g()):h(!0)})()}),[u,r,d,e,c,v,l,g]);const E=(0,T.Z)((({direction:t})=>{t===i.Uq.Backwards&&c&&p({chatId:e,messageId:c})}));return u&&r&&c?a.ZP.createElement("div",{className:(0,ce.Z)(sh,"custom-scroll",u&&rh)},a.ZP.createElement(_u.Z,{statistics:r,type:"message",title:d("StatisticOverview")}),!Z.current.length&&a.ZP.createElement(hs.Z,null),a.ZP.createElement("div",{ref:m},Ih.map((e=>a.ZP.createElement("div",{className:(0,ce.Z)(lh,!Z.current.includes(e)&&ch)})))),Boolean(r.publicForwards)&&a.ZP.createElement("div",{className:ih},a.ZP.createElement("h2",{className:oh},d("Stats.Message.PublicShares")),a.ZP.createElement(Qa.Z,{items:r.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:E,preloadBackwards:o.eFF,noFastList:!0},r.publicForwardsData.map((e=>a.ZP.createElement(Ch,{key:e.messageId,data:e})))))):a.ZP.createElement(hs.Z,null)}))),kh=(0,a.X$)((function({data:e,chatsById:t,usersById:n}){const i=(0,M.Z)(),{openChat:o}=(0,s.Sv)(),l=n[e.peerId],c=t[e.peerId],d=(0,T.Z)((()=>{o({id:l.id})}));return a.ZP.createElement("div",{className:(0,ce.Z)(vh,"statistic-public-forward"),onClick:d},a.ZP.createElement(yt.Z,{size:"medium",peer:l||c,withStorySolid:!0,forceUnreadStorySolid:!0}),a.ZP.createElement("div",null,a.ZP.createElement("div",{className:gh},l?(0,r.Js)(l):(0,r.U)(i,c)),a.ZP.createElement("div",{className:Eh},e.viewsCount?i("ChannelStats.ViewsCount",e.viewsCount,"i"):i("NoViews"))))}));let Nh,wh;const Mh={viewsGraph:"Stats.StoryInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},Th=Object.keys(Mh),Ah=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.x67)(e,t)?.statisticsDcId,a=(0,l.jUK)(e),s=a.statistics.currentStory,i=a.statistics.currentStoryId,{byId:o}=e.users,{byId:r}=e.chats;return{statistics:s,dcId:n,storyId:i,usersById:o,chatsById:r}}))((function({chatId:e,isActive:t,statistics:i,dcId:r,storyId:l,chatsById:c,usersById:d}){const m=(0,M.Z)(),u=(0,a.sO)(null),[h,Z]=(0,a.eJ)(!1),P=(0,a.sO)([]),{loadStoryStatistics:p,loadStoryPublicForwards:v,loadStatisticsAsyncGraph:g}=(0,s.Sv)(),E=(0,N.Z)();(0,a.d4)((()=>{l&&p({chatId:e,storyId:l})}),[e,l]),(0,a.d4)((()=>{t&&!l||(P.current=[],Z(!1))}),[t,l]),(0,a.d4)((()=>{i&&Th.forEach((t=>{const n=i[t];"string"==typeof n&&g({name:t,chatId:e,token:n})}))}),[e,i,g]),(0,a.d4)((()=>{(async()=>{await async function(){return Nh||(Nh=n.e(8878).then(n.bind(n,18878)),wh=await Nh),Nh}(),h?i&&u.current&&(Th.forEach(((e,t)=>{const n=i[e];if("string"==typeof n||P.current.includes(e))return;if(!n)return void P.current.push(e);const{zoomToken:a}=n;wh.create(u.current.children[t],{title:m(Mh[e]),...a?{onZoom:e=>(0,He.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:m("Graph.ZoomOut")}:{},...n}),P.current.push(e)})),E()):Z(!0)})()}),[h,i,m,e,l,g,r,E]);const C=(0,T.Z)((()=>{l&&v({chatId:e,storyId:l})}));return h&&i&&l?a.ZP.createElement("div",{className:(0,ce.Z)(sh,"custom-scroll",h&&rh)},a.ZP.createElement(_u.Z,{statistics:i,type:"story",title:m("StatisticOverview")}),!P.current.length&&a.ZP.createElement(hs.Z,null),a.ZP.createElement("div",{ref:u},Th.map((e=>a.ZP.createElement("div",{className:(0,ce.Z)(lh,!P.current.includes(e)&&ch)})))),Boolean(i.publicForwards)&&a.ZP.createElement("div",{className:ih},a.ZP.createElement("h2",{className:oh},m("Stats.Message.PublicShares")),a.ZP.createElement(Qa.Z,{items:i.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:C,preloadBackwards:o.eFF,noFastList:!0},i.publicForwardsData.map((e=>"messageId"in e?a.ZP.createElement(Ch,{key:`message_${e.messageId}`,data:e}):a.ZP.createElement(kh,{key:`story_${e.storyId}`,data:e,chatsById:c,usersById:d})))))):a.ZP.createElement(hs.Z,null)}))),Rh=(0,a.X$)((0,s.c$)(((e,{answer:t})=>{const{voters:n,offsets:a}=(0,l.jUK)(e).pollResults;return{voters:n?.[t.option],offset:a?.[t.option]||""}}))((({chat:e,message:t,answer:n,answerVote:i,totalVoters:o,voters:l,offset:c})=>{const{loadPollOptionResults:d,openChat:m,closePollResults:u}=(0,s.Sv)(),h=(0,D.Z)(i.votersCount),[Z,P]=(0,a.eJ)(!0),p=Boolean(l),{option:v,text:g}=n,E=(0,M.Z)();(0,a.d4)((()=>{p&&h===i.votersCount||d({chat:e,messageId:t.id,option:v,offset:c,limit:4,shouldResetVoters:!0})}),[i.votersCount,p]);const C=(0,a.I4)((()=>{P(!0),d({chat:e,messageId:t.id,option:v,offset:c,limit:50})}),[e,d,t.id,c,v]);(0,a.d4)((()=>{P(!1)}),[l]);const b=(0,a.I4)((e=>{m({id:e}),u()}),[u,m]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},l?l.map((e=>a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable",onClick:()=>b(e)},(0,r.YC)(e)?a.ZP.createElement(ns.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}):a.ZP.createElement(Zs.Z,{avatarSize:"tiny",chatId:e,noStatusOrTyping:!0})))):a.ZP.createElement(hs.Z,null),l&&function(){const e=i.votersCount-l.length;return i.votersCount>4&&e>0&&a.ZP.createElement(gl.Z,{count:e,itemName:"voter",isLoading:Z,onClick:C})}()),a.ZP.createElement("div",{className:"answer-head",dir:E.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},g),a.ZP.createElement("span",{className:"answer-percent",dir:E.isRtl?"auto":void 0},(f=i.votersCount,(y=o)>0?(f/y*100).toFixed():0),"%")));var f,y}))),Lh=(0,a.X$)((0,s.c$)((e=>{const{pollResults:{chatId:t,messageId:n}}=(0,l.jUK)(e);return t&&n?{chat:(0,l.Z1J)(e,t),message:(0,l.hjO)(e,t,n)}:{}}))((({isActive:e,chat:t,message:n,onClose:s})=>{const i=(0,M.Z)();if((0,pe.Z)({isActive:e,onBack:s}),!n||!t)return a.ZP.createElement(hs.Z,null);const{summary:o,results:l}=(0,r.t9)(n);if(!l.results)return;const c=(0,Kn.ee)(l.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:i.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,te.Z)(o.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},o.answers.map((e=>a.ZP.createElement(Rh,{key:`${n.id}-${e.option}`,chat:t,message:n,answer:e,answerVote:c[e.option],totalVoters:l.totalVoters})))))})));var Bh=n(98138);const Fh="Qj1MQaLfhumlxACIpkUl",xh="ph5g3hCSQ_72FnZ3YkuA",Dh="bYZBp9H7Ks8tqaBvQm57",Oh="sV6D57DhbsFwQhRNzw9K",Uh="pUkmozcBdIn4yWGGPoX1",_h="JT0__kgf23rGv5BWQF2s",$h="gx85t_IsGh2fgS2yDGtk",jh="o9l56jP2uXfAul061gXq",Vh="ByQF8Qg3NcYnBCvGwoH0",Gh=5*u.Gw,Hh=(0,a.X$)((0,s.c$)((e=>{const{createTopicPanel:t}=(0,l.jUK)(e);return{chat:t?.chatId?(0,l.Z1J)(e,t.chatId):void 0,createTopicPanel:t,isCurrentUserPremium:(0,l.wVz)(e)}}))((({isActive:e,chat:t,createTopicPanel:n,isCurrentUserPremium:i,onClose:r})=>{const{createTopic:l,openPremiumModal:c}=(0,s.Sv)(),[d,m]=(0,a.eJ)(""),[u,h]=(0,a.eJ)(0),[Z,P]=(0,a.eJ)(void 0),p=(0,M.Z)(),v=Boolean(d),g=Boolean(n?.isLoading);(0,pe.Z)({isActive:e,onBack:r}),(0,a.d4)((()=>{e||(m(""),P(void 0))}),[e]);const E=(0,a.I4)((e=>{m(e.target.value)}),[]),C=(0,a.I4)((()=>{h((e=>(0,Zi.Z)((0,Bh.fB)().length,e+1)))}),[]),b=(0,a.I4)((()=>{l({chatId:t.id,title:d,iconColor:(0,Bh.fB)()[u],iconEmojiId:Z})}),[t,l,u,Z,d]),f=(0,a.I4)((e=>{e.isFree||i||e.id===o.Zkg?e.id!==o.Zkg?P(e.id):P(void 0):c({initialSection:"animated_emoji"})}),[i,c]),y=(0,a.Ye)((()=>({id:0,title:d,iconColor:(0,Bh.fB)()[u],iconEmojiId:Z})),[u,Z,d]);if(t?.isForum)return a.ZP.createElement("div",{className:Fh},a.ZP.createElement("div",{className:(0,ce.Z)(xh,"custom-scroll")},a.ZP.createElement("div",{className:(0,ce.Z)(Dh,Oh)},a.ZP.createElement("span",{className:jh},p("CreateTopicTitle")),a.ZP.createElement(K.ZP,{name:"zoomFade",activeKey:Number(y.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:_h},a.ZP.createElement(Ps.Z,{topic:y,className:(0,ce.Z)($h,"TVwtYFuxdwJH5LZ7yvwu"),onClick:C,size:Gh,noLoopLimit:!0})),a.ZP.createElement(us.Z,{value:d,onChange:E,label:p("lng_forum_topic_title"),disabled:g,teactExperimentControlled:!0})),a.ZP.createElement("div",{className:(0,ce.Z)(Dh,Uh)},a.ZP.createElement(Jo,{idPrefix:"create-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:f,className:Vh,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0}))),a.ZP.createElement(na.Z,{isShown:v,disabled:g,onClick:b,ariaLabel:p("Save")},g?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))}))),Jh=5*u.Gw,zh=(0,a.X$)((0,s.c$)((e=>{const{editTopicPanel:t}=(0,l.jUK)(e),n=t?.chatId?(0,l.Z1J)(e,t.chatId):void 0;return{chat:n,topic:t?.topicId?n?.topics?.[t?.topicId]:void 0,editTopicPanel:t,isCurrentUserPremium:(0,l.wVz)(e)}}))((({isActive:e,chat:t,topic:n,editTopicPanel:i,isCurrentUserPremium:r,onClose:l})=>{const{editTopic:c,openPremiumModal:d}=(0,s.Sv)(),[m,u]=(0,a.eJ)(""),[h,Z]=(0,a.eJ)(void 0),P=(0,M.Z)(),p=Boolean(i?.isLoading),v=n?.id===o.OxA;(0,pe.Z)({isActive:e,onBack:l}),(0,a.d4)((()=>{e||(u(""),Z(void 0))}),[e]),(0,a.d4)((()=>{(n?.title||n?.iconEmojiId)&&(u(n.title),Z(n.iconEmojiId))}),[n]);const g=(0,a.Ye)((()=>m!==n?.title||h!==n?.iconEmojiId),[h,m,n?.iconEmojiId,n?.title]),E=(0,a.I4)((e=>{const t=e.target.value;u(t)}),[]),C=(0,a.I4)((()=>{c({chatId:t.id,title:m,topicId:n.id,iconEmojiId:h})}),[t,c,h,m,n]),b=(0,a.I4)((e=>{e.isFree||r||e.id===o.Zkg?e.id!==o.Zkg?Z(e.id):Z("0"):d({initialSection:"animated_emoji"})}),[r,d]),f=(0,a.Ye)((()=>({...n,title:m,iconEmojiId:h})),[h,m,n]);if(t?.isForum)return a.ZP.createElement("div",{className:Fh},a.ZP.createElement("div",{className:(0,ce.Z)(xh,"custom-scroll")},!n&&a.ZP.createElement(hs.Z,null),n&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:(0,ce.Z)(Dh,Oh,v&&"CSjgq5gkTxM3iZQ9oJ9b")},a.ZP.createElement("span",{className:jh},P(v?"CreateGeneralTopicTitle":"CreateTopicTitle")),a.ZP.createElement(K.ZP,{name:"zoomFade",activeKey:Number(f.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:_h},a.ZP.createElement(Ps.Z,{topic:f,className:$h,size:Jh,noLoopLimit:!0})),a.ZP.createElement(us.Z,{value:m,onChange:E,label:P("lng_forum_topic_title"),disabled:p,teactExperimentControlled:!0})),!v&&a.ZP.createElement("div",{className:(0,ce.Z)(Dh,Uh)},a.ZP.createElement(Jo,{idPrefix:"edit-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:b,className:Vh,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})))),a.ZP.createElement(na.Z,{isShown:g,disabled:p,onClick:C,ariaLabel:P("Save")},p?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))}))),Xh="Channel title can't be empty",Yh=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),{management:a}=(0,l.jUK)(e),{progress:s}=a,i=Boolean(n?.isSignaturesShown),{invites:o}=a.byChatId[t]||{};return{chat:n,chatFullInfo:(0,l.x67)(e,t),progress:s,isSignaturesShown:i,canChangeInfo:(0,r.VE)(n,"changeInfo"),canInvite:(0,r.VE)(n,"inviteUsers"),exportedInvites:o,availableReactions:e.availableReactions}}))((({chatId:e,chat:t,chatFullInfo:n,progress:o,isSignaturesShown:l,canChangeInfo:c,canInvite:d,exportedInvites:m,isActive:u,availableReactions:h,onScreenSelect:Z,onClose:P})=>{const{updateChat:p,toggleSignatures:v,closeManagement:g,leaveChannel:E,deleteChannel:C,openChat:b,loadExportedChatInvites:f,loadChatJoinRequests:y}=(0,s.Sv)(),I=t?.title||"",S=n?.about||"",N=Boolean(n?.linkedChatId),[w,T,A]=(0,k.Z)(),[R,L]=(0,a.eJ)(!1),[B,F]=(0,a.eJ)(I),[x,D]=(0,a.eJ)(S),[O,U]=(0,a.eJ)(),[$,j]=(0,a.eJ)(),V=t&&(0,r.RT)(t),G=(0,H.Z)(V,!1,_.IU.BlobUrl),J=(0,M.Z)();(0,pe.Z)({isActive:u,onBack:P}),(0,a.d4)((()=>{f({chatId:e}),f({chatId:e,isRevoked:!0}),y({chatId:e})}),[e]),(0,a.d4)((()=>{o===i.wv.Complete&&(L(!1),j(void 0))}),[o]);const z=(0,a.Ye)((()=>Object.keys(n?.adminMembersById||{}).length),[n?.adminMembersById]),X=n?.kickedMembers?.length||0,Y=(0,a.I4)((()=>{Z(i.u1.ChatPrivacyType)}),[Z]),q=(0,a.I4)((()=>{Z(i.u1.Discussion)}),[Z]),K=(0,a.I4)((()=>{Z(i.u1.Reactions)}),[Z]),W=(0,a.I4)((()=>{Z(i.u1.ChatAdministrators)}),[Z]),Q=(0,a.I4)((()=>{Z(i.u1.Invites)}),[Z]),ee=(0,a.I4)((()=>{Z(i.u1.JoinRequests)}),[Z]),te=(0,a.I4)((e=>{U(e),L(!0)}),[]),ne=(0,a.I4)((e=>{F(e.target.value),L(!0)}),[]),ae=(0,a.I4)((e=>{D(e.target.value),L(!0)}),[]),se=(0,a.I4)((()=>{const t=B.trim(),n=x.trim();t.length?p({chatId:e,title:t,about:n,photo:O}):j(Xh)}),[x,e,O,B,p]),ie=(0,a.I4)((()=>{v({chatId:e,isEnabled:!l})}),[e,l,v]),oe=(0,a.I4)((()=>{Z(i.u1.ChannelSubscribers)}),[Z]),re=(0,a.I4)((()=>{Z(i.u1.ChannelRemovedUsers)}),[Z]),le=(0,a.I4)((()=>{t.isCreator?C({chatId:t.id}):E({chatId:t.id}),A(),g(),b({id:void 0})}),[t.isCreator,t.id,A,g,E,C,b]),ce=(0,a.Ye)((()=>{if(!n?.enabledReactions)return J("ReactionsOff");if("all"===n.enabledReactions.type)return J("ReactionsAll");const e=n.enabledReactions.allowed.length,t=h?.filter((e=>!e.isInactive)).length||0;return t?`${e} / ${t}`:`${e}`}),[h,n?.enabledReactions,J]),de=(0,a.Ye)((()=>(0,r.Sb)(t)),[t]);if(t.isRestricted||t.isForbidden)return;const me=o===i.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(sc.Z,{currentAvatarBlobUrl:G,onChange:te,disabled:!c}),a.ZP.createElement(us.Z,{id:"channel-title",label:J("EnterChannelName"),onChange:ne,value:B,error:$===Xh?$:void 0,disabled:!c}),a.ZP.createElement(ic.Z,{id:"channel-about",className:"mb-2",label:J("DescriptionPlaceholder"),onChange:ae,value:x,maxLength:255,maxLengthIndicator:(255-x.length).toString(),disabled:!c,noReplaceNewlines:!0}),t.isCreator&&a.ZP.createElement(jn.Z,{icon:"lock",multiline:!0,onClick:Y},a.ZP.createElement("span",{className:"title"},J("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},J(de?"TypePublic":"TypePrivate"))),a.ZP.createElement(jn.Z,{icon:"message",multiline:!0,onClick:q,disabled:!c},a.ZP.createElement("span",{className:"title"},J("Discussion")),a.ZP.createElement("span",{className:"subtitle"},J(N?"DiscussionUnlink":"Add"))),d&&a.ZP.createElement(jn.Z,{icon:"link",onClick:Q,multiline:!0,disabled:!m},a.ZP.createElement("span",{className:"title"},J("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},m?(0,$e.kh)(m.length):J("Loading"))),Boolean(t.joinRequests?.length)&&a.ZP.createElement(jn.Z,{icon:"add-user-filled",onClick:ee,multiline:!0},a.ZP.createElement("span",{className:"title"},J("SubscribeRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,$e.kh)(t.joinRequests.length))),a.ZP.createElement(jn.Z,{icon:"heart-outline",multiline:!0,onClick:K,disabled:!c},a.ZP.createElement("span",{className:"title"},J("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ce)),a.ZP.createElement("div",{className:"ListItem narrow"},a.ZP.createElement(As.Z,{checked:l,label:J("ChannelSignMessages"),onChange:ie}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"admin",multiline:!0,onClick:W},a.ZP.createElement("span",{className:"title"},J("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},z)),a.ZP.createElement(jn.Z,{icon:"group",multiline:!0,onClick:oe},a.ZP.createElement("span",{className:"title",dir:"auto"},J("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},J("Subscribers",t.membersCount??0,"i"))),a.ZP.createElement(jn.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:re},a.ZP.createElement("span",{className:"title"},J("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},X))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:T},t.isCreator?J("ChannelDelete"):J("LeaveChannel")))),a.ZP.createElement(na.Z,{isShown:R,onClick:se,disabled:me,ariaLabel:J("Save")},me?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})),a.ZP.createElement(Xn.Z,{isOpen:w,onClose:A,text:t.isCreator?J("ChannelDeleteAlert"):J("ChannelLeaveAlert"),confirmLabel:t.isCreator?J("ChannelDelete"):J("LeaveChannel"),confirmHandler:le,confirmIsDestructive:!0}))}))),qh=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t);return{chat:n,currentUserId:e.currentUserId,isChannel:(0,r.eA)(n),adminMembersById:(0,l.x67)(e,t)?.adminMembersById}}))((({chat:e,isChannel:t,currentUserId:n,adminMembersById:o,onScreenSelect:l,onChatMemberSelect:c,onClose:d,isActive:m})=>{const u=(0,M.Z)();(0,pe.Z)({isActive:m,onBack:d});const h=Boolean(e.isCreator||e.adminRights?.addAdmins),Z=(0,a.Ye)((()=>o?Object.values(o).sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[o]),P=(0,a.I4)((e=>{c(e.userId,e.promotedByUserId===n),l(i.u1.ChatAdminRights)}),[n,c,l]),p=(0,a.I4)((()=>{l(i.u1.GroupAddAdmins)}),[l]),v=(0,a.I4)((e=>{if(e.isOwner)return u("ChannelCreator");const t=(0,s.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?u("EditAdminPromotedBy",(0,r.Js)(n)):u("ChannelAdmin")}),[u]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"recent",multiline:!0,disabled:!0},a.ZP.createElement("span",{className:"title"},u("EventLog")),a.ZP.createElement("span",{className:"subtitle"},u(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:u.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),Z.map((e=>a.ZP.createElement(jn.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>P(e)},a.ZP.createElement(ns.Z,{userId:e.userId,status:v(e),forceShowSelf:!0})))),a.ZP.createElement(na.Z,{isShown:h,onClick:p,ariaLabel:u("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon icon-add-user-filled"})))))}))),Kh=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),{isUsernameAvailable:a,checkedUsername:s,error:i}=(0,l.aWT)(e,t);return{chat:n,isChannel:(0,r.eA)(n),progress:(0,l.jUK)(e).management.progress,error:i,isUsernameAvailable:a,checkedUsername:s,isProtected:n?.isProtected,maxPublicLinks:(0,Qs.M)(e,"channelsPublic"),privateInviteLink:(0,l.x67)(e,t)?.inviteLink}}))((({chat:e,isActive:t,isChannel:n,progress:l,isUsernameAvailable:c,checkedUsername:d,error:m,isProtected:u,maxPublicLinks:h,privateInviteLink:Z,onClose:P})=>{const{updatePublicLink:p,updatePrivateLink:v,toggleIsProtected:g,openLimitReachedModal:E,resetManagementError:C}=(0,s.Sv)(),b=(0,a.Ye)((()=>e.usernames?.find((({isEditable:e})=>e))),[e.usernames]),f=b?.username||"",y=(0,a.Ye)((()=>(0,r.Sb)(e)),[e]),[I,S]=(0,a.eJ)(!1),[N,w]=(0,a.eJ)(y?"public":"private"),[T,A]=(0,a.eJ)(),[R,L,B]=(0,k.Z)(),[F,x,O]=(0,k.Z)(),U=(0,D.Z)(c),_=I&&Boolean("public"===N&&(T||f&&""===T)&&(c??U)||"private"===N&&y);(0,pe.Z)({isActive:t,onBack:P}),(0,a.d4)((()=>{S(!1)}),[f]),(0,a.d4)((()=>{N&&!Z&&v()}),[N,Z,v]);const $=(0,a.I4)((t=>{A(t),S(!0),m&&C({chatId:e.id})}),[e.id,m]),j=(0,a.I4)(((e,t)=>{if(Object.values((0,s.Rd)().chats.byId).filter((({isCreator:e,usernames:t})=>e&&t?.some((e=>e.isActive)))).length>=h&&"public"===e){E({limit:"channelsPublic"});const e=t.currentTarget.closest(".radio-group");return e.querySelector("[value=public]").checked=!1,void(e.querySelector("[value=private]").checked=!0)}w(e),S(!0)}),[h,E]),V=(0,a.I4)((t=>{g({chatId:e.id,isProtected:"protected"===t})}),[e.id,g]),G=(0,a.I4)((()=>{y&&"private"===N?x():p({username:"public"===N&&T||""})}),[y,x,N,p,T]),H=(0,a.I4)((()=>{p({username:"",shouldDisableUsernames:!0}),O()}),[O,p]),J=(0,a.I4)((()=>{B(),v()}),[B,v]),z=(0,M.Z)(),X=n?"Channel":"Mega",Y=n?"Channel":"Group",q=[{value:"private",label:z(`${X}Private`),subLabel:z(`${X}PrivateInfo`)},{value:"public",label:z(`${X}Public`),subLabel:z(`${X}PublicInfo`)}],K=[{value:"allowed",label:z("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:z("ChannelVisibility.Forwarding.Disabled")}],W=l===i.wv.InProgress,Q="public"===N&&e.usernames&&e.usernames.length>0;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:z.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},z(`${Y}Type`)),a.ZP.createElement(Dl.Z,{selected:N,name:"channel-type",options:q,onChange:j})),"private"===N?a.ZP.createElement("div",{className:"section",dir:z.isRtl?"rtl":void 0},Z?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(ur.Z,{url:Z,className:"group-link",text:Z}),a.ZP.createElement("p",{className:"section-info",dir:z.isRtl?"rtl":void 0},z(`${X}PrivateLinkHelp`)),a.ZP.createElement(jn.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:L},z("RevokeLink")),a.ZP.createElement(Xn.Z,{isOpen:R,onClose:B,text:z("RevokeAlert"),confirmLabel:z("RevokeButton"),confirmHandler:J,confirmIsDestructive:!0})):a.ZP.createElement(hs.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(ac,{asLink:!0,currentUsername:f,isLoading:W,isUsernameAvailable:c,checkedUsername:d,onChange:$}),m===o.WfZ&&function(){const e=`${o.zHP}${o.LlA}`;return a.ZP.createElement("p",{className:"section-info",dir:"auto"},z("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map((t=>"PURCHASE_LINK"===t?a.ZP.createElement(ur.Z,{url:e,text:`@${o.LlA}`}):t)))}(),a.ZP.createElement("p",{className:"section-info",dir:"auto"},z(`${Y}.Username.CreatePublicLinkHelp`))),Q&&a.ZP.createElement(Ql,{chatId:e.id,usernames:e.usernames,onEditUsername:$}),a.ZP.createElement("div",{className:"section",dir:z.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},z(n?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(Dl.Z,{selected:u?"protected":"allowed",name:"forwarding-type",options:K,onChange:V}),a.ZP.createElement("p",{className:"section-info"},z(n?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(na.Z,{isShown:_,disabled:W,ariaLabel:z("Save"),onClick:G},W?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})),a.ZP.createElement(Xn.Z,{isOpen:F,onClose:O,text:z("ChannelVisibility.Confirm.MakePrivate.Channel",f),confirmHandler:H,confirmIsDestructive:!0}))}))),Wh=(0,a.X$)((0,s.c$)(((e,{chat:t})=>{const{currentUserId:n}=e;return{currentUserId:n,chatMembers:(0,l.x67)(e,t.id)?.members}}))((({chat:e,currentUserId:t,chatMembers:n,isOpen:i,onClose:o})=>{const{loadMoreMembers:l,deleteChatMember:c}=(0,s.Sv)(),d=(0,M.Z)(),[m,u]=(0,a.eJ)(""),h=(0,a.Ye)((()=>{const e=(n||[]).reduce(((e,n)=>(n.isAdmin||n.isOwner||n.userId===t||e.push(n.userId),e)),[]),a=(0,s.Rd)().users.byId;return(0,r.kK)(e,a,m)}),[n,t,m]),Z=(0,a.I4)((t=>{c({chatId:e.id,userId:t}),o()}),[e.id,c,o]);return a.ZP.createElement(vs,{isOpen:i,chatOrUserIds:h,searchPlaceholder:d("ChannelBlockUser"),search:m,onSearchChange:u,loadMore:l,onSelectChatOrUser:Z,onClose:o})}))),Qh=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),{byId:a}=e.users;return{chat:n,usersById:a,canDeleteMembers:n&&((0,r.VE)(n,"banUsers")||n.isCreator),removedMembers:(0,l.x67)(e,t)?.kickedMembers||Wn.D,isChannel:n&&(0,r.eA)(n)}}))((({chat:e,usersById:t,canDeleteMembers:n,removedMembers:i,isChannel:o,onClose:l,isActive:c})=>{const{updateChatMemberBannedRights:d}=(0,s.Sv)(),m=(0,M.Z)(),[u,h,Z]=(0,k.Z)();(0,pe.Z)({isActive:c,onBack:l});const P=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const n=t[e.kickedByUserId];return n?m("UserRemovedBy",(0,r.Js)(n)):void 0}),[m,t]),p=(0,a.I4)((t=>{if(e)return[{title:m("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[m,e,d]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:m.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},m(o?"NoBlockedChannel2":"NoBlockedGroup2")),i.map((e=>a.ZP.createElement(jn.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:p(e)},a.ZP.createElement(ns.Z,{userId:e.userId,status:P(e),forceShowSelf:!0})))),n&&a.ZP.createElement(na.Z,{isShown:!0,onClick:h,ariaLabel:m("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon icon-add-user-filled"})),e&&n&&a.ZP.createElement(Wh,{chat:e,isOpen:u,onClose:Z}))))}))),eZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),{linkedChatId:a}=(0,l.x67)(e,t)||{},{forDiscussionIds:s,byId:i}=e.chats;return{chat:n,chatsByIds:i,forDiscussionIds:s,linkedChat:a?(0,l.Z1J)(e,a):void 0,isChannel:n&&(0,r.eA)(n)}}))((({chat:e,onClose:t,isActive:n,chatId:r,chatsByIds:l,linkedChat:c,forDiscussionIds:d,isChannel:m,onScreenSelect:u})=>{const{loadGroupsForDiscussion:h,linkDiscussionGroup:Z,unlinkDiscussionGroup:P,toggleJoinRequest:p,toggleJoinToSend:v}=(0,s.Sv)(),[g,E]=(0,a.eJ)(),[C,b,f]=(0,k.Z)(),[y,I,S]=(0,k.Z)(),[N,w]=(0,a.eJ)(Boolean(c?.isJoinToSend)),[T,A]=(0,a.eJ)(Boolean(c?.isJoinRequest)),R=(0,M.Z)(),L=c?.id;(0,pe.Z)({isActive:n,onBack:t}),(0,a.d4)((()=>{h()}),[h]),(0,a.d4)((()=>{n&&(w(c?.isJoinToSend||!1),A(c?.isJoinRequest||!1))}),[c,n]);const B=(0,a.I4)((()=>{f(),P({channelId:m?r:L}),m||u(i.u1.Initial)}),[f,P,m,r,L,u]),F=(0,a.I4)((()=>{S(),Z({channelId:r,chatId:g})}),[S,Z,r,g]),x=(0,a.I4)((e=>{w(e),v({chatId:L,isEnabled:e}),e||A(!1)}),[L,v]),D=(0,a.I4)((e=>{A(e),p({chatId:L,isEnabled:e})}),[L,p]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(vl.Z,{tgsUrl:pl.l.DiscussionGroups,size:o.bMi,className:"section-icon"}),c&&a.ZP.createElement("div",null,a.ZP.createElement(jn.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Zs.Z,{chatId:c.id})),a.ZP.createElement(jn.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:b},R(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Xn.Z,{isOpen:C,onClose:f,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(yt.Z,{size:"tiny",peer:c}),a.ZP.createElement("div",{className:"modal-title"},R(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,te.Z)(R(m?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:R(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:B,confirmIsDestructive:!0})),!c&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},R("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(jn.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,disabled:!0},R("DiscussionCreateGroup")),d?d.map(((e,t)=>a.ZP.createElement(jn.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{E(e),I()}},a.ZP.createElement(Zs.Z,{chatId:e})))):a.ZP.createElement(wr.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},R("DiscussionChannelHelp2")),a.ZP.createElement(Xn.Z,{isOpen:y,onClose:S,header:function(){if(!g)return;const e=l[g];return e?a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(yt.Z,{size:"tiny",peer:e}),a.ZP.createElement("div",{className:"modal-title"},R("Channel.DiscussionGroup.LinkGroup"))):void 0}(),textParts:function(){if(!g)return;const t=l[g];return t?t.hasPrivateLink?(0,te.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):(0,te.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"]):void 0}(),confirmLabel:R("DiscussionLinkGroup"),confirmHandler:F}))),c&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading"},R("ChannelSettingsJoinTitle")),a.ZP.createElement(As.Z,{checked:N,onCheck:x,label:R("ChannelSettingsJoinToSend")}),N&&a.ZP.createElement(As.Z,{checked:T,onCheck:D,label:R("ChannelSettingsJoinRequest")}),a.ZP.createElement("p",{className:"text-muted"},R(N?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")))))}))),tZ="Group title can't be empty",nZ=["sendMessages","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages","manageTopics","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs"],aZ=nZ.length+1,sZ=(0,ue.Ds)((e=>e()),500,!1),iZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),a=(0,l.x67)(e,t),{management:s,limitReachedModal:i}=(0,l.jUK)(e),{progress:o}=s,c=Boolean(a?.linkedChatId),d=(0,r.G9)(n),{invites:m}=s.byChatId[t]||{},u=!c&&((0,r.VE)(n,"changeInfo")||n.isCreator);return{chat:n,chatFullInfo:a,progress:o,isBasicGroup:d,hasLinkedChannel:c,canChangeInfo:d?n.isCreator:(0,r.VE)(n,"changeInfo"),canBanUsers:d?n.isCreator:(0,r.VE)(n,"banUsers"),canInvite:d?n.isCreator:(0,r.VE)(n,"inviteUsers"),exportedInvites:m,isChannelsPremiumLimitReached:"channels"===i?.limit,availableReactions:e.availableReactions,canEditForum:u}}))((({chatId:e,chat:t,chatFullInfo:n,progress:o,isBasicGroup:l,hasLinkedChannel:c,canChangeInfo:d,canBanUsers:m,canInvite:u,canEditForum:h,isActive:Z,exportedInvites:P,isChannelsPremiumLimitReached:p,availableReactions:v,onScreenSelect:g,onClose:E})=>{const{togglePreHistoryHidden:C,updateChat:b,deleteChat:f,leaveChannel:y,deleteChannel:I,closeManagement:S,openChat:N,loadExportedChatInvites:w,loadChatJoinRequests:T,toggleForum:A}=(0,s.Sv)(),[R,L,B]=(0,k.Z)(),F=t.title,x=n?.about||"",[D,O]=(0,a.eJ)(!1),[U,$]=(0,a.eJ)(F),[j,V]=(0,a.eJ)(x),[G,J]=(0,a.eJ)(),[z,X]=(0,a.eJ)(),[Y,q]=(0,a.eJ)(t.isForum),K=(0,r.RT)(t),W=(0,H.Z)(K,!1,_.IU.BlobUrl),Q=(0,a.Ye)((()=>(0,r.Sb)(t)),[t]),ee=(0,M.Z)(),ne=(0,a.sO)(null);(0,pe.Z)({isActive:Z,onBack:E}),(0,a.d4)((()=>{u&&(w({chatId:e}),w({chatId:e,isRevoked:!0}),T({chatId:e}))}),[e,u]),(0,a.d4)((()=>{q(Boolean(t.isForum))}),[t.isForum]),(0,a.d4)((()=>{o===i.wv.Complete&&(O(!1),X(void 0))}),[o]);const ae=(0,a.I4)((()=>{g(i.u1.ChatPrivacyType)}),[g]),se=(0,a.I4)((()=>{g(i.u1.Discussion)}),[g]),ie=(0,a.I4)((()=>{g(i.u1.Reactions)}),[g]),oe=(0,a.I4)((()=>{g(i.u1.GroupPermissions)}),[g]),re=(0,a.I4)((()=>{g(i.u1.ChatAdministrators)}),[g]),le=(0,a.I4)((()=>{g(i.u1.Invites)}),[g]),ce=(0,a.I4)((()=>{g(i.u1.JoinRequests)}),[g]),de=(0,a.I4)((e=>{J(e),O(!0)}),[]),me=(0,a.I4)((e=>{$(e.target.value),O(!0)}),[]),ue=(0,a.I4)((e=>{V(e.target.value),O(!0)}),[]),he=(0,a.I4)((()=>{const t=U.trim(),n=j.trim();t.length?b({chatId:e,title:t,about:n,photo:G}):X(tZ)}),[j,e,G,U,b]),Ze=(0,a.I4)((()=>{g(i.u1.GroupMembers)}),[g]),Pe=(0,a.I4)((()=>{if(!n)return;const{isPreHistoryHidden:e}=n;C({chatId:t.id,isEnabled:!e})}),[t.id,n]),ve=(0,a.I4)((()=>{q((t=>{const n=!t;return sZ((()=>{A({chatId:e,isEnabled:n})})),n}))}),[e,A]);(0,a.d4)((()=>{if(!p)return;const e=ne.current?.querySelector("input");e.checked=!n?.isPreHistoryHidden}),[p,n?.isPreHistoryHidden]);const ge=(0,a.Ye)((()=>{if(!n?.enabledReactions)return ee("ReactionsOff");if("all"===n.enabledReactions.type)return ee("ReactionsAll");const e=n.enabledReactions.allowed.length,t=v?.filter((e=>!e.isInactive)).length||0;return t?`${e} / ${t}`:`${e}`}),[v,n?.enabledReactions,ee]),Ee=(0,a.Ye)((()=>{if(!t.defaultBannedRights)return 0;let e=nZ.filter((e=>!("manageTopics"===e&&!Y||t.defaultBannedRights[e]))).length;const{sendStickers:n,sendGifs:a}=t.defaultBannedRights;return n||a||(e+=1),e}),[t.defaultBannedRights,Y]),Ce=(0,a.Ye)((()=>Object.keys(n?.adminMembersById||{}).length),[n?.adminMembersById]),be=(0,a.I4)((()=>{l?f({chatId:t.id}):t.isCreator?I({chatId:t.id}):y({chatId:t.id}),B(),S(),N({id:void 0})}),[l,t.isCreator,t.id,B,S,y,I,f,N]);if(t.isRestricted||t.isForbidden)return;const fe=o===i.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(sc.Z,{isForForum:Y,currentAvatarBlobUrl:W,onChange:de,disabled:!d}),a.ZP.createElement(us.Z,{id:"group-title",label:ee("GroupName"),onChange:me,value:U,error:z===tZ?z:void 0,disabled:!d}),a.ZP.createElement(ic.Z,{id:"group-about",className:"mb-2",label:ee("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-j.length).toString(),onChange:ue,value:j,disabled:!d,noReplaceNewlines:!0}),t.isCreator&&a.ZP.createElement(jn.Z,{icon:"lock",multiline:!0,onClick:ae},a.ZP.createElement("span",{className:"title"},ee("GroupType")),a.ZP.createElement("span",{className:"subtitle"},ee(Q?"TypePublic":"TypePrivate"))),c&&a.ZP.createElement(jn.Z,{icon:"message",multiline:!0,onClick:se},a.ZP.createElement("span",{className:"title"},ee("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},ee("DiscussionUnlink"))),a.ZP.createElement(jn.Z,{icon:"permissions",multiline:!0,onClick:oe,disabled:!m},a.ZP.createElement("span",{className:"title"},ee("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},Ee,"/",aZ-(Y?0:1))),a.ZP.createElement(jn.Z,{icon:"heart-outline",multiline:!0,onClick:ie,disabled:!d},a.ZP.createElement("span",{className:"title"},ee("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ge)),a.ZP.createElement(jn.Z,{icon:"admin",multiline:!0,onClick:re},a.ZP.createElement("span",{className:"title"},ee("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,$e.kh)(Ce))),u&&a.ZP.createElement(jn.Z,{icon:"link",onClick:le,multiline:!0,disabled:!P},a.ZP.createElement("span",{className:"title"},ee("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},P?(0,$e.kh)(P.length):ee("Loading"))),Boolean(t.joinRequests?.length)&&a.ZP.createElement(jn.Z,{icon:"add-user-filled",onClick:ce,multiline:!0},a.ZP.createElement("span",{className:"title"},ee("MemberRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,$e.kh)(t.joinRequests.length))),h&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(jn.Z,{icon:"forums",ripple:!0,onClick:ve},a.ZP.createElement("span",null,ee("ChannelTopics")),a.ZP.createElement(qn.Z,{id:"group-notifications",label:ee("ChannelTopics"),checked:Y,inactive:!0})),a.ZP.createElement("div",{className:"section-info section-info_push"},ee("ForumToggleDescription")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"group",multiline:!0,onClick:Ze},a.ZP.createElement("span",{className:"title"},ee("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,$e.kh)(t.membersCount??0))),!Q&&!c&&Boolean(n)&&a.ZP.createElement("div",{className:"ListItem narrow",ref:ne},a.ZP.createElement(As.Z,{checked:!n.isPreHistoryHidden,label:ee("ChatHistory"),onChange:Pe,disabled:!m}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:L},ee("DeleteMega")))),a.ZP.createElement(na.Z,{isShown:D,onClick:he,disabled:fe,ariaLabel:ee("Save")},fe?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})),a.ZP.createElement(Xn.Z,{isOpen:R,onClose:B,textParts:(0,te.Z)(l||!t.isCreator?ee("AreYouSureDeleteAndExit"):ee("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:l||!t.isCreator?ee("DeleteMega"):ee("DeleteGroupForAll"),confirmHandler:be,confirmIsDestructive:!0}))}))),oZ=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,l.Z1J)(e,t),s=(0,l.x67)(e,t),{byId:i}=e.users,{currentUserId:o}=e,c=(0,r.eA)(a),d=!(a.isCreator||n);return{chat:a,usersById:i,currentUserId:o,isChannel:c,isForum:a.isForum,isFormFullyDisabled:d,defaultRights:a.adminRights,hasFullInfo:Boolean(s),adminMembersById:s?.adminMembersById}}))((({isActive:e,isNewAdmin:t,selectedUserId:n,defaultRights:o,chat:l,usersById:c,currentUserId:d,adminMembersById:m,hasFullInfo:u,isChannel:h,isForum:Z,isFormFullyDisabled:P,onClose:p,onScreenSelect:v})=>{const{updateChatAdmin:g}=(0,s.Sv)(),[E,C]=(0,a.eJ)({}),[b,f]=(0,a.eJ)(Boolean(t)),[y,I]=(0,a.eJ)(!1),[S,N,w]=(0,k.Z)(),[T,A]=(0,a.eJ)(""),R=(0,M.Z)();(0,pe.Z)({isActive:e,onBack:p});const L=(0,a.Ye)((()=>{const e=n?m?.[n]:void 0;if(!t||!e&&n){if(t){const e=(0,s.Rd)().users.byId[n];return e?{userId:e.id,adminRights:o,customTitle:R("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return e}}),[m,o,t,R,n]);(0,a.d4)((()=>{u&&n&&!L&&v(i.u1.ChatAdministrators)}),[l,u,v,L,n]),(0,a.d4)((()=>{C(L?.adminRights||{}),A((L?.customTitle||"").substr(0,16)),f(Boolean(t)),I(!1)}),[o,t,L]);const B=(0,a.I4)((e=>{const{name:t}=e.target;C((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),f(!0)}),[]),F=(0,a.I4)((()=>{n&&(I(!0),g({chatId:l.id,userId:n,adminRights:E,customTitle:T}))}),[n,g,l.id,E,T]),x=(0,a.I4)((()=>{n&&(g({chatId:l.id,userId:n,adminRights:{}}),w())}),[l.id,w,n,g]),D=(0,a.I4)((e=>!((0,r.G9)(l)||!P&&l.adminRights&&(l.isCreator||l.adminRights[e]))),[l,P]),O=(0,a.Ye)((()=>{if(t||!L)return;if(L.isOwner)return R("ChannelCreator");const e=L.promotedByUserId?c[L.promotedByUserId]:void 0;return e?R("EditAdminPromotedBy",(0,r.Js)(e)):R("ChannelAdmin")}),[t,L,c,R]),U=(0,a.I4)((e=>{const{value:t}=e.target;A(t),f(!0)}),[]);if(L)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(ns.Z,{userId:L.userId,status:O,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},R("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"changeInfo",checked:Boolean(E.changeInfo),label:R(h?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:D("changeInfo"),onChange:B})),h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"postMessages",checked:Boolean(E.postMessages),label:R("EditAdminPostMessages"),blocking:!0,disabled:D("postMessages"),onChange:B})),h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"editMessages",checked:Boolean(E.editMessages),label:R("EditAdminEditMessages"),blocking:!0,disabled:D("editMessages"),onChange:B})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"deleteMessages",checked:Boolean(E.deleteMessages),label:R(h?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:D("deleteMessages"),onChange:B})),h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"postStories",checked:Boolean(E.postStories),label:R("EditAdminPostStories"),blocking:!0,disabled:D("postStories"),onChange:B})),h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"editStories",checked:Boolean(E.editStories),label:R("EditAdminEditStories"),blocking:!0,disabled:D("editStories"),onChange:B})),h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"deleteStories",checked:Boolean(E.deleteStories),label:R("EditAdminDeleteStories"),blocking:!0,disabled:D("deleteStories"),onChange:B})),!h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"banUsers",checked:Boolean(E.banUsers),label:R("EditAdminBanUsers"),blocking:!0,disabled:D("banUsers"),onChange:B})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"inviteUsers",checked:Boolean(E.inviteUsers),label:R("EditAdminAddUsers"),blocking:!0,disabled:D("inviteUsers"),onChange:B})),!h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"pinMessages",checked:Boolean(E.pinMessages),label:R("EditAdminPinMessages"),blocking:!0,disabled:D("pinMessages"),onChange:B})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"addAdmins",checked:Boolean(E.addAdmins),label:R("EditAdminAddAdmins"),blocking:!0,disabled:D("addAdmins"),onChange:B})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"manageCall",checked:Boolean(E.manageCall),label:R("StartVoipChatPermission"),blocking:!0,disabled:D("manageCall"),onChange:B})),Z&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"manageTopics",checked:Boolean(E.manageTopics),label:R("ManageTopicsPermission"),blocking:!0,disabled:D("manageTopics"),onChange:B})),!h&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"anonymous",checked:Boolean(E.anonymous),label:R("EditAdminSendAnonymously"),blocking:!0,disabled:D("anonymous"),onChange:B})),P&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},R("Channel.EditAdmin.CannotEdit")),!h&&a.ZP.createElement(us.Z,{id:"admin-title",label:R("EditAdminRank"),onChange:U,value:T,disabled:P,maxLength:16}),d!==n&&!P&&!t&&a.ZP.createElement(jn.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:N},R("EditAdminRemoveAdmin")))),a.ZP.createElement(na.Z,{isShown:b,onClick:F,ariaLabel:R("Save"),disabled:y},y?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})),!t&&a.ZP.createElement(Xn.Z,{isOpen:S,onClose:w,text:"Are you sure you want to dismiss this admin?",confirmLabel:R("Channel.Admin.Dismiss"),confirmHandler:x,confirmIsDestructive:!0}))})));var rZ=n(13995),lZ=n(22275);const cZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),{statusesById:a}=e.users,{members:s,adminMembersById:i,areParticipantsHidden:o}=(0,l.x67)(e,t)||{},c=n&&(0,r.eA)(n),{userIds:d}=e.contactList||{},m=e.appConfig?.hiddenMembersMinCount,u=n&&(n.isCreator||(0,r.VE)(n,"banUsers")),h=u&&!(0,r.G9)(n)&&void 0!==n.membersCount&&void 0!==m&&n.membersCount>=m,{query:Z,fetchingStatus:P,globalUserIds:p,localUserIds:v}=(0,l.jUK)(e).userSearch;return{areParticipantsHidden:Boolean(n&&o),members:s,adminMembersById:i,userStatusesById:a,isChannel:c,localContactIds:d,searchQuery:Z,isSearching:P,globalUserIds:p,localUserIds:v,canDeleteMembers:u,currentUserId:e.currentUserId,canHideParticipants:h}}))((({chatId:e,noAdmins:t,members:n,adminMembersById:o,userStatusesById:l,isChannel:c,isActive:d,globalUserIds:m,localContactIds:u,localUserIds:h,isSearching:Z,searchQuery:P,currentUserId:p,canDeleteMembers:v,areParticipantsHidden:g,canHideParticipants:E,onClose:C,onScreenSelect:b,onChatMemberSelect:f})=>{const{openChat:y,setUserSearchQuery:I,closeManagement:S,toggleParticipantsHidden:k}=(0,s.Sv)(),N=(0,M.Z)(),w=(0,a.sO)(null),T=(0,a.sO)(null),[A,R]=(0,a.eJ)(),L=(0,a.Ye)((()=>t&&o?Object.keys(o):[]),[o,t]),B=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId;if(!n||!e)return[];const a=(0,r.Z0)(n.map((({userId:e})=>e)),e,l);return t?a.filter((e=>!L.includes(e))):a}),[n,l,t,L]);(0,rZ.Z)(B);const F=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId,n=(0,s.Rd)().chats.byId,a=Boolean(P),i=a?u?(0,r.kK)(u,e,P):[]:B;return(0,r.ih)((0,Kn.Tw)([...i,...a&&h||[],...a&&m||[]]).filter((n=>{const a=e[n];return!a||(c||a.canBeInvitedToGroup||!(0,r.cS)(a))&&(!t||!L.includes(n))})),n,!0)}),[B,u,P,h,m,c,t,L]),[x,D]=(0,cs.Z)(void 0,F,Boolean(P)),O=(0,a.I4)((e=>{t?(f(e,!0),b(i.u1.ChatNewAdminRights)):(S(),y({id:e}))}),[S,t,f,b,y]),U=(0,a.I4)((e=>{I({query:e.target.value})}),[I]),_=(0,ms.Z)(T,d,(e=>{x&&x.length>0&&O(x[-1===e?0:e])}),".ListItem-button",!0),$=(0,a.I4)((()=>{R(void 0)}),[]),j=(0,a.I4)((()=>{k({chatId:e,isEnabled:!g})}),[g,e,k]);return(0,pe.Z)({isActive:d,onBack:C}),a.ZP.createElement("div",{className:"Management"},t&&a.ZP.createElement("div",{className:"Management__filter",dir:N.isRtl?"rtl":void 0},a.ZP.createElement(us.Z,{ref:w,value:P,onChange:U,placeholder:N("Search")})),a.ZP.createElement("div",{className:"custom-scroll"},E&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"group",ripple:!0,onClick:j},a.ZP.createElement("span",null,N("ChannelHideMembers")),a.ZP.createElement(qn.Z,{label:N("ChannelHideMembers"),checked:g})),a.ZP.createElement("p",{className:"section-info"},N(g?"GroupMembers.MembersHiddenOn":"GroupMembers.MembersHiddenOff"))),a.ZP.createElement("div",{className:"section"},x?.length?a.ZP.createElement(Qa.Z,{className:"picker-list custom-scroll",items:F,onLoadMore:D,noScrollRestore:Boolean(P),ref:T,onKeyDown:_},x.map((e=>{return a.ZP.createElement(jn.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>O(e),contextActions:(t=e,t!==p&&v?[{title:N("lng_context_remove_from_group"),icon:"stop",handler:()=>{R(t)}}]:void 0)},a.ZP.createElement(ns.Z,{userId:e,forceShowSelf:!0,withStory:!0}));var t}))):Z||!x||x.length?a.ZP.createElement(hs.Z,null):a.ZP.createElement(wr.Z,{teactOrderKey:0,key:"nothing-found",text:c?"No subscribers found":"No members found"}))),v&&a.ZP.createElement(lZ.Z,{isOpen:Boolean(A),userId:A,onClose:$}))}))),dZ=["embedLinks","sendPolls","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs","sendStickers","sendGifs"],mZ=[...dZ,"sendPlain"];function uZ(e){const[t,n]=(0,a.eJ)({}),[s,i]=(0,a.eJ)(!1),[o,r]=(0,a.eJ)(!1);(0,a.d4)((()=>{n(e||{}),i(!1),setTimeout((()=>{r(!1)}),250)}),[e]);const l=(0,a.I4)((a=>{const{name:s}=a.target,o=s;function r(e){return!e||void 0}const l=t;let c={...l,[o]:r(l[o]),..."sendStickers"===o&&{sendGifs:r(l[o])}};const d=()=>{const e=dZ.map((e=>c[e]));e.some((e=>!e))?c={...c,sendMedia:void 0}:e.every(Boolean)&&(c={...c,sendMedia:!0})};"sendMedia"!==o?d():c={...c,...dZ.reduce(((e,t)=>Object.assign(e,{[t]:c.sendMedia})),{})},"embedLinks"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,embedLinks:!0}),"sendPlain"!==o&&!c.embedLinks&&c.sendPlain&&(c={...c,sendPlain:void 0}),"sendMedia"!==o&&d();const m=mZ.every((e=>c[e]));c={...c,sendMessages:!!m||void 0},n(c),i(!e||Object.keys(c).some((t=>{const n=t;return Boolean(e[n])!==Boolean(c[n])})))}),[e,t]);return{permissions:t,isLoading:o,havePermissionChanged:s,handlePermissionChange:l,setIsLoading:r}}const hZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),a=(0,l.x67)(e,t),s=Boolean(a?.linkedChatId);return{chat:n,currentUserId:e.currentUserId,hasLinkedChat:s,removedUsersCount:a?.kickedMembers?.length||0,members:a?.members}}))((({onScreenSelect:e,onChatMemberSelect:t,chat:n,currentUserId:o,hasLinkedChat:l,removedUsersCount:c,members:d,onClose:m,isActive:u})=>{const{updateChatDefaultBannedRights:h,showNotification:Z}=(0,s.Sv)(),{permissions:P,havePermissionChanged:p,isLoading:g,handlePermissionChange:E,setIsLoading:C}=uZ(n?.defaultBannedRights),b=(0,M.Z)(),{isForum:f}=n||{},y=(0,a.Ye)((()=>n&&(0,r.Sb)(n)),[n]),I=l||y;(0,pe.Z)({isActive:u,onBack:m});const S=(0,a.I4)((()=>{e(i.u1.GroupRemovedUsers)}),[e]),k=(0,a.I4)((()=>{e(i.u1.GroupUserPermissionsCreate)}),[e]),N=(0,a.I4)((n=>{t(n.userId,n.promotedByUserId===o),e(i.u1.GroupUserPermissions)}),[o,t,e]),[w,T]=(0,a.eJ)(!1),A=(0,a.I4)((e=>{(0,v.Z)(e),T(!w)}),[w]),R=(0,a.I4)((()=>{Z({message:b("lng_rights_permission_unavailable")})}),[b,Z]),L=(0,a.I4)((()=>{n&&(C(!0),h({chatId:n.id,bannedRights:P}))}),[n,P,C,h]),B=(0,a.Ye)((()=>d?d.filter((({bannedRights:e})=>Boolean(e))):[]),[d]),F=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!n)return;const{defaultBannedRights:a}=n;return Object.keys(t).reduce(((e,n)=>{const s=n;if(!t[s]||a?.[s]||"sendInline"===s||"viewMessages"===s||"sendGames"===s)return e;const i=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";case"manageTopics":return"GroupPermission.NoManageTopics";case"sendPlain":return"UserRestrictionsNoSendText";case"sendDocs":return"UserRestrictionsNoSendDocs";case"sendRoundvideos":return"UserRestrictionsNoSendRound";case"sendVoices":return"UserRestrictionsNoSendVoice";case"sendAudios":return"UserRestrictionsNoSendMusic";case"sendVideos":return"UserRestrictionsNoSendVideos";case"sendPhotos":return"UserRestrictionsNoSendPhotos";default:return}}(s);if(!i)return e;const o=b(i);return`${e}${e.length?`, ${o}`:o}`}),"")}),[n,b]);return a.ZP.createElement("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 504px;--before-shift-height: 112px;"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section without-bottom-shadow"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},b("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendPlain",checked:!P.sendPlain,label:b("UserRestrictionsSend"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendMedia",checked:!P.sendMedia,label:b("UserRestrictionsSendMedia"),blocking:!0,rightIcon:w?"up":"down",onChange:E,onClickLabel:A})),a.ZP.createElement("div",{className:"DropdownListTrap"},a.ZP.createElement("div",{className:(0,ce.Z)("DropdownList",w&&"DropdownList--open")},a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendPhotos",checked:!P.sendPhotos,label:b("UserRestrictionsSendPhotos"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendVideos",checked:!P.sendVideos,label:b("UserRestrictionsSendVideos"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendStickers",checked:!P.sendStickers&&!P.sendGifs,label:b("UserRestrictionsSendStickers"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendAudios",checked:!P.sendAudios,label:b("UserRestrictionsSendMusic"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendDocs",checked:!P.sendDocs,label:b("UserRestrictionsSendFiles"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendVoices",checked:!P.sendVoices,label:b("UserRestrictionsSendVoices"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendRoundvideos",checked:!P.sendRoundvideos,label:b("UserRestrictionsSendRound"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"embedLinks",checked:!P.embedLinks,label:b("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"sendPolls",checked:!P.sendPolls,label:b("UserRestrictionsSendPolls"),blocking:!0,onChange:E})))),a.ZP.createElement("div",{className:(0,ce.Z)("part",w&&"shifted")},a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"inviteUsers",checked:!P.inviteUsers,label:b("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox",onClick:I?R:void 0},a.ZP.createElement(As.Z,{name:"pinMessages",checked:!P.pinMessages,label:b("UserRestrictionsPinMessages"),disabled:I,blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem with-checkbox",onClick:I?R:void 0},a.ZP.createElement(As.Z,{name:"changeInfo",checked:!P.changeInfo,label:b("UserRestrictionsChangeInfo"),blocking:!0,disabled:I,onChange:E})),f&&a.ZP.createElement("div",{className:"ListItem with-checkbox"},a.ZP.createElement(As.Z,{name:"manageTopics",checked:!P.manageTopics,label:b("CreateTopicsPermission"),blocking:!0,onChange:E})))),a.ZP.createElement("div",{className:(0,ce.Z)("section",w&&"shifted")},a.ZP.createElement(jn.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:S},a.ZP.createElement("span",{className:"title"},b("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},c))),a.ZP.createElement("div",{className:(0,ce.Z)("section",w&&"shifted")},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},b("PrivacyExceptions")),a.ZP.createElement(jn.Z,{icon:"add-user",onClick:k},b("ChannelAddException")),B.map((e=>a.ZP.createElement(jn.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>N(e)},a.ZP.createElement(ns.Z,{userId:e.userId,status:F(e),forceShowSelf:!0})))))),a.ZP.createElement(na.Z,{isShown:p,onClick:L,ariaLabel:b("Save"),disabled:g},g?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))}))),ZZ=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,l.Z1J)(e,t),s=(0,l.x67)(e,t);return{chat:a,isFormFullyDisabled:!(a.isCreator||n),hasFullInfo:Boolean(s),members:s?.members}}))((({chat:e,selectedChatMemberId:t,hasFullInfo:n,members:o,onScreenSelect:r,isFormFullyDisabled:l,onClose:c,isActive:d})=>{const{updateChatMemberBannedRights:m}=(0,s.Sv)(),u=(0,a.Ye)((()=>{if(o)return o.find((({userId:e})=>e===t))}),[o,t]),{permissions:h,havePermissionChanged:Z,isLoading:P,handlePermissionChange:p,setIsLoading:g}=uZ(u?.bannedRights||e?.defaultBannedRights),[E,C,b]=(0,k.Z)(),f=(0,M.Z)(),{isForum:y}=e||{};(0,pe.Z)({isActive:d,onBack:c}),(0,a.d4)((()=>{n&&t&&!u&&r(i.u1.GroupPermissions)}),[e,n,r,u,t]);const I=(0,a.I4)((()=>{e&&t&&(g(!0),m({chatId:e.id,userId:t,bannedRights:h}))}),[e,t,g,m,h]),S=(0,a.I4)((()=>{e&&t&&m({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})}),[e,t,m]),N=(0,a.I4)((t=>!!l||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t]),[e,l]),[w,T]=(0,a.eJ)(!1),A=(0,a.I4)((e=>{(0,v.Z)(e),T(!w)}),[w]);if(u)return a.ZP.createElement("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 503px;--before-shift-height: 208px;"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section without-bottom-shadow"},a.ZP.createElement(jn.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(ns.Z,{userId:u.userId,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},f("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendPlain",checked:!h.sendPlain,label:f("UserRestrictionsSend"),blocking:!0,disabled:N("sendPlain"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendMedia",checked:!h.sendMedia,label:f("UserRestrictionsSendMedia"),blocking:!0,rightIcon:w?"up":"down",disabled:N("sendMedia"),onChange:p,onClickLabel:A})),a.ZP.createElement("div",{className:"DropdownListTrap"},a.ZP.createElement("div",{className:(0,ce.Z)("DropdownList",w&&"DropdownList--open")},a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendPhotos",checked:!h.sendPhotos,label:f("UserRestrictionsSendPhotos"),blocking:!0,disabled:N("sendPhotos"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendVideos",checked:!h.sendVideos,label:f("UserRestrictionsSendVideos"),blocking:!0,disabled:N("sendVideos"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendStickers",checked:!h.sendStickers&&!h.sendGifs,label:f("UserRestrictionsSendStickers"),blocking:!0,disabled:N("sendStickers"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendAudios",checked:!h.sendAudios,label:f("UserRestrictionsSendMusic"),blocking:!0,disabled:N("sendAudios"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendDocs",checked:!h.sendDocs,label:f("UserRestrictionsSendFiles"),blocking:!0,disabled:N("sendDocs"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendVoices",checked:!h.sendVoices,label:f("UserRestrictionsSendVoices"),blocking:!0,disabled:N("sendVoices"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendRoundvideos",checked:!h.sendRoundvideos,label:f("UserRestrictionsSendRound"),blocking:!0,disabled:N("sendRoundvideos"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"embedLinks",checked:!h.embedLinks,label:f("UserRestrictionsEmbedLinks"),blocking:!0,disabled:N("embedLinks"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"sendPolls",checked:!h.sendPolls,label:f("UserRestrictionsSendPolls"),blocking:!0,disabled:N("sendPolls"),onChange:p})))),a.ZP.createElement("div",{className:(0,ce.Z)("part",w&&"shifted")},a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"inviteUsers",checked:!h.inviteUsers,label:f("UserRestrictionsInviteUsers"),blocking:!0,disabled:N("inviteUsers"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"pinMessages",checked:!h.pinMessages,label:f("UserRestrictionsPinMessages"),blocking:!0,disabled:N("pinMessages"),onChange:p})),a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"changeInfo",checked:!h.changeInfo,label:f("UserRestrictionsChangeInfo"),blocking:!0,disabled:N("changeInfo"),onChange:p})),y&&a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:"manageTopics",checked:!h.manageTopics,label:f("CreateTopicsPermission"),blocking:!0,disabled:N("manageTopics"),onChange:p})))),!l&&a.ZP.createElement("div",{className:(0,ce.Z)("section",w&&"shifted")},a.ZP.createElement(jn.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:C},f("UserRestrictionsBlock")))),a.ZP.createElement(na.Z,{isShown:Z,onClick:I,ariaLabel:f("Save"),disabled:P},P?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})),a.ZP.createElement(Xn.Z,{isOpen:E,onClose:b,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:S,confirmIsDestructive:!0}))}))),PZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t),{byId:a,statusesById:s}=e.users,i=(0,l.x67)(e,t)?.members;return{members:i,usersById:a,userStatusesById:s,isChannel:n&&(0,r.eA)(n)}}))((({usersById:e,userStatusesById:t,members:n,isChannel:s,onScreenSelect:o,onChatMemberSelect:l,onClose:c,isActive:d})=>{(0,pe.Z)({isActive:d,onBack:c});const m=(0,a.Ye)((()=>{if(n&&e)return(0,r.Z0)(n.filter((e=>!e.isOwner)).map((({userId:e})=>e)),e,t)}),[n,e,t]),u=(0,a.I4)((e=>{l(e),o(i.u1.GroupUserPermissions)}),[l,o]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},m?m.map(((e,t)=>a.ZP.createElement(jn.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>u(e)},a.ZP.createElement(ns.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(wr.Z,{teactOrderKey:0,key:"nothing-found",text:s?"No subscribers found":"No members found"}))))}))),pZ=[1,10,100],vZ={hour:36e5,day:864e5,week:6048e5},gZ=vZ.hour,EZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{editingInvite:n}=(0,l.jUK)(e).management.byChatId[t];return{editingInvite:n}}))((({chatId:e,editingInvite:t,isActive:n,onClose:o,onScreenSelect:r})=>{const{editExportedChatInvite:l,exportChatInvite:c}=(0,s.Sv)(),d=(0,M.Z)(),[m,u,h]=(0,k.Z)(),[Z,P]=(0,a.eJ)(!1),[p,v]=(0,a.eJ)(""),[g,E]=(0,a.eJ)(Date.now()+gZ),[C,b]=(0,a.eJ)("unlimited"),[f,y]=(0,a.eJ)(10),[I,S]=(0,a.eJ)("0"),[N,w]=(0,a.eJ)(!1);(0,pe.Z)({isActive:n,onBack:o}),(0,G.Z)((([e])=>{if(e!==t)if(t){const{title:e,usageLimit:n,expireDate:a,isRequestNeeded:s}=t;if(e&&v(e),n&&(S(pZ.includes(n)?n.toString():"custom"),y(n)),a){const e=(0,$n.bp)()+gZ;b("custom"),E(1e3*Math.max(a,e))}s&&P(!0)}else v(""),b("unlimited"),S("0"),E(1e3*(0,$n.bp)()+gZ),y(10),P(!1)}),[t]);const T=(0,a.I4)((e=>{P(e.target.checked)}),[]),A=(0,a.I4)((e=>{v(e.target.value)}),[]),R=(0,a.I4)((e=>{y(Number.parseInt(e.target.value,10))}),[]),L=(0,a.I4)((e=>{E(e.getTime()),h()}),[h]),B=(0,a.I4)((()=>{w(!0);const n="custom"===I?f:Number(I);let a;switch(C){case"custom":a=(0,$n.bp)()+(g-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,$n.bp)()+vZ[C]/1e3;break;case"unlimited":a=0;break;default:a=void 0}t?l({link:t.link,chatId:e,title:p,isRequestNeeded:Z,expireDate:a,usageLimit:n}):c({chatId:e,title:p,isRequestNeeded:Z,expireDate:a,usageLimit:n}),r(i.u1.Invites)}),[e,g,f,l,t,c,Z,C,I,p,r]);return a.ZP.createElement("div",{className:"Management ManageInvite"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(As.Z,{label:d("ApproveNewMembers"),subLabel:d("ApproveNewMembersDescription"),checked:Z,onChange:T})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(us.Z,{className:"link-name",placeholder:d("LinkNameHint"),value:p,onChange:A}),a.ZP.createElement("p",{className:"text-muted hint"},d("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},d("LimitByPeriod")),a.ZP.createElement(Dl.Z,{name:"expireOptions",options:[{value:"hour",label:d("Hours",1)},{value:"day",label:d("Days",1)},{value:"week",label:d("Weeks",1)},{value:"unlimited",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_expire_custom")}],onChange:b,selected:C}),"custom"===C&&a.ZP.createElement(Y.Z,{className:"expire-limit",isText:!0,onClick:u},(0,_e.Tu)(d,g)," ",(0,_e.mr)(d,g)),a.ZP.createElement("p",{className:"text-muted hint"},d("TimeLimitHelp"))),!Z&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},d("LimitNumberOfUses")),a.ZP.createElement(Dl.Z,{name:"usageOptions",options:[...pZ.map((e=>({value:e.toString(),label:e}))),{value:"0",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_usage_custom")}],onChange:S,selected:I}),"custom"===I&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:f,onChange:R}),a.ZP.createElement("p",{className:"text-muted hint"},d("UsesLimitHelp"))),a.ZP.createElement(na.Z,{isShown:!0,onClick:B,disabled:N,ariaLabel:d(t?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon icon-check"}))),a.ZP.createElement(Us,{isOpen:m,isFutureMode:!0,withTimePicker:!0,onClose:h,onSubmit:L,selectedAt:g,submitButtonLabel:d("Save")}))}))),CZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{inviteInfo:n}=(0,l.jUK)(e).management.byChatId[t],{invite:a,importers:s,requesters:i}=n||{},o=(0,l.Z1J)(e,t);return{invite:a,importers:s,requesters:i,isChannel:o&&(0,r.eA)(o)}}))((({chatId:e,invite:t,importers:n,requesters:i,isChannel:o,isActive:r,onClose:l})=>{const{showNotification:c,loadChatInviteImporters:d,loadChatInviteRequesters:m,openChat:u}=(0,s.Sv)(),h=(0,M.Z)(),{usage:Z=0,usageLimit:P,link:p,adminId:v}=t||{},g=t?.expireDate&&1e3*(t.expireDate-(0,$n.bp)())+Date.now(),E=(t?.expireDate||0)-(0,$n.bp)()<0;(0,a.d4)((()=>{p&&(d({chatId:e,link:p}),m({chatId:e,link:p}))}),[e,p,d,m]);const C=(0,a.I4)((()=>{(0,Wl.TE)(t.link),c({message:h("LinkCopied")})}),[t,h,c]);return(0,pe.Z)({isActive:r,onBack:l}),a.ZP.createElement("div",{className:"Management ManageInviteInfo"},a.ZP.createElement("div",{className:"custom-scroll"},!t&&a.ZP.createElement("p",{className:"text-muted"},h("Loading")),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"link-title"},t.title||t.link),a.ZP.createElement("input",{className:"form-control",value:t.link,readOnly:!0,onClick:C}),a.ZP.createElement(Y.Z,{className:"copy-link",onClick:C},h("CopyLink")),Boolean(g)&&a.ZP.createElement("p",{className:"text-muted"},E?h("ExpiredLink"):h("LinkExpiresIn",`${(0,_e.Tu)(h,g)} ${(0,_e.mr)(h,g)}`))),v&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,h("LinkCreatedeBy")),a.ZP.createElement(jn.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>u({id:v})},a.ZP.createElement(ns.Z,{userId:v,status:(0,_e.ZK)(h,1e3*t.date,!0),forceShowSelf:!0}))),(()=>{if(n?.length||!i?.length)return n?a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,n.length?h("PeopleJoined",Z):h("NoOneJoined")),a.ZP.createElement("p",{className:"text-muted"},!n.length&&(P?h("PeopleCanJoinViaLinkCount",P-Z):h("NoOneJoinedYet")),n.map((e=>{const t=(0,_e.ZK)(h,1e3*e.date,!0),n=e.isFromChatList?`${t} • ${h("JoinedViaFolder")}`:t;return a.ZP.createElement(jn.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>u({id:e.userId})},a.ZP.createElement(ns.Z,{userId:e.userId,status:n,forceShowSelf:!0}))})))):a.ZP.createElement(we.Z,null)})(),(()=>{if(!t?.isRevoked){if(!i&&n)return a.ZP.createElement(we.Z,null);if(i?.length)return a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,h(o?"SubscribeRequests":"MemberRequests")),a.ZP.createElement("p",{className:"text-muted"},i.map((e=>a.ZP.createElement(jn.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>u({id:e.userId})},a.ZP.createElement(ns.Z,{userId:e.userId,status:(0,_e.ZK)(h,1e3*e.date,!0),forceShowSelf:!0}))))))}})())))}))),bZ="•";function fZ(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:i,usage:o=0,date:r}=t;return n||i?Number(n)-Number(i):a||o?o-a:r-s}const yZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{invites:n,revokedInvites:a}=(0,l.jUK)(e).management.byChatId[t],s=(0,l.Z1J)(e,t);return{exportedInvites:n,revokedExportedInvites:a,chat:s,isChannel:s&&(0,r.eA)(s)}}))((({chatId:e,chat:t,exportedInvites:n,revokedExportedInvites:l,isActive:c,isChannel:d,onClose:m,onScreenSelect:u})=>{const{setEditingExportedInvite:h,showNotification:Z,editExportedChatInvite:P,deleteExportedChatInvite:p,deleteRevokedExportedChatInvites:v,setOpenedInviteInfo:g}=(0,s.Sv)(),E=(0,M.Z)(),[C,b,f]=(0,k.Z)(),[y,I,S]=(0,k.Z)(),[w,T]=(0,a.eJ)(),[A,R,L]=(0,k.Z)(),[B,F]=(0,a.eJ)();(0,pe.Z)({isActive:c,onBack:m});const x=(0,a.Ye)((()=>{if(n)return n.some((({expireDate:e})=>e&&e-(0,$n.bp)()<_e.xR/1e3))}),[n]),D=(0,N.Z)();(0,Js.Z)((()=>{D()}),x?1e3:void 0);const O=(0,a.Ye)((()=>t&&(0,r.WS)(t)),[t]),U=n?.find((({isPermanent:e})=>e)),_=O?`${o.zHP}${O}`:U?.link,$=(0,a.Ye)((()=>{const e=t?.usernames?n:n?.filter((({isPermanent:e})=>!e));return e?.sort(fZ)}),[t?.usernames,n]),j=(0,a.I4)((t=>{const{link:n,title:a,isRequestNeeded:s,expireDate:i,usageLimit:o}=t;P({chatId:e,link:n,title:a,isRequestNeeded:s,expireDate:i,usageLimit:o,isRevoked:!0})}),[e,P]),V=(0,a.I4)((e=>{T(e),I()}),[I]),G=(0,a.I4)((()=>{w&&(j(w),T(void 0),S())}),[S,j,w]),H=(0,a.I4)((()=>{u(i.u1.EditInvite)}),[u]),J=(0,a.I4)((()=>{U&&V(U)}),[V,U]),z=(0,a.I4)((()=>{v({chatId:e}),f()}),[e,f,v]),X=(0,a.I4)((t=>{g({chatId:e,invite:t}),u(i.u1.InviteInfo)}),[e,u,g]),q=(0,a.I4)((t=>{p({chatId:e,link:t.link})}),[e,p]),K=(0,a.I4)((e=>{F(e),R()}),[R]),W=(0,a.I4)((()=>{B&&(q(B),F(void 0),L())}),[L,q,B]),Q=(0,a.I4)((e=>{(0,Wl.TE)(e),Z({message:E("LinkCopied")})}),[E,Z]),ee=e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:i,isRevoked:o}=e;let r="";if(r=!o&&n&&t<n?E("CanJoin",n-t):t?E("PeopleJoined",t):E("NoOneJoined"),o)return r+=` ${bZ} ${E("Revoked")}`,r;if(i&&(r+=` ${bZ} ${E("JoinRequests",i)}`),void 0!==n&&t===n)r+=` ${bZ} ${E("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,$n.bp)());r+=` ${bZ} `,r+=e>0?E("InviteLink.ExpiresIn",(0,_e.D)(E,e)):E("InviteLink.Expired")}else s&&(r+=` ${bZ} ${E("Permanent")}`);return r},te=e=>{const{usage:t=0,usageLimit:n,isRevoked:a,expireDate:s}=e;return a?"link-status-icon-gray":n&&t<n?"link-status-icon-green":s&&1e3*(s-(0,$n.bp)())<=0?"link-status-icon-red":"link-status-icon-blue"},ne=t=>{const n=[];return n.push({title:E("Copy"),icon:"copy",handler:()=>Q(t.link)}),t.isPermanent||t.isRevoked||n.push({title:E("Edit"),icon:"edit",handler:()=>(t=>{h({chatId:e,invite:t}),u(i.u1.EditInvite)})(t)}),t.isRevoked?n.push({title:E("DeleteLink"),icon:"delete",handler:()=>K(t),destructive:!0}):n.push({title:E("RevokeButton"),icon:"delete",handler:()=>V(t),destructive:!0}),n};return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(vl.Z,{tgsUrl:pl.l.Invite,size:o.jVS,className:"section-icon"}),a.ZP.createElement("p",{className:"text-muted"},E(d?"PrimaryLinkHelpChannel":"PrimaryLinkHelp"))),_&&a.ZP.createElement(Qo.Z,{className:"section",link:_,withShare:!0,onRevoke:t?.usernames?void 0:J,title:E(t?.usernames?"PublicLink":"lng_create_permanent_link_title")}),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement(Y.Z,{isText:!0,key:"create",className:"create-link",onClick:H},E("CreateNewLink")),(!$||!$.length)&&a.ZP.createElement(wr.Z,{text:"No links found",key:"nothing"}),$?.map((e=>a.ZP.createElement(jn.Z,{leftElement:a.ZP.createElement("i",{className:`icon icon-link link-status-icon ${te(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>X(e),contextActions:ne(e),key:e.link},a.ZP.createElement("span",{className:"title invite-title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ee(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},E("ManageLinksInfoHelp"))),l&&Boolean(l.length)&&a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{className:"text-muted",key:"title"},E("RevokedLinks")),a.ZP.createElement(jn.Z,{icon:"delete",destructive:!0,key:"delete",onClick:b},a.ZP.createElement("span",{className:"title"},E("DeleteAllRevokedLinks"))),l?.map((e=>a.ZP.createElement(jn.Z,{leftElement:a.ZP.createElement("i",{className:`icon icon-link link-status-icon ${te(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>X(e),contextActions:ne(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ee(e))))))),a.ZP.createElement(Xn.Z,{isOpen:C,onClose:f,title:E("DeleteAllRevokedLinks"),text:E("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:E("DeleteAll"),confirmHandler:z}),a.ZP.createElement(Xn.Z,{isOpen:y,onClose:S,title:E("RevokeLink"),text:E("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:E("RevokeButton"),confirmHandler:G}),a.ZP.createElement(Xn.Z,{isOpen:A,onClose:L,title:E("DeleteLink"),text:E("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:E("Delete"),confirmHandler:W}))}))),IZ=(0,a.X$)((0,s.c$)(((e,{userId:t})=>({user:(0,l.dyD)(e,t)})))((({userId:e,chatId:t,about:n,date:i,isChannel:o,user:l})=>{const{openChat:c,hideChatJoinRequest:d}=(0,s.Sv)(),m=(0,ce.y)("JoinRequest"),u=(0,M.Z)(),h=(0,r.Js)(l),Z=1e3*(i-(0,$n.bp)())+Date.now(),P=(0,_e.zk)(new Date(Z))?(0,_e.mr)(u,Z):(0,_e.j1)(u,Z,!0,!1,!0),p=(0,a.I4)((()=>{d({chatId:t,userId:e,isApproved:!0})}),[t,d,e]),v=(0,a.I4)((()=>{d({chatId:t,userId:e,isApproved:!1})}),[t,d,e]);return a.ZP.createElement("div",{className:m("&")},a.ZP.createElement("div",{className:m("top")},a.ZP.createElement("div",{className:m("user"),onClick:()=>{c({id:e})}},a.ZP.createElement(yt.Z,{key:e,size:"medium",peer:l}),a.ZP.createElement("div",{className:m("user-info")},a.ZP.createElement("div",{className:m("user-name")},h),a.ZP.createElement("div",{className:m("user-subtitle")},n))),a.ZP.createElement("div",{className:m("date")},P)),a.ZP.createElement("div",{className:m("buttons")},a.ZP.createElement(Y.Z,{className:m("button"),onClick:p},u(o?"ChannelAddToChannel":"ChannelAddToGroup")),a.ZP.createElement(Y.Z,{className:m("button"),isText:!0,onClick:v},u("DismissRequest"))))}))),SZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t);return{chat:n,isChannel:n&&(0,r.eA)(n)}}))((({chat:e,chatId:t,isActive:n,isChannel:i,onClose:l})=>{const{hideAllChatJoinRequests:c,loadChatJoinRequests:d}=(0,s.Sv)(),[m,u,h]=(0,k.Z)(),[Z,P,p]=(0,k.Z)(),v=(0,M.Z)();(0,pe.Z)({isActive:n,onBack:l}),(0,a.d4)((()=>{e?.joinRequests||(0,r.YC)(t)||d({chatId:t})}),[e,t,d]);const g=(0,a.I4)((()=>{c({chatId:t,isApproved:!0}),h()}),[c,t,h]),E=(0,a.I4)((()=>{c({chatId:t,isApproved:!1}),p()}),[c,t,p]);return a.ZP.createElement("div",{className:"Management ManageJoinRequests"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(vl.Z,{tgsUrl:pl.l.JoinRequest,size:o.PMB,className:"section-icon"}),Boolean(e?.joinRequests?.length)&&a.ZP.createElement("div",{className:"bulk-actions"},a.ZP.createElement(Y.Z,{className:"bulk-action-button",onClick:u},"Accept all"),a.ZP.createElement(Y.Z,{className:"bulk-action-button",onClick:P,isText:!0},"Dismiss all"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{key:"title"},e?.joinRequests?e.joinRequests.length?v("JoinRequests",e.joinRequests.length):v("NoMemberRequests"):v("Loading")),!e?.joinRequests&&a.ZP.createElement(we.Z,{key:"loading"}),0===e?.joinRequests?.length&&a.ZP.createElement("p",{className:"text-muted",key:"empty"},v(i?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")),e?.joinRequests?.map((({userId:e,about:n,date:s})=>a.ZP.createElement(IZ,{userId:e,about:n,date:s,isChannel:i,chatId:t,key:e}))))),a.ZP.createElement(Xn.Z,{isOpen:m,onClose:h,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:g}),a.ZP.createElement(Xn.Z,{isOpen:Z,onClose:p,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:E}))}))),kZ=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,l.Z1J)(e,t);return{enabledReactions:(0,l.x67)(e,t)?.enabledReactions,availableReactions:e.availableReactions,chat:n}}))((({availableReactions:e,enabledReactions:t,chat:n,isActive:i,onClose:o})=>{const{setChatEnabledReactions:l}=(0,s.Sv)(),c=(0,M.Z)(),[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)(!1),[Z,P]=(0,a.eJ)(t);(0,pe.Z)({isActive:i,onBack:o});const p=(0,a.Ye)((()=>[{value:"all",label:c("AllReactions")},{value:"some",label:c("SomeReactions")},{value:"none",label:c("NoReactions")}]),[c]),v=(0,a.I4)((()=>{n&&(h(!0),l({chatId:n.id,enabledReactions:Z}))}),[n,Z,l]);(0,a.d4)((()=>{h(!1),m(!1),P(t)}),[t]);const g=(0,a.Ye)((()=>e?.filter((({isInactive:e})=>!e))),[e]),E=(0,a.I4)((e=>{P("all"===e?{type:"all"}:"some"===e?{type:"some",allowed:"some"===t?.type?t.allowed:[]}:void 0),m(!0)}),[t]),C=(0,a.I4)((e=>{if(!n||!g)return;const{name:t,checked:a}=e.currentTarget;if("some"===Z?.type){const e={emoticon:t};P(a?{type:"some",allowed:[...Z.allowed,e]}:{type:"some",allowed:Z.allowed.filter((t=>!(0,r.Hl)(t,e)))})}m(!0)}),[g,n,Z]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading"},c("AvailableReactions")),a.ZP.createElement(Dl.Z,{selected:Z?.type||"none",name:"reactions",options:p,onChange:E}),a.ZP.createElement("p",{className:"section-info mt-4"},"all"===Z?.type&&c("EnableAllReactionsInfo"),"some"===Z?.type&&c("EnableSomeReactionsInfo"),!Z&&c("DisableReactionsInfo"))),"some"===Z?.type&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading"},c("AvailableReactions")),g?.map((({reaction:t,title:n})=>a.ZP.createElement("div",{className:"ListItem"},a.ZP.createElement(As.Z,{name:t.emoticon,checked:Z?.allowed.some((e=>(0,r.Hl)(t,e))),label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(as.Z,{reaction:t,availableReactions:e}),n),onChange:C})))))),a.ZP.createElement(na.Z,{isShown:d,onClick:v,ariaLabel:c("Save"),disabled:u},u?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})))}))),NZ="Please provide first name",wZ=(0,a.X$)((0,s.c$)(((e,{userId:t})=>{const n=(0,l.dyD)(e,t),a=(0,l.Z1J)(e,t),s=(0,l.ccz)(e,t),{progress:i}=(0,l.jUK)(e).management,o=a&&(0,r.i4)(a,(0,l.dZI)(e),(0,l.NJL)(e)),c=s?.personalPhoto;return{user:n,progress:i,isMuted:o,personalPhoto:c,notPersonalPhoto:s?.profilePhoto||s?.fallbackPhoto}}))((({userId:e,user:t,progress:n,isMuted:l,onClose:c,isActive:d,personalPhoto:m,notPersonalPhoto:u})=>{const{updateContact:h,deleteContact:Z,closeManagement:P,uploadContactProfilePhoto:p}=(0,s.Sv)(),[v,g,E]=(0,k.Z)(),[C,b,f]=(0,k.Z)(),[y,I]=(0,a.eJ)(!1),[S,N]=(0,a.eJ)(),w=(0,M.Z)();(0,pe.Z)({isActive:d,onBack:c});const T=t&&t.firstName||"",A=t&&t.lastName||"",[R,L]=(0,a.eJ)(T),[B,F]=(0,a.eJ)(A),[x,D]=(0,a.eJ)(!l);(0,a.d4)((()=>{D(!l)}),[l]),(0,a.d4)((()=>{I(!1),E()}),[E,e]),(0,a.d4)((()=>{L(T),F(A)}),[T,A,t]),(0,a.d4)((()=>{n===i.wv.Complete&&(I(!1),N(void 0),E())}),[E,n]);const O=(0,a.I4)((e=>{L(e.target.value),I(!0),S===NZ&&N(void 0)}),[S]),U=(0,a.I4)((e=>{F(e.target.value),I(!0)}),[]),_=(0,a.I4)((e=>{D(e.target.checked),I(!0)}),[]),$=(0,a.I4)((()=>{const t=R.trim(),n=B.trim();t.length?h({userId:e,isMuted:!x,firstName:t,lastName:n}):N(NZ)}),[R,B,h,e,x]),j=(0,a.I4)((()=>{Z({userId:e}),E(),P()}),[E,P,Z,e]),V=(0,a.sO)(null),G=(0,a.sO)(!1),H=(0,a.I4)((()=>{V.current?.click(),G.current=!0}),[]),J=(0,a.I4)((()=>{V.current?.click(),G.current=!1}),[]),z=(0,a.I4)((()=>{f(),I(!0),p({userId:e})}),[f,p,e]),X=(0,a.I4)((t=>{I(!0),p({userId:e,file:t,isSuggest:G.current})}),[p,e]);if(!t)return;const Y=!(0,r.cS)(t)&&t.id!==o.awM,q=n===i.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(ns.Z,{userId:t.id,avatarSize:"jumbo",noStatusOrTyping:!0,noEmojiStatus:!0,withFullInfo:!0}),a.ZP.createElement(us.Z,{id:"user-first-name",label:w("UserInfo.FirstNamePlaceholder"),onChange:O,value:R,error:S===NZ?S:void 0}),a.ZP.createElement(us.Z,{id:"user-last-name",label:w("UserInfo.LastNamePlaceholder"),onChange:U,value:B}),a.ZP.createElement("div",{className:"ListItem narrow"},a.ZP.createElement(As.Z,{checked:x,label:w("Notifications"),subLabel:w(x?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:_}))),Y&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"camera-add",ripple:!0,onClick:H},a.ZP.createElement("span",{className:"list-item-ellipsis"},w("UserInfo.SuggestPhoto",t.firstName))),a.ZP.createElement(jn.Z,{icon:"camera-add",ripple:!0,onClick:J},a.ZP.createElement("span",{className:"list-item-ellipsis"},w("UserInfo.SetCustomPhoto",t.firstName))),m&&a.ZP.createElement(jn.Z,{leftElement:a.ZP.createElement(yt.Z,{photo:u,noPersonalPhoto:!0,peer:t,size:"mini",className:"personal-photo"}),ripple:!0,onClick:b},w("UserInfo.ResetCustomPhoto")),a.ZP.createElement("p",{className:"text-muted",dir:"auto"},w("UserInfo.CustomPhotoInfo",t.firstName))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(jn.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:g},w("DeleteContact")))),a.ZP.createElement(na.Z,{isShown:y,onClick:$,disabled:q,ariaLabel:w("Save")},q?a.ZP.createElement(we.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon icon-check"})),a.ZP.createElement(Xn.Z,{isOpen:v,onClose:E,text:w("AreYouSureDeleteContact"),confirmLabel:w("DeleteContact"),confirmHandler:j,confirmIsDestructive:!0}),a.ZP.createElement(Xn.Z,{isOpen:C,onClose:f,text:w("UserInfo.ResetToOriginalAlertText",t.firstName),confirmLabel:w("Reset"),confirmHandler:z,confirmIsDestructive:!0}),a.ZP.createElement(Gc.Z,{onChange:X,inputRef:V}))}))),MZ=(0,a.X$)((0,s.c$)((e=>({managementType:(0,l.pPq)(e)})))((({chatId:e,currentScreen:t,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:o,onChatMemberSelect:r,onClose:l,isActive:c,managementType:d})=>{switch(t){case i.u1.Initial:switch(d){case"user":return a.ZP.createElement(wZ,{key:e,userId:e,onClose:l,isActive:c});case"group":return a.ZP.createElement(iZ,{key:e,chatId:e,onScreenSelect:o,onClose:l,isActive:c||[i.u1.ChatPrivacyType,i.u1.Discussion,i.u1.GroupPermissions,i.u1.ChatAdministrators,i.u1.GroupRemovedUsers,i.u1.GroupUserPermissionsCreate,i.u1.GroupUserPermissions,i.u1.ChatAdminRights,i.u1.ChatNewAdminRights,i.u1.GroupRecentActions].includes(t)});case"channel":return a.ZP.createElement(Yh,{key:e,chatId:e,onScreenSelect:o,onClose:l,isActive:c||[i.u1.ChannelSubscribers,i.u1.ChatAdministrators,i.u1.ChannelRemovedUsers,i.u1.Discussion,i.u1.ChatPrivacyType,i.u1.ChatAdminRights,i.u1.ChatNewAdminRights,i.u1.GroupRecentActions].includes(t)})}break;case i.u1.ChatPrivacyType:return a.ZP.createElement(Kh,{chatId:e,isActive:c,onClose:l});case i.u1.Discussion:return a.ZP.createElement(eZ,{chatId:e,onScreenSelect:o,isActive:c,onClose:l});case i.u1.GroupPermissions:return a.ZP.createElement(hZ,{chatId:e,onScreenSelect:o,onChatMemberSelect:r,isActive:c||[i.u1.GroupRemovedUsers,i.u1.GroupUserPermissionsCreate,i.u1.GroupUserPermissions].includes(t),onClose:l});case i.u1.ChannelRemovedUsers:case i.u1.GroupRemovedUsers:return a.ZP.createElement(Qh,{chatId:e,isActive:c,onClose:l});case i.u1.GroupUserPermissionsCreate:return a.ZP.createElement(PZ,{chatId:e,onChatMemberSelect:r,onScreenSelect:o,isActive:c||[i.u1.GroupUserPermissions].includes(t),onClose:l});case i.u1.GroupUserPermissions:return a.ZP.createElement(ZZ,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:o,isActive:c,onClose:l});case i.u1.ChatAdministrators:return a.ZP.createElement(qh,{chatId:e,onScreenSelect:o,onChatMemberSelect:r,isActive:c||[i.u1.ChatAdminRights,i.u1.ChatNewAdminRights,i.u1.GroupRecentActions].includes(t),onClose:l});case i.u1.ChatNewAdminRights:case i.u1.ChatAdminRights:return a.ZP.createElement(oZ,{chatId:e,isNewAdmin:t===i.u1.ChatNewAdminRights,selectedUserId:n,isPromotedByCurrentUser:s,onScreenSelect:o,isActive:c,onClose:l});case i.u1.ChannelSubscribers:case i.u1.GroupMembers:return a.ZP.createElement(cZ,{chatId:e,isActive:c,onClose:l});case i.u1.Invites:return a.ZP.createElement(yZ,{chatId:e,isActive:c,onClose:l,onScreenSelect:o});case i.u1.EditInvite:return a.ZP.createElement(EZ,{chatId:e,isActive:c,onClose:l,onScreenSelect:o});case i.u1.GroupAddAdmins:return a.ZP.createElement(cZ,{chatId:e,noAdmins:!0,isActive:c,onClose:l,onScreenSelect:o,onChatMemberSelect:r});case i.u1.Reactions:return a.ZP.createElement(kZ,{chatId:e,isActive:c,onClose:l});case i.u1.InviteInfo:return a.ZP.createElement(CZ,{chatId:e,isActive:c,onClose:l});case i.u1.JoinRequests:return a.ZP.createElement(SZ,{chatId:e,isActive:c,onClose:l})}}))),TZ=/^4\d/,AZ=/^5[1-5]/,RZ=/^2[2-7]\d{2}/,LZ=/^220[0-4]/;let BZ=function(e){return e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard",e[e.Mir=3]="Mir",e}({});const FZ={[BZ.Default]:"",[BZ.Visa]:"visa",[BZ.Mastercard]:"mastercard",[BZ.Mir]:"mir"};function xZ(e){return e=e.replace(/\s/g,""),TZ.test(e)?BZ.Visa:LZ.test(e)?BZ.Mir:AZ.test(e)||RZ.test(e)?BZ.Mastercard:BZ.Default}const DZ={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},OZ=(e,t)=>{switch(t.type){case"changeAddress1":return{...e,streetLine1:t.payload,formErrors:{...e.formErrors,streetLine1:void 0}};case"changeAddress2":return{...e,streetLine2:t.payload,formErrors:{...e.formErrors,streetLine2:void 0}};case"changeCity":return{...e,city:t.payload,formErrors:{...e.formErrors,city:void 0}};case"changeState":return{...e,state:t.payload,formErrors:{...e.formErrors,state:void 0}};case"changeCountry":return{...e,countryIso2:t.payload.iso2,billingCountry:t.payload.defaultName,formErrors:{...e.formErrors,countryIso2:void 0}};case"changePostCode":return{...e,postCode:t.payload,formErrors:{...e.formErrors,postCode:void 0}};case"changeFullName":return{...e,fullName:t.payload,formErrors:{...e.formErrors,fullName:void 0}};case"changeEmail":return{...e,email:t.payload,formErrors:{...e.formErrors,email:void 0}};case"changePhone":return{...e,phone:t.payload,formErrors:{...e.formErrors,phone:void 0}};case"changeShipping":return{...e,shipping:t.payload};case"changeCardNumber":return{...e,cardNumber:t.payload,formErrors:{...e.formErrors,cardNumber:void 0}};case"changeCardholder":return{...e,cardholder:t.payload,formErrors:{...e.formErrors,cardholder:void 0}};case"changeExpiryDate":return{...e,expiry:t.payload,formErrors:{...e.formErrors,expiry:void 0}};case"changeCvvCode":return{...e,cvv:t.payload,formErrors:{...e.formErrors,cvv:void 0}};case"changeBillingCountry":return{...e,billingCountry:t.payload,formErrors:{...e.formErrors,billingCountry:void 0}};case"changeBillingZip":return{...e,billingZip:t.payload,formErrors:{...e.formErrors,billingZip:void 0}};case"changeSaveInfo":return{...e,saveInfo:t.payload};case"changeSaveCredentials":return{...e,saveCredentials:t.payload};case"updateUserInfo":return t.payload.country?{...e,...t.payload,billingCountry:t.payload.country}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};case"setTipAmount":return{...e,tipAmount:t.payload};case"changeSavedCredentialId":return{...e,savedCredentialId:t.payload};case"resetState":return{...DZ};default:return e}},UZ={root:"SM3T4awhZJvKn_c8aRuY",description:"RWoBZem6PCNMF5hu6Shs","checkout-picture":"prUKJGh6W9LIyjSnRbZc",checkoutPicture:"prUKJGh6W9LIyjSnRbZc",text:"xUG3uFeTiPPFkWHQELCc","checkout-title":"MO45Rkd2ksVxfzAONvQ6",checkoutTitle:"MO45Rkd2ksVxfzAONvQ6","checkout-description":"LqaZe1TRdNI17BEa1gcl",checkoutDescription:"LqaZe1TRdNI17BEa1gcl","price-info":"mz2vhtmYPNRaJbeUrXKA",priceInfo:"mz2vhtmYPNRaJbeUrXKA","price-info-item":"Ct9Ine31cu5h7FCjtRWa",priceInfoItem:"Ct9Ine31cu5h7FCjtRWa","price-info-item-main":"JduVB3d3NxN9TybmxIgS",priceInfoItemMain:"JduVB3d3NxN9TybmxIgS","price-info-item-title":"O7d8G4OQ_yTJSHiHbgBR",priceInfoItemTitle:"O7d8G4OQ_yTJSHiHbgBR",tipsList:"zsSyrAOxg0qs0nPJWSEe",tipsItem:"lcjeIUsdqs95BdK_oysT",tipsItem_active:"XRnGKO5ClzA_4S8i81wC",tipsItemActive:"XRnGKO5ClzA_4S8i81wC","invoice-info":"MyMLGHhiEKOVIoG3aQTS",invoiceInfo:"MyMLGHhiEKOVIoG3aQTS",provider:"hLVHJSaVspSZdzxNlBJk",stripe:"nrKVVKzRmr7s0TE15uG1",smartglocal:"oONvjFUTa5AbWvrbzbWn","checkout-info-item-info-title":"bkIqUpVUAY04wdT8fySX",checkoutInfoItemInfoTitle:"bkIqUpVUAY04wdT8fySX","checkout-info-item-info-data":"VAzhVfK6c1pUriepo4Ga",checkoutInfoItemInfoData:"VAzhVfK6c1pUriepo4Ga","tos-checkbox":"WjrdCzbl3hROmSBGGnjy",tosCheckbox:"WjrdCzbl3hROmSBGGnjy"},_Z=(0,a.X$)((({chat:e,invoice:t,prices:n,shippingPrices:o,checkoutInfo:l,currency:c,totalPrice:d,isTosAccepted:m,dispatch:u,onAcceptTos:h,tipAmount:Z,needAddress:P,hasShippingOptions:p,savedCredentials:v})=>{const{setPaymentStep:g}=(0,s.Sv)(),E=(0,M.Z)(),C=Boolean(u),{photo:b,title:f,text:y,termsUrl:I,suggestedTipAmounts:S,maxTipAmount:k}=t||{},{paymentMethod:N,paymentProvider:w,shippingAddress:T,name:A,phone:R,shippingMethod:L}=l||{},B=(0,H.Z)((0,r.O9)(b)),F=(0,a.I4)((e=>{u({type:"setTipAmount",payload:k?Math.min(e,k):e})}),[u,k]),x=(0,a.I4)((()=>{g({step:v?.length?i.KB.SavedPayments:i.KB.PaymentInfo})}),[v?.length,g]),D=(0,a.I4)((()=>{g({step:i.KB.ShippingInfo})}),[g]),O=(0,a.I4)((()=>{g({step:i.KB.Shipping})}),[g]);return a.ZP.createElement("div",{className:UZ.root},a.ZP.createElement("div",{className:UZ.description},B&&a.ZP.createElement("img",{className:UZ.checkoutPicture,src:B,draggable:!1,alt:""}),!B&&b&&a.ZP.createElement(Ma.Z,{width:b.dimensions?.width,height:b.dimensions?.height,className:UZ.checkoutPicture,forceAspectRatio:!0}),a.ZP.createElement("div",{className:UZ.text},a.ZP.createElement("h5",{className:UZ.checkoutTitle},f),y&&a.ZP.createElement("div",{className:UZ.checkoutDescription},(0,te.Z)(y,["br","links","emoji"])))),a.ZP.createElement("div",{className:UZ.priceInfo},n&&n.map((e=>$Z(E.code,e.label,e.amount,c))),o&&o.map((e=>$Z(E.code,e.label,e.amount,c))),S&&S.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:UZ.priceInfoItem},a.ZP.createElement("div",{className:UZ.priceInfoItemTitle},f),a.ZP.createElement("div",null,(0,ei.x)(Z,c,E.code))),a.ZP.createElement("div",{className:UZ.tipsList},S.map((e=>a.ZP.createElement("div",{key:e,className:(0,ce.Z)(UZ.tipsItem,e===Z&&UZ.tipsItem_active),onClick:u?()=>F(e===Z?0:e):void 0},(0,ei.x)(e,c,E.code,!0)))))),void 0!==d&&$Z(E.code,E("Checkout.TotalAmount"),d,c,!0)),a.ZP.createElement("div",{className:UZ.invoiceInfo},jZ({title:N||v?.[0].title,label:E("PaymentCheckoutMethod"),icon:"card",onClick:C?x:void 0}),w&&jZ({title:w,label:E("PaymentCheckoutProvider"),customIcon:(0,ce.Z)(UZ.provider,UZ[w.toLowerCase()])}),(P||!C)&&jZ({title:T,label:E("PaymentShippingAddress"),icon:"location",onClick:C?D:void 0}),A&&jZ({title:A,label:E("PaymentCheckoutName"),icon:"user"}),R&&jZ({title:R,label:E("PaymentCheckoutPhoneNumber"),icon:"phone"}),(p||!C)&&jZ({title:L,label:E("PaymentCheckoutShippingMethod"),icon:"truck",onClick:C?O:void 0}),I&&(U=I,a.ZP.createElement(As.Z,{label:function(t,n){const s=E("PaymentCheckoutAcceptRecurrent",e?.title).split("*");return a.ZP.createElement(a.ZP.Fragment,null,s[0],a.ZP.createElement(ur.Z,{url:t,text:s[1],isRtl:n}),s.slice(2))}(U,E.isRtl),name:"checkout_tos",checked:Boolean(m),className:UZ.tosCheckbox,tabIndex:0,onCheck:h}))));var U}));function $Z(e,t,n,s,i=!1){return a.ZP.createElement("div",{className:(0,ce.Z)(UZ.priceInfoItem,i&&UZ.priceInfoItemMain)},a.ZP.createElement("div",{className:UZ.priceInfoItemTitle},t),a.ZP.createElement("div",null,(0,ei.x)(n,s,e)))}function jZ({title:e,label:t,icon:n,customIcon:s,onClick:i}){return a.ZP.createElement(jn.Z,{multiline:Boolean(e&&t!==e),icon:n,inactive:!i,onClick:i},s&&a.ZP.createElement("i",{className:(0,ce.Z)("icon",s)}),a.ZP.createElement("div",{className:UZ.checkoutInfoItemInfoTitle},e||t),e&&t!==e&&a.ZP.createElement("p",{className:UZ.checkoutInfoItemInfoData},t))}const VZ=(0,a.X$)((({url:e,noRedirect:t,onClose:n})=>{const{openTelegramLink:i}=(0,s.Sv)(),r=(0,M.Z)(),l=(0,a.I4)((e=>{try{const a=JSON.parse(e.data),{eventType:s,eventData:r}=a;if("web_app_open_tg_link"!==s)return;if(!t){const e=o.zHP+r.path_full;i({url:e})}n()}catch(e){}}),[n,t,i]);return(0,a.d4)((()=>(window.addEventListener("message",l),()=>window.removeEventListener("message",l))),[l]),a.ZP.createElement("div",{className:"ConfirmPayment"},a.ZP.createElement("iframe",{src:e,title:r("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"}))})),GZ=(0,a.X$)((0,s.c$)((e=>{const{payment:t}=(0,l.jUK)(e);return{error:t.error?.message,passwordHint:e.twoFaSettings.hint,savedCredentials:t.savedCredentials}}))((({isActive:e,error:t,state:n,savedCredentials:i,passwordHint:o,onPasswordChange:r})=>{const{clearPaymentError:l}=(0,s.Sv)(),c=(0,M.Z)(),[d,m]=(0,a.eJ)(!1),u=(0,a.Ye)((()=>i?.length&&n.savedCredentialId?i.find((({id:e})=>e===n.savedCredentialId))?.title:void 0),[i,n.savedCredentialId]);return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement(Ml.Z,{isBig:!0,isPasswordVisible:d}),a.ZP.createElement(wl.Z,{error:t?c(t):void 0,hint:o,description:c("PaymentConfirmationMessage",u),placeholder:c("Password"),clearError:l,shouldShowSubmit:!1,shouldResetValue:e,isPasswordVisible:d,onChangePasswordVisibility:m,onInputChange:r}))})));var HZ=n(96625);function JZ(e,t=400){(0,a.d4)((()=>{g.$b||setTimeout((()=>{(0,Z.WM)((()=>{e.current?.focus()}))}),t)}),[e,t])}const zZ=n.p+"mastercard.790db81f7978635f77d8.svg",XZ=n.p+"mir.e3a390b90e2e3e292621.svg",YZ=n.p+"visa.538e537ba818f53b0a8f.svg",qZ=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,M.Z)(),i=(0,a.sO)(null);JZ(i);const[o,r]=(0,a.eJ)(BZ.Default);(0,a.d4)((()=>{const t=xZ(e);r(t)}),[]);const l=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),a=xZ(e.target.value);r(a),n(t)}),[n]),c=function(e){switch(e){case BZ.Mastercard:return a.ZP.createElement("img",{src:zZ,draggable:!1,alt:""});case BZ.Visa:return a.ZP.createElement("img",{src:YZ,draggable:!1,alt:""});case BZ.Mir:return a.ZP.createElement("img",{src:XZ,draggable:!1,alt:""});default:return}}(o);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement(us.Z,{ref:i,label:s("PaymentCardNumber"),onChange:l,value:e,inputMode:"numeric",className:o?"has-right-addon":"",error:t,tabIndex:0,maxLength:23,teactExperimentControlled:!0}),a.ZP.createElement("span",{className:"right-addon"},c))})),KZ=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,M.Z)(),i=(0,a.I4)((t=>{const a=t.target.value;e.endsWith("/")&&e.length>a.length?n(a):n(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t?.[0]&&Number(t[0])>12&&(t[0]="12"),t?.[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(t.target.value))}),[n,e]);return a.ZP.createElement(us.Z,{label:s("PaymentCardExpireDate"),onChange:i,value:e,error:t,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})})),WZ=(0,a.X$)((({state:e,canSaveCredentials:t,needCardholderName:n,needCountry:s,needZip:i,countryList:o,dispatch:r})=>{const l=(0,a.sO)(null);(0,a.d4)((()=>{l.current&&l.current.value!==e.billingCountry&&(l.current.value=e.billingCountry)}),[e.billingCountry]);const c=(0,a.I4)((e=>{r({type:"changeCardNumber",payload:e})}),[r]),d=(0,a.I4)((e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[r]),m=(0,a.I4)((e=>{r({type:"changeExpiryDate",payload:e})}),[r]),u=(0,a.I4)((e=>{const t=e.target.value.replace(/[^0-9]/g,"");r({type:"changeCvvCode",payload:t})}),[r]),h=(0,a.I4)((e=>{r({type:"changeBillingCountry",payload:e.target.value})}),[r]),Z=(0,a.I4)((e=>{r({type:"changeBillingZip",payload:e.target.value})}),[r]),P=(0,a.I4)((e=>{r({type:"changeSaveCredentials",payload:e.target.value})}),[r]),p=(0,M.Z)(),{formErrors:v={}}=e;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,p("PaymentCardTitle")),a.ZP.createElement(qZ,{onChange:c,value:e.cardNumber,error:v.cardNumber}),n&&a.ZP.createElement(us.Z,{label:p("Checkout.NewCard.CardholderNamePlaceholder"),onChange:d,value:e.cardholder,inputMode:"text",tabIndex:0,error:v.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(KZ,{value:e.expiry,onChange:m,error:v.expiry}),a.ZP.createElement(us.Z,{label:p("lng_payments_card_cvc"),onChange:u,value:e.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:v.cvv,teactExperimentControlled:!0})),s||i?a.ZP.createElement("h5",null,p("PaymentBillingAddress")):void 0,s&&a.ZP.createElement(HZ.Z,{label:p("PaymentShippingCountry"),onChange:h,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:v.billingCountry,tabIndex:0,ref:l},o.map((({defaultName:t,name:n})=>a.ZP.createElement("option",{value:t,className:"county-item",selected:t===e.billingCountry},t||n)))),i&&a.ZP.createElement(us.Z,{label:p("PaymentShippingZipPlaceholder"),onChange:Z,value:e.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:v.billingZip}),a.ZP.createElement(As.Z,{label:p("PaymentCardSavePaymentInformation"),checked:!!t&&e.saveCredentials,tabIndex:0,onChange:P,disabled:!t}),a.ZP.createElement("p",{className:"description"},p(t?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"))))})),QZ=(0,a.X$)((({state:e,savedCredentials:t,dispatch:n,onNewCardClick:s})=>{const i=(0,M.Z)(),o=(0,a.Ye)((()=>t?.length?t.map((({id:e,title:t})=>({label:t,value:e}))):Wn.D),[t]),r=(0,a.I4)((e=>{n({type:"changeSavedCredentialId",payload:e})}),[n]);return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,i("PaymentCardTitle")),a.ZP.createElement(Dl.Z,{name:"saved-credentials",options:o,selected:e.savedCredentialId,onChange:r}),a.ZP.createElement(Y.Z,{isText:!0,onClick:s},i("PaymentCheckoutMethodNewCard"))))})),eP=(0,a.X$)((({state:e,shippingOptions:t,currency:n,dispatch:s})=>{const i=(0,M.Z)();(0,a.d4)((()=>{t&&t.length&&!e.shipping&&s({type:"changeShipping",payload:t[0].id})}),[t,e.shipping,s]);const o=(0,a.I4)((e=>{s({type:"changeShipping",payload:e})}),[s]),r=(0,a.Ye)((()=>t.map((({id:e,title:t,amount:a})=>({label:t,subLabel:(0,ei.x)(a,n,i.code),value:e})))),[t,n,i.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,i("PaymentShippingMethod")),a.ZP.createElement(Dl.Z,{name:"shipping-options",options:r,onChange:o,selected:e.shipping})))})),tP=(0,a.X$)((({state:e,needEmail:t,needPhone:n,needName:s,needAddress:i,countryList:o,dispatch:r})=>{const l=(0,a.sO)(null),c=(0,a.sO)(null),d=(0,a.sO)(null);(0,a.d4)((()=>{d.current&&d.current.value!==e.countryIso2&&(d.current.value=e.countryIso2)}),[e.countryIso2]);const m=(0,M.Z)();JZ(l);const u=(0,a.I4)((e=>{r({type:"changeAddress1",payload:e.target.value})}),[r]),h=(0,a.I4)((e=>{r({type:"changeAddress2",payload:e.target.value})}),[r]),Z=(0,a.I4)((e=>{r({type:"changeCity",payload:e.target.value})}),[r]),P=(0,a.I4)((e=>{r({type:"changeState",payload:e.target.value})}),[r]),p=(0,a.I4)((e=>{r({type:"changeCountry",payload:o.find((t=>t.iso2===e.target.value))})}),[o,r]),v=(0,a.I4)((e=>{r({type:"changePostCode",payload:e.target.value})}),[r]),g=(0,a.I4)((e=>{r({type:"changeFullName",payload:e.target.value})}),[r]),E=(0,a.I4)((e=>{r({type:"changeEmail",payload:e.target.value})}),[r]),C=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,c.current&&(c.current.value=t),r({type:"changePhone",payload:t})}),[r]),b=(0,a.I4)((e=>{r({type:"changeSaveInfo",payload:e.target.value})}),[r]),{formErrors:f}=e;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,i?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,m("PaymentShippingAddress")),a.ZP.createElement(us.Z,{ref:l,label:m("PaymentShippingAddress1Placeholder"),onChange:u,value:e.streetLine1,inputMode:"text",tabIndex:0,error:f.streetLine1}),a.ZP.createElement(us.Z,{label:m("PaymentShippingAddress2Placeholder"),onChange:h,value:e.streetLine2,inputMode:"text",tabIndex:0,error:f.streetLine2}),a.ZP.createElement(us.Z,{label:m("PaymentShippingCityPlaceholder"),onChange:Z,value:e.city,inputMode:"text",tabIndex:0,error:f.city}),a.ZP.createElement(us.Z,{label:m("PaymentShippingStatePlaceholder"),onChange:P,value:e.state,inputMode:"text",error:f.state}),a.ZP.createElement(HZ.Z,{label:m("PaymentShippingCountry"),onChange:p,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:f.countryIso2,ref:d,tabIndex:0},o.map((({defaultName:t,name:n,iso2:s})=>a.ZP.createElement("option",{value:s,className:"county-item",selected:s===e.countryIso2},t||n)))),a.ZP.createElement(us.Z,{label:m("PaymentShippingZipPlaceholder"),onChange:v,value:e.postCode,inputMode:"text",tabIndex:0,error:f.postCode})):void 0,s||t||n?a.ZP.createElement("h5",null,m("PaymentShippingReceiver")):void 0,s&&a.ZP.createElement(us.Z,{label:m("PaymentShippingName"),onChange:g,value:e.fullName,inputMode:"text",tabIndex:0,error:f.fullName}),t&&a.ZP.createElement(us.Z,{label:m("PaymentShippingEmailPlaceholder"),onChange:E,value:e.email,inputMode:"email",tabIndex:0,error:f.email}),n&&a.ZP.createElement(us.Z,{label:m("PaymentShippingPhoneNumber"),onChange:C,value:e.phone,inputMode:"tel",tabIndex:0,error:f.phone,ref:c}),a.ZP.createElement(As.Z,{label:m("PaymentShippingSave"),subLabel:m("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),tabIndex:0,onChange:b})))})),nP="stripe",aP="smartglocal",sP=new Set([nP,aP]),iP=(0,a.X$)((0,s.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:i,invoiceContainer:o,nativeProvider:r,nativeParams:c,passwordMissing:d,error:m,confirmPaymentUrl:u,inputInvoice:h,requestId:Z,stripeCredentials:P,smartGlocalCredentials:p,savedCredentials:v,temporaryPassword:g,isExtendedMedia:E}=(0,l.jUK)(e).payment,C=h&&"chatId"in h?(0,l.Z1J)(e,h.chatId):void 0,b=Boolean(i&&(!r||!sP.has(r))),{needCardholderName:f,needCountry:y,needZip:I}=c||{},{isNameRequested:S,isShippingAddressRequested:k,isPhoneRequested:N,isEmailRequested:w,shouldSendPhoneToProvider:M,shouldSendEmailToProvider:T,currency:A,prices:R}=o||{};return{step:t,chat:C,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:r,passwordMissing:d,isNameRequested:S,isShippingAddressRequested:k,isPhoneRequested:N,isEmailRequested:w,shouldSendPhoneToProvider:M,shouldSendEmailToProvider:T,currency:A,prices:R,isProviderError:b,invoice:i,needCardholderName:f,needCountry:y,needZip:I,error:m,confirmPaymentUrl:u,countryList:e.countryList.general,requestId:Z,hasShippingOptions:Boolean(n?.length),smartGlocalToken:p?.token,stripeId:P?.id,savedCredentials:v,passwordValidUntil:g?.validUntil,isExtendedMedia:E}}))((({isOpen:e,onClose:t,step:n,chat:o,shippingOptions:r,savedInfo:l,canSaveCredentials:c,isNameRequested:d,isShippingAddressRequested:m,isPhoneRequested:u,isEmailRequested:h,shouldSendPhoneToProvider:Z,shouldSendEmailToProvider:P,currency:p,passwordMissing:v,isProviderError:g,invoice:E,nativeProvider:C,prices:b,needCardholderName:f,needCountry:y,needZip:I,confirmPaymentUrl:S,error:N,countryList:w,hasShippingOptions:T,requestId:A,smartGlocalToken:R,stripeId:L,savedCredentials:B,passwordValidUntil:F,isExtendedMedia:x})=>{const{loadPasswordInfo:O,validateRequestedInfo:U,sendPaymentForm:_,setPaymentStep:$,sendCredentialsInfo:j,clearPaymentError:V,validatePaymentPassword:G}=(0,s.Sv)(),H=(0,M.Z)(),[J,z,X]=(0,k.Z)(),[q,W]=(0,cl.Z)(OZ,DZ),[Q,ee]=(0,a.eJ)(!1),[te,ae]=(0,a.eJ)(!1),[se,ie]=(0,a.eJ)(""),oe=(0,D.Z)(n,!0),re=(0,D.Z)(A),le=n!==i.KB.ConfirmPayment,de=(0,a.I4)((e=>{$({step:e})}),[$]);(0,a.d4)((()=>{e&&(ie(""),O(),z())}),[e,O,z]),(0,a.d4)((()=>{!e&&J&&X()}),[X,J,e]),(0,a.d4)((()=>{(void 0!==n||N)&&ee(!1)}),[n,N,A]),(0,a.d4)((()=>{n!==i.KB.Checkout||n!==oe||A===re||q.savedCredentialId||q.cardNumber||de(i.KB.PaymentInfo)}),[q.cardNumber,q.savedCredentialId,re,oe,A,de,n]),(0,a.d4)((()=>{N?.field&&W({type:"setFormErrors",payload:{[N.field]:N.message}})}),[N,W]),(0,a.d4)((()=>{if(l){const{name:e,phone:t,email:n,shippingAddress:a}=l,{countryIso2:s,...i}=a||{},o=s&&w.find((({iso2:e})=>e===s)).defaultName;W({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...o&&{country:o,countryIso2:s,...i}}})}}),[l,W,w]),(0,a.d4)((()=>{B?.length&&W({type:"changeSavedCredentialId",payload:B[0].id})}),[W,B]);const me=(0,a.I4)((()=>{V()}),[V]),ue=(0,a.Ye)((()=>n!==i.KB.Checkout?0:function(e=[],t,n,a){const s=t?rP(t,n):[];let i=a;return i=e.concat(s||[]).reduce(((e,t)=>e+t.amount),i),i}(b,r,q.shipping,q.tipAmount)),[n,b,r,q.shipping,q.tipAmount]),he=(0,a.Ye)((()=>{if(n===i.KB.Checkout)return function(e,t,n){const a=function(e){const t=xZ(e);return FZ[t]||""}(e.cardNumber),s=a&&e.cardNumber?`${a} *${e.cardNumber.slice(-4)}`:void 0,i=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:o,fullName:r}=e,l=t?oP(t,e.shipping):void 0,c=l?.title;return{paymentMethod:s,paymentProvider:n,shippingAddress:i,name:r,phone:o,shippingMethod:c}}(q,r,C||"")}),[n,q,r,C]),Ze=(0,a.I4)((()=>{de(i.KB.PaymentInfo)}),[de]),Pe=(0,a.I4)((()=>{V()}),[V]),pe=(0,a.I4)((()=>{const{saveInfo:e}=q,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:i,postCode:o,fullName:r,phone:l,email:c}=e;return{name:r,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:i,postCode:o}}}(q);U({requestInfo:t,saveInfo:e})}),[U,q]),ve=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:i,billingZip:o}=e,[r,l]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:r,expiryYear:l,cvv:s,country:i,zip:o}}}(q);j({credentials:e})}),[j,q]),ge=(0,a.I4)((()=>{_({shippingOptionId:q.shipping,saveCredentials:q.saveCredentials,savedCredentialId:q.savedCredentialId,tipAmount:q.tipAmount})}),[_,q]),Ee=(0,a.I4)((()=>{switch(n){case i.KB.ShippingInfo:ee(!0),pe();break;case i.KB.Shipping:de(i.KB.Checkout);break;case i.KB.SavedPayments:de(i.KB.ConfirmPassword);break;case i.KB.ConfirmPassword:if(""===se)return;ee(!0),G({password:se});break;case i.KB.PaymentInfo:ee(!0),ve(),W({type:"changeSavedCredentialId",payload:""});break;case i.KB.Checkout:{if(l&&!A&&!q.shipping)return ee(!0),void pe();if(q.savedCredentialId&&(!F||F<=Date.now()/1e3-3))return void de(i.KB.ConfirmPassword);if(!q.savedCredentialId&&(C===nP&&!L||C===aP&&!R))return void de(i.KB.PaymentInfo);const{phone:e,email:t,fullName:n}=q;if(m&&!A||h&&!t||u&&!e||d&&!n)return void de(i.KB.ShippingInfo);if(m&&!q.shipping)return void de(i.KB.Shipping);ee(!0),ge();break}}}),[h,d,u,m,C,F,W,q,A,l,ve,ge,de,R,n,L,se,G,pe]);(0,a.d4)((()=>n===i.KB.ConfirmPassword?(0,ga.Z)({onEnter:Ee}):void 0),[Ee,n]);const Ce=(0,a.I4)((()=>{W({type:"resetState"}),ae(!1),t()}),[t,W]),be=(0,a.I4)((()=>{de(n===i.KB.ConfirmPassword?i.KB.SavedPayments:i.KB.Checkout)}),[de,n]),fe=(0,a.Ye)((()=>{switch(n){case i.KB.Checkout:return H("PaymentCheckout");case i.KB.ShippingInfo:return H("PaymentShippingInfo");case i.KB.Shipping:return H("PaymentShippingMethod");case i.KB.SavedPayments:return H("PaymentCheckoutMethod");case i.KB.ConfirmPassword:return H("Checkout.PasswordEntry.Title");case i.KB.PaymentInfo:return H("PaymentCardInfo");case i.KB.ConfirmPayment:return H("Checkout.WebConfirmation.Title");default:return""}}),[n,H]),ye=n===i.KB.Checkout?H("Checkout.PayPrice",(0,ei.x)(ue,p,H.code)):H("Next");if(g)return a.ZP.createElement(ne.Z,{className:"error",isOpen:J,onClose:X,onCloseAnimationEnd:Ce},a.ZP.createElement("p",null,"Sorry, Telegram Web A doesn't support payments with this provider yet. ",a.ZP.createElement("br",null),"Please use one of our mobile apps to do this."),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{isText:!0,onClick:X},H("OK"))));const Ie=function(){if(Q)return!0;switch(n){case i.KB.Checkout:return Boolean(E?.isRecurring&&!te);case i.KB.PaymentInfo:return Boolean(""===q.cardNumber||f&&""===q.cardholder||""===q.cvv||""===q.expiry);default:return!1}}();return a.ZP.createElement(ne.Z,{className:(0,ce.Z)("PaymentModal",E?.isRecurring&&"recurring"),isOpen:J,onClose:X,onCloseAnimationEnd:Ce},a.ZP.createElement("div",{className:"header",dir:H.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n===i.KB.Checkout?X:be,ariaLabel:"Close"},a.ZP.createElement("i",{className:(0,ce.Z)("icon",n===i.KB.Checkout?"icon-close":"icon-arrow-left")})),a.ZP.createElement("h3",null,fe)),void 0!==n?a.ZP.createElement(K.ZP,{name:"slide",activeKey:n},a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case i.KB.Checkout:return a.ZP.createElement(_Z,{chat:o,prices:b,dispatch:W,shippingPrices:q.shipping&&r?rP(r,q.shipping):void 0,totalPrice:ue,invoice:E,checkoutInfo:he,currency:p,hasShippingOptions:T,tipAmount:q.tipAmount,needAddress:Boolean(m),savedCredentials:B,isTosAccepted:te,onAcceptTos:ae});case i.KB.SavedPayments:return a.ZP.createElement(QZ,{state:q,savedCredentials:B,dispatch:W,onNewCardClick:Ze});case i.KB.ConfirmPassword:return a.ZP.createElement(GZ,{state:q,savedCredentials:B,onPasswordChange:ie,isActive:e===n});case i.KB.PaymentInfo:return a.ZP.createElement(WZ,{state:q,dispatch:W,canSaveCredentials:Boolean(!v&&c),needCardholderName:f,needCountry:y,needZip:I,countryList:w});case i.KB.ShippingInfo:return a.ZP.createElement(tP,{state:q,dispatch:W,needAddress:Boolean(m),needEmail:Boolean(h||P),needPhone:Boolean(u||Z),needName:Boolean(d),countryList:w});case i.KB.Shipping:return a.ZP.createElement(eP,{state:q,dispatch:W,shippingOptions:r||[],currency:p});case i.KB.ConfirmPayment:return a.ZP.createElement(VZ,{url:S,noRedirect:x,onClose:X});default:return}}(n))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(we.Z,{color:"gray"})),le&&a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(Y.Z,{type:"submit",onClick:Ee,disabled:Ie,isLoading:Q},ye)),N&&!N.field&&function(){if(N)return a.ZP.createElement(ne.Z,{className:"error",isOpen:Boolean(N),onClose:me},a.ZP.createElement("h4",null,N.description||"Error"),a.ZP.createElement("p",null,N.description||"Error"),a.ZP.createElement("div",{className:"dialog-buttons mt-2"},a.ZP.createElement(Y.Z,{isText:!0,onClick:Pe},H("OK"))))}())})));function oP(e,t){return e.find((({id:e})=>e===t))}function rP(e,t){const n=oP(e,t);return n?.prices}const lP=(0,a.X$)((0,s.c$)((e=>{const{receipt:t}=(0,l.jUK)(e).payment,{currency:n,prices:a,info:s,totalAmount:i,credentialsTitle:o,shippingPrices:r,shippingMethod:c,photo:d,text:m,title:u,tipAmount:h}=t||{};return{currency:n,prices:a,info:s,tipAmount:h,totalAmount:i,credentialsTitle:o,shippingPrices:r,shippingMethod:c,photo:d,text:m,title:u}}))((({isOpen:e,onClose:t,prices:n,shippingPrices:s,tipAmount:i,totalAmount:o,currency:r,info:l,photo:c,text:d,title:m,credentialsTitle:u,shippingMethod:h})=>{const Z=(0,M.Z)(),[P,p,v]=(0,k.Z)();(0,a.d4)((()=>{e&&p()}),[e,p]);const g=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=a?.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:i,name:o}=t;return{paymentMethod:e,shippingAddress:s,name:o,phone:i,shippingMethod:n}}(u,l,h)),[l,h,u]),E=(0,a.Ye)((()=>({photo:c,text:d,title:m,amount:o,currency:r})),[r,c,d,m,o]);return a.ZP.createElement(ne.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:P,onClose:v,onCloseAnimationEnd:t},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(Y.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:v,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon icon-close"})),a.ZP.createElement("h3",null," ",Z("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(_Z,{prices:n,shippingPrices:s,totalPrice:o,tipAmount:i,invoice:E,checkoutInfo:g,currency:r}))))}))),cP=(0,a.X$)((({chatId:e,userIds:t})=>{const{sendInviteMessages:n,closeInviteViaLinkModal:i}=(0,s.Sv)(),o=(0,M.Z)(),[l,c]=(0,a.eJ)([]);(0,a.d4)((()=>{t&&c(t)}),[t]);const d=(0,T.Z)((()=>i())),m=(0,T.Z)((()=>i())),u=(0,a.I4)((()=>{n({chatId:e,userIds:l}),i()}),[l,e]),h=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId;return t?.map((t=>(0,r.Js)(e[t]))).join(", ")}),[t]);return a.ZP.createElement(ne.Z,{isOpen:Boolean(t&&e),title:o("SendInviteLink.InviteTitle"),onClose:d,isSlim:!0},a.ZP.createElement("p",{className:"rSporml7GduY_xOM5_K0"},(0,te.Z)(o("SendInviteLink.TextAvailableSingleUser",h),["simple_markdown"])),a.ZP.createElement(Qn.Z,{itemIds:t,selectedIds:l??[],onSelectedIdsChange:c}),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:u,disabled:!l?.length},o("SendInviteLink.ActionInvite")),a.ZP.createElement(Y.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},o("SendInviteLink.ActionSkip"))))}))},93490:(e,t,n)=>{n.d(t,{Z:()=>h});var a=n(60748),s=n(83716),i=n(57773),o=n(42797),r=n(60706),l=n(28183),c=n(97799);const d=[0,50],m=[0,20],u=[20,0],h=(0,a.X$)((({isPasswordVisible:e,isBig:t})=>{const[n,h]=(0,r.Z)(!1),[Z,P]=(0,r.Z)(!1),{isMobile:p}=(0,o.ZP)(),v=p?s.qpg:s.z7m;(0,l.Z)(P,2e3);const g=(0,a.I4)(h,[h]);return a.ZP.createElement("div",{id:"monkey",className:t?"big":""},!n&&a.ZP.createElement("div",{className:"monkey-preview"}),a.ZP.createElement(c.Z,{size:t?s.K2q:v,className:Z?"hidden":"shown",tgsUrl:i.l.MonkeyClose,playSegment:d,noLoop:!0,onLoad:g}),a.ZP.createElement(c.Z,{size:t?s.K2q:v,className:Z?"shown":"hidden",tgsUrl:i.l.MonkeyPeek,playSegment:e?m:u,noLoop:!0}))}))},76857:(e,t,n)=>{n.d(t,{Z:()=>r,j:()=>i});var a=n(83716),s=n(74095);const i=Math.min(navigator.hardwareConcurrency||4,4);let o;function r(){return a.Cgt?[]:(o||(o=new Array(i).fill(void 0).map((()=>{const e=new Worker(new URL(n.p+n.u(4680),n.b));return{worker:e,connector:(0,s.K)(e)}}))),o)}}}]);
|
||
//# sourceMappingURL=3779.ef6bd0713071a3cff8a6.js.map
|