telegram-tt/dist/3779.f36c3c587d1b7b752d4a.js
Alexander Zinchuk 7152377b03 [Build]
2022-09-12 13:33:17 +02:00

2 lines
404 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[3779],{46276:(e,t,n)=>{n.r(t),n.d(t,{AboutAdsModal:()=>An,ArchivedChats:()=>Xi,AttachmentModal:()=>Jl,BotAttachModal:()=>Et,BotCommandMenu:()=>fr,BotCommandTooltip:()=>Cr,BotTrustModal:()=>pt,CalendarModal:()=>ct,ChatFolderModal:()=>ji,ContactList:()=>$i,ContextMenuContainer:()=>Zl,CustomEmojiSetsModal:()=>fl,CustomSendMenu:()=>Ir,DeleteFolderDialog:()=>Ct,DeleteMessageModal:()=>Rn,Dialogs:()=>qe,DropArea:()=>yr.Z,EmojiInteractionAnimation:()=>Jn,EmojiTooltip:()=>Sr,ForwardPicker:()=>ze,GifSearch:()=>_r,GiftPremiumModal:()=>In,HeaderMenuContainer:()=>yl,HistoryCalendar:()=>dt,InlineBotTooltip:()=>Fr,LeftSearch:()=>La,Management:()=>Oo,MediaViewer:()=>Re,MentionTooltip:()=>_l,MessageSelectToolbar:()=>On,MessageStatistics:()=>lo,MobileSearch:()=>Sl,NewChat:()=>Vi,NewChatStep1:()=>Ui,NewChatStep2:()=>_i,NewContactModal:()=>ut,Notifications:()=>We,PaymentModal:()=>dc,PinMessageModal:()=>Ln,PollModal:()=>zl,PollResults:()=>oo,PremiumLimitReachedModal:()=>Mn,PremiumMainModal:()=>Cn,ReactorListModal:()=>Gn,ReceiptModal:()=>hc,RightSearch:()=>Dr,SafeLinkModal:()=>et,SeenByModal:()=>$n,SendAsMenu:()=>xr,Settings:()=>Oi,SponsoredMessageContextMenuContainer:()=>gl,Statistics:()=>eo,StickerSearch:()=>Ur,StickerSetModal:()=>El,StickerTooltip:()=>br,SymbolMenu:()=>pr,TextFormatter:()=>kr.Z,UnpinAllMessagesModal:()=>Fn,UrlAuthModal:()=>at,WebAppModal:()=>gt});var a=n(14050),s=n(91713),i=n(33555),l=n(83158),r=n(11192),o=n(10396),c=n(23989),d=n(77361),m=n(83716),u=n(74399),h=n(43858),v=n(3858),P=n(55254);function Z(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===s.bZ.ProfileAvatar||t===s.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===s.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===s.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function g(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 p(e,t){Object.assign(e.style,t)}function E(e,t){let n,a;switch(e){case s.bZ.Album:case s.bZ.ScheduledAlbum:n=`.Transition__slide--active > .MessageList #album-media-${(0,l.d0)(t.id)}`,a=".full-media";break;case s.bZ.SharedMedia:n=`#shared-media${(0,l.d0)(t.id)}`,a="img";break;case s.bZ.SearchResult:n=`#search-media${(0,l.d0)(t.id)}`,a="img";break;case s.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition__slide--active .ChatInfo .Avatar",a=".avatar-media";break;case s.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto",a=".avatar-media";break;case s.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto",a=".avatar-media";break;case s.bZ.ScheduledInline:case s.bZ.Inline:default:n=`.Transition__slide--active > .MessageList #${(0,l.d0)(t.id)}`,a=".message-content .full-media, .message-content .thumbnail"}const i=document.querySelector(n),r=i&&i.querySelectorAll(a);return{container:i,mediaEl:null==r?void 0:r[r.length-1]}}function C(e,t){switch(t){case s.bZ.Album:case s.bZ.ScheduledAlbum:case s.bZ.Inline:case s.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case s.bZ.SharedMedia:case s.bZ.SettingsAvatar:case s.bZ.ProfileAvatar:case s.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case s.bZ.MiddleHeaderAvatar:e.classList.add("circle")}}var f=n(996),b=n(60706),I=n(65326),y=n(18674),k=n(46590),N=n(59107),S=n(87204),w=n(6137),M=n(6202),T=n(92566),A=n(96264),R=n(29290),L=n(71394);const F=new Map;const x=e=>{var t;let{message:n,mediaId:i=0,avatarOwner:r,origin:o,delay:c}=e;const d=n?(0,l.O$)(n):void 0,m=n?(0,l.b7)(n):void 0,h=n?(0,l.F$)(n):void 0,v=n?(0,l.Cg)(n):void 0,P=!!n&&(0,l.rl)(n),Z=!!n&&(0,l.hC)(n),g=n?(0,l.c0)(n):void 0,p=null==r||null===(t=r.photos)||void 0===t?void 0:t[i],E=Boolean(null==p?void 0:p.isVideo),C=Boolean(m||v||Z),f=Boolean(!C&&(d||h||P)),{isGif:b}=m||v||{},y=o===s.bZ.SharedMedia,k=o===s.bZ.SearchResult,N=(0,a.Ye)((()=>e=>r?p?p.isVideo&&e?(0,l.Dk)(p):0===i?(0,l.RT)(r,e?"big":"normal"):`photo${p.id}?size=c`:(0,l.RT)(r,e?"big":"normal"):n&&(0,l.Ti)(n,e?"viewerFull":"viewerPreview")),[r,n,p,i]),S=(0,M.Z)(n&&(y||k)&&(0,l.Ti)(n,"pictogram"),void 0,w.IU.BlobUrl,void 0,c),x=N(),B=(0,M.Z)(x,void 0,w.IU.BlobUrl,void 0,c),{mediaData:D,loadProgress:O}=(0,T.Z)(N(!0),void 0,n&&(0,l.kG)(n,"viewerFull"),void 0,c),$=d||m?(d||m).blobUrl:void 0;let U=!C&&($||D)||B||S;const _=function(e){const t=(0,a.sO)();let n=!1;(0,R.Z)((()=>{if(n=!0,t.current=void 0,!e)return;const a=new Image;if(a.src=e,!a.width)return;const s=(0,L.ao)(a);(0,A.Z)(s.getContext("2d"),0,0,s.width,s.height,2,2),t.current=s.toDataURL()}),[e]);const s=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;const s=(0,a.sO)(e?F.get(e):void 0),i=(0,a.sO)(),l=(0,I.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,L.ao)(a);(0,A.Z)(t.getContext("2d"),0,0,t.width,t.height,2,2);const n=t.toDataURL();s.current=n,l(),F.size>=1e3&&F.clear(),F.set(e,n)},n?i.current=window.setTimeout((()=>{a.src=e}),n):a.src=e}),[e,n,l,t]),s.current}(e||void 0,Boolean(t.current));return t.current||!n&&s||e||void 0}(!U&&n&&(0,l.DH)(n));U||o===s.bZ.SearchResult||(U=_),E&&B&&(U=B);const G=n?(0,l.ep)(n):r?`avatar${r.id}.${null!=r&&r.hasVideoAvatar?"mp4":"jpg"}`:void 0;let V;return n?P||Z?V=(0,l.aE)(n).mediaSize:d||h?V=(0,l.bV)(d||h):(m||v)&&(V=(0,l.jC)(m||v)):V=E?u.Fp:u.vY,{getMediaHash:N,photo:d,video:m,webPagePhoto:h,webPageVideo:v,isVideo:C,isPhoto:f,isGif:b,isDocumentPhoto:P,isDocumentVideo:Z,fileName:G,bestImageData:U,dimensions:V,isFromSharedMedia:y,avatarPhoto:p,isVideoAvatar:E,localBlobUrl:$,fullMediaBlobUrl:D,previewBlobUrl:B,pictogramBlobUrl:S,loadProgress:O,videoSize:g}};var B=n(66534),D=n(231),O=n(40126),$=n(2255),U=n(53106),_=n(58964),G=n(39196);const V=(0,a.X$)((0,i.c$)(((e,t)=>{let{message:n}=t;return{isDownloading:!!n&&(0,r.te)(e,n),isProtected:(0,r.EV)(e,n)}}))((e=>{let{mediaData:t,isVideo:n,message:s,fileName:r,isAvatar:o,isDownloading:c,isProtected:m,canReport:u,onReport:h,onCloseMediaViewer:v,zoomLevelChange:P,setZoomLevelChange:Z,onForward:g}=e;const{downloadMessageMedia:p,cancelMessageMediaDownload:E}=(0,i.Sv)(),{loadProgress:C}=(0,T.Z)(s&&(0,l.Ti)(s,"download"),!c,s&&(0,l.kG)(s,"download")),f=(0,a.I4)((()=>{c?E({message:s}):p({message:s})}),[E,p,c,s]),b=(0,a.I4)((()=>{Z((P<0?P:0)-1)}),[Z,P]),I=(0,a.I4)((()=>{Z((P>0?P:0)+1)}),[Z,P]),y=(0,N.Z)(),k=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",className:n?"active":void 0,onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);if(d.wB){if(m)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(U.Z,{trigger:k,positionX:"right"},!o&&a.ZP.createElement(_.Z,{icon:"forward",onClick:g},y("Forward")),n?a.ZP.createElement(_.Z,{icon:c?"close":"download",onClick:f},c?`${Math.round(100*C)}% Downloading...`:"Download"):a.ZP.createElement(_.Z,{icon:"download",href:t,download:r},y("AccActionDownload")),u&&a.ZP.createElement(_.Z,{icon:"flag",onClick:h},y("ReportPeer.Report"))),c&&a.ZP.createElement(G.Z,{progress:C,size:"s",noCross:!0}))}return a.ZP.createElement("div",{className:"MediaViewerActions"},!o&&!m&&a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("Forward"),onClick:g},a.ZP.createElement("i",{className:"icon-forward"})),function(){if(!m)return n?a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("AccActionDownload"),onClick:f},c?a.ZP.createElement(G.Z,{progress:C,size:"s",onClick:f}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(D.Z,{href:t,download:r,round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"}))}(),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("MediaZoomOut"),onClick:b},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("MediaZoomIn"),onClick:I},a.ZP.createElement("i",{className:"icon-zoom-in"})),u&&a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y(n?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:h},a.ZP.createElement("i",{className:"icon-flag"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:y("Close"),onClick:v},a.ZP.createElement("i",{className:"icon-close"})))})));var J=n(9933),X=n(46752),z=n(64963),j=n(28712),H=n(69118),q=n(67360),Y=n(28183),W=n(12255),K=n(49204);const Q=e=>{let{text:t="",isHidden:n,isForVideo:s,onClick:i,isProtected:l}=e;const[r,o]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;o(t>2*u.Gw)};t();const n=(0,H.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const c=(0,X.Z)("MediaViewerFooter",s&&"is-for-video",n&&"is-hidden",l&&"is-protected");return a.ZP.createElement("div",{className:c,onClick:function(e){t&&e.stopPropagation()}},t&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:d.wB?void 0:i},a.ZP.createElement("p",{className:"media-text custom-scroll "+(r?"multiline":""),dir:"auto"},t)))};var ee=n(12019);const te=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var ne=n(31212),ae=n(46898),se=n(74753),ie=n(790),le=n(2155),re=n(18051),oe=n(52328);const ce=e=>{e.stopPropagation()},de=[.5,1,1.5,2],me=e=>{let{bufferedRanges:t,bufferedProgress:n,currentTime:s,duration:i,fileSize:l,isForceMobileVersion:r,isPlayed:o,isFullscreenSupported:c,isFullscreen:m,isVisible:u,isBuffered:h,volume:v,isMuted:P,playbackRate:Z,onChangeFullscreen:g,onVolumeClick:p,onVolumeChange:E,onPlaybackRateChange:C,onPlayPause:f,setVisibility:I,onSeek:y}=e;const[k,S,w]=(0,b.Z)(),M=(0,a.sO)(null),T=(0,a.sO)(!1),A=T.current;(0,a.d4)((()=>{if(!d.$b)return;let e;if(u&&o&&!A&&!k)return e=window.setTimeout((()=>{I(!1)}),3e3),()=>{e&&window.clearTimeout(e)};e&&window.clearTimeout(e)}),[o,u,A,I,k]),(0,a.d4)((()=>(u?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[u]),(0,a.d4)((()=>{u||w()}),[w,u]);const R=(0,N.Z)(),L=(0,a.I4)((e=>{if(T.current&&M.current){const{width:t,left:n}=M.current.getBoundingClientRect(),a=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;y(Math.max(Math.min(i*((a-n)/t),i),0))}}),[i,y]),F=(0,a.I4)((e=>{T.current=!0,L(e)}),[L]),x=(0,a.I4)((()=>{T.current=!1}),[]);(0,a.d4)((()=>{if(M.current&&u)return(0,z.sf)(M.current,{onCapture:F,onRelease:x,onClick:x,onDrag:L})}),[u,F,L,x]);const B=(0,a.Ye)((()=>0===v||P?"icon-muted":v<.3?"icon-volume-1":v<.6?"icon-volume-2":"icon-volume-3"),[v,P]);return a.ZP.createElement("div",{className:(0,X.Z)("VideoPlayerControls",r&&"mobile",u&&"active"),onClick:ce},function(e,t,n,s){const i=e/t*100;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},n.map((e=>{let{start:t,end:n}=e;return a.ZP.createElement("div",{className:"player-seekline-buffered",style:`left: ${100*t}%; right: ${100-100*n}%`})})),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${i||0}%`})))}(s,i,t,M),a.ZP.createElement("div",{className:"buttons"},a.ZP.createElement(D.Z,{ariaLabel:R("AccActionPlay"),size:"tiny",ripple:!d.wB,color:"translucent-white",className:"play",round:!0,onClick:f},a.ZP.createElement("i",{className:o?"icon-pause":"icon-play"})),a.ZP.createElement(D.Z,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:p},a.ZP.createElement("i",{className:B})),!d.cj&&a.ZP.createElement(re.Z,{bold:!0,className:"volume-slider",value:P?0:100*v,onChange:E}),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,ie.k9)(e)} / ${(0,ie.k9)(t)}`)}(s,i),!h&&a.ZP.createElement("div",{className:"player-file-size"},`${(0,le.sS)(R,l*n)} / ${(0,le.sS)(R,l)}`),a.ZP.createElement("div",{className:"spacer"}),a.ZP.createElement(D.Z,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:S},`${Z}x`),c&&a.ZP.createElement(D.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:g},a.ZP.createElement("i",{className:m?"icon-smallscreen":"icon-fullscreen"}))),a.ZP.createElement(oe.Z,{isOpen:k,className:(0,X.Z)("playback-rate-menu",!c&&"no-fullscreen"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:w},de.map((e=>a.ZP.createElement(_.Z,{disabled:Z===e,onClick:()=>C(e)},`${e}x`)))))};function ue(){return ue=Object.assign||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},ue.apply(this,arguments)}const he=(0,a.X$)((e=>{let{url:t,isGif:n,posterData:s,posterSize:l,loadProgress:r,fileSize:o,isMediaViewerOpen:c,noPlay:m,volume:u,isMuted:h,playbackRate:P,onClose:Z,toggleControls:g,areControlsVisible:p,isProtected:E}=e;const{setMediaViewerVolume:C,setMediaViewerMuted:f,setMediaViewerPlaybackRate:b}=(0,i.Sv)(),I=(0,a.sO)(null),[y,k]=(0,a.eJ)(!d.$b||!d.cj),[N,S]=(0,a.eJ)(0),[w,M,T]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(te&&document[te]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(te&&document[te]))},a=()=>{s(!0)},i=()=>{s(!1),t(!1)},l=e.current;return document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),l&&(l.addEventListener("webkitbeginfullscreen",a,!1),l.addEventListener("webkitendfullscreen",i,!1)),()=>{document.removeEventListener("fullscreenchange",n,!1),document.removeEventListener("webkitfullscreenchange",n,!1),document.removeEventListener("mozfullscreenchange",n,!1),l&&(l.removeEventListener("webkitbeginfullscreen",a,!1),l.removeEventListener("webkitendfullscreen",i,!1))}}),[]),te||"iOS"===d.Lt?[n,()=>{e.current&&(te||"iOS"===d.Lt)&&(e.current.requestFullscreen?e.current.requestFullscreen():e.current.webkitRequestFullscreen?e.current.webkitRequestFullscreen():e.current.webkitEnterFullscreen?e.current.webkitEnterFullscreen():e.current.mozRequestFullScreen&&e.current.mozRequestFullScreen(),s(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),s(!1))}]:[!1]}(I,k),A=(0,a.I4)((()=>{g(!0)}),[g]),R=(0,a.I4)((e=>{var t;const n=null===(t=I.current)||void 0===t?void 0:t.getBoundingClientRect();n&&(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&g(!1)}),[g]),{isBuffered:L,bufferedRanges:F,bufferingHandlers:x,bufferedProgress:B}=(0,ee.Z)(),{shouldRender:O,transitionClassNames:$}=(0,ne.Z)(!L,void 0,void 0,"slow"),{shouldRender:U,transitionClassNames:_}=(0,ne.Z)(d.cj&&!y&&!O,void 0,void 0,"slow");(0,a.d4)((()=>{m||!c?I.current.pause():t&&!d.$b&&(0,se.Z)(I.current)}),[m,c,t]),(0,a.d4)((()=>{I.current.currentTime===I.current.duration?(S(0),k(!1)):S(I.current.currentTime)}),[N]),(0,a.d4)((()=>{I.current.volume=u}),[u]),(0,a.d4)((()=>{I.current.playbackRate=P}),[P]);const V=(0,a.I4)((e=>{e.stopPropagation(),y?(I.current.pause(),k(!1)):((0,se.Z)(I.current),k(!0))}),[y]);(0,ae.Z)(I,[]);const J=(0,a.I4)((e=>{S(e.currentTarget.currentTime)}),[]),X=(0,a.I4)((()=>{S(0),k(!1),g(!0)}),[g]),z=(0,a.I4)((()=>{w&&T?T():!w&&M&&M()}),[T,w,M]),j=(0,a.I4)((e=>{I.current.currentTime=e}),[]),H=(0,a.I4)((e=>{C({volume:e/100})}),[C]),q=(0,a.I4)((()=>{f({isMuted:!h})}),[h,f]),Y=(0,a.I4)((e=>{b({playbackRate:e})}),[b]);(0,a.d4)((()=>{if(!c)return;const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),V(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[V,c]);const W=l&&`width: ${l.width}px; height: ${l.height}px`,K=`background-image: url(${s})`;return a.ZP.createElement("div",{className:"VideoPlayer",onMouseMove:d.$b?void 0:A,onMouseOut:d.$b?void 0:R},a.ZP.createElement("div",{style:W},E&&a.ZP.createElement("div",{onContextMenu:v.Z,onDoubleClick:d.$b?void 0:z,onClick:d.wB?void 0:V,className:"protector"}),a.ZP.createElement("video",ue({ref:I,autoPlay:d.$b,controlsList:E?"nodownload":void 0,playsInline:!0,loop:n,muted:n||h,id:"media-viewer-video",style:K,onPlay:d.cj?()=>k(!0):void 0,onEnded:X,onClick:d.wB?void 0:V,onDoubleClick:d.$b?void 0:z},x,{onTimeUpdate:J}),t&&a.ZP.createElement("source",{src:t}))),U&&a.ZP.createElement(D.Z,{round:!0,className:`play-button ${_}`,onClick:V},a.ZP.createElement("i",{className:"icon-play"})),O&&a.ZP.createElement("div",{className:["spinner-container",$].join(" ")},!L&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(G.Z,{size:"xl",progress:L?1:r,square:!0,onClick:Z})),!n&&!O&&a.ZP.createElement(me,{isPlayed:y,bufferedRanges:F,bufferedProgress:B,isBuffered:L,currentTime:N,isFullscreenSupported:Boolean(M),isFullscreen:w,fileSize:o,duration:I.current&&I.current.duration||0,isVisible:p,setVisibility:g,isForceMobileVersion:l&&l.width<400,onSeek:j,onChangeFullscreen:z,onPlayPause:V,volume:u,playbackRate:P,isMuted:h,onVolumeClick:q,onVolumeChange:H,onPlaybackRateChange:Y}))})),ve=(0,a.X$)((0,i.c$)(((e,t)=>{const{chatId:n,threadId:a,mediaId:i,avatarOwnerId:l,origin:o}=t,{volume:c,isMuted:d,playbackRate:m}=e.mediaViewer;if(o===s.bZ.SearchResult){if(!n||!i)return{volume:c,isMuted:d,playbackRate:m};const t=(0,r.hj)(e,n,i);return t?{chatId:n,mediaId:i,senderId:t.senderId,origin:o,message:t,isProtected:(0,r.EV)(e,t),volume:c,isMuted:d,playbackRate:m}:{volume:c,isMuted:d,playbackRate:m}}if(l)return{mediaId:i,senderId:l,avatarOwner:(0,r.dy)(e,l)||(0,r.Z1)(e,l),origin:o,volume:c,isMuted:d,playbackRate:m};if(!(n&&a&&i))return{volume:c,isMuted:d,playbackRate:m};let u;return u=o&&[s.bZ.ScheduledAlbum,s.bZ.ScheduledInline].includes(o)?(0,r.Tm)(e,n,i):(0,r.hj)(e,n,i),u?{chatId:n,threadId:a,mediaId:i,senderId:u.senderId,origin:o,message:u,isProtected:(0,r.EV)(e,u),volume:c,isMuted:d,playbackRate:m}:{volume:c,isMuted:d,playbackRate:m}}))((e=>{const{mediaId:t,isActive:n,avatarOwner:s,chatId:i,message:l,origin:r,animationLevel:o,areControlsVisible:c,isProtected:m,volume:h,playbackRate:P,isMuted:Z,onClose:g,onFooterClick:p,setControlsVisible:E}=e,C=2===o,{isVideo:b,isPhoto:I,bestImageData:y,dimensions:k,isGif:N,isVideoAvatar:S,localBlobUrl:w,fullMediaBlobUrl:M,previewBlobUrl:T,pictogramBlobUrl:A,videoSize:R,loadProgress:L}=x({message:l,avatarOwner:s,mediaId:t,origin:r,delay:C&&350}),F=Boolean(s||t),B=(0,a.I4)((e=>{null==E||E(e)}),[E]);if(s)return S?a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},a.ZP.createElement(he,{key:t,url:w||M,isGif:!0,posterData:y,posterSize:(0,u.PA)(k,!1,!0),loadProgress:L,fileSize:R,isMediaViewerOpen:F&&n,areControlsVisible:c,toggleControls:B,isProtected:m,noPlay:!n,onClose:g,isMuted:!0,volume:0,playbackRate:1})):a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},Pe(M||T,(0,u.PA)(k,!1),!d.wB&&!m,m));if(!l)return;const D=(0,f.X)(l),O=Boolean(D);return a.ZP.createElement("div",{className:(0,X.Z)("MediaViewerContent",O&&"has-footer")},I&&Pe(w||M||T||A,l&&(0,u.PA)(k,O),!d.wB&&!m,m),b&&(n?a.ZP.createElement(he,{key:t,url:w||M,isGif:N,posterData:y,posterSize:l&&(0,u.PA)(k,O,!0),loadProgress:L,fileSize:R,areControlsVisible:c,isMediaViewerOpen:F&&n,toggleControls:B,noPlay:!n,onClose:g,isMuted:Z,isProtected:m,volume:h,playbackRate:P}):function(e,t,n,s){const i=t&&`width: ${t.width}px; height: ${t.height}px`,l=`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:l,className:(0,X.Z)(s&&"is-protected"),draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(K.Z,{color:"white"}))}(y,l&&(0,u.PA)(k,O,!0),!d.wB&&!m,m)),D&&a.ZP.createElement(Q,{text:D,onClick:p,isProtected:m,isHidden:!!d.$b&&!c,isForVideo:b&&!N}))})));function Pe(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,X.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(K.Z,{color:"white"}))}function Ze(){return Ze=Object.assign||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},Ze.apply(this,arguments)}const{easeOutCubic:ge,easeOutQuart:pe}=J.M8,Ee=d.$b?40:0,Ce=350;let fe,be;var Ie;!function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(Ie||(Ie={}));const ye=(0,a.X$)((e=>{let{mediaId:t,getMediaId:n,selectMedia:s,isVideo:i,isGif:l,isPhoto:r,isOpen:o,hasFooter:c,zoomLevelChange:m,animationLevel:u,...h}=e;const v=(0,a.sO)(null),P=(0,a.sO)(null),Z=(0,a.sO)({x:0,y:0,scale:1}),g=(0,a.sO)({x:0,y:0,scale:1}),p=(0,a.sO)(void 0),E=(0,a.sO)(!0),C=(0,a.sO)(!1),[f,b]=(0,a.eJ)(t),y=(0,S.Z)(m),k=void 0!==y&&y!==m,w=(0,I.Z)(),[M,T]=(0,a.eJ)(!1),[A,R]=(0,a.eJ)(!1),{height:L,width:F,isResizing:x}=(0,W.Z)(),{onClose:B}=h,D=(0,N.Z)(),O=(0,a.I4)((e=>{Z.current=e,w()}),[w]),$=(0,q.Z)(s,[],350,!0),U=(0,q.Z)((()=>{p.current=void 0}),[],500,!0),_=(0,q.Z)((e=>{E.current=e,w()}),[w],800,!0),G=l&&!d.cj,V=d.$b?40:F/10,K=(0,a.I4)((e=>{if(!d.$b)return;const t=L-e.pageY<80;!t&&e.pageX<V||!t&&e.pageX>F-V||T(!M)}),[V,M,L,F]);if((0,Y.Z)((()=>T(!0)),450),(0,a.d4)((()=>{if(!v.current||void 0===f)return;let e=g.current;const t={x:0,y:0},a={x:0,y:0},s={x:0,y:0};let i,l,r=Date.now();const o=(0,H.Ds)((()=>{r=Date.now()}),500,!1,!0),c=t=>{const a=n(f,t);if(void 0!==a){const n=(F+Ee)*t;return Z.current.x+=n,E.current=!1,b(a),$(a),_(!0),e={x:0,y:0,scale:1},0===u?(O(e),!0):(fe=(0,J.vr)({from:Z.current.x,to:0,duration:Ce,timing:ge,onUpdate:e=>O({y:0,x:e,scale:1})}),!0)}return!1},m=e=>{if(1!==Z.current.scale)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let t=0;return L-e.pageY<80?[!1,!1]:(e.pageX<V?t=-1:e.pageX>F-V&&(t=1),[0!==t,c(t)])},h=e=>{if(1===Z.current.scale)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},I=function(e){let{x:t,y:n,scale:a}=e,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!i)return[{x:t,y:n,scale:a},!0,!0];let l=!0,r=!0;const o=(F-F*a)/2,c=(L-L*a)/2,d=Math.max(-i.left*a,o),m=F-i.right*a;l=(0,j.Kh)(t,m,d),t=(0,j.uZ)(t,m,d);const u=Math.max(-i.top*a+s,c),h=L-i.bottom*a;return r=(0,j.Kh)(n,h,u),n=(0,j.uZ)(n,h,u),[{x:t,y:n,scale:a},l,r]},y=i=>{if(C.current)return void(C.current=!1);"mouseup"===i.type&&R(!1);const l=Math.abs(Z.current.x),o=Math.abs(Z.current.y),{scale:c,x:d,y:m}=Z.current;if(U(),_(!0),c<1)return e={x:0,y:0,scale:1},void(fe=(0,J.vr)({from:[d,m,c],to:[0,0,1],duration:Ce,timing:ge,onUpdate:e=>O({x:e[0],y:e[1],scale:e[2]})}));if(c>1){const n=Math.min(c,4),l=n/c;let o=d*l+(a.x-l*a.x),u=m*l+(a.y-l*a.y);const h=.15;if("wheel"!==i.type&&e.scale===c){const e=Math.abs(t.x)/(Date.now()-r),n=Math.abs(t.y)/(Date.now()-r);o-=Math.abs(t.x)*e*h*s.x,u-=Math.abs(t.y)*n*h*s.y}return[e]=I({x:o,y:u,scale:n},60),void(fe=(0,J.vr)({from:[d,m,c],to:[e.x,e.y,e.scale],duration:Ce,timing:ge,onUpdate:e=>O({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:d,y:m,scale:c},o>=50)return void B();if(o>0)return void(fe=(0,J.vr)({from:m,to:0,duration:Ce,timing:ge,onUpdate:e=>O({x:0,y:e,scale:c})}));const u=d<0?1:-1,h=n(f,d<0?1:-1),v=s.x<0?-1:1;if(void 0!==h&&l>=50&&u===v){const e=(F+Ee)*u;Z.current.x+=e,b(h),$(h)}fe=(0,J.vr)({from:Z.current.x,to:0,duration:Ce,timing:ge,onUpdate:e=>O({y:0,x:e,scale:Z.current.scale})})},k=(0,z.sf)(v.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls",minZoom:1,maxZoom:4,doubleTapZoom:3,onCapture:e=>{if(Se(e))return;if("mousedown"===e.type&&(R(!0),1!==Z.current.scale))return void e.preventDefault();r=Date.now();const{x:t,y:n,scale:a}=Z.current;if(0===t&&0===n&&1===a){if(!P.current)return;if(l=P.current.querySelector("img, video"),!l)return;i=l.getBoundingClientRect()}},onDrag:(n,a,i,l)=>{let{dragOffsetX:r,dragOffsetY:c}=i;if(C.current||Se(n))return;if(d.cj&&"touchstart"===a.type){const{pageX:e}=a.touches[0];if(e<=z.vJ||e>=F-z.vJ)return}fe&&(fe(),fe=void 0),s.x=t.x-r,s.y=t.y-c,t.x=r,t.y=c;const m=Math.abs(r),u=Math.abs(c),{scale:h,x:v,y:P}=Z.current;if(o(),1===h){if("mousemove"!==n.type){if(p.current!==Ie.Vertical&&(p.current===Ie.Horizontal||Math.abs(v)>10||m/u>1.5)){p.current=Ie.Horizontal,E.current=!1;const e=F+Ee,t=(0,j.uZ)(r,-e,e);return O({x:t,y:0,scale:h}),void("wheel"===n.type&&Math.abs(t)>100&&(y(n),C.current=!0))}if(p.current===Ie.Vertical||Math.abs(P)>10||u/m>1.5){p.current=Ie.Vertical;const e=L,t=(0,j.uZ)(c,-e,e);O({x:0,y:t,scale:h}),"wheel"===n.type&&Math.abs(t)>100&&(y(n),C.current=!0)}}}else{const t=e.x+r,a=e.y+c;if(["wheel","mousemove"].includes(n.type)){const[e,n,s]=I({x:t,y:a,scale:h},60);return l&&l(!n,!s),void O(e)}"touches"in n&&1===n.touches.length&&O({x:t,y:a,scale:h})}},onZoom:(t,n)=>{let{zoom:s,zoomFactor:i,initialCenterX:l,initialCenterY:r,dragOffsetX:o,dragOffsetY:c,currentCenterX:d,currentCenterY:m}=n;fe&&fe(),l=l||F/2,r=r||L/2,d=d||F/2,m=m||L/2;const u=null!=s?s:(0,j.uZ)(e.scale*i,.5,12),h=u/e.scale,v=Math.abs(Math.min(e.x,0)),P=Math.abs(Math.min(e.y,0));a.x=d,a.y=m;const Z=v+l,g=P+r,p=Z-h*Z,E=g-h*g,[C]=I({x:e.x+p+o,y:e.y+E+c,scale:u});O(C)},onClick(t){const[n,a]=m(t);if(n){if(t.preventDefault(),t.stopPropagation(),d.$b)return;a||B()}else 1!==e.scale||d.$b||!G&&Ne(t.target,".VideoPlayer")||B()},onDoubleClick(t,n){let{centerX:a,centerY:s}=n;const[i]=m(t);if(i)return t.preventDefault(),void t.stopPropagation();if(!d.$b&&"wheel"!==t.type)return;const{x:l,y:r,scale:o}=Z.current;if(1===o){if(0!==l||0!==r)return;e=I({x:a-3*a,y:s-3*s,scale:3})[0]}else e={x:0,y:0,scale:1};fe=(0,J.vr)({from:[l,r,o],to:[e.x,e.y,e.scale],duration:Ce,timing:ge,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};O(t)}})},onRelease:y});return document.addEventListener("keydown",h,!1),()=>{k(),document.removeEventListener("keydown",h,!1)}}),[B,O,n,f,F,L,V,G,$,_,U,u,R]),(0,a.d4)((()=>{if(!v.current||!k)return;const{scale:e}=Z.current,t=m>0?-1:1;let n=100,a=0;e<=.6&&t>0||e>=12&&t<0||(1===e&&t>0&&(n=20),be&&be(),be=(0,J.vr)({from:t,to:t*n,duration:Ce,timing:pe,onUpdate:e=>{if(!v.current)return;const t=(0,j.NM)(e-a,2);a=e;const n=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});v.current.dispatchEvent(n)}}))}),[m,k]),void 0===f)return;const Q=n(f,1),ee=n(f,-1),te=void 0!==ee,ne=void 0!==Q,ae=Z.current.x,se=Z.current.y,{scale:ie}=Z.current;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:v},te&&1===ie&&!x&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:ke(-F+ae-Ee)},a.ZP.createElement(ve,Ze({},h,{animationLevel:u,areControlsVisible:M,mediaId:ee}))),a.ZP.createElement("div",{className:(0,X.Z)("MediaViewerSlide","MediaViewerSlide--active",A&&ie>1&&"MediaViewerSlide--moving"),onClick:K,ref:P,style:ke(ae,se,ie)},a.ZP.createElement(ve,Ze({},h,{mediaId:f,animationLevel:u,isActive:E.current,setControlsVisible:T,areControlsVisible:M&&1===ie}))),ne&&1===ie&&!x&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:ke(F+ae+Ee)},a.ZP.createElement(ve,Ze({},h,{animationLevel:u,areControlsVisible:M,mediaId:Q}))),te&&1===ie&&!d.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${i&&!l&&"inline"}`,"aria-label":D("AccDescrPrevious"),dir:D.isRtl?"rtl":void 0}),ne&&1===ie&&!d.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${i&&!l&&"inline"}`,"aria-label":D("Next"),dir:D.isRtl?"rtl":void 0}))}));function ke(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return`transform: translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)});`}function Ne(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function Se(e){const t=e.target;return!!Ne(t,".VideoPlayerControls")&&(Ne(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu")||e.preventDefault(),!0)}var we=n(32340),Me=n(70172);const Te=(0,i.c$)(((e,t)=>{let{chatId:n,messageId:a,isAvatar:s}=t;if(s&&n)return{sender:(0,l.YC)(n)?(0,r.dy)(e,n):(0,r.Z1)(e,n)};if(!a||!n)return{};const i=(0,r.hj)(e,n,a);return{message:i,sender:i&&(0,r.Ur)(e,i)}}))((e=>{let{chatId:t,messageId:n,sender:s,isAvatar:r,message:o}=e;const{closeMediaViewer:c,focusMessage:m,toggleChatInfo:u}=(0,i.Sv)(),h=(0,a.I4)((()=>{c(),d.wB?setTimeout((()=>{u(!1,{forceSyncOnIOs:!0}),m({chatId:t,messageId:n})}),350):m({chatId:t,messageId:n})}),[t,m,u,n,c]),v=(0,N.Z)();if(!s||!o&&!r)return;const P=(0,l.OU)(v,s);return a.ZP.createElement("div",{className:"SenderInfo",onClick:h},(0,l.YC)(s.id)?a.ZP.createElement(Me.Z,{key:s.id,size:"medium",user:s}):a.ZP.createElement(Me.Z,{key:s.id,size:"medium",chat:s}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},P&&(0,we.Z)(P)),a.ZP.createElement("div",{className:"date",dir:"auto"},r?v("lng_mediaview_profile_photo"):(0,ie.ZK)(v,1e3*o.date,!0))))})),Ae=350,Re=(0,a.X$)((0,i.c$)((e=>{const{chatId:t,threadId:n,mediaId:a,avatarOwnerId:i,origin:l}=e.mediaViewer,{animationLevel:o}=e.settings.byKey;let c,d,m,u=!!t&&(0,r.FM)(e,t);if(l===s.bZ.SearchResult){if(!t||!a)return{animationLevel:o};const n=(0,r.hj)(e,t,a);return n?{chatId:t,mediaId:a,senderId:n.senderId,isChatWithSelf:u,origin:l,message:n,animationLevel:o}:{animationLevel:o}}if(i){const t=(0,r.dy)(e,i)||(0,r.Z1)(e,i);return u=(0,r.FM)(e,i),{mediaId:a,senderId:i,avatarOwner:t,isChatWithSelf:u,animationLevel:o,origin:l}}if(!(t&&n&&a))return{animationLevel:o};if(c=l&&[s.bZ.ScheduledAlbum,s.bZ.ScheduledInline].includes(l)?(0,r.Tm)(e,t,a):(0,r.hj)(e,t,a),!c)return{animationLevel:o};if(d=l&&[s.bZ.ScheduledAlbum,s.bZ.ScheduledInline].includes(l)?(0,r.Fn)(e,t):(0,r.Zw)(e,t),l===s.bZ.Inline||l===s.bZ.Album)m=(0,r.qC)(e,t,n)||(0,r.gb)(e,t,n);else if(l===s.bZ.SharedMedia){const t=(0,r.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};m=n}return{chatId:t,threadId:n,mediaId:a,senderId:c.senderId,isChatWithSelf:u,origin:l,message:c,chatMessages:d,collectionIds:m,animationLevel:o}}))((e=>{let{chatId:t,threadId:n,mediaId:r,senderId:v,isChatWithSelf:w,origin:M,avatarOwner:T,message:A,chatMessages:R,collectionIds:L,animationLevel:F}=e;const{openMediaViewer:U,closeMediaViewer:_,openForwardMenu:G,focusMessage:J,toggleChatInfo:X}=(0,i.Sv)(),z=Boolean(T||r),j=(0,a.sO)(),H=(0,S.Z)(v),q=2===F?"slide-fade":"none",Y=2===F,[W,K,Q]=(0,b.Z)(),[ee,te]=(0,a.eJ)(1),{webPagePhoto:ne,webPageVideo:ae,isVideo:se,isPhoto:ie,bestImageData:le,dimensions:re,isGif:oe,isFromSharedMedia:ce,avatarPhoto:de,fileName:me,fullMediaBlobUrl:ue,previewBlobUrl:he}=x({message:A,avatarOwner:T,mediaId:r,delay:Y&&Ae}),ve=!!de&&!w,Pe=ne||ae?r:void 0,Ze=(0,a.Ye)((()=>{return Pe?[Pe]:T?(null===(e=T.photos)||void 0===e?void 0:e.map(((e,t)=>t)))||[]:(0,l.N0)(R||{},L||[],ce);var e}),[Pe,T,R,L,ce]),ge=r?Ze.indexOf(r):-1;!z||H&&H===v&&j.current||(j.current=ge),(0,a.d4)((()=>{d.wB&&document.body.classList.toggle("is-media-viewer-open",z)}),[z]);const pe=(0,I.Z)();(0,a.d4)((()=>{const e=window.matchMedia(u.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",pe):"function"==typeof e.addListener&&e.addListener(pe),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",pe):"function"==typeof e.removeListener&&e.removeListener(pe)}}),[pe]);const Ee=(0,S.Z)(A),Ce=(0,S.Z)(M),fe=(0,S.Z)(T),be=(0,S.Z)(le),Ie=A?(0,f.X)(A):void 0,ke=Boolean(Ie);(0,a.d4)((()=>{Y&&z&&!Ee&&!fe&&((0,y.YW)(Ae+m.fK),function(e,t,n,a,i,l){const{mediaEl:r}=E(t,l);if(!r)return;const{width:o}=h.Z.get(),{width:c,height:v}=(0,u.fM)(e,i),{width:P,height:g}=(0,u.jg)(c,v,a.width,a.height),f=(o-P)/2,b=function(e){const t=window.matchMedia(u.L6);let n=4.125;return e&&!d.$b&&(n+=t.matches?.875:2.125),n*u.Gw}(e)+(v-g)/2;let{top:I,left:y,width:k,height:N}=r.getBoundingClientRect();if([s.bZ.SharedMedia,s.bZ.Album,s.bZ.ScheduledAlbum,s.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,i){if(e===t){const l=Math.max(s,i)*(e/t);a-=(l-s)/2,n-=(l-i)/2,s=l,i=l}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}}(P,g,I,y,k,N);I=e.top,y=e.left,k=e.width,N=e.height}const S=y+k/2-(f+P/2),w=I+N/2-(b+g/2),M=k/P,T=N/g,A=Z(n||r);p(A,{top:`${b}px`,left:`${f}px`,width:`${P}px`,height:`${g}px`,transform:`translate3d(${S}px, ${w}px, 0) scale(${M}, ${T})`}),C(A,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(A),requestAnimationFrame((()=>{A.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(A),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(A)&&document.body.removeChild(A),document.body.classList.remove("ghost-animating")}))}),200+m.fK)}))}))}(ke,M,le,re,se,A)),Y&&!z&&(Ee||fe)&&((0,y.YW)(Ae+m.fK),function(e,t,n){const{container:a,mediaEl:i}=E(e,n);if(!i)return;const l=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!l||!i)return;const{top:r,left:o,width:c,height:d}=l.getBoundingClientRect(),{top:u,left:v,width:f,height:b}=i.getBoundingClientRect();let I=u;if(!(0,P.P)(a)){const{height:e}=h.Z.get();I=u<r?-b:e}const y=o+c/2-(v+f/2),k=r+d/2-(I+b/2);let N=c/f,S=d/b;const w=[s.bZ.Inline,s.bZ.ScheduledInline].includes(e)&&!g(a,i)||[s.bZ.Album,s.bZ.ScheduledAlbum].includes(e)&&!g(a,i);[s.bZ.SharedMedia,s.bZ.Album,s.bZ.ScheduledAlbum,s.bZ.SearchResult].includes(e)&&(N>S?N=S:S>N&&(S=N));const M=document.getElementsByClassName("ghost")[0],T=M||Z(t||i,e);M||p(T,{top:`${I}px`,left:`${v}px`,width:`${f}px`,height:`${b}px`,transform:`translate3d(${y}px, ${k}px, 0) scale(${N}, ${S})`}),requestAnimationFrame((()=>{if(M){const{top:e,left:t,width:n,height:a}=M.getBoundingClientRect();p(T,{transition:"none",top:`${I}px`,left:`${v}px`,transformOrigin:"top left",transform:`translate3d(${t-v}px, ${e-I}px, 0) scale(${n/f}, ${a/b})`,width:`${f}px`,height:`${b}px`})}document.body.classList.add("ghost-animating"),M||document.body.appendChild(T),requestAnimationFrame((()=>{M&&(M.style.transition=""),T.style.transform="",w&&(T.style.opacity="0"),C(T,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")}))}),200+m.fK)}))}))}(Ce,be,Ee||void 0))}),[Y,z,M,Ce,A,Ee,fe,le,be,re,se,ke]);const Ne=(0,a.I4)((()=>{_()}),[_]),Se=(0,a.I4)((()=>{Ne(),d.wB?setTimeout((()=>{X(!1,{forceSyncOnIOs:!0}),J({chatId:t,threadId:n,mediaId:r})}),Ae):J({chatId:t,threadId:n,mediaId:r})}),[Ne,t,n,J,X,r]),we=(0,a.I4)((()=>{G({fromChatId:t,messageIds:[r]})}),[G,t,r]),Me=(0,a.I4)((e=>{U({chatId:t,threadId:n,mediaId:e,avatarOwnerId:null==T?void 0:T.id,origin:M},{forceOnHeavyAnimation:!0})}),[null==T?void 0:T.id,t,U,M,n]);(0,a.d4)((()=>z?(0,c.Z)((()=>{Ne()})):void 0),[Ne,z]),(0,a.d4)((()=>{se&&!oe&&(0,o.Es)()}),[oe,se]),(0,a.d4)((()=>{if(z)return h.Z.disableRefresh(),()=>{h.Z.enableRefresh()}}),[z]);const Re=(0,a.I4)(((e,t)=>{if(void 0===e)return;const n=Ze.indexOf(e);return-1===t&&n>0||1===t&&n<Ze.length-1?Ze[n+t]:void 0}),[Ze]),Le=(0,N.Z)();return(0,k.Z)({isActive:z,onBack:_}),a.ZP.createElement(O.Z,{id:"MediaViewer",isOpen:z},a.ZP.createElement("div",{className:"media-viewer-head",dir:Le.isRtl?"rtl":void 0},d.wB&&a.ZP.createElement(D.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:Le("Close"),onClick:Ne},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement($.Z,{activeKey:j.current,name:q},T?a.ZP.createElement(Te,{key:T.id,chatId:T.id,isAvatar:!0}):a.ZP.createElement(Te,{key:r,chatId:t,messageId:r})),a.ZP.createElement(V,{mediaData:ue||he,isVideo:se,message:A,fileName:me,canReport:ve,onReport:K,onCloseMediaViewer:Ne,onForward:we,zoomLevelChange:ee,setZoomLevelChange:te,isAvatar:Boolean(T)}),a.ZP.createElement(B.Z,{isOpen:W,onClose:Q,subject:"media",photo:de,chatId:null==T?void 0:T.id})),a.ZP.createElement(ye,{mediaId:r,getMediaId:Re,chatId:t,isPhoto:ie,isGif:oe,threadId:n,avatarOwnerId:null==T?void 0:T.id,origin:M,isOpen:z,hasFooter:ke,zoomLevelChange:ee,isVideo:se,animationLevel:F,onClose:Ne,selectMedia:Me,onFooterClick:Se}))})));var Le=n(60782),Fe=n(18360),xe=n(27407),Be=n(72313),De=n(12515),Oe=n(34288),$e=n(13103),Ue=n(97687),_e=n(21273),Ge=n(31876),Ve=n(98799),Je=n(6058);const Xe=(0,a.X$)((e=>{let{isOpen:t,currentUserId:n,chatOrUserIds:s,filterRef:i,filter:r,filterPlaceholder:o,loadMore:c,onFilterChange:d,onSelectChatOrUser:u,onClose:h,onCloseAnimationEnd:v}=e;const P=(0,N.Z)(),[Z,g]=(0,xe.Z)(c,s,Boolean(r)),p=(0,a.I4)((()=>{d("")}),[d]);(0,De.Z)(i,t,p);const E=(0,a.sO)(null),C=(0,a.I4)((e=>{d(e.currentTarget.value)}),[d]),f=(0,Be.Z)(E,t,(e=>{Z&&Z.length>0&&u(Z[-1===e?0:e])}),".ListItem-button",!0),b=a.ZP.createElement("div",{className:"modal-header",dir:P.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("Close"),onClick:h},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Ue.Z,{ref:i,value:r,onChange:C,onKeyDown:f,placeholder:o})),I=s.indexOf(Z[0]);return a.ZP.createElement($e.Z,{isOpen:t,className:"ChatOrUserPicker",header:b,onClose:h,onCloseAnimationEnd:v},null!=Z&&Z.length?a.ZP.createElement(_e.Z,{ref:E,className:"picker-list custom-scroll",items:Z,onLoadMore:g,withAbsolutePositioning:!0,maxHeight:s.length*m.rS,onKeyDown:f},Z.map(((e,t)=>a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable force-rounded-corners",style:`top: ${(I+t)*m.rS}px;`,onClick:()=>u(e)},(0,l.YC)(e)?a.ZP.createElement(Je.Z,{status:e===n?P("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Ve.Z,{chatId:e}))))):Z&&!Z.length?a.ZP.createElement("p",{className:"no-results"},P("lng_blocked_list_not_found")):a.ZP.createElement(Oe.Z,null))})),ze=(0,a.X$)((0,i.c$)((e=>{var t;const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:i,switchBotInline:l}=e;return{chatsById:n,activeListIds:a.active,archivedListIds:a.archived,pinnedIds:s.active,contactIds:null===(t=e.contactList)||void 0===t?void 0:t.userIds,currentUserId:i,switchBotInline:l}}))((e=>{let{chatsById:t,activeListIds:n,archivedListIds:s,pinnedIds:r,contactIds:o,currentUserId:c,isOpen:d,switchBotInline:m}=e;const{setForwardChatId:u,exitForwardMode:h,openChatWithText:v,resetSwitchBotInline:P}=(0,i.Sv)(),Z=(0,N.Z)(),[g,p]=(0,a.eJ)(""),E=(0,a.sO)(null),[C,f,I]=(0,b.Z)();(0,a.d4)((()=>{d&&f()}),[d,f]);const y=(0,a.Ye)((()=>{if(!d)return;let e=r||[];c&&(e=(0,Le.Tw)([c,...e]));const a=[...n||[],...g&&s||[]].filter((e=>{const n=t[e];return n&&(0,l.Qm)(n,w._f)})),m=(0,i.Rd)().users.byId;return(0,l.ih)((0,Le.Tw)([...(0,l.$l)(Z,a,t,g,c),...o?(0,l.kK)(o,m,g):[]]),t,void 0,e)}),[n,s,t,o,c,g,d,Z,r]),k=(0,a.I4)((e=>{if(m){const t=`@${m.botUsername} ${m.query}`;v({chatId:e,text:t}),P()}else u({id:e})}),[v,P,u,m]),S=(0,a.I4)((()=>{h(),P()}),[h,P]),M=(0,Fe.Z)(y,!0);if(d||C)return a.ZP.createElement(Xe,{currentUserId:c,isOpen:d,chatOrUserIds:M,filterRef:E,filterPlaceholder:Z("ForwardTo"),filter:g,onFilterChange:p,onSelectChatOrUser:k,onClose:S,onCloseAnimationEnd:I})})));var je=n(91947);function He(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const qe=(0,a.X$)((0,i.c$)((e=>(0,Le.ei)(e,["dialogs"])))((e=>{let{dialogs:t}=e;const{dismissDialog:n,acceptInviteConfirmation:s,sendMessage:l,showNotification:r}=(0,i.Sv)(),[o,c,d]=(0,b.Z)(),m=(0,N.Z)();var u,h,v;if((0,a.d4)((()=>{t.length>0&&c()}),[t,c]),t.length)return a.ZP.createElement("div",{id:"Dialogs"},Boolean(t.length)&&("hash"in(u=t[t.length-1])?(e=>{const{hash:t,title:i,about:l,participantsCount:c,isChannel:u,photo:h,isRequestNeeded:v}=e,Z=m(u?"Subscribers":"Members",c,"i"),g=m(u?"ChannelJoin":"JoinGroup"),p=m(u?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement($e.Z,{isOpen:o,onClose:d,className:"error",header:P(i,h),onCloseAnimationEnd:n},void 0!==c&&a.ZP.createElement("p",{className:"modal-help"},Z),l&&a.ZP.createElement("p",{className:"modal-about"},(0,we.Z)(l,["br"])),v&&a.ZP.createElement("p",{className:"modal-help"},m(u?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{s({hash:t}),v&&r({message:m(u?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),d()}},v?p:g),a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",onClick:d},m("Cancel")))})(u):"phoneNumber"in u?(h=u,a.ZP.createElement($e.Z,{isOpen:o,onClose:d,className:"confirm",title:m("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:n},m("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",null,a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{l({contact:(0,Le.ei)(h,["firstName","lastName","phoneNumber"])}),d()}},m("OK")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},m("Cancel"))))):(v=u,a.ZP.createElement($e.Z,{isOpen:o,onClose:d,onCloseAnimationEnd:n,className:"error",title:He(v)},v.hasErrorKey?(0,je.ZP)(v):(0,we.Z)(v.message,["simple_markdown","emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(D.Z,{isText:!0,onClick:d},m("OK")))))));function P(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(Me.Z,{size:"small",photo:t}),a.ZP.createElement("div",{className:"modal-title"},(0,we.Z)(e)),a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})))}})));var Ye=n(96937);const We=(0,a.X$)((0,i.c$)((e=>(0,Le.ei)(e,["notifications"])))((e=>{let{notifications:t}=e;const{dismissNotification:n}=(0,i.Sv)();if(t.length)return a.ZP.createElement("div",{id:"Notifications"},t.map((e=>{let{message:t,className:s,localId:i,action:l,actionText:r,title:o}=e;return a.ZP.createElement(Ye.Z,{title:o?(0,we.Z)(o,["simple_markdown","emoji","br","links"]):void 0,action:l,actionText:r,className:s,message:(0,we.Z)(t,["simple_markdown","emoji","br","links"]),onDismiss:()=>n({localId:i})})})))})));var Ke=n(81396),Qe=n(17551);const et=(0,a.X$)((e=>{let{url:t}=e;const{toggleSafeLinkModal:n}=(0,i.Sv)(),s=(0,N.Z)(),l=(0,a.I4)((()=>{window.open((0,Ke.X)(t),"_blank","noopener"),n({url:void 0})}),[n,t]),r=(0,a.I4)((()=>{n({url:void 0})}),[n]),o=(0,Fe.Z)(t);return a.ZP.createElement(Qe.Z,{isOpen:Boolean(t),onClose:r,title:s("OpenUrlTitle"),textParts:(0,we.Z)(s("OpenUrlAlert2",o),["links"]),confirmLabel:s("OpenUrlTitle"),confirmHandler:l})}));var tt=n(14605);const nt="XxZ7KIBUQzsSYf8KZiIc",at=(0,a.X$)((e=>{let{urlAuth:t,currentUser:n}=e;const{closeUrlAuthModal:s,acceptBotUrlAuth:r,acceptLinkUrlAuth:o}=(0,i.Sv)(),[c,d]=(0,a.eJ)(!0),[m,u]=(0,a.eJ)(!0),h=(0,Fe.Z)(t,!1),{domain:v,botId:P,shouldRequestWriteAccess:Z}=(null==h?void 0:h.request)||{},g=P?(0,i.Rd)().users.byId[P]:void 0,p=(0,N.Z)(),E=(0,a.I4)((()=>{null!=t&&t.url&&c?(t.button?r:o)({isWriteAllowed:m}):window.open((0,Ke.X)(null==h?void 0:h.url),"_blank","noopener"),s()}),[t,c,s,r,o,m,h]),C=(0,a.I4)((()=>{s()}),[s]),f=(0,a.I4)((e=>{d(e),u(e)}),[d]);return(0,a.d4)((()=>{v&&(d(!0),u(Boolean(Z)))}),[Z,v]),a.ZP.createElement(Qe.Z,{isOpen:Boolean(null==t?void 0:t.url),onClose:C,title:p("OpenUrlTitle"),confirmLabel:p("OpenUrlTitle"),confirmHandler:E},(0,we.Z)(p("OpenUrlAlert2",null==h?void 0:h.url),["links"]),v&&a.ZP.createElement(tt.Z,{checked:c,label:a.ZP.createElement(a.ZP.Fragment,null,(0,we.Z)(p("Conversation.OpenBotLinkLogin",[v,(0,l.Js)(n)]),["simple_markdown"])),onCheck:f,className:nt}),Z&&a.ZP.createElement(tt.Z,{checked:m,label:a.ZP.createElement(a.ZP.Fragment,null,(0,we.Z)(p("Conversation.OpenBotLinkAllowMessages",(0,l.Js)(g)),["simple_markdown"])),onCheck:u,disabled:!c,className:nt}))})),st=2147483647e3,it=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function lt(e,t,n,a,s){const i=new Date(e,t,n),l=a&&(0,ie.$Y)(a),r=s&&(0,ie.$Y)(s);return!!(r&&i>r)||!!(l&&i<l)}function rt(e){return String(e).padStart(2,"0")}function ot(e,t,n){return`${e}-${t+1}-${n}`}const ct=(0,a.X$)((e=>{let{selectedAt:t,minAt:n,maxAt:s,isFutureMode:i,isPastMode:l,isOpen:r,withTimePicker:o,submitButtonLabel:c,secondButtonLabel:d,onClose:m,onSubmit:u,onSecondButtonClick:h}=e;const v=(0,N.Z)(),P=new Date,Z=(0,a.Ye)((()=>i&&!n?new Date:new Date(Math.max(n||0,0))),[i,n]),g=(0,a.Ye)((()=>l&&!s?new Date:new Date(Math.min(s||st,st))),[l,s]),p=(0,a.Ye)((()=>t?new Date(t):new Date),[t]),E=(0,S.Z)(r),[C,f,I]=(0,b.Z)(!1),[y,k]=(0,a.eJ)(p),[w,M]=(0,a.eJ)(new Date(y.getFullYear(),y.getMonth(),1)),[T,A]=(0,a.eJ)(rt(p.getHours())),[R,L]=(0,a.eJ)(rt(p.getMinutes())),F=ot(y.getFullYear(),y.getMonth(),y.getDate()),x=w.getFullYear(),B=w.getMonth();(0,a.d4)((()=>{!E&&r&&(k(p),M(new Date(p.getFullYear(),p.getMonth(),1)),o&&(A(rt(p.getHours())),L(rt(p.getMinutes()))))}),[p,r,E,o]),(0,a.d4)((()=>{i&&!C&&y.getTime()<Z.getTime()&&(k(Z),A(rt(Z.getHours())),L(rt(Z.getMinutes())))}),[i,C,Z,y]),(0,a.d4)((()=>{l&&!C&&y.getTime()>g.getTime()&&(k(g),A(rt(g.getHours())),L(rt(g.getMinutes())))}),[i,l,C,g,Z,y]),(0,a.d4)((()=>{if(t){const e=new Date(t);k(e),A(rt(e.getHours())),L(rt(e.getMinutes()))}}),[t]);const O=l&&x>=P.getFullYear()&&B>=P.getMonth()||g&&x>=g.getFullYear()&&B>=g.getMonth(),$=i&&x<=P.getFullYear()&&B<=P.getMonth(),{prevMonthGrid:U,currentMonthGrid:_,nextMonthGrid:G}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],i=new Date;i.setDate(1),i.setMonth(t),i.setFullYear(e);const l=i.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<l;e++)n.push(r-l+e+1);for(;i.getMonth()===t;){const e=i.getDate();a.push(e),i.setDate(e+1)}const o=(a.length+n.length)%7;if(o>0)for(let e=1;e<=7-o;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(x,B)),[B,x]),V=(0,a.Ye)((()=>c||function(e,t){const n=(0,ie.xH)(t,e.code);return n===(0,ie.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,ie.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,ie.mr)(e,t)])}(v,y)),[v,y,c]),J=(0,a.I4)((()=>{u(y)}),[u,y]),z=(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),23)),a=new Date(y.getTime());a.setHours(n),k(a);const s=rt(n);A(s),e.target.value=s}),[y]),j=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return L(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(y.getTime());a.setMinutes(n),k(a);const s=rt(n);L(s),e.target.value=s}),[y]);return a.ZP.createElement($e.Z,{isOpen:r,onClose:m,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:m},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,v(`lng_month${B+1}`)," ",x),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",disabled:$,onClick:$?void 0:function(){M((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",disabled:O,onClick:O?void 0:function(){M((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))}},a.ZP.createElement("i",{className:"icon-next"})))),a.ZP.createElement("div",{className:"calendar-wrapper"},a.ZP.createElement("div",{className:"calendar-grid"},it.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,v(e))))),U.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),_.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void k((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(B),n.setFullYear(x),n}));var t},className:(0,X.Z)("day-button",lt(x,B,e,Z,g)?"disabled":e?"clickable":"",F===ot(x,B,e)&&"selected")},Boolean(e)&&a.ZP.createElement("span",null,e)))),G.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),o&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:T,onChange:z,onFocus:f,onBlur:I}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:R,onChange:j,onFocus:f,onBlur:I})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(D.Z,{onClick:J},V),d&&a.ZP.createElement(D.Z,{onClick:h,isText:!0},d)))})),dt=(0,a.X$)((0,i.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})))((e=>{let{isOpen:t,selectedAt:n}=e;const{searchMessagesByDate:s,closeHistoryCalendar:l}=(0,i.Sv)(),r=(0,a.I4)((e=>{s({timestamp:e.valueOf()/1e3}),l()}),[l,s]),o=(0,N.Z)();return a.ZP.createElement(ct,{isOpen:t,selectedAt:n,isPastMode:!0,submitButtonLabel:o("JumpToDate"),onClose:l,onSubmit:r})})));var mt=n(6272);const ut=(0,a.X$)((0,i.c$)(((e,t)=>{let{userId:n}=t;return{user:n?(0,r.dy)(e,n):void 0,userStatus:n?(0,r.ss)(e,n):void 0,serverTimeOffset:e.serverTimeOffset,phoneCodeList:e.countryList.phoneCodes}}))((e=>{var t,n,s;let{isOpen:r,userId:o,isByPhoneNumber:c,user:m,userStatus:u,phoneCodeList:h,serverTimeOffset:v}=e;const{updateContact:P,importContact:Z,closeNewContactDialog:g}=(0,i.Sv)(),p=(0,N.Z)(),E=(0,Fe.Z)(m),C=(0,Fe.Z)(c),f=(0,a.sO)(null),[I,y,k]=(0,b.Z)(),[S,w]=(0,a.eJ)(null!==(t=null==E?void 0:E.firstName)&&void 0!==t?t:""),[M,T]=(0,a.eJ)(null!==(n=null==E?void 0:E.lastName)&&void 0!==n?n:""),[A,R]=(0,a.eJ)(null!==(s=null==E?void 0:E.phoneNumber)&&void 0!==s?s:""),[L,F]=(0,a.eJ)(!0),x=Boolean(S&&(!c||A));(0,a.d4)((()=>{var e,t,n;r&&(y(),w(null!==(e=null==E?void 0:E.firstName)&&void 0!==e?e:""),T(null!==(t=null==E?void 0:E.lastName)&&void 0!==t?t:""),R(null!==(n=null==E?void 0:E.phoneNumber)&&void 0!==n?n:""),F(!0))}),[r,y,null==E?void 0:E.firstName,null==E?void 0:E.lastName,null==E?void 0:E.phoneNumber]),(0,a.d4)((()=>{!d.$b&&I&&setTimeout((()=>{var e;null===(e=f.current)||void 0===e||e.focus()}),200)}),[I]);const B=(0,a.I4)((e=>{w(e.target.value)}),[]),O=(0,a.I4)((e=>{R((0,mt.WZ)(h,e.target.value))}),[h]),$=(0,a.I4)((e=>{T(e.target.value)}),[]),U=(0,a.I4)((()=>{g(),w(""),T(""),R("")}),[g]),_=(0,a.I4)((()=>{c||!o?Z({firstName:S,lastName:M,phoneNumber:A}):P({userId:o,firstName:S,lastName:M,shouldSharePhoneNumber:L})}),[S,Z,c,M,A,L,P,o]);if(r||I)return a.ZP.createElement($e.Z,{className:"NewContactModal",title:p("NewContact"),isOpen:r,onClose:U,onCloseAnimationEnd:k},E&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"NewContactModal__profile",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Me.Z,{size:"jumbo",user:E,text:`${S} ${M}`}),a.ZP.createElement("div",{className:"NewContactModal__profile-info"},a.ZP.createElement("p",{className:"NewContactModal__phone-number"},null!=E&&E.phoneNumber?(0,mt.WZ)(h,E.phoneNumber):p("MobileHidden")),a.ZP.createElement("span",{className:"NewContactModal__user-status",dir:"auto"},(0,l.Tq)(p,E,u,v)))),a.ZP.createElement(Ue.Z,{ref:f,value:S,label:p("FirstName"),tabIndex:0,onChange:B}),a.ZP.createElement(Ue.Z,{value:M,label:p("LastName"),tabIndex:0,onChange:$}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,we.Z)(p("NewContact.Phone.Hidden.Text",(null==E?void 0:E.firstName)||""),["emoji","simple_markdown"])),a.ZP.createElement(tt.Z,{checked:L,tabIndex:0,onCheck:F,label:p("lng_new_contact_share")}),a.ZP.createElement("p",{className:"NewContactModal__help-text"},(0,we.Z)(p("AddContact.SharedContactExceptionInfo",null==E?void 0:E.firstName)))),C&&a.ZP.createElement("div",{className:"NewContactModal__new-contact",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Me.Z,{size:"jumbo",text:`${S} ${M}`}),a.ZP.createElement("div",{className:"NewContactModal__new-contact-fieldset"},a.ZP.createElement(Ue.Z,{ref:f,value:A,inputMode:"tel",label:p("lng_contact_phone"),tabIndex:0,onChange:O}),a.ZP.createElement(Ue.Z,{value:S,label:p("FirstName"),tabIndex:0,onChange:B}),a.ZP.createElement(Ue.Z,{value:M,label:p("LastName"),tabIndex:0,onChange:$}))),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",onClick:U},p("Cancel")),a.ZP.createElement(D.Z,{isText:!0,className:"confirm-dialog-button",disabled:!x,onClick:_},p("Done"))))})));var ht=n(18629),vt=n(62357);const Pt=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),Zt={ok:"OK",cancel:"Cancel",close:"Close"},gt=(0,a.X$)((0,i.c$)(((e,t)=>{let{webApp:n}=t;const{botId:a}=n||{},s=a?e.attachMenu.bots[a]:void 0,i=a?(0,r.dy)(e,a):void 0,l=(0,r.jr)(e),o=(0,r.Pu)(e),{isPaymentModalOpen:c,status:d}=e.payment;return{attachMenuBot:s,bot:i,chat:l,theme:o,isPaymentModalOpen:c,paymentStatus:d}}))((e=>{var t;let{webApp:n,chat:s,bot:l,attachMenuBot:r,theme:o,isPaymentModalOpen:c,paymentStatus:u}=e;const{closeWebApp:v,sendWebViewData:P,prolongWebView:Z,toggleBotInAttachMenu:g,openTelegramLink:p,openChat:E,openInvoice:C,setWebAppPaymentSlug:f}=(0,i.Sv)(),[I,y]=(0,a.eJ)(),[k,w]=(0,a.eJ)(!1),[M,T]=(0,a.eJ)((0,ht.B)().bg_color),[A,L]=(0,a.eJ)((0,ht.B)().bg_color),[F,x]=(0,a.eJ)(!1),[B,O,$]=(0,b.Z)(!1),[G,V]=(0,a.eJ)(),J=(0,S.Z)(G),z=G||J,j=(0,N.Z)(),{url:H,buttonText:q,queryId:Y}=n||{},Q=Boolean(H),ee=!Y,te=(0,a.I4)((e=>{const{eventType:t,eventData:n}=e;if("web_app_close"===t&&v(),"web_app_open_invoice"===t&&(f({slug:n.slug}),C({slug:n.slug})),"web_app_open_tg_link"===t&&!c){const e=m.zH+n.path_full;p({url:e}),v()}if("web_app_open_link"===t){const e=n.url;window.open(e,"_blank","noreferrer")}if("web_app_setup_back_button"===t&&w(n.is_visible),"web_app_set_background_color"===t){const e=(0,ht.B)(),t=(0,ht.U)(n.color)?n.color:e.bg_color;T(t)}if("web_app_set_header_color"===t){const e=(0,ht.B)(),t=e[n.color_key],a=(0,ht.U)(t)?t:e.bg_color;L(a)}if("web_app_data_send"===t&&(v(),P({bot:l,buttonText:q,data:n.data})),"web_app_setup_main_button"===t){var a;const e=(0,ht.B)(),t=(0,ht.U)(n.color)?n.color:e.button_color,s=(0,ht.U)(n.text_color)?n.text_color:e.text_color;y({isVisible:n.is_visible&&Boolean(null===(a=n.text)||void 0===a?void 0:a.trim().length),isActive:n.is_active,text:n.text||"",color:t,textColor:s,isProgressVisible:n.is_progress_visible})}if("web_app_setup_closing_behavior"===t&&x(n.need_confirmation),"web_app_open_popup"===t){var s;if(!n.message.trim().length||null===(s=n.buttons)||void 0===s||!s.length||n.buttons.length>3)return;V(n)}}),[l,q,v,C,p,P,f,c]),{ref:ne,reloadFrame:ae,sendEvent:se,sendViewport:ie,sendTheme:le}=((e,t,n)=>{const s=(0,a.sO)(null),i=(0,a.sO)(!1),l=(0,W.Z)(),r=(0,a.I4)((e=>{if(!s.current)return;const t=s.current;t.src="about:blank",t.addEventListener("load",(()=>{t.src=e}),{once:!0})}),[]),o=(0,a.I4)((e=>{var t;null!==(t=s.current)&&void 0!==t&&t.contentWindow&&s.current.contentWindow.postMessage(JSON.stringify(e),"*")}),[]),c=(0,a.I4)((()=>{if(!s.current)return;const{width:e,height:t}=s.current.getBoundingClientRect();o({eventType:"viewport_changed",eventData:{width:e,height:t,is_expanded:!0}})}),[o]),d=(0,a.I4)((()=>{o({eventType:"theme_changed",eventData:{theme_params:(0,ht.B)()}})}),[o]),m=(0,a.I4)((e=>{o({eventType:"set_custom_style",eventData:e})}),[o]),u=(0,a.I4)((e=>{if(!i.current)try{const a=JSON.parse(e.data);if("web_app_request_viewport"===a.eventType&&c(),"web_app_request_theme"===a.eventType&&d(),"iframe_ready"===a.eventType){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");m("* {\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))}if("web_app_data_send"===a.eventType){if(!t)return;i.current=!0}n(a)}catch(e){}}),[t,n,m,d,c]);return(0,a.d4)((()=>{l&&c()}),[c,l]),(0,a.d4)((()=>(window.addEventListener("message",u),()=>window.removeEventListener("message",u))),[u]),(0,a.d4)((()=>{var t;e&&null!==(t=s.current)&&void 0!==t&&t.contentWindow&&(c(),i.current=!1)}),[e,c]),{ref:s,sendEvent:o,reloadFrame:r,sendViewport:c,sendTheme:d}})(Q,ee,te),re=(null==I?void 0:I.isVisible)&&I.text.trim().length>0;(0,vt.Z)((()=>{Z({botId:l.id,queryId:Y,peerId:s.id})}),Y?45e3:void 0,!0);const oe=(0,a.I4)((()=>{se({eventType:"main_button_pressed"})}),[se]),ce=(0,a.I4)((()=>{se({eventType:"settings_button_pressed"})}),[se]),de=(0,a.I4)((()=>{ae(n.url)}),[ae,n]),me=(0,a.I4)((()=>{F?O():v()}),[F,O,v]),ue=(0,a.I4)((e=>{V(void 0),se({eventType:"popup_closed",eventData:{button_id:e}})}),[se]);(0,R.Z)((()=>{setTimeout((()=>{ie()}),400)}),[null==I?void 0:I.isVisible,ie]),(0,R.Z)((()=>{setTimeout((()=>{le()}),400)}),[o,le]),(0,a.d4)((()=>{if(Q)return h.Z.disableRefresh(),()=>{h.Z.enableRefresh()}}),[Q]),(0,R.Z)((e=>{let[t]=e;c!==t&&null!=n&&n.slug&&!c&&u&&(se({eventType:"invoice_closed",eventData:{slug:n.slug,status:u}}),f({slug:void 0}))}),[c,u,se,f,n]);const he=(0,a.I4)((()=>{g({botId:l.id,isEnabled:!r})}),[l,r,g]),ve=(0,a.I4)((()=>{k?se({eventType:"back_button_pressed"}):me()}),[me,k,se]),Pe=(0,a.I4)((()=>{E({id:l.id}),v()}),[l,v,E]);(0,a.d4)((()=>{Q||(x(!1),$(),V(void 0))}),[$,Q]);const Ze=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),ge=(0,X.Z)("animated-close-icon",k&&"state-back"),pe=(0,a.Ye)((()=>a.ZP.createElement("div",{className:"modal-header",style:`background-color: ${A}`},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:j(k?"Back":"Close"),onClick:ve},a.ZP.createElement("div",{className:ge})),a.ZP.createElement("div",{className:"modal-title"},null==l?void 0:l.firstName),a.ZP.createElement(U.Z,{className:"web-app-more-menu",trigger:Ze,positionX:"right"},s&&l&&s.id!==l.id&&a.ZP.createElement(_.Z,{icon:"bots",onClick:Pe},j("BotWebViewOpenBot")),a.ZP.createElement(_.Z,{icon:"reload",onClick:de},j("WebApp.ReloadPage")),(null==l?void 0:l.isAttachMenuBot)&&a.ZP.createElement(_.Z,{icon:r?"stop":"install",onClick:he,destructive:Boolean(r)},j(r?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")),(null==r?void 0:r.hasSettings)&&a.ZP.createElement(_.Z,{icon:"settings",onClick:ce},j("Settings"))))),[j,ve,l,Ze,s,Pe,de,r,he,ce,k,A,ge]),Ee=(0,S.Z)(null==I?void 0:I.color,!0),Ce=(0,S.Z)(null==I?void 0:I.textColor,!0),fe=(0,S.Z)(I&&Boolean(I.isActive),!0),be=(0,S.Z)(null==I?void 0:I.text,!0),Ie=(null==I?void 0:I.color)||Ee,ye=(null==I?void 0:I.textColor)||Ce,ke=void 0!==(null==I?void 0:I.isActive)?I.isActive:fe,Ne=(null==I?void 0:I.text)||be;(0,a.d4)((()=>{if(!Q){const e=(0,ht.B)();y(void 0),w(!1),T(e.bg_color),L(e.bg_color)}}),[Q]);const[Se,we]=(0,a.eJ)(!1),[Me,Te]=(0,a.eJ)(!0),Ae=(0,a.sO)();return(0,a.d4)((()=>{Ae.current&&clearTimeout(Ae.current),re?(Te(!1),Ae.current=setTimeout((()=>{we(!0)}),250)):(we(!1),Ae.current=setTimeout((()=>{Te(!0)}),250))}),[we,re]),a.ZP.createElement($e.Z,{className:"WebAppModal",isOpen:Q,onClose:me,header:pe,hasCloseButton:!0,style:`background-color: ${M}`},Q&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("iframe",{ref:ne,className:(0,X.Z)("web-app-frame",Se&&"with-button"),src:H,title:`${null==l?void 0:l.firstName} Web App`,sandbox:Pt,allow:"camera; microphone; geolocation;",allowFullScreen:!0}),a.ZP.createElement(D.Z,{className:(0,X.Z)("web-app-button",re&&"visible",Me&&"hidden"),style:`background-color: ${Ie}; color: ${ye}`,disabled:!ke,onClick:oe},Ne,(null==I?void 0:I.isProgressVisible)&&a.ZP.createElement(K.Z,{color:"white"}))),F&&a.ZP.createElement(Qe.Z,{isOpen:B,onClose:$,title:j("lng_bot_close_warning_title"),text:j("lng_bot_close_warning"),confirmHandler:v,confirmIsDestructive:!0,confirmLabel:j("lng_bot_close_warning_sure")}),z&&a.ZP.createElement($e.Z,{isOpen:Boolean(G),title:z.title||" ",onClose:ue,hasCloseButton:!0,className:(0,X.Z)("web-app-popup",!(null!==(t=z.title)&&void 0!==t&&t.trim().length)&&"without-title")},z.message,a.ZP.createElement("div",{className:"dialog-buttons mt-2"},z.buttons.map((e=>a.ZP.createElement(D.Z,{key:e.id||e.text||e.type,color:"destructive"===e.type?"danger":"primary",isText:!0,fluid:!0,size:"smaller",onClick:()=>ue(e.id)},e.text||j(Zt[e.type])))))))}))),pt=(0,a.X$)((e=>{let{bot:t,type:n}=e;const{cancelBotTrustRequest:s,markBotTrusted:r}=(0,i.Sv)(),o=(0,N.Z)(),c=(0,S.Z)(t,!1),d=(0,S.Z)(n,!1),m=t||c,u=n||d,h=(0,a.I4)((()=>{r({botId:t.id})}),[r,t]),v=o("game"===u?"AppName":"BotOpenPageTitle"),P=o("game"===u?"BotPermissionGameAlert":"BotOpenPageMessage",(0,l.Js)(m));return a.ZP.createElement(Qe.Z,{isOpen:Boolean(t),onClose:s,confirmHandler:h,title:v,textParts:(0,we.Z)(P,["br","simple_markdown","emoji"])})})),Et=e=>{let{bot:t}=e;const{closeBotAttachRequestModal:n,confirmBotAttachRequest:s}=(0,i.Sv)(),l=(0,N.Z)(),r=null==t?void 0:t.firstName;return a.ZP.createElement(Qe.Z,{isOpen:Boolean(t),onClose:n,confirmHandler:s,title:r,textParts:l("WebApp.AddToAttachmentText",r)})},Ct=(0,a.X$)((e=>{let{deleteFolderDialogId:t}=e;const{closeDeleteChatFolderModal:n,deleteChatFolder:s}=(0,i.Sv)(),l=(0,N.Z)(),r=(0,a.I4)((()=>{n(),s({id:t})}),[n,s,t]);return a.ZP.createElement(Qe.Z,{isOpen:void 0!==t,onClose:n,text:l("FilterDeleteAlert"),confirmLabel:l("Delete"),confirmHandler:r,confirmIsDestructive:!0})}));var ft=n(81367),bt=n(9937);const It="slESyAvUqizX4_EIX_yg",yt=(0,a.X$)((e=>{let{leftValue:t,rightValue:n,className:s,floatingBadgeIcon:i,rightStyle:l}=e;const r=(0,N.Z)();return a.ZP.createElement("div",{className:(0,X.Z)("qiAkShre9E6R3S_XXL9S",s)},i&&a.ZP.createElement("div",{className:"gIcOQgrfw3soP3cK9s5Q"},a.ZP.createElement("i",{className:(0,X.Z)("y7T3FpaFXDsnPGk6dPmg",i)}),a.ZP.createElement("div",{className:"rQ6ZdKdWi4HVydX6qhWS",dir:r.isRtl?"rtl":void 0},t),a.ZP.createElement("div",{className:"Ip5PkcvyMOnN0RLpXLXO",dangerouslySetInnerHTML:{__html:'<svg width="26" height="9" viewBox="0 0 26 9" fill="none" xmlns="http://www.w3.org/2000/svg"><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"/></svg>'}})),a.ZP.createElement("div",{className:(0,X.Z)(It,"lQi3xqxjvl2Owb4ES2SM")},a.ZP.createElement("div",{className:"kuq7sjJF6mvCc4Y5CXpv X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR",dir:r.isRtl?"rtl":void 0},r("LimitFree")),!i&&a.ZP.createElement("div",{className:"FaVxkFCcMpBfLY74WJZv X0zFAEpRoPWj1yE904xR"},t)),a.ZP.createElement("div",{className:(0,X.Z)(It,"Dcv5uphsn2Sxpg3ROS_u"),style:l},a.ZP.createElement("div",{className:"QWqqObtxZyakBzakEoyh X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR",dir:r.isRtl?"rtl":void 0},r("LimitPremium")),a.ZP.createElement("div",{className:"TCdcdr_TxlgpCSBV0ePq X0zFAEpRoPWj1yE904xR X0zFAEpRoPWj1yE904xR"},n)))})),kt=[91,160,255],Nt=[197,100,243],St=(0,a.X$)((e=>{let{title:t,description:n,leftValue:s,rightValue:i,colorStepProgress:l}=e;const r=(0,a.Ye)((()=>kt.map(((e,t)=>(0,j.t7)(e,Nt[t],l)))),[l]);return a.ZP.createElement("div",{className:"jeeOV_UYyl50GFLOzjGC"},a.ZP.createElement("div",{className:"SVqE3gr2ekQUWfFT_Mvg"},t),a.ZP.createElement("div",{className:"mCBNPstzrSlOQsz6rOtE"},n),a.ZP.createElement(yt,{leftValue:s,rightValue:i,rightStyle:`background: rgb(${r.join(",")})`}))}));var wt=n(15866),Mt=n(70692);const Tt=n.p+"DeviceFrame.79271ee0fa60a7b6a1aa.svg",At={root:"WHiQiGCtWfjSlEysEelB",wrapper:"WUpKHfqLbeZmhfYqqiko",down:"MiGmL4xqBPkxmLim4Ai0",frame:"xuhT9JHpFkVsTcUWeh4L",video:"sLLJqCkdSug4bzEQrACs"},Rt=(0,a.X$)((e=>{let{videoId:t,isReverseAnimation:n,isDown:s,videoThumbnail:i,index:l,isActive:r}=e;const o=(0,M.Z)(`document${t}`),c=(0,wt.Z)(i.dataUri),d=(0,Mt.Z)(o),m=(0,a.sO)(null);return(0,a.d4)((()=>{const e=m.current;e&&(r?(0,se.Z)(e):e.pause())}),[r]),a.ZP.createElement("div",{className:At.root},a.ZP.createElement("div",{className:(0,X.Z)(At.wrapper,n&&At.reverse,s&&At.down),id:`premium_feature_preview_video_${l}`},a.ZP.createElement("img",{src:Tt,alt:"",className:At.frame}),a.ZP.createElement("canvas",{ref:c,className:At.video}),a.ZP.createElement("video",{ref:m,className:(0,X.Z)(At.video,d),src:o,autoPlay:r,disablePictureInPicture:!0,playsInline:!0,muted:!0,loop:!0})))}));var Lt=n(3570),Ft=n(97799);const xt=e=>{var t,n;let{size:s,realIndex:i,isActivated:l,canPlay:r,reaction:o,index:c,maxLength:d,handleClick:m}=e;const u=(0,M.Z)(`document${null===(t=o.activateAnimation)||void 0===t?void 0:t.id}`),h=(0,M.Z)(`document${null===(n=o.aroundAnimation)||void 0===n?void 0:n.id}`),[v,P,Z]=(0,b.Z)(l),[g,p,E]=(0,b.Z)(!1),C=(s-.2*s)/2,f=c/d*(2*Math.PI),I=f-Math.PI/6*Math.cos(f),y=.2+.7*(Math.sin(I)+1)/2,k=y>.85?1:y,N=Math.cos(I)*C,S=Math.sin(I)*C*.6,w=(0,a.I4)((()=>{m(i)}),[m,i]);return(0,a.d4)((()=>{l&&(P(),E())}),[l,P,E]),a.ZP.createElement(a.ZP.Fragment,null,l&&!g&&a.ZP.createElement(Ft.Z,{className:"bIR5UZpxiCoHBe0ZmtIn sbJjdz4IEwYhlti5MyPA",tgsUrl:h,play:r,isLowPriority:!0,noLoop:!0,size:.6*s,style:`--x: ${N}px; --y: ${S}px; --scale: ${k};`,onEnded:p}),a.ZP.createElement(Ft.Z,{className:"sbJjdz4IEwYhlti5MyPA",tgsUrl:u,onClick:w,play:v&&r,noLoop:!0,size:.2*s,style:`--x: ${N}px; --y: ${S}px; --scale: ${k};`,onEnded:Z}))},Bt=(0,a.X$)((0,i.c$)((e=>({availableReactions:e.availableReactions})))((e=>{var t;let{availableReactions:n,isActive:s}=e;const i=(0,a.sO)(null),[l,r,o]=(0,b.Z)(),c=(0,a.sO)(),[d,m]=(0,a.eJ)(0),[u,h]=(0,a.eJ)(0),v=(null==n||null===(t=n.filter((e=>e.isPremium)))||void 0===t?void 0:t.slice(0,15))||[];(0,vt.Z)((()=>{m((e=>(0,Lt.Z)(v.length,e+1)))}),l||!s?void 0:3e3);const P=(0,a.I4)((e=>{m(e),r(),c.current&&clearTimeout(c.current),c.current=setTimeout((()=>{o()}),4e3)}),[r,o]);return(0,a.d4)((()=>{const e=i.current;e&&h(e.closest(".modal-dialog").clientWidth)}),[]),a.ZP.createElement("div",{className:"lSI7Gb2It7nFGpBE4IFs",ref:i},v.map(((e,t)=>a.ZP.createElement(xt,{size:u,reaction:e,realIndex:t,index:(t-d+v.length/4)%v.length,maxLength:v.length,handleClick:P,isActivated:d===t,canPlay:s}))))}))),Dt="_rzXza87NHdAMH2TDKul",Ot="qd3rvhZma3JJmhdt07Ig",$t=(0,a.X$)((e=>{let{length:t,active:n,onSelectSlide:s}=e;const i=Math.max(0,Math.min(t-8,n-4)),l=i===t-8-1,r=i===t-8,o=0===i,c=1===i,m=Math.min(t,8),u=(0,a.I4)((()=>{s(n+1)}),[n,s]),h=(0,a.I4)((()=>{s(n-1)}),[n,s]),v=Math.min(8,t);return a.ZP.createElement("div",null,!d.$b&&a.ZP.createElement(D.Z,{className:(0,X.Z)(Dt,0===n&&Ot),color:"translucent",disabled:0===n,round:!0,onClick:h},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement("div",{className:"NtJc4bt94t9fklIWC6wF",style:`--start-from: ${i}; --length: ${t}; --count: ${v};`},Array(t).fill(void 0).map(((e,t)=>{const d=t,u=t===i+m-1&&!r&&!l,h=t===i+m-2&&!l&&!r||t===i+m-1&&l,v=t===i&&!o&&!c,P=t===i+1&&!o&&!c||t===i&&c,Z=t<i||t>=i+m;return a.ZP.createElement("div",{onClick:()=>s(t),className:(0,X.Z)("eCgEFkp07vgaUGwymYAQ",d===n&&"nlCmVncFkKVtsawWqcfw",(h||P)&&"AIpVWjJc47egZ8ATaC3n",(u||v)&&"MnRKztu0OZTyIywGLMc6",Z&&"boSFbatyzatdw70J7mpu")})}))),!d.$b&&a.ZP.createElement(D.Z,{className:(0,X.Z)(Dt,n===t-1&&Ot,"J4UYbae0Frt01jIavpB0"),color:"translucent",round:!0,disabled:n===t-1,onClick:u},a.ZP.createElement("i",{className:"icon-next"})))})),Ut=e=>{let{size:t,realIndex:n,canPlay:s,sticker:i,index:l,maxLength:r,onClick:o,onEnded:c}=e;const d=(0,M.Z)(`sticker${i.id}`),m=(0,M.Z)(`sticker${i.id}?size=f`),u=0===l,[h,v,P]=(0,b.Z)(u),Z=t-.6*t,g=3*Z,p=3.2*Z,E=l/r*(2*Math.PI),C=u?1:.66,f=Math.cos(E)*g-2.8*Z,I=Math.sin(E)*p,y=(0,a.I4)((()=>{o(n)}),[o,n]),k=(0,a.I4)((()=>{P(),c()}),[P,c]);return(0,a.d4)((()=>{u&&v()}),[u,v]),a.ZP.createElement(a.ZP.Fragment,null,u&&a.ZP.createElement(Ft.Z,{className:"JLzWnq8to4W24wBGmbyt PIYKt4xxOUBpRjRu0b4q",tgsUrl:m,play:s,isLowPriority:!0,noLoop:!0,size:.8*t,style:`--x: calc(${f}px - 10%); --y: ${I}px;`}),a.ZP.createElement(Ft.Z,{className:"PIYKt4xxOUBpRjRu0b4q",tgsUrl:d,play:s&&h,noLoop:!0,size:.6*t,style:`--x: ${f}px; --y: ${I}px; --opacity: ${C}`,onClick:y,onEnded:k}))},_t=(0,a.X$)((0,i.c$)((e=>({stickers:e.stickers.premium.stickers})))((e=>{let{stickers:t,isActive:n}=e;const s=(0,a.sO)(null),[i,l]=(0,a.eJ)(0),[r,o]=(0,a.eJ)(0),c=null==t?void 0:t.slice(0,15),d=(0,a.I4)((e=>{l(-e)}),[]),m=(0,a.I4)((()=>{setTimeout((()=>{l((e=>(0,Lt.Z)(c.length,e+1)))}),150)}),[c.length]);return(0,a.d4)((()=>{const e=s.current;e&&o(e.closest(".modal-dialog").clientWidth)}),[]),a.ZP.createElement("div",{className:"dVn5gk50tXn1EiI4kJFJ",ref:s},null==c?void 0:c.map(((e,t)=>a.ZP.createElement(Ut,{size:r,sticker:e,realIndex:t,index:(t+i+c.length)%c.length,maxLength:c.length,onClick:d,onEnded:m,canPlay:n}))))}))),Gt="fEQZ2fyO9g6L1v8QJUCJ",Vt="xkC9BFxv7RkSwbPe4RMb",Jt="eEYA2lXPy_DUKe8JKHiP",Xt="TVO7LjkV_yHUGIu5PXCA",zt={double_limits:"PremiumPreviewLimits",unique_reactions:"PremiumPreviewReactions",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"},jt={double_limits:"PremiumPreviewLimitsDescription",unique_reactions:"PremiumPreviewReactionsDescription",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"},Ht=["double_limits","more_upload","faster_download","voice_to_text","no_ads","unique_reactions","premium_stickers","animated_emoji","advanced_chat_management","profile_badge","animated_userpics"],qt=["faster_download","voice_to_text","advanced_chat_management","profile_badge","animated_userpics"],Yt=["channels","dialogFolderPinned","channelsPublic","savedGifs","stickersFaved","aboutLength","captionLength","dialogFilters","dialogFiltersChats"],Wt={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle"},Kt={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle"},Qt=(0,a.X$)((e=>{let{promo:t,initialSection:n,onBack:s,onClickSubscribe:i,isPremium:l,limits:r}=e;const o=(0,N.Z)(),c=(0,a.sO)(null),[d,m]=(0,a.eJ)(Ht.indexOf(n)),[u,h]=(0,a.eJ)(0),[v,P,Z]=(0,b.Z)(),[g,p]=(0,a.eJ)(!0),[E,C]=(0,a.eJ)(!1),f=(0,S.Z)(n);function I(e){const{scrollTop:t,clientHeight:n,scrollHeight:a}=e.currentTarget;p(t<=20),C(t>=a-n-20)}(0,a.d4)((()=>{const e=c.current;if(!e||f===n)return;const t=Ht.indexOf(n);m(t),P(),(0,ft.Z)(e,e.clientWidth*t,0).then(Z)}),[d,n,f,P,Z]);const y=(0,a.I4)((async e=>{const t=c.current;t&&(m(e),P(),await(0,ft.Z)(t,t.clientWidth*e,800),Z())}),[P,Z]);return a.ZP.createElement("div",{className:"QfngIllOc1THaTQiJf7h"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",className:(0,X.Z)("ZTIpWD6Zrj1U7rnGvrlD",0!==d&&"E42Dy7DFLAxvj8HE4GAD"),color:0===d?"translucent":"translucent-white",onClick:s,ariaLabel:o("Back")},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("div",{className:"EXGFQjwHmQxjvMLbYtS9"}),a.ZP.createElement("div",{className:(0,X.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 l=e.currentTarget.querySelector("#premium_feature_preview_video_"+(i-1)),r=e.currentTarget.querySelector(`#premium_feature_preview_video_${i}`);if(null==l||l.classList.toggle("reverse",!1),null==r||r.classList.toggle("reverse",!0),v)return;const o=Math.round(a/t);m(o)},ref:c},Ht.map(((e,n)=>{if("double_limits"===e)return a.ZP.createElement("div",{className:(0,X.Z)(Vt,"zngeFAwxdlVJZY876fHc")},a.ZP.createElement("h2",{className:(0,X.Z)("Mw81cOCIGy8KGn9VokFA",g&&"tRvcw256KSHRqgSj5uGX")},o(zt.double_limits)),a.ZP.createElement("div",{className:(0,X.Z)("le7Qv9QkHlO3qdK0Hs_g","custom-scroll"),onScroll:I},Yt.map(((e,t)=>{const n=null==r?void 0:r[e][0].toString(),s=null==r?void 0:r[e][1].toString();return a.ZP.createElement(St,{title:o(Wt[e]),description:o(Kt[e],s),leftValue:n,rightValue:s,colorStepProgress:t/(Yt.length-1)})}))));if("unique_reactions"===e)return a.ZP.createElement("div",{className:Vt},a.ZP.createElement("div",{className:Gt},a.ZP.createElement(Bt,{isActive:d===n})),a.ZP.createElement("h1",{className:Jt},o(zt.unique_reactions)),a.ZP.createElement("div",{className:Xt},(0,we.Z)(o(jt.unique_reactions),["br"])));if("premium_stickers"===e)return a.ZP.createElement("div",{className:Vt},a.ZP.createElement("div",{className:Gt},a.ZP.createElement(_t,{isActive:d===n})),a.ZP.createElement("h1",{className:Jt},o(zt.premium_stickers)),a.ZP.createElement("div",{className:Xt},(0,we.Z)(o(jt.premium_stickers),["br"])));const s=t.videoSections.indexOf(e);return-1!==s?a.ZP.createElement("div",{className:Vt},a.ZP.createElement("div",{className:Gt},a.ZP.createElement(Rt,{isActive:d===n,videoId:t.videos[s].id,videoThumbnail:t.videos[s].thumbnail,isDown:qt.includes(e),index:n,isReverseAnimation:n===u})),a.ZP.createElement("h1",{className:Jt},o(zt[t.videoSections[s]])),a.ZP.createElement("div",{className:Xt},(0,we.Z)(o(jt[t.videoSections[s]]),["br"]))):void 0}))),a.ZP.createElement("div",{className:(0,X.Z)("EKr_FVmiDSwhUxouhaqB",(E||0!==d)&&"H8z5Q6gsuqeCy82HFlyX")},a.ZP.createElement($t,{length:Ht.length,active:d,onSelectSlide:y}),a.ZP.createElement(D.Z,{className:(0,X.Z)("n8tTb600de2uZKGkyw67"),isShiny:!l,withPremiumGradient:!l,onClick:l?s:function(){i(n)}},l?o("OK"):o("SubscribeToPremium",(0,bt.x)(Number(t.monthlyAmount),t.currency,o.code)))))}));var en=n(13049),tn=n(9211);const nn={root:"PEnE7xWTMwTPGmhubmj6",text:"U4UYSH7uHW3k4FlqBefm",header:"Jdlm3dtJ8gOIY0x0u2d4",description:"cE44My72bdvMJna9mgoc",icon:"mxF3NdPgAi_H0ZFgNEtw"},an=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"],sn=(0,a.X$)((e=>{let{icon:t,title:n,text:s,index:i,onClick:l}=e;return a.ZP.createElement(Ge.Z,{buttonClassName:nn.root,onClick:l},a.ZP.createElement("img",{src:t,className:nn.icon,alt:"",style:`--item-color: ${an[i]}`}),a.ZP.createElement("div",{className:nn.text},a.ZP.createElement("div",{className:nn.title},(0,we.Z)(n,["br"])),a.ZP.createElement("div",{className:nn.description},s)))})),ln=n.p+"PremiumLogo.a5c0e88cd478f4d76d82.svg",rn=n.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",on=n.p+"PremiumFile.884dd3865acfe594fc61.svg",cn=n.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",dn=n.p+"PremiumVoice.b3a2893dbe481108ab94.svg",mn=n.p+"PremiumAds.a758f19ece91fe91318e.svg",un=n.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",hn=n.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",vn=n.p+"PremiumChats.89d9d315638e283ca895.svg",Pn=n.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",Zn=n.p+"PremiumVideo.288cb61931e33d913f0a.svg",gn=n.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",pn="yVkdTScCEhH3EQMQiA42",En={double_limits:rn,unique_reactions:un,premium_stickers:hn,animated_emoji:gn,no_ads:mn,voice_to_text:dn,profile_badge:Pn,faster_download:cn,more_upload:on,advanced_chat_management:vn,animated_userpics:Zn},Cn=(0,a.X$)((0,i.c$)((e=>{var t,n,a,s,i,l,o,c,d,m,u,h;return{currentUserId:e.currentUserId,promo:null===(t=e.premiumModal)||void 0===t?void 0:t.promo,isClosing:null===(n=e.premiumModal)||void 0===n?void 0:n.isClosing,isSuccess:null===(a=e.premiumModal)||void 0===a?void 0:a.isSuccess,isGift:null===(s=e.premiumModal)||void 0===s?void 0:s.isGift,monthsAmount:null===(i=e.premiumModal)||void 0===i?void 0:i.monthsAmount,fromUser:null!==(l=e.premiumModal)&&void 0!==l&&l.fromUserId?(0,r.dy)(e,e.premiumModal.fromUserId):void 0,toUser:null!==(o=e.premiumModal)&&void 0!==o&&o.toUserId?(0,r.dy)(e,e.premiumModal.toUserId):void 0,initialSection:null===(c=e.premiumModal)||void 0===c?void 0:c.initialSection,isPremium:(0,r.wV)(e),limitChannels:(0,tn.P)(e,"channels"),limitFolders:(0,tn.P)(e,"dialogFilters"),limitPins:(0,tn.P)(e,"dialogFolderPinned"),limitLinks:(0,tn.P)(e,"channelsPublic"),limits:null===(d=e.appConfig)||void 0===d?void 0:d.limits,premiumSlug:null===(m=e.appConfig)||void 0===m?void 0:m.premiumInvoiceSlug,premiumBotUsername:null===(u=e.appConfig)||void 0===u?void 0:u.premiumBotUsername,premiumPromoOrder:null===(h=e.appConfig)||void 0===h?void 0:h.premiumPromoOrder}}))((e=>{let{isOpen:t,currentUserId:n,fromUser:s,promo:r,initialSection:o,isPremium:c,limitChannels:d,limitLinks:u,limitFolders:h,limitPins:v,limits:P,premiumSlug:Z,premiumBotUsername:g,isClosing:p,isSuccess:E,isGift:C,toUser:f,monthsAmount:b,premiumPromoOrder:I}=e;const y=(0,a.sO)(null),{closePremiumModal:k,openInvoice:S,requestConfetti:w,openTelegramLink:M}=(0,i.Sv)(),T=(0,N.Z)(),[A,L]=(0,a.eJ)(!0),[F,x]=(0,a.eJ)(o),B=(0,a.I4)((e=>()=>{x(e)}),[]);function O(e){y.current&&(Z?S({slug:Z}):g&&(M({url:`${m.zH}${g}?start=${e||"promo"}`}),k()))}const U=(0,a.I4)((()=>{const e=y.current;if(e&&t){const{top:t,left:n,width:a,height:s}=e.querySelector(".modal-content").getBoundingClientRect();w({top:t,left:n,width:a,height:s})}}),[t,w]);if((0,a.d4)((()=>{E&&U()}),[E,U]),(0,R.Z)((e=>{let[t]=e;t!==c&&U()}),[c]),r)return a.ZP.createElement($e.Z,{className:"JJNHc_FZuydBNBIHK9xC",onCloseAnimationEnd:()=>k({isClosed:!0}),onClose:k,isOpen:t&&!p,dialogRef:y},a.ZP.createElement($.Z,{name:"slide",activeKey:F?1:0,className:"Q05gUm0HCMtSoeX2HVGw"},F?a.ZP.createElement(Qt,{initialSection:F,onBack:B(void 0),promo:r,onClickSubscribe:O,isPremium:c,limits:P}):a.ZP.createElement("div",{className:(0,X.Z)("E9_LJ9RqAHTj8h84EROt","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;L(t<=150)}},a.ZP.createElement(D.Z,{round:!0,size:"smaller",className:"TyuYAZecpI2K_1i3B5XO",color:"translucent",onClick:()=>k(),ariaLabel:T("Close")},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("img",{className:"Vaf41aTAoSwl_e_cZhah",src:ln,alt:""}),a.ZP.createElement("h2",{className:"J2z1gqvfQu5kqV_UP8US"},(0,we.Z)(C?(null==s?void 0:s.id)===n?T("TelegramPremiumUserGiftedPremiumOutboundDialogTitle",[(0,l.Js)(f),b]):T("TelegramPremiumUserGiftedPremiumDialogTitle",[(0,l.Js)(s),b]):s?T("TelegramPremiumUserDialogTitle",(0,l.Js)(s)):T(c?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:"PXg8sU2cfdeysJXctlpB"},(0,we.Z)(C?(null==s?void 0:s.id)===n?T("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,l.Js)(f)):T("TelegramPremiumUserGiftedPremiumDialogSubtitle"):T(s?"TelegramPremiumUserDialogSubtitle":c?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle"),["simple_markdown","emoji"])),a.ZP.createElement("div",{className:(0,X.Z)("Rwuf1efaEfZ13AD5XbCB",A&&"NV7fN3j69oFZEJu7ejG8")},a.ZP.createElement("h2",{className:"jA_DV7G5VJo8xGOe0otF"},T("TelegramPremium"))),a.ZP.createElement("div",{className:(0,X.Z)("LlPAfJpL066su4P2NFmh",c&&"wpPtJKCqTdOGkKoh7KTo")},(I||Ht).map(((e,t)=>{if(Ht.includes(e))return a.ZP.createElement(sn,{key:e,title:T(zt[e]),text:"double_limits"===e?T(jt[e],[d,h,v,u,4]):T(jt[e]),icon:En[e],index:t,onClick:B(e)})})),a.ZP.createElement("div",{className:(0,X.Z)(pn,"MQbFSG2o_R8rjKDsqs8R"),dir:T.isRtl?"rtl":void 0},a.ZP.createElement("p",null,(0,we.Z)(T("AboutPremiumDescription"),["simple_markdown"])),a.ZP.createElement("p",null,(0,we.Z)(T("AboutPremiumDescription2"),["simple_markdown"]))),function(){if(r&&(!C||(null==s?void 0:s.id)!==n))return a.ZP.createElement("div",{className:pn,dir:T.isRtl?"rtl":void 0},(0,en.H)(r.statusText,r.statusEntities))}()),!c&&a.ZP.createElement("div",{className:"FApXoTPpasib6Np5Uxpt"},a.ZP.createElement(D.Z,{className:"Fb3VVHNrypZ3lhYfSVI_",isShiny:!0,withPremiumGradient:!0,onClick:function(){O()}},T("SubscribeToPremium",(0,bt.x)(Number(r.monthlyAmount),r.currency,T.code)))))))})));var fn=n(8337);const bn=(0,a.X$)((e=>{let{option:t,checked:n,fullMonthlyAmount:s,onChange:i}=e;const l=(0,N.Z)(),{months:r,amount:o,currency:c}=t,d=Math.floor(o/r),m=(0,a.Ye)((()=>s&&s>d?Math.ceil(100-d/(s/100)):void 0),[s,d]),u=(0,a.I4)((e=>{e.target.checked&&i(r)}),[r,i]);return a.ZP.createElement("label",{className:(0,X.Z)("c43s0Q6_xgGlM8sZxQ7Q",n&&"PjYaF42Oe55WgPpTP6Od"),dir:l.isRtl?"rtl":void 0},a.ZP.createElement("input",{className:"r03M3Tzd52_D2GCAdabK",type:"radio",name:"gift_option",value:r,checked:n,onChange:u}),a.ZP.createElement("div",{className:"oL_26LDnHDwJRxqKF1Kn"},a.ZP.createElement("div",{className:"JmEuBQ4mFzu1MiFV5qSB"},l("Months",r)),a.ZP.createElement("div",{className:"hssGd7AUhDhhG2_aXqe9"},l("PricePerMonth",(0,bt.x)(d,c,l.code)),m&&a.ZP.createElement("span",{className:"WCXGWHYNQh8lg2rIWehC",title:l("GiftDiscount")}," ",m,"% ")),a.ZP.createElement("div",{className:"mhc9AgOUiNT2QMcErpQe"},(0,bt.x)(o,c,l.code))))})),In=(0,a.X$)((0,i.c$)((e=>{var t;const{forUserId:n,monthlyCurrency:a,monthlyAmount:s}=e.giftPremiumModal||{},i=n?(0,r.dy)(e,n):void 0;return{user:i,gifts:i?null===(t=i.fullInfo)||void 0===t?void 0:t.premiumGifts:void 0,monthlyCurrency:a,monthlyAmount:s?Number(s):void 0}}))((e=>{let{isOpen:t,user:n,gifts:s,monthlyCurrency:r,monthlyAmount:o}=e;const{openPremiumModal:c,closeGiftPremiumModal:d,openUrl:m}=(0,i.Sv)(),u=(0,N.Z)(),h=(0,Fe.Z)(n,!0),v=(0,Fe.Z)(s,!0),[P,Z]=(0,a.eJ)(),g=null==v?void 0:v[0],p=(0,a.Ye)((()=>{if(!v||0===v.length||!g)return;const e=v.reduce(((e,t)=>t.amount<(null==g?void 0:g.amount)?t:g),g);return e.currency===r&&o?o:Math.floor(e.amount/e.months)}),[g,v,o,r]);(0,a.d4)((()=>{t&&Z(null==g?void 0:g.months)}),[null==g?void 0:g.months,t]);const E=(0,a.Ye)((()=>null==v?void 0:v.find((e=>e.months===P))),[v,P]),C=(0,a.I4)((()=>{E&&(d(),m({url:E.botUrl}))}),[d,m,E]),f=(0,a.I4)((()=>{c()}),[c]);return a.ZP.createElement($e.Z,{onClose:d,isOpen:t,className:"K80So3B9potKGNvwdtYE"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",className:"dxx424IZDNuP1OLbUIve",color:"translucent",onClick:()=>d(),ariaLabel:u("Close")},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Me.Z,{user:h,size:"jumbo",className:"qJgJ7R5NJVmAxBjT5LxT"}),a.ZP.createElement("h2",{className:"eqCNa8zBoMroKcepfXyE"},u("GiftTelegramPremiumTitle")),a.ZP.createElement("p",{className:"MtYhgDChavNfKIUAJPzt"},(0,we.Z)(u("GiftTelegramPremiumDescription",(0,l.Vl)(h)),["emoji","simple_markdown"])),a.ZP.createElement("div",{className:"HyfHjS1vAds31eFcSpDg"},null==v?void 0:v.map((e=>a.ZP.createElement(bn,{key:e.amount,option:e,fullMonthlyAmount:p,checked:e.months===P,onChange:Z})))),function(){const e=u("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return a.ZP.createElement("p",{className:"J0hST5xsC45ZolfGpbDc"},e[1],a.ZP.createElement(fn.Z,{isPrimary:!0,onClick:f},e[2]),e[3])}()),a.ZP.createElement(D.Z,{className:"sSXm9RjIQSsVFi0D1nEd",isShiny:!0,disabled:!P,onClick:C},u("GiftSubscriptionFor",E&&(0,bt.x)(Number(E.amount),E.currency,u.code))))}))),yn={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities"},kn={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked"},Nn={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium"},Sn={dialogFiltersChats:"icon-chat-badge",uploadMaxFileparts:"icon-file-badge",dialogFilters:"icon-folder-badge",dialogFolderPinned:"icon-pin-badge",channelsPublic:"icon-link-badge",channels:"icon-chats-badge"},wn={uploadMaxFileparts:(e,t)=>8e3===t?e("FileSize.GB","4"):4e3===t?e("FileSize.GB","2"):(0,le.sS)(e,t*m.pJ)},Mn=(0,a.X$)((0,i.c$)(((e,t)=>{let{limit:n}=t;const{limits:a}=e.appConfig||{},s=(0,r.wV)(e);return{defaultValue:n?null==a?void 0:a[n][0]:void 0,premiumValue:n?null==a?void 0:a[n][1]:void 0,canBuyPremium:!(0,r.oe)(e),isPremium:s}}))((e=>{let{defaultValue:t,premiumValue:n,limit:s,isPremium:l,canBuyPremium:r}=e;const{closeLimitReachedModal:o,openPremiumModal:c}=(0,i.Sv)(),d=(0,N.Z)(),[m,u,h]=(0,b.Z)(),v=(0,a.I4)((()=>{c(),u()}),[c,u]);(0,a.d4)((()=>{!s&&m&&h()}),[m,s,h]);const P=d("LimitReached"),Z=s&&wn[s],g=function(e){let{lang:t,limitType:n,isPremium:a,canBuyPremium:s,defaultValue:i,premiumValue:l,valueFormatter:r}=e;if(!n)return;const o=r?r(t,i):i,c=r?r(t,l):l;return a?t(Nn[n],c):s?t(yn[n],"channelsPublic"===n?c:[o,c]):t(kn[n],o)}({lang:d,limitType:s,isPremium:l,canBuyPremium:r,defaultValue:t,premiumValue:n,valueFormatter:Z}),p=s&&Sn[s],E=r&&!l;return a.ZP.createElement($e.Z,{onClose:u,onCloseAnimationEnd:o,isOpen:Boolean(s)&&!m,title:P,className:"iz5RJvcQyNNDQzKfXQbN"},!E&&a.ZP.createElement("div",{className:"womlEQglVV1w8ltVa6PQ"},a.ZP.createElement("i",{className:(0,X.Z)("q8SgjqQqlOVMSofzhdwh",p)}),a.ZP.createElement("div",{className:"QC8Xe4ShGc_q82s4Tjmg"},(null==Z?void 0:Z(d,l?n:t))||(l?n:t))),E&&a.ZP.createElement(yt,{className:"az3lXhmlMfZfIQ_81jog",leftValue:(null==Z?void 0:Z(d,t))||(null==t?void 0:t.toString()),rightValue:(null==Z?void 0:Z(d,n))||(null==n?void 0:n.toString()),floatingBadgeIcon:p}),a.ZP.createElement("div",null,(0,we.Z)(g,["simple_markdown","br"])),a.ZP.createElement("div",{className:"DgRFl7StCs4fhROb7CKH"},a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary"},d(E?"Cancel":"OK")),E&&a.ZP.createElement(D.Z,{className:(0,X.Z)("confirm-dialog-button","Twnx_5clE9fKNOMo7lXf"),isShiny:!0,onClick:v,color:"primary"},d("IncreaseLimit"),a.ZP.createElement("i",{className:(0,X.Z)("BW05mF5k9uq5qBi_BYzg","icon-double-badge")}))))})));var Tn=n(10088);const An=(0,a.X$)((e=>{let{isOpen:t,onClose:n}=e;const s=(0,N.Z)();return a.ZP.createElement($e.Z,{isOpen:t,onClose:n,hasCloseButton:!0,title:s("SponsoredMessageInfo")},a.ZP.createElement("p",null,(0,we.Z)(s("SponsoredMessageInfoDescription1"),["br"])),a.ZP.createElement("p",null,(0,we.Z)(s("SponsoredMessageInfoDescription2"),["br"])),a.ZP.createElement("p",null,(0,we.Z)(s("SponsoredMessageInfoDescription3"),["br"])),a.ZP.createElement("p",null,a.ZP.createElement(Tn.Z,{url:s("SponsoredMessageAlertLearnMoreUrl"),text:s("SponsoredMessageAlertLearnMoreUrl")})),a.ZP.createElement("p",null,(0,we.Z)(s("SponsoredMessageInfoDescription4"),["br"])),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},s("Close")))})),Rn=(0,a.X$)((0,i.c$)(((e,t)=>{let{message:n,isSchedule:a}=t;const{threadId:s}=(0,r.Bt)(e)||{},{canDeleteForAll:i}=s&&(0,r._k)(e,n,s)||{},o=(0,r.Z1)(e,n.chatId);return{canDeleteForAll:!a&&i,contactName:o&&(0,l.YC)(o.id)?(0,l.Vl)((0,r.dy)(e,(0,l.zX)(o))):void 0,willDeleteForCurrentUserOnly:o&&(0,l.G9)(o)&&!i,willDeleteForAll:o&&(0,l.ZV)(o)}}))((e=>{let{isOpen:t,isSchedule:n,message:s,album:l,canDeleteForAll:r,contactName:o,willDeleteForCurrentUserOnly:c,willDeleteForAll:d,onClose:m}=e;const{deleteMessages:u,deleteScheduledMessages:h}=(0,i.Sv)(),v=(0,a.I4)((()=>{const e=null!=l&&l.messages?l.messages.map((e=>{let{id:t}=e;return t})):[s.id];u({messageIds:e,shouldDeleteForAll:!0}),m()}),[u,s.id,m,l]),P=(0,a.I4)((()=>{const e=null!=l&&l.messages?l.messages.map((e=>{let{id:t}=e;return t})):[s.id];n?h({messageIds:e}):u({messageIds:e,shouldDeleteForAll:!1}),m()}),[l,s.id,n,m,h,u]),Z=(0,N.Z)();return a.ZP.createElement($e.Z,{isOpen:t,onClose:m,onEnter:t&&!r?P:void 0,className:"delete",title:Z("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,Z("AreYouSureDeleteSingleMessage")),c&&a.ZP.createElement("p",null,Z("lng_delete_for_me_chat_hint",1,"i")),d&&a.ZP.createElement("p",null,Z("lng_delete_for_everyone_hint",1,"i")),r&&a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},o&&(0,we.Z)(Z("Conversation.DeleteMessagesFor",o)),!o&&Z("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},Z(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},Z("Cancel")))}))),Ln=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,l.YC)(n),s=(0,r.FM)(e,n),i=(0,r.Z1)(e,n),o=Boolean(i)&&(0,l.eA)(i),c=Boolean(i)&&(0,l.G9)(i),d=Boolean(i)&&(0,l.ZV)(i);return{isPrivateChat:a,isChatWithSelf:s,isChannel:o,isGroup:c,isSuperGroup:d,canPinForAll:a&&!s||d||c,contactName:i&&(0,l.YC)(i.id)?(0,l.Vl)((0,r.dy)(e,(0,l.zX)(i))):void 0}}))((e=>{let{isOpen:t,messageId:n,chatId:s,isChannel:l,isGroup:r,isSuperGroup:o,canPinForAll:c,contactName:d,onClose:m}=e;const{pinMessage:u}=(0,i.Sv)(),h=(0,a.I4)((()=>{u({chatId:s,messageId:n,isUnpin:!1}),m()}),[u,s,n,m]),v=(0,a.I4)((()=>{u({chatId:s,messageId:n,isUnpin:!1,isOneSide:!0,isSilent:!0}),m()}),[s,n,m,u]),P=(0,N.Z)();return a.ZP.createElement($e.Z,{isOpen:t,onClose:m,className:"pin",title:P("PinMessageAlertTitle")},a.ZP.createElement("p",null,P(l?"PinMessageAlertChannel":r||o?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:v},P("DialogPin")),c&&a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:h},d?(0,we.Z)(P("Conversation.PinMessagesFor",d)):P("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},P("Cancel")))}))),Fn=(0,a.X$)((e=>{let{isOpen:t,pinnedMessagesCount:n=0,onClose:s,onUnpin:i}=e;const l=(0,N.Z)();return a.ZP.createElement($e.Z,{isOpen:t,onClose:s,className:"unpin-all",title:l("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,l("Chat.UnpinAllMessagesConfirmation",n,"i")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:i},l("DialogUnpin")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},l("Cancel")))}));var xn=n(517),Bn=n(73541);const Dn=(0,a.X$)((0,i.c$)(((e,t)=>{let{isSchedule:n}=t;const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:s}=(0,r.xl)(e),i=(0,r.jr)(e);return{selectedMessageIds:a,canDeleteForAll:!n&&s,contactName:i&&(0,l.YC)(i.id)?(0,l.Vl)((0,r.dy)(e,(0,l.zX)(i))):void 0,willDeleteForCurrentUserOnly:i&&(0,l.G9)(i)&&!s,willDeleteForAll:i&&(0,l.ZV)(i)}}))((e=>{let{isOpen:t,isSchedule:n,selectedMessageIds:s,canDeleteForAll:l,contactName:r,willDeleteForCurrentUserOnly:o,willDeleteForAll:c,onClose:d}=e;const{deleteMessages:m,deleteScheduledMessages:u,exitMessageSelectMode:h}=(0,i.Sv)(),v=(0,S.Z)(t),P=(0,a.I4)((()=>{d(),m({messageIds:s,shouldDeleteForAll:!0})}),[m,s,d]),Z=(0,a.I4)((()=>{n?u({messageIds:s}):m({messageIds:s,shouldDeleteForAll:!1}),d()}),[n,d,u,s,m]),g=(0,N.Z)();if((0,a.d4)((()=>{!t&&v&&h()}),[h,t,v]),s)return a.ZP.createElement($e.Z,{isOpen:t,onClose:d,onEnter:l?void 0:Z,className:"delete",title:g("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,g("AreYouSureDeleteFewMessages")),o&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),c&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),l&&a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},r?(0,we.Z)(g("ChatList.DeleteForEveryone",r)):g("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(D.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},g(l?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},g("Cancel")))}))),On=(0,a.X$)((0,i.c$)((e=>{const{type:t,chatId:n}=(0,r.Bt)(e)||{},a="scheduled"===t,{canDelete:s}=(0,r.xl)(e),i=Boolean(!a&&(0,r.nB)(e)),l=(0,r.Nu)(e),{messageIds:o}=e.selectedMessages||{},c=!!n&&(0,r.ku)(e,n,o),d=e.forwardMessages.isModalShown;return{isSchedule:a,selectedMessagesCount:(0,r.D7)(e),canDeleteMessages:s,canReportMessages:i,canDownloadMessages:l,selectedMessageIds:o,hasProtectedMessage:c,isForwardModalOpen:d}}))((e=>{let{canPost:t,isActive:n,messageListType:s,isSchedule:l,selectedMessagesCount:r,canDeleteMessages:o,canReportMessages:c,canDownloadMessages:d,hasProtectedMessage:m,isForwardModalOpen:u,selectedMessageIds:h}=e;const{exitMessageSelectMode:v,openForwardMenuForSelectedMessages:P,downloadSelectedMessages:Z,copySelectedMessages:g,showNotification:p}=(0,i.Sv)(),E=(0,N.Z)(),[C,f,I]=(0,b.Z)(),[y,k,w]=(0,b.Z)();((e,t)=>{(0,Bn.y)({"Mod+C":function(n){e&&(n.preventDefault(),t())}})})(Boolean(n),g),(0,a.d4)((()=>!n||C||y||u?void 0:(0,xn.Z)({onBackspace:o?f:void 0,onDelete:o?f:void 0,onEsc:v})),[n,C,y,f,v,u,o]);const M=(0,a.I4)((()=>{g(),p({message:E("Share.Link.Copied")}),v()}),[g,v,E,p]),T=(0,a.I4)((()=>{Z(),v()}),[Z,v]),A=(0,S.Z)(r||void 0,!0),R=E("VoiceOver.Chat.MessagesSelected",n?r:A,"i"),L=(0,X.Z)("MessageSelectToolbar",t&&"with-composer",n&&"shown"),F=(e,t,n,s,i)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,X.Z)("item",s&&"disabled",i&&"destructive"),onClick:s?void 0:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:L},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(D.Z,{color:"translucent",round:!0,onClick:v,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:R},R),Boolean(r)&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==s&&F("forward",E("Chat.ForwardActionHeader"),P,m),c&&F("flag",E("Conversation.ReportMessages"),k),d&&F("download",E("lng_media_download"),T,m),F("copy",E("lng_context_copy_selected_items"),M,m),F("delete",E("EditAdminGroupDeleteMessages"),f,!o,!0))),a.ZP.createElement(Dn,{isOpen:C,isSchedule:l,onClose:I}),a.ZP.createElement(B.Z,{isOpen:y,onClose:w,messageIds:h}))}))),$n=(0,a.X$)((0,i.c$)((e=>{var t;const{chatId:n,messageId:a}=e.seenByModal||{};return n&&a?{memberIds:null===(t=(0,r.hj)(e,n,a))||void 0===t?void 0:t.seenByUserIds}:{}}))((e=>{let{isOpen:t,memberIds:n}=e;const{openChat:s,closeSeenByModal:l}=(0,i.Sv)(),r=(0,N.Z)(),o=(0,a.I4)((e=>{l(),setTimeout((()=>{s({id:e})}),100)}),[l,s]),c=(0,Fe.Z)(n,!0);return a.ZP.createElement($e.Z,{isOpen:t,onClose:l,className:"narrow",title:`Seen by ${null==n?void 0:n.length} users`},a.ZP.createElement("div",{dir:r.isRtl?"rtl":void 0},c&&c.map((e=>a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>o(e)},a.ZP.createElement(Je.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:l},r("Close")))})));var Un=n(48198),_n=n(4863);const Gn=(0,a.X$)((0,i.c$)((e=>{const{chatId:t,messageId:n}=e.reactorModal||{},a=t&&n?(0,r.hj)(e,t,n):void 0;return{chatId:t,messageId:n,reactions:null==a?void 0:a.reactions,reactors:null==a?void 0:a.reactors,seenByUserIds:null==a?void 0:a.seenByUserIds}}))((e=>{let{isOpen:t,reactors:n,reactions:r,chatId:o,messageId:c,seenByUserIds:d}=e;const{loadReactors:m,closeReactorListModal:u,openChat:h}=(0,i.Sv)(),v=(0,i.Rd)().users.byId,P=(0,N.Z)(),[Z,g,p]=(0,b.Z)(!1),[E,C]=(0,a.eJ)(void 0),f=n&&r&&n.count>=10&&r.results.length>1,I=(0,a.sO)();(0,a.d4)((()=>{Z&&!t&&(p(),C(void 0))}),[Z,t,p]);const y=(0,a.I4)((()=>{I.current&&h({id:I.current}),u()}),[u,h]),k=(0,a.I4)((()=>{g()}),[g]),S=(0,a.I4)((e=>{I.current=e,k()}),[k]),w=(0,a.I4)((()=>{m({chatId:o,messageId:c})}),[o,m,c]),M=(0,a.Ye)((()=>null!=n&&n.reactions?(0,Le.Tw)(n.reactions.map((e=>e.reaction))):[]),[null==n?void 0:n.reactions]),T=(0,a.Ye)((()=>E?null==n?void 0:n.reactions.filter((e=>e.reaction===E)).map((e=>e.userId)):(0,Le.Tw)((null==n?void 0:n.reactions.map((e=>e.userId)).concat(d||[]))||[])),[E,null==n?void 0:n.reactions,d]),[A,R]=(0,xe.Z)(w,T,n&&void 0===n.nextOffset);return(0,a.d4)((()=>{null==R||R({direction:s.Uq.Backwards})}),[R]),a.ZP.createElement($e.Z,{isOpen:t&&!Z,onClose:k,className:"ReactorListModal narrow",title:P("Reactions"),onCloseAnimationEnd:y},f&&a.ZP.createElement("div",{className:"Reactions"},a.ZP.createElement(D.Z,{className:(0,X.Z)(!E&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(void 0)},a.ZP.createElement("i",{className:"icon-heart"}),(null==n?void 0:n.count)&&(0,le.bi)(n.count)),M.map((e=>{var t;const n=null==r||null===(t=r.results.find((t=>t.reaction===e)))||void 0===t?void 0:t.count;return a.ZP.createElement(D.Z,{className:(0,X.Z)(E===e&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(e)},a.ZP.createElement(Un.Z,{reaction:e,className:"reaction-filter-emoji"}),n&&(0,le.bi)(n))}))),a.ZP.createElement("div",{dir:P.isRtl?"rtl":void 0},null!=A&&A.length?a.ZP.createElement(_e.Z,{className:"reactor-list custom-scroll",items:A,onLoadMore:R},null==A?void 0:A.map((e=>{var t;const s=v[e],i=(0,l.Js)(s),r=null==n||null===(t=n.reactions.find((t=>t.userId===e)))||void 0===t?void 0:t.reaction;return a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable reactors-list-item",onClick:()=>S(e)},a.ZP.createElement(Me.Z,{user:s,size:"small"}),a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},i&&(0,we.Z)(i)),s.isPremium&&a.ZP.createElement(_n.Z,null)),r&&a.ZP.createElement(Un.Z,{className:"reactors-list-emoji",reaction:r}))}))):a.ZP.createElement(Oe.Z,null)),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:u},P("Close")))})));var Vn=n(13365);const Jn=(0,a.X$)((0,i.c$)(((e,t)=>{let{activeEmojiInteraction:n}=t;const a=void 0!==n.animatedEffect&&(0,r.tH)(e,n.animatedEffect);return{effectAnimationId:a?a.id:void 0,localEffectAnimation:!a&&n.animatedEffect&&Object.keys(Vn.l).includes(n.animatedEffect)?n.animatedEffect:void 0}}))((e=>{let{effectAnimationId:t,localEffectAnimation:n,activeEmojiInteraction:s}=e;const{stopActiveEmojiInteraction:l}=(0,i.Sv)(),[r,o]=(0,b.Z)(!1),[c,m]=(0,b.Z)(!1),u=(0,a.sO)(),h=(0,a.I4)((()=>{o(),u.current&&clearTimeout(u.current),setTimeout((()=>{l({id:s.id})}),250)}),[s.id,o,l]),v=(0,a.I4)((e=>{var t;null!==(t=e.target)&&void 0!==t&&t.closest(".AnimatedEmoji")||h()}),[h]);(0,a.d4)((()=>(document.addEventListener("touchstart",v),document.addEventListener("touchmove",v),document.addEventListener("mousedown",v),document.addEventListener("wheel",v),()=>{document.removeEventListener("touchstart",v),document.removeEventListener("touchmove",v),document.removeEventListener("mousedown",v),document.removeEventListener("wheel",v)})),[v]),(0,a.bt)((()=>{const e=(0,y.YW)();u.current=setTimeout((()=>{h(),e()}),3e3)}),[h]);const P=(0,M.Z)(`sticker${t}`,!t);if(!s.startSize)return;const Z=(s.startSize||0)/309,g=n&&n in Vn.l?Vn.l[n]:P;return a.ZP.createElement("div",{className:(0,X.Z)("EmojiInteractionAnimation",r&&"hiding",c&&"playing",s.isReversed&&"reversed"),style:`--scale: ${Z}; --start-x: ${s.x}px; --start-y: ${s.y}px;`},a.ZP.createElement(Ft.Z,{key:`effect_${t}`,size:309,tgsUrl:g,play:c,quality:d.wZ?.5:void 0,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:m}))})));var Xn=n(93133),zn=n(70735),jn=n(78781),Hn=n(41470);const qn=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};var Yn=n(40329),Wn=n(50742);const Kn=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.Z1)(e,a),i=s&&(0,l.zX)(s);return{chat:s,user:i?(0,r.dy)(e,i):void 0,isPinned:(0,r.ep)(e,a),isMuted:s?(0,l.i4)(s,(0,r.dZ)(e),(0,r.NJ)(e)):void 0,canChangeFolder:Boolean(null===(n=e.chatFolders.orderedIds)||void 0===n?void 0:n.length)}}))((e=>{let{chatId:t,withUsername:n,onClick:s,chat:i,user:r,isPinned:o,isMuted:c,canChangeFolder:d}=e;const[m,u,h]=(0,b.Z)(),[v,P,Z]=(0,b.Z)(),g=(0,Hn.Z)({chat:i,user:r,isPinned:o,isMuted:c,canChangeFolder:d,handleDelete:u,handleChatFolderChange:P},!0),p=(0,a.I4)((()=>{s(t)}),[t,s]),E=qn(p);if(i)return a.ZP.createElement(Ge.Z,{className:"chat-item-clickable search-result",onClick:p,contextActions:g,buttonRef:E},(0,l.YC)(t)?a.ZP.createElement(Je.Z,{userId:t,withUsername:n,avatarSize:"large",withVideoAvatar:!0}):a.ZP.createElement(Ve.Z,{chatId:t,withUsername:n,avatarSize:"large",withVideoAvatar:!0}),a.ZP.createElement(Yn.Z,{isOpen:m,onClose:h,chat:i}),a.ZP.createElement(Wn.Z,{isOpen:v,onClose:Z,chatId:t}))}))),Qn=(0,H.P2)((e=>e()),6e4,!0),ea=(0,a.X$)((0,i.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}))((e=>{let{topUserIds:t,usersById:n,recentlyFoundChatIds:s,onReset:r}=e;const{loadTopUsers:o,openChat:c,addRecentlyFoundChatId:d,clearRecentlyFoundChats:m}=(0,i.Sv)(),u=(0,a.sO)(null);(0,a.d4)((()=>{Qn((()=>{o()}))}),[o]),(0,jn.Z)(u.current,!t);const h=(0,a.I4)((e=>{c({id:e,shouldReplaceHistory:!0}),r(),setTimeout((()=>{d({id:e})}),250)}),[c,d,r]),v=(0,N.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},t&&a.ZP.createElement("div",{className:"top-peers-section",dir:v.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:u,className:"top-peers no-selection"},t.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>h(e),dir:v.isRtl?"rtl":void 0},a.ZP.createElement(Me.Z,{user:n[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,we.Z)((0,l.Vl)(n[e])||" "))))))),s&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:v.isRtl?"rtl":void 0},v("Recent"),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:m,isRtl:v.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),s.map((e=>a.ZP.createElement(Kn,{chatId:e,onClick:h})))))})));var ta=n(89411),na=n(50685);const aa=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.Z1)(e,n);if(!a)return{};const s=(0,l.zX)(a);return{chat:a,lastSyncTime:e.lastSyncTime,...s&&{privateChatUser:(0,r.dy)(e,s)}}}))((e=>{let{message:t,searchQuery:n,chatId:s,chat:r,privateChatUser:o,lastSyncTime:c}=e;const{focusMessage:m}=(0,i.Sv)(),u=(0,l.bf)(t)?void 0:(0,l.DH)(t),h=(0,M.Z)((0,l.Ti)(t,"micro")),v=Boolean((0,l.Y5)(t)),P=(0,a.I4)((()=>{m({chatId:s,messageId:t.id,shouldReplaceHistory:!0})}),[s,m,t.id]),Z=(0,N.Z)(),g=qn(P);if(r)return a.ZP.createElement(Ge.Z,{className:"ChatMessage chat-item-clickable",ripple:!d.wB,onClick:P,buttonRef:g},a.ZP.createElement(Me.Z,{chat:r,user:o,isSavedMessages:null==o?void 0:o.isSelf,lastSyncTime:c}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},(0,we.Z)((0,l.U)(Z,r,o))),r.isVerified&&a.ZP.createElement(ta.Z,null),(null==o?void 0:o.isPremium)&&a.ZP.createElement(_n.Z,null),r.fakeType&&a.ZP.createElement(na.Z,{fakeType:r.fakeType})),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(fn.Z,{className:"date"},(0,ie.VX)(Z,1e3*t.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,i){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,X.Z)("media-preview--image",i&&"round")}),(0,l.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,f.e)(e,t,!0,s)):(0,f.e)(e,t,void 0,s)}(Z,t,h||u,n,v)))))}))),sa=(0,a.X$)((e=>{let{searchDate:t,onSelect:n}=e;const s=(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,ie.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,ie.xH)(a)})}return t}(t)),[t]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},s.map((e=>{let{date:t,text:s}=e;return a.ZP.createElement("div",{onClick:()=>n(t),className:"date-item",key:s},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,s))})))}));var ia=n(47262),la=n(49187);const ra=(0,H.P2)((e=>e()),500,!0),oa=(0,a.X$)((0,i.c$)((e=>{var t;const{byId:n}=e.chats,{userIds:a}=e.contactList||{};if(!a)return{chatsById:n};const{currentUserId:s,messages:i,lastSyncTime:l}=e,{fetchingStatus:r,globalResults:o,localResults:c,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=o||{},{chatIds:h,userIds:v}=c||{},{byChatId:P}=i;return{currentUserId:s,localContactIds:a,localChatIds:h,localUserIds:v,globalChatIds:m,globalUserIds:u,foundIds:null==d||null===(t=d.text)||void 0===t?void 0:t.foundIds,globalMessagesByChatId:P,chatsById:n,fetchingStatus:r,lastSyncTime:l}}))((e=>{let{searchQuery:t,searchDate:n,dateSearchQuery:r,currentUserId:o,localContactIds:c,localChatIds:m,localUserIds:u,globalChatIds:h,globalUserIds:v,foundIds:P,globalMessagesByChatId:Z,chatsById:g,fetchingStatus:p,lastSyncTime:E,onReset:C,onSearchDateSelect:b}=e;const{openChat:I,addRecentlyFoundChatId:y,searchMessagesGlobal:k,setGlobalSearchChatId:S}=(0,i.Sv)(),w=(0,a.sO)(null);(0,jn.Z)(w.current,void 0,!0);const M=(0,N.Z)(),[T,A]=(0,a.eJ)(!1),[R,L]=(0,a.eJ)(!1),F=(0,a.I4)((e=>{let{direction:n}=e;E&&n===s.Uq.Backwards&&ra((()=>{k({type:"text",query:t})}))}),[E,k,t]),x=(0,a.I4)((e=>{I({id:e,shouldReplaceHistory:!0}),e!==o&&y({id:e}),d.wB||C()}),[o,I,y,C]),B=(0,a.I4)((e=>{S({id:e})}),[S]),D=(0,a.Ye)((()=>{if(!t||t.startsWith("@")&&t.length<2)return zn.D;const e=[...o?[o]:[],...c||[]],n=(0,i.Rd)().users.byId,a=(0,l.kK)(e,n,t,o,M("SavedMessages"));return[...(0,l.ih)((0,Le.Tw)([...a||[],...m||[],...u||[]]),g,void 0,o?[o]:void 0)]}),[t,o,c,M,m,u,g]),O=(0,a.Ye)((()=>!t||t.length<4||!h||!v?zn.D:(0,l.ih)((0,Le.Tw)([...h,...v]),g,!0)),[g,h,v,t]),$=(0,a.Ye)((()=>(t||n)&&P&&0!==P.length?P.map((e=>{var t;const[n,a]=e.split("_");return null==Z||null===(t=Z[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):zn.D),[P,Z,t,n]),U=(0,a.I4)((()=>{A(!T)}),[T]),_=(0,a.I4)((()=>{L(!R)}),[R]),G=p&&!p.chats&&!p.messages&&!D.length&&!O.length&&!$.length;return t||n?a.ZP.createElement(_e.Z,{className:"LeftSearch custom-scroll",items:$,onLoadMore:F,noScrollRestoreOnTop:!0,noFastList:!0},r&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(sa,{searchDate:r,onSelect:b})),G&&a.ZP.createElement(ia.Z,{text:M("ChatList.Search.NoResults"),description:M("ChatList.Search.NoResultsDescription")}),Boolean(D.length)&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:M.isRtl?"rtl":void 0,ref:w},D.map((e=>a.ZP.createElement(la.Z,{chatOrUserId:e,onClick:B,clickArg:e})))),Boolean(D.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:M.isRtl?"auto":void 0},D.length>5&&a.ZP.createElement(fn.Z,{className:"Link",onClick:U},M(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),M("DialogList.SearchSectionDialogs")),D.map(((e,t)=>{if(T||!(t>=5))return a.ZP.createElement(Kn,{chatId:e,onClick:x})}))),Boolean(O.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:M.isRtl?"auto":void 0},O.length>5&&a.ZP.createElement(fn.Z,{className:"Link",onClick:_},M(R?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),M("DialogList.SearchSectionGlobal")),O.map(((e,t)=>{if(R||!(t>=5))return a.ZP.createElement(Kn,{chatId:e,withUsername:!0,onClick:x})}))),Boolean($.length)&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:M.isRtl?"auto":void 0},M("SearchMessages")),$.map((function(e){const n=(0,f.e)(M,e),s=g[e.chatId];if(n&&s)return a.ZP.createElement(aa,{chatId:e.chatId,message:e,searchQuery:t})})))):a.ZP.createElement(ea,{onReset:C})}))),ca=(0,H.P2)((e=>e()),500,!0),da=(0,a.X$)((0,i.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:i,resultsByType:l}=e.globalSearch,{foundIds:r}=(null==l?void 0:l.text)||{};return{currentUserId:n,foundIds:r,globalMessagesByChatId:a,chatsById:t,fetchingStatus:i,lastSyncTime:s}}))((e=>{let{searchQuery:t,currentUserId:n,dateSearchQuery:l,foundIds:r,globalMessagesByChatId:o,chatsById:c,fetchingStatus:d,lastSyncTime:m,onSearchDateSelect:u}=e;const{searchMessagesGlobal:h}=(0,i.Sv)(),v=(0,N.Z)(),P=(0,a.I4)((e=>{let{direction:a}=e;m&&a===s.Uq.Backwards&&ca((()=>{h({type:"text",query:t,chatId:n})}))}),[n,m,h,t]),Z=(0,a.Ye)((()=>r&&0!==r.length?r.map((e=>{var t;const[n,a]=e.split("_");return null==o||null===(t=o[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):zn.D),[r,o]),g=d&&!d.chats&&!d.messages&&!Z.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(_e.Z,{className:"search-content custom-scroll chat-list",items:Z,onLoadMore:P,noFastList:!0},l&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(sa,{searchDate:l,onSelect:u})),g&&a.ZP.createElement(ia.Z,{text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),Z.map((function(e){const n=(0,f.e)(v,e),s=c[e.chatId];if(n&&s)return a.ZP.createElement(aa,{chatId:e.chatId,message:e,searchQuery:t})}))))})));function ma(e){return(t,n)=>{var a,s;const{byId:i}=t.chats,{byId:l}=t.users,{fetchingStatus:o,resultsByType:c,chatId:d}=t.globalSearch,m="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:u}=t.messages,h=null==c||null===(a=c[m])||void 0===a?void 0:a.foundIds,v=t.activeDownloads.byChatId;return{theme:(0,r.Pu)(t),isLoading:void 0===h||!!o&&Boolean(o.chats||o.messages),chatsById:i,usersById:l,globalMessagesByChatId:u,foundIds:h,searchChatId:d,activeDownloads:v,isChatProtected:d?null===(s=(0,r.Z1)(t,d))||void 0===s?void 0:s.isProtected:void 0,lastSyncTime:t.lastSyncTime}}}var ua=n(17891),ha=n(3657),va=n(13709);const Pa="media",Za=(0,H.P2)((e=>e()),500,!0),ga=(0,a.X$)((0,i.c$)(ma(Pa))((e=>{let{searchQuery:t,searchChatId:n,isLoading:l,globalMessagesByChatId:r,foundIds:o,lastSyncTime:c,isChatProtected:d}=e;const{searchMessagesGlobal:u,openMediaViewer:h}=(0,i.Sv)(),v=(0,a.sO)(null),P=(0,N.Z)(),{observe:Z}=(0,ha.S1)({rootRef:v,throttleMs:500}),g=(0,a.I4)((e=>{let{direction:a}=e;c&&a===s.Uq.Backwards&&Za((()=>{u({type:Pa,query:t,chatId:n})}))}),[c,u,t,n]),p=(0,a.Ye)((()=>o&&r?o.map((e=>{var t;const[n,a]=e.split("_");return null===(t=r[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):zn.D),[r,o]),E=(0,a.I4)(((e,t)=>{h({chatId:t,mediaId:e,origin:s.bZ.SearchResult})}),[h]),C=(0,ua.Z)([t],m.Y)&&!l,f=C&&o&&o.length>0&&!t,b=C&&o&&o.length>0&&t,I=(0,X.Z)("search-content custom-scroll",b&&"chat-list");return a.ZP.createElement("div",{ref:v,className:"LeftSearch"},a.ZP.createElement(_e.Z,{className:I,items:p,itemSelector:t?".ListItem":".Media",onLoadMore:g,noFastList:!0},!C&&a.ZP.createElement(Oe.Z,null),C&&(!o||0===o.length)&&a.ZP.createElement(ia.Z,{text:P("ChatList.Search.NoResults"),description:P("ChatList.Search.NoResultsDescription")}),f&&a.ZP.createElement("div",{className:"media-list",dir:P.isRtl?"rtl":void 0},p.map((e=>a.ZP.createElement(va.Z,{key:e.id,idPrefix:"search-media",message:e,isProtected:d||e.isProtected,observeIntersection:Z,onClick:E})))),b&&p.map((e=>a.ZP.createElement(aa,{key:e.id,chatId:e.chatId,message:e})))))})));var pa=n(91),Ea=n(45418);const Ca="links",fa=(0,H.P2)((e=>e()),500,!0),ba=(0,a.X$)((0,i.c$)(ma(Ca))((e=>{let{searchQuery:t,searchChatId:n,isLoading:l,chatsById:r,usersById:o,globalMessagesByChatId:c,foundIds:d,lastSyncTime:u,isChatProtected:h}=e;const{searchMessagesGlobal:v,focusMessage:P}=(0,i.Sv)(),Z=(0,a.sO)(null),g=(0,N.Z)(),{observe:p}=(0,ha.S1)({rootRef:Z,throttleMs:500}),E=(0,a.I4)((e=>{let{direction:a}=e;u&&a===s.Uq.Backwards&&fa((()=>{v({type:Ca,query:t,chatId:n})}))}),[u,v,t,n]),C=(0,a.Ye)((()=>d&&c?d.map((e=>{var t;const[n,a]=e.split("_");return null===(t=c[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):zn.D),[c,d]),f=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),b=(0,ua.Z)([t],m.Y)&&!l;return a.ZP.createElement("div",{ref:Z,className:"LeftSearch"},a.ZP.createElement(_e.Z,{className:"search-content documents-list custom-scroll",items:C,onLoadMore:E,noFastList:!0},!b&&a.ZP.createElement(Oe.Z,null),b&&(!d||0===d.length)&&a.ZP.createElement(ia.Z,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),b&&d&&d.length>0&&C.map(((e,t)=>{const n=0===t||(0,ie.kj)(e.date)!==(0,ie.kj)(C[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:g.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0},(0,ie.np)(g,new Date(1e3*e.date))),a.ZP.createElement(Ea.Z,{key:e.id,message:e,senderTitle:(0,pa.F)(g,e,r,o),isProtected:h||e.isProtected,observeIntersection:p,onMessageClick:f}))}))))})));var Ia=n(82535);const ya="documents",ka=(0,H.P2)((e=>e()),500,!0),Na=(0,a.X$)((0,i.c$)(ma(ya))((e=>{let{searchQuery:t,searchChatId:n,isLoading:r,chatsById:o,usersById:c,globalMessagesByChatId:d,foundIds:u,activeDownloads:h,lastSyncTime:v}=e;const{searchMessagesGlobal:P,focusMessage:Z}=(0,i.Sv)(),g=(0,a.sO)(null),p=(0,N.Z)(),{observe:E}=(0,ha.S1)({rootRef:g,throttleMs:500}),C=(0,a.I4)((e=>{let{direction:a}=e;v&&a===s.Uq.Backwards&&ka((()=>{P({type:ya,query:t,chatId:n})}))}),[v,P,t,n]),f=(0,a.Ye)((()=>u&&d?u.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=d[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,l.aE)(s)?s:void 0})).filter(Boolean):zn.D),[d,u]),b=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),I=(0,ua.Z)([t],m.Y)&&!r;return a.ZP.createElement("div",{ref:g,className:"LeftSearch"},a.ZP.createElement(_e.Z,{className:"search-content documents-list custom-scroll",items:f,onLoadMore:C,noFastList:!0},!I&&a.ZP.createElement(Oe.Z,null),I&&(!u||0===u.length)&&a.ZP.createElement(ia.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),I&&u&&u.length>0&&f.map(((e,t)=>{var n;const s=0===t||(0,ie.kj)(e.date)!==(0,ie.kj)(f[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},s&&a.ZP.createElement("p",{className:"section-heading"},(0,ie.np)(p,new Date(1e3*e.date))),a.ZP.createElement(Ia.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,pa.F)(p,e,o,c),className:"scroll-item",isDownloading:null===(n=h[e.chatId])||void 0===n?void 0:n.includes(e.id),observeIntersection:E,onDateClick:b}))}))))})));var Sa=n(54752);const wa=(0,H.P2)((e=>e()),500,!0),Ma=(0,a.X$)((0,i.c$)(ma("audio"))((e=>{let{theme:t,isVoice:n,searchQuery:l,searchChatId:r,isLoading:o,chatsById:c,usersById:d,globalMessagesByChatId:u,foundIds:h,lastSyncTime:v,activeDownloads:P}=e;const{searchMessagesGlobal:Z,focusMessage:g,openAudioPlayer:p}=(0,i.Sv)(),E=(0,N.Z)(),C=n?"voice":"audio",f=(0,a.I4)((e=>{let{direction:t}=e;v&&t===s.Uq.Backwards&&wa((()=>{Z({type:C,query:l,chatId:r})}))}),[C,v,Z,l,r]),b=(0,a.Ye)((()=>h&&u?h.map((e=>{var t;const[n,a]=e.split("_");return null===(t=u[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):zn.D),[u,h]),I=(0,a.I4)(((e,t)=>{g({chatId:t,messageId:e})}),[g]),y=(0,a.I4)(((e,t)=>{p({chatId:t,messageId:e})}),[p]),k=(0,ua.Z)([l],m.Y)&&!o;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(_e.Z,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:f,noFastList:!0},!k&&a.ZP.createElement(Oe.Z,null),k&&(!h||0===h.length)&&a.ZP.createElement(ia.Z,{text:E("ChatList.Search.NoResults"),description:E("ChatList.Search.NoResultsDescription")}),k&&h&&h.length>0&&b.map(((e,n)=>{var i,l;const r=0===n||(0,ie.kj)(e.date)!==(0,ie.kj)(b[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},r&&a.ZP.createElement("p",{className:"section-heading",dir:E.isRtl?"rtl":void 0},(0,ie.np)(E,new Date(1e3*e.date))),a.ZP.createElement(Sa.ZP,{key:e.id,theme:t,message:e,origin:s.Cr.Search,senderTitle:(0,pa.F)(E,e,c,d),date:e.date,lastSyncTime:v,className:"scroll-item",onPlay:y,onDateClick:I,canDownload:!(null!==(i=c[e.chatId])&&void 0!==i&&i.isProtected||e.isProtected),isDownloading:null===(l=P[e.chatId])||void 0===l?void 0:l.includes(e.id)}))}))))}))),Ta=[{type:s.nJ.ChatList,title:"SearchAllChatsShort"},{type:s.nJ.Media,title:"SharedMediaTab2"},{type:s.nJ.Links,title:"SharedLinksTab2"},{type:s.nJ.Files,title:"SharedFilesTab2"},{type:s.nJ.Music,title:"SharedMusicTab2"},{type:s.nJ.Voice,title:"SharedVoiceTab2"}],Aa=[{type:s.nJ.ChatList,title:"All Messages"},...Ta.slice(1)],Ra=Object.keys(s.nJ).length/2,La=(0,a.X$)((0,i.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}))((e=>{let{searchQuery:t,searchDate:n,isActive:l,currentContent:r=s.nJ.ChatList,chatId:o,onReset:c}=e;const{setGlobalSearchContent:d,setGlobalSearchDate:m}=(0,i.Sv)(),u=(0,N.Z)(),[h,v]=(0,a.eJ)(r),P=(0,a.Ye)((()=>(0,ie.xk)(t)),[t]),Z=(0,a.I4)((e=>{const t=Ta[e];d({content:t.type}),v(e)}),[d]),g=(0,a.I4)((e=>{m({date:e.getTime()/1e3})}),[m]);(0,k.Z)({isActive:l,onBack:c});const p=(0,a.sO)(null),E=(0,Be.Z)(p,l,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:p,onKeyDown:E},a.ZP.createElement(Xn.Z,{activeTab:h,tabs:o?Aa:Ta,onSwitchTab:Z}),a.ZP.createElement($.Z,{name:u.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:Ra,activeKey:r},(()=>{switch(r){case s.nJ.ChatList:return o?a.ZP.createElement(da,{searchQuery:t,dateSearchQuery:P,onReset:c,onSearchDateSelect:g}):a.ZP.createElement(oa,{searchQuery:t,searchDate:n,dateSearchQuery:P,onReset:c,onSearchDateSelect:g});case s.nJ.Media:return a.ZP.createElement(ga,{searchQuery:t});case s.nJ.Links:return a.ZP.createElement(ba,{searchQuery:t});case s.nJ.Files:return a.ZP.createElement(Na,{searchQuery:t});case s.nJ.Music:return a.ZP.createElement(Ma,{key:"audio",searchQuery:t});case s.nJ.Voice:return a.ZP.createElement(Ma,{key:"voice",isVoice:!0,searchQuery:t});default:return}})()))})));var Fa=n(91090);const xa={currentPassword:"",password:"",hint:"",email:""},Ba=(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 xa;default:return e}},Da=(0,a.X$)((e=>{let{currentScreen:t,editedFolderId:n,onReset:l,onSaveFilter:r,onScreenSelect:o}=e;const{signOut:c,openDeleteChatFolderModal:m}=(0,i.Sv)(),[u,h]=(0,a.eJ)(!1),v=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(s.MT.Experimental)})),P=(0,a.I4)((()=>{h(!0)}),[]),Z=(0,a.I4)((()=>{h(!1)}),[]),g=(0,a.I4)((()=>{n&&m({folderId:n})}),[n,m]),p=(0,a.I4)((()=>{Z(),c()}),[Z,c]),E=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]),C=(0,N.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:l,ariaLabel:C("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(t){case s.MT.EditProfile:return a.ZP.createElement("h3",null,C("lng_settings_information"));case s.MT.General:return a.ZP.createElement("h3",null,C("General"));case s.MT.QuickReaction:return a.ZP.createElement("h3",null,C("DoubleTapSetting"));case s.MT.CustomEmoji:return a.ZP.createElement("h3",null,C("Emoji"));case s.MT.Notifications:return a.ZP.createElement("h3",null,C("Notifications"));case s.MT.DataStorage:return a.ZP.createElement("h3",null,C("DataSettings"));case s.MT.Privacy:return a.ZP.createElement("h3",null,C("PrivacySettings"));case s.MT.Language:return a.ZP.createElement("h3",null,C("Language"));case s.MT.Stickers:return a.ZP.createElement("h3",null,C("StickersName"));case s.MT.Experimental:return a.ZP.createElement("h3",null,C("lng_settings_experimental"));case s.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,C("ChatBackground"));case s.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,C("SetColor"));case s.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,C("PrivacyPhone"));case s.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,C("PrivacyLastSeen"));case s.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,C("Privacy.ProfilePhoto"));case s.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,C("PrivacyForwards"));case s.MT.PrivacyVoiceMessages:return a.ZP.createElement("h3",null,C("PrivacyVoiceMessages"));case s.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,C("AutodownloadGroupChats"));case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement("h3",null,C("AlwaysShareWith"));case s.MT.PrivacyPhoneNumberDeniedContacts:case s.MT.PrivacyLastSeenDeniedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:case s.MT.PrivacyForwardingDeniedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:case s.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement("h3",null,C("NeverShareWith"));case s.MT.ActiveSessions:return a.ZP.createElement("h3",null,C("SessionsTitle"));case s.MT.ActiveWebsites:return a.ZP.createElement("h3",null,C("OtherWebSessions"));case s.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,C("BlockedUsers"));case s.MT.TwoFaDisabled:case s.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,C("TwoStepVerification"));case s.MT.TwoFaNewPassword:case s.MT.TwoFaChangePasswordNew:case s.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,C("PleaseEnterCurrentPassword"));case s.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,C("PleaseReEnterPassword"));case s.MT.TwoFaNewPasswordHint:case s.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,C("PasswordHint"));case s.MT.TwoFaNewPasswordEmail:case s.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,C("RecoveryEmailTitle"));case s.MT.TwoFaNewPasswordEmailCode:case s.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case s.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,C("TwoStepVerificationPasswordSet"));case s.MT.TwoFaChangePasswordCurrent:case s.MT.TwoFaTurnOff:case s.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,C("PleaseEnterCurrentPassword"));case s.MT.PasscodeDisabled:case s.MT.PasscodeEnabled:case s.MT.PasscodeNewPasscode:case s.MT.PasscodeNewPasscodeConfirm:case s.MT.PasscodeCongratulations:return a.ZP.createElement("h3",null,C("Passcode"));case s.MT.PasscodeTurnOff:return a.ZP.createElement("h3",null,C("PasscodeController.Disable.Title"));case s.MT.PasscodeChangePasscodeCurrent:case s.MT.PasscodeChangePasscodeNew:return a.ZP.createElement("h3",null,C("PasscodeController.Change.Title"));case s.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement("h3",null,C("PasscodeController.ReEnterPasscode.Placeholder"));case s.MT.Folders:return a.ZP.createElement("h3",null,C("Filters"));case s.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,C("FilterNew"));case s.MT.FoldersEditFolder:case s.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,C("FilterEdit")),n&&a.ZP.createElement(U.Z,{className:"settings-more-menu",trigger:E,positionX:"right"},a.ZP.createElement(_.Z,{icon:"delete",destructive:!0,onClick:g},C("Delete"))));case s.MT.FoldersIncludedChats:case s.MT.FoldersIncludedChatsFromChatList:case s.MT.FoldersExcludedChats:case s.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},t===s.MT.FoldersIncludedChats||t===s.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,C("FilterInclude")):a.ZP.createElement("h3",null,C("FilterExclude")),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:r,ariaLabel:C("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",{onClick:v},C("SETTINGS")),a.ZP.createElement(D.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",onClick:()=>o(s.MT.EditProfile),ariaLabel:C("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(U.Z,{className:"settings-more-menu",trigger:E,positionX:"right"},a.ZP.createElement(_.Z,{icon:"logout",onClick:P},C("LogOutTitle"))))}}(),a.ZP.createElement(Qe.Z,{isOpen:u,onClose:Z,text:C("lng_sure_logout"),confirmLabel:C("AccountSettings.Logout"),confirmHandler:p,confirmIsDestructive:!0}))}));var Oa=n(20787),$a=n(70180);const Ua=(0,a.X$)((0,i.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{sessionCount:e.activeSessions.orderedHashes.length,currentUser:t?(0,r.dy)(e,t):void 0,lastSyncTime:n,canBuyPremium:!(0,r.oe)(e)}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:l,currentUser:r,sessionCount:o,lastSyncTime:c,canBuyPremium:d}=e;const{loadProfilePhotos:m,loadAuthorizations:u,openPremiumModal:h}=(0,i.Sv)(),v=(0,N.Z)(),P=null==r?void 0:r.id;return(0,a.d4)((()=>{P&&c&&m({profileId:P})}),[c,P,m]),(0,k.Z)({isActive:t,onBack:l}),(0,a.d4)((()=>{c&&u()}),[c,u]),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},r&&a.ZP.createElement(Oa.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement($a.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Ge.Z,{icon:"settings",onClick:()=>n(s.MT.General)},v("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Ge.Z,{icon:"unmute",onClick:()=>n(s.MT.Notifications)},v("Notifications")),a.ZP.createElement(Ge.Z,{icon:"data",onClick:()=>n(s.MT.DataStorage)},v("DataSettings")),a.ZP.createElement(Ge.Z,{icon:"lock",onClick:()=>n(s.MT.Privacy)},v("PrivacySettings")),a.ZP.createElement(Ge.Z,{icon:"folder",onClick:()=>n(s.MT.Folders)},v("Filters")),a.ZP.createElement(Ge.Z,{icon:"active-sessions",onClick:()=>n(s.MT.ActiveSessions)},v("SessionsTitle"),o>0&&a.ZP.createElement("span",{className:"settings-item__current-value"},o)),a.ZP.createElement(Ge.Z,{icon:"language",onClick:()=>n(s.MT.Language)},v("Language"),a.ZP.createElement("span",{className:"settings-item__current-value"},v.langName)),a.ZP.createElement(Ge.Z,{icon:"stickers",onClick:()=>n(s.MT.Stickers)},v("StickersName")),d&&a.ZP.createElement(Ge.Z,{leftElement:a.ZP.createElement(_n.Z,{withGradient:!0,big:!0}),className:"settings-main-menu-premium",onClick:()=>h()},v("TelegramPremium"))))})));var _a=n(90710),Ga=n(41151);const Va=/https:\/\/t\.me\/?/i,Ja=/^([a-zA-Z0-9_]+)$/,Xa=(0,H.Ds)((e=>e()),250,!1),za=(0,a.X$)((e=>{let{currentUsername:t,asLink:n,isLoading:s,isUsernameAvailable:i,checkUsername:l,onChange:r}=e;const[o,c]=(0,a.eJ)(t||""),d=(0,N.Z)(),u=n?"SetUrl":"Username",h=d(n?"SetUrlPlaceholder":"Username"),[v,P]=(0,a.Ye)((()=>o.length?o.length<5?[void 0,`${h} is too short`]:o.length>32?[void 0,`${h} is too long`]:Ja.test(o)?void 0===i?[]:[i?d(`${u}Available`,"Username"):void 0,!1===i?d(`${u}InUse`):void 0]:[void 0,`${h} contains invalid characters`]:[]),[o,i,d,u,h]);(0,a.d4)((()=>{c(t||"")}),[n,t]);const Z=(0,a.I4)((e=>{const t=e.target.value.trim().replace(Va,"");c(t),e.target.value=`${n?m.zH:""}${t}`;const a=function(e){return e.length>=5&&e.length<=32&&Ja.test(e)}(t);a&&Xa((()=>{l({username:t})})),r&&r(!!a&&t)}),[n,l,r]);return a.ZP.createElement(Ue.Z,{value:`${n?m.zH:""}${o}`,onChange:Z,label:h,error:P,success:v,readOnly:s})})),ja=(0,a.X$)((e=>{let{ref:t,id:n,className:s,value:i,label:l,error:r,success:o,disabled:c,readOnly:d,placeholder:m,autoComplete:u,inputMode:h,maxLength:v,maxLengthIndicator:P,tabIndex:Z,onChange:g,onInput:p,onKeyPress:E,onKeyDown:C,onBlur:f,onPaste:b}=e,I=(0,a.sO)(null);t&&(I=t);const y=(0,N.Z)(),k=r||o||l,S=(0,X.Z)("input-group",i&&"touched",r?"error":o&&"success",c&&"disabled",d&&"disabled",k&&"with-label",s);(0,a.d4)((()=>{const e=I.current;e&&(e.style.height="0",e.style.height=`${e.scrollHeight}px`)}),[]);const w=(0,a.I4)((e=>{e.currentTarget.value=e.currentTarget.value.replace(/\n/,""),e.currentTarget.style.height="0",e.currentTarget.style.height=`${e.currentTarget.scrollHeight}px`,null==g||g(e)}),[g]);return a.ZP.createElement("div",{className:S,dir:y.isRtl?"rtl":void 0},a.ZP.createElement("textarea",{ref:I,className:"form-control",id:n,dir:"auto",value:i||"",tabIndex:Z,placeholder:m,maxLength:v,autoComplete:u,inputMode:h,disabled:c,readOnly:d,onChange:w,onInput:p,onKeyPress:E,onKeyDown:C,onBlur:f,onPaste:b,"aria-label":k}),k&&a.ZP.createElement("label",{htmlFor:n},k),P&&a.ZP.createElement("div",{className:"max-length-indicator"},P))})),Ha=(0,H.P2)((e=>e()),6e4,!0),qa="Please provide your first name",Ya=(0,a.X$)((0,i.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,r.dy)(e,t):void 0,i=(0,tn.M)(e,"aboutLength");if(!s)return{progress:n,isUsernameAvailable:a,maxBioLength:i};const{firstName:o,lastName:c,username:d,fullInfo:m}=s,{bio:u}=m||{};return{currentAvatarHash:(0,l.RT)(s),currentFirstName:o,currentLastName:c,currentBio:u,currentUsername:d,progress:n,isUsernameAvailable:a,maxBioLength:i}}))((e=>{let{isActive:t,onReset:n,currentAvatarHash:l,currentFirstName:r,currentLastName:o,currentBio:c,currentUsername:d,progress:u,isUsernameAvailable:h,maxBioLength:v}=e;const{loadCurrentUser:P,updateProfile:Z,checkUsername:g}=(0,i.Sv)(),p=(0,N.Z)(),[E,C]=(0,a.eJ)(!1),[f,b]=(0,a.eJ)(!1),[I,y]=(0,a.eJ)(),[S,T]=(0,a.eJ)(),[A,R]=(0,a.eJ)(r||""),[L,F]=(0,a.eJ)(o||""),[x,B]=(0,a.eJ)(c||""),[D,O]=(0,a.eJ)(d||""),$=(0,M.Z)(l,!1,w.IU.BlobUrl),U=u===s.rN.InProgress,_=!1===D,G=(0,a.Ye)((()=>!_&&(Boolean(S)||f||!0===h)),[S,f,_,h]);(0,k.Z)({isActive:t,onBack:n}),(0,a.d4)((()=>{Ha((()=>{P()}))}),[P]),(0,a.d4)((()=>{T(void 0)}),[$]),(0,a.d4)((()=>{R(r||""),F(o||""),B(c||"")}),[r,o,c]),(0,a.d4)((()=>{O(d||"")}),[d]),(0,a.d4)((()=>{u===s.rN.Complete&&(b(!1),C(!1),y(void 0))}),[u]);const V=(0,a.I4)((e=>{T(e)}),[]),J=(0,a.I4)((e=>{R(e.target.value),b(!0)}),[]),X=(0,a.I4)((e=>{F(e.target.value),b(!0)}),[]),z=(0,a.I4)((e=>{B(e.target.value),b(!0)}),[]),j=(0,a.I4)((e=>{O(e),C(!0)}),[]),H=(0,a.I4)((()=>{const e=A.trim(),t=L.trim(),n=x.trim();e.length?Z({photo:S,...f&&{firstName:e,lastName:t,bio:n},...E&&{username:D}}):y(qa)}),[S,A,L,x,f,D,E,Z]);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(_a.Z,{currentAvatarBlobUrl:$,onChange:V,title:"Edit your profile photo",disabled:U}),a.ZP.createElement(Ue.Z,{value:A,onChange:J,label:p("FirstName"),disabled:U,error:I===qa?I:void 0}),a.ZP.createElement(Ue.Z,{value:L,onChange:X,label:p("LastName"),disabled:U}),a.ZP.createElement(ja,{value:x,onChange:z,label:p("UserBio"),disabled:U,maxLength:v,maxLengthIndicator:v?(v-x.length).toString():void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},(0,we.Z)(p("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("Username")),a.ZP.createElement(za,{currentUsername:D||"",isLoading:U,isUsernameAvailable:h,checkUsername:g,onChange:j}),a.ZP.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},(0,we.Z)(p("UsernameHelp"),["br","simple_markdown"])),D&&a.ZP.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},p("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},m.zH,D)))),a.ZP.createElement(Ga.Z,{isShown:G,onClick:H,disabled:U,ariaLabel:"Save changes"},U?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Wa=(0,a.X$)((0,i.c$)((e=>(0,Le.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])))((e=>{let{isActive:t,onReset:n,canAutoLoadPhotoFromContacts:s,canAutoLoadPhotoInPrivateChats:l,canAutoLoadPhotoInGroups:r,canAutoLoadPhotoInChannels:o,canAutoLoadVideoFromContacts:c,canAutoLoadVideoInPrivateChats:d,canAutoLoadVideoInGroups:u,canAutoLoadVideoInChannels:h,canAutoLoadFileFromContacts:v,canAutoLoadFileInPrivateChats:P,canAutoLoadFileInGroups:Z,canAutoLoadFileInChannels:g,canAutoPlayGifs:p,canAutoPlayVideos:E,autoLoadFileMaxSizeMb:C}=e;const{setSettingOption:f}=(0,i.Sv)(),b=(0,N.Z)();(0,k.Z)({isActive:t,onBack:n});const I=(0,a.I4)((e=>b("AutodownloadSizeLimitUpTo",b("FileSize.MB",String(m.by[e]),"i"))),[b]),y=(0,a.I4)((e=>{f({autoLoadFileMaxSizeMb:m.by[e]})}),[f]),S=(0,a.I4)((e=>{f({canAutoPlayGifs:e})}),[f]),w=(0,a.I4)((e=>{f({canAutoPlayVideos:e})}),[f]);function M(e,t,n,s,i,l){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},e),a.ZP.createElement(tt.Z,{label:b("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>f({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(tt.Z,{label:b("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>f({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(tt.Z,{label:b("AutoDownloadSettings.GroupChats"),checked:i,onCheck:e=>f({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(tt.Z,{label:b("AutoDownloadSettings.Channels"),checked:l,onCheck:e=>f({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=m.by.indexOf(C);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(re.Z,{label:b("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:I,onChange:y}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},M(b("AutoDownloadPhotosTitle"),"Photo",s,l,r,o),M(b("AutoDownloadVideosTitle"),"Video",c,d,u,h),M("Auto-download files","File",v,P,Z,g),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},b("AutoplayMedia")),a.ZP.createElement(tt.Z,{label:b("GifsTab2"),checked:p,onCheck:S}),a.ZP.createElement(tt.Z,{label:b("DataAndStorage.Autoplay.Videos"),checked:E,onCheck:w})))})));var Ka=n(95616),Qa=n(58912);var es=n(80036);const ts={x:0,y:0},ns=(0,a.X$)((e=>{let{children:t,id:n,onDrag:s,onDragEnd:i,style:l,knobStyle:r,isDisabled:o}=e;const c=(0,N.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)({isDragging:!1,origin:ts,translation:ts}),h=e=>{var t,n;e.stopPropagation(),e.preventDefault();const{x:a,y:s}=as(e);u({...m,isDragging:!0,origin:{x:a,y:s},width:null===(t=d.current)||void 0===t?void 0:t.offsetWidth,height:null===(n=d.current)||void 0===n?void 0:n.offsetHeight})},v=(0,a.I4)((e=>{const{x:t,y:a}=as(e),i={x:t-m.origin.x,y:a-m.origin.y};u((e=>({...e,translation:i}))),s(i,n)}),[n,s,m.origin.x,m.origin.y]),P=(0,a.I4)((()=>{requestAnimationFrame((()=>{u((e=>({...e,isDragging:!1,width:void 0,height:void 0}))),i()}))}),[i]);(0,a.d4)((()=>{m.isDragging&&o&&u((e=>({...e,isDragging:!1,width:void 0,height:void 0})))}),[o,m.isDragging]),(0,a.d4)((()=>(m.isDragging?(window.addEventListener("touchmove",v),window.addEventListener("mousemove",v),window.addEventListener("touchend",P),window.addEventListener("touchcancel",P),window.addEventListener("mouseup",P)):(window.removeEventListener("touchmove",v),window.removeEventListener("mousemove",v),window.removeEventListener("touchend",P),window.removeEventListener("touchcancel",P),window.removeEventListener("mouseup",P),u((e=>({...e,translation:ts})))),()=>{m.isDragging&&(window.removeEventListener("touchmove",v),window.removeEventListener("mousemove",v),window.removeEventListener("touchend",P),window.removeEventListener("touchcancel",P),window.removeEventListener("mouseup",P))})),[v,P,m.isDragging]);const Z=(0,X.Z)("C9QYXaRLeCEFngOBl4S3",m.isDragging&&"vhGsRt79lQzzuXny9KG8"),g=(0,a.Ye)((()=>(0,es.Z)(`transform: translate(${m.translation.x}px, ${m.translation.y}px)`,m.width?`width: ${m.width}px`:void 0,m.height?`height: ${m.height}px`:void 0,l)),[l,m.height,m.translation.x,m.translation.y,m.width]);return a.ZP.createElement("div",{style:g,className:Z,ref:d},t,!o&&a.ZP.createElement("div",{"aria-label":c("i18n_dragToSort"),tabIndex:0,role:"button",className:(0,X.Z)("oGgH1RraeCPayQnxA8C_","draggable-knob"),onMouseDown:h,onTouchStart:h,style:r},a.ZP.createElement("i",{className:"icon-sort","aria-hidden":!0})))}));function as(e){let t,n;return"touches"in e?(t=e.touches[0].clientX,n=e.touches[0].clientY):(t=e.clientX,n=e.clientY),{x:t,y:n}}const ss=(0,H.P2)((e=>e()),6e4,!0),is=(0,a.X$)((0,i.c$)((e=>{const{orderedIds:t,byId:n,recommended:a}=e.chatFolders;return{folderIds:t,foldersById:n,isPremium:(0,r.wV)(e),recommendedChatFolders:a,maxFolders:(0,tn.M)(e,"dialogFilters")}}))((e=>{let{isActive:t,onCreateFolder:n,onEditFolder:s,onReset:r,folderIds:o,foldersById:c,isPremium:d,recommendedChatFolders:u,maxFolders:h}=e;const{loadRecommendedChatFolders:v,addChatFolder:P,openLimitReachedModal:Z,openDeleteChatFolderModal:g,sortChatFolders:p}=(0,i.Sv)(),[E,C]=(0,a.eJ)({orderedFolderIds:o,dragOrderIds:o,draggedIndex:void 0});(0,a.d4)((()=>{ss((()=>{v()}))}),[v]);const f=(0,a.I4)((()=>{Object.keys(c).length>=h-1?Z({limit:"dialogFilters"}):n()}),[c,h,n,Z]),b=(0,N.Z)();(0,k.Z)({isActive:t,onBack:r});const I=(0,Ka.mE)(),y=(0,a.Ye)((()=>{if(E.orderedFolderIds)return E.orderedFolderIds.length<=1?zn.D:E.orderedFolderIds.map((e=>{const t=c[e];return e===m.Nf?{id:e,title:b("FilterAllChats")}:{id:t.id,title:t.title,subtitle:(0,l.SB)(b,t,I[t.id])}}))}),[E.orderedFolderIds,c,b,I]),S=(0,a.I4)((e=>{Object.keys(c).length>=h-1?Z({limit:"dialogFilters"}):P({folder:e})}),[c,h,P,Z]),w=(0,a.I4)(((e,t)=>{var n,a;const s=Math.round(e.y/68),i=(null===(n=E.orderedFolderIds)||void 0===n?void 0:n.indexOf(t))||0,l=null===(a=E.orderedFolderIds)||void 0===a?void 0:a.filter((e=>e!==t));var r,c;l&&(r=i+s,0,c=(null==o?void 0:o.length)||0,r>=0&&r<=c)&&(l.splice(i+s+(d?0:1),0,t),C((e=>({...e,draggedIndex:i,dragOrderIds:l}))))}),[null==o?void 0:o.length,d,E.orderedFolderIds]),M=(0,a.I4)((()=>{C((e=>(p({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0})))}),[p]),T=(0,a.Ye)((()=>!d||Object.keys(c).length<h-1),[c,d,h]);return a.ZP.createElement("div",{className:"settings-content no-border custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(Qa.Z,{size:m.ku,tgsUrl:Vn.l.FoldersAll,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},b("CreateNewFilterInfo")),T&&a.ZP.createElement(D.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:f,isRtl:b.isRtl},a.ZP.createElement("i",{className:"icon-add"}),b("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:b.isRtl?"rtl":void 0},b("Filters")),a.ZP.createElement("div",{className:"settings-sortable-container",style:`height: ${68*((null==o?void 0:o.length)||0)}px`},null!=y&&y.length?y.map(((e,n)=>{var i,l,r,o;const u=n>h-1,v=E.draggedIndex===n,P=68*(null!==(i=null===(l=E.orderedFolderIds)||void 0===l?void 0:l.indexOf(e.id))&&void 0!==i?i:0),p=68*(null!==(r=null===(o=E.dragOrderIds)||void 0===o?void 0:o.indexOf(e.id))&&void 0!==r?r:0);return e.id===m.Nf?a.ZP.createElement(ns,{key:e.id,id:e.id,onDrag:w,onDragEnd:M,style:`top: ${v?P:p}px;`,knobStyle:(b.isRtl?"left":"right")+": 0.375rem;",isDisabled:!d||!t},a.ZP.createElement(Ge.Z,{key:e.id,className:"mb-2 no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},b("FoldersAllChatsDesc")))):a.ZP.createElement(ns,{key:e.id,id:e.id,onDrag:w,onDragEnd:M,style:`top: ${v?P:p}px;`,knobStyle:(b.isRtl?"left":"right")+": 3rem;",isDisabled:u||!t},a.ZP.createElement(Ge.Z,{className:"mb-2 no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{g({folderId:e.id})},destructive:!0,title:b("Delete"),icon:"delete"}],onClick:()=>{u?Z({limit:"dialogFilters"}):s(c[e.id])}},a.ZP.createElement("span",{className:"title"},(0,we.Z)(e.title,["emoji"]),u&&a.ZP.createElement("i",{className:"icon-lock-badge settings-folders-blocked-icon"})),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))})):y&&!y.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(Oe.Z,null))),u&&Boolean(u.length)&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:b.isRtl?"rtl":void 0},b("FilterRecommended")),u.map((e=>a.ZP.createElement(Ge.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,we.Z)(e.title,["emoji"])),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement(D.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:b.isRtl},b("Add"))))))))})));var ls=n(53455);const rs=e=>{let{count:t,itemName:n,itemPluralName:s,isLoading:i,onClick:l}=e;const r=(0,N.Z)();return a.ZP.createElement(D.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:i,isRtl:r.isRtl,onClick:l},a.ZP.createElement("i",{className:"icon-down"}),"Show ",t," more ",t>1?s||`${n}s`:n)},os="Please provide a title for this folder.",cs="ChatList.Filter.Error.Empty",ds=(0,a.X$)((0,i.c$)(((e,t)=>{let{state:n}=t;const{listIds:a}=e.chats,{byId:s}=e.chatFolders;return{loadedActiveChatIds:a.active,loadedArchivedChatIds:a.archived,isRemoved:void 0!==n.folderId&&!s[n.folderId]}}))((e=>{let{state:t,dispatch:n,onAddIncludedChats:s,onAddExcludedChats:r,isActive:o,onReset:c,isRemoved:d,onBack:u,loadedActiveChatIds:h,loadedArchivedChatIds:v}=e;const{editChatFolder:P,addChatFolder:Z}=(0,i.Sv)(),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(!1);(0,a.d4)((()=>{d&&c()}),[d,c]);const{selectedChatIds:f,selectedChatTypes:b}=(0,ls.vb)(t,"included"),{selectedChatIds:I,selectedChatTypes:y}=(0,ls.vb)(t,"excluded");(0,a.d4)((()=>{p(!1),C(!1)}),[t.folderId]);const[S,w]=(0,a.Ye)((()=>{const e=new Set([...h||[],...v||[]]),t=(0,Le.eL)(f,e),n=(0,Le.eL)(I,e);return[g?t:t.slice(0,5-b.length),E?n:n.slice(0,5-y.length)]}),[I,f,b,y,E,g,h,v]),M=(0,N.Z)();(0,k.Z)({isActive:o,onBack:u});const T=(0,a.I4)((e=>{const{currentTarget:t}=e;n({type:"setTitle",payload:t.value.trim()})}),[n]),A=(0,a.I4)((()=>{const{title:e}=t.folder;e?f.length||Object.keys(b).length?(n({type:"setIsLoading",payload:!0}),"edit"===t.mode?P({id:t.folderId,folderUpdate:t.folder}):Z({folder:t.folder}),setTimeout((()=>{c()}),500)):n({type:"setError",payload:cs}):n({type:"setError",payload:os})}),[Z,n,P,f.length,b,c,t]);function R(e){const t="included"===e?b:y,n="included"===e?S:w,s="included"===e?g:E,i=("included"===e?f:I).length-t.length-n.length,r="included"===e?()=>p(!0):()=>C(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?ls.fi.find((t=>{let{key:n}=t;return n===e})):ls.Yy.find((t=>{let{key:n}=t;return n===e}));if(n)return a.ZP.createElement(Ge.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},M(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Ge.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,l.YC)(e)?a.ZP.createElement(Je.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Ve.Z,{avatarSize:"small",chatId:e})))),!s&&i>0&&a.ZP.createElement(rs,{count:i,itemName:"chat",onClick:r}))}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(Qa.Z,{size:m.ku,tgsUrl:Vn.l.FoldersNew,play:String(t.folderId),className:"settings-content-icon"}),"create"===t.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:M.isRtl?"rtl":void 0},M("FilterIncludeInfo")),a.ZP.createElement(Ue.Z,{className:"mb-0",label:M("FilterNameHint"),value:t.folder.title,onChange:T,error:t.error&&t.error===os?os:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},t.error&&t.error===cs&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:M.isRtl?"rtl":void 0},M(t.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:M.isRtl?"rtl":void 0},M("FilterInclude")),a.ZP.createElement(Ge.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},M("FilterAddChats")),R("included")),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:M.isRtl?"rtl":void 0},M("FilterExclude")),a.ZP.createElement(Ge.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:r},M("FilterAddChats")),R("excluded"))),a.ZP.createElement(Ga.Z,{isShown:Boolean(t.isTouched),disabled:t.isLoading,onClick:A,ariaLabel:"edit"===t.mode?"Save changes":"Create folder"},t.isLoading?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),ms=(0,a.X$)((0,i.c$)((e=>({maxChats:(0,tn.M)(e,"dialogFiltersChats")})))((e=>{let{mode:t,chatIds:n,selectedIds:s,selectedChatTypes:r,filterValue:o,onSelectedIdsChange:c,onSelectedChatTypesChange:d,onFilterChange:m,maxChats:u}=e;const{openLimitReachedModal:h}=(0,i.Sv)(),v=(0,a.sO)(null),P="included"===t?ls.fi:ls.Yy,Z=s.length+r.length>10;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{v.current.focus()}))}),500)}),[]);const g=(0,a.I4)((e=>{const n=[...s];if(n.includes(e))n.splice(n.indexOf(e),1);else{if(s.length>=u&&"included"===t)return void h({limit:"dialogFiltersChats"});n.push(e)}c(n)}),[s,c,u,t,h]),p=(0,a.I4)((e=>{const t=[...r];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),d(t)}),[r,d]),E=(0,a.I4)((e=>{const{value:t}=e.currentTarget;m(t)}),[m]),C=(0,N.Z)(),[f,b]=(0,xe.Z)(void 0,n,Boolean(o));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},r.map((function(e){const t=P.find((t=>{let{key:n}=t;return e===n}));if(t)return a.ZP.createElement(la.Z,{icon:t.icon,title:C(t.title),isMinimized:Z,canClose:!0,onClick:p,clickArg:t.key})})),s.map(((e,t)=>a.ZP.createElement(la.Z,{chatOrUserId:e,isMinimized:Z&&t<s.length-5,canClose:!0,onClick:g,clickArg:e}))),a.ZP.createElement(Ue.Z,{ref:v,value:o,onChange:E,placeholder:C("Search")})),a.ZP.createElement(_e.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:f,onLoadMore:b},(!f||!f.length||f.includes(n[0]))&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{key:"header1",className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("FilterChatTypes")),P.map((function(e){return a.ZP.createElement(Ge.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>p(e.key),ripple:!0},a.ZP.createElement("i",{className:`icon-${e.icon}`}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},C(e.title)),a.ZP.createElement(tt.Z,{label:"",checked:r.includes(e.key),round:!0}))})),a.ZP.createElement("div",{key:"divider",className:"picker-list-divider"}),a.ZP.createElement("h4",{key:"header2",className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("FilterChats"))),null!=f&&f.length?f.map((function(e){const t=s.includes(e);return a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>g(e),ripple:!0},(0,l.YC)(e)?a.ZP.createElement(Je.Z,{userId:e}):a.ZP.createElement(Ve.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(tt.Z,{label:"",checked:t,round:!0}))})):f&&!f.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(Oe.Z,{key:"loading"})))}))),us=(0,a.X$)((e=>{let{mode:t,state:n,dispatch:s,isActive:r,onReset:o}=e;const{chatFilter:c}=n,{selectedChatIds:d,selectedChatTypes:u}=(0,ls.vb)(n,t,!0),h=(0,N.Z)(),v=(0,Ka.d7)(m.Nf),P=(0,Ka.d7)(m.WS),Z=(0,a.Ye)((()=>{const e=(0,i.Rd)().chats.byId,t=[...v||[],...P||[]];return(0,Le.Tw)([...d,...(0,l.$l)(h,t,e,c)])}),[v,P,d,h,c]),g=(0,a.I4)((e=>{s({type:"setChatFilter",payload:e})}),[s]),p=(0,a.I4)((e=>{s("included"===t?{type:"setIncludeFilters",payload:{...n.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...n.excludeFilters,excludedChatIds:e}})}),[t,n,s]),E=(0,a.I4)((e=>{const n={};e.forEach((e=>{n[e]=!0})),s("included"===t?{type:"setIncludeFilters",payload:{includedChatIds:d,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:d,...n}})}),[t,d,s]);return(0,k.Z)({isActive:r,onBack:o}),Z?a.ZP.createElement(ms,{mode:t,chatIds:Z,selectedIds:d,selectedChatTypes:u,filterValue:c,onSelectedIdsChange:p,onSelectedChatTypesChange:E,onFilterChange:g}):a.ZP.createElement(Oe.Z,null)})),hs=(0,a.X$)((e=>{let{currentScreen:t,shownScreen:n,state:i,dispatch:l,isActive:r,onScreenSelect:o,onReset:c}=e;const d=(0,a.I4)((()=>{t!==s.MT.FoldersCreateFolder&&t!==s.MT.FoldersEditFolder&&t!==s.MT.FoldersEditFolderFromChatList||setTimeout((()=>{l({type:"reset"})}),200),t!==s.MT.FoldersIncludedChats&&t!==s.MT.FoldersExcludedChats?c():"create"===i.mode?o(s.MT.FoldersCreateFolder):o(s.MT.FoldersEditFolder)}),[i.mode,l,t,c,o]),m=(0,a.I4)((()=>{l({type:"reset"}),o(s.MT.FoldersCreateFolder)}),[o,l]),u=(0,a.I4)((e=>{l({type:"editFolder",payload:e}),o(s.MT.FoldersEditFolder)}),[l,o]),h=(0,a.I4)((()=>{l({type:"editIncludeFilters"}),o(t===s.MT.FoldersEditFolderFromChatList?s.MT.FoldersIncludedChatsFromChatList:s.MT.FoldersIncludedChats)}),[t,l,o]),v=(0,a.I4)((()=>{l({type:"editExcludeFilters"}),o(t===s.MT.FoldersEditFolderFromChatList?s.MT.FoldersExcludedChatsFromChatList:s.MT.FoldersExcludedChats)}),[t,l,o]);switch(t){case s.MT.Folders:return a.ZP.createElement(is,{onCreateFolder:m,onEditFolder:u,isActive:r||[s.MT.FoldersCreateFolder,s.MT.FoldersEditFolder,s.MT.FoldersIncludedChats,s.MT.FoldersExcludedChats].includes(n),onReset:c});case s.MT.FoldersCreateFolder:case s.MT.FoldersEditFolder:case s.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(ds,{state:i,dispatch:l,onAddIncludedChats:h,onAddExcludedChats:v,onReset:d,isActive:r||[s.MT.FoldersIncludedChats,s.MT.FoldersExcludedChats].includes(n),onBack:c});case s.MT.FoldersIncludedChats:case s.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(us,{mode:"included",state:i,dispatch:l,onReset:d,isActive:r});case s.MT.FoldersExcludedChats:case s.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(us,{mode:"excluded",state:i,dispatch:l,onReset:d,isActive:r});default:return}}));var vs=n(50711),Ps=n(14434),Zs=n(27370);const gs=["Solid and Steady","Nice and Fast","Lots of Stuff"],ps=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],Es=(0,a.X$)((0,i.c$)((e=>{const{theme:t,shouldUseSystemTheme:n}=e.settings.byKey;return{...(0,Le.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","isSensitiveEnabled","canChangeSensitive","timeFormat"]),theme:t,shouldUseSystemTheme:n}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:l,messageTextSize:r,animationLevel:o,messageSendKeyCombo:c,timeFormat:u,theme:h,shouldUseSystemTheme:v}=e;const{setSettingOption:P}=(0,i.Sv)(),Z=(0,N.Z)(),g=[{label:Z("EmptyChat.Appearance.Light"),value:"light"},{label:Z("EmptyChat.Appearance.Dark"),value:"dark"},{label:Z("EmptyChat.Appearance.System"),value:"auto"}],p=d.$b?void 0:[{value:"enter",label:Z("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:Z(d.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],E=(0,a.I4)((e=>{gs.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),P({animationLevel:e})}),[P]),C=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,d.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()),P({messageTextSize:e})}),[P]),f=(0,a.I4)((e=>{const t="auto"===e?(0,d.vn)():e;P({theme:t}),P({shouldUseSystemTheme:"auto"===e}),t!==h&&(0,Zs.Z)(t,o===m.zy)}),[o,P,h]),b=(0,a.I4)((e=>{P({timeFormat:e}),P({wasTimeFormatSetManually:!0}),(0,vs.qf)(e)}),[P]),I=(0,a.I4)((e=>{P({messageSendKeyCombo:e})}),[P]);return(0,k.Z)({isActive:t,onBack:l}),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:Z.isRtl?"rtl":void 0},Z("SETTINGS")),a.ZP.createElement(re.Z,{label:Z("TextSize"),min:12,max:20,value:r,onChange:C}),a.ZP.createElement(Ge.Z,{icon:"photo",onClick:()=>n(s.MT.GeneralChatBackground)},Z("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},Z("Theme")),a.ZP.createElement(Ps.Z,{name:"theme",options:g,selected:v?"auto":h,onChange:f})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(Ps.Z,{name:"timeformat",options:ps,selected:u,onChange:b})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:Z.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(re.Z,{options:gs,value:o,onChange:E})),p&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:Z.isRtl?"rtl":void 0},Z("VoiceOver.Keyboard")),a.ZP.createElement(Ps.Z,{name:"keyboard-send-settings",options:p,onChange:I,selected:c})))})));var Cs=n(85655),fs=n(75851),bs=n(49524);const Is=(0,a.X$)((e=>{var t;let{wallpaper:n,theme:i,isSelected:l,onClick:r}=e;const{slug:o,document:c}=n,d=`wallpaper${c.id}`,u=c.previewBlobUrl,h=(0,M.Z)(`${d}?size=m`),v=(0,wt.Z)(null===(t=c.thumbnail)||void 0===t?void 0:t.dataUri,Boolean(h),!0),{transitionClassNames:P}=(0,ne.Z)(Boolean(h||u),void 0,void 0,"slow"),[Z,g]=(0,a.eJ)(!1),{mediaData:p,loadProgress:E}=(0,T.Z)(d,!Z),C=!1===(0,S.Z)(Z),{shouldRender:f,transitionClassNames:b}=(0,ne.Z)(Z&&!p||o===s.mp,void 0,C,"slow"),I=(0,a.sO)();I.current=i;const y=(0,a.I4)((()=>{(async()=>{const e=await(0,L.gm)(p);await bs.save(m.fo,I.current,e),r(o)})()}),[p,r,o]);(0,a.d4)((()=>{p&&y()}),[p,y]);const k=(0,a.I4)((()=>{p?y():g((e=>!e))}),[p,y]),N=(0,X.Z)("WallpaperTile",l&&"selected");return a.ZP.createElement("div",{className:N,onClick:k},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:v,className:"thumbnail"}),a.ZP.createElement("img",{src:h||u,className:(0,X.Z)("full-media",P),alt:""}),f&&a.ZP.createElement("div",{className:(0,X.Z)("spinner-container",b)},a.ZP.createElement(G.Z,{progress:E,onClick:k}))))})),ys=(0,H.P2)((e=>e()),6e4,!0),ks=(0,a.X$)((0,i.c$)((e=>{const t=(0,r.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((e=>{let{isActive:t,onScreenSelect:n,onReset:l,background:r,isBlurred:o,loadedWallpapers:c,theme:d}=e;const{loadWallpapers:u,uploadWallpaper:h,setThemeSettings:v}=(0,i.Sv)(),P=(0,a.sO)();P.current=d,(0,a.d4)((()=>{ys((()=>{u()}))}),[u]);const Z=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&h(t[0])}),[h]),g=(0,a.I4)((()=>{(0,Cs.g)("image/jpeg",Z,!0)}),[Z]),p=(0,a.I4)((()=>{n(s.MT.GeneralChatBackgroundColor)}),[n]),E=(0,a.I4)((()=>{v({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?m.Vv:m.g})}),[v,d]),C=(0,a.I4)((e=>{v({theme:P.current,background:e});const t=c&&c.find((t=>t.slug===e));null!=t&&t.document.thumbnail&&(0,fs.ix)(t.document.thumbnail.dataUri).then((e=>{const t=(0,fs.uR)(e),n=`#${(0,fs.CO)(e)}`;v({theme:P.current,backgroundColor:n,patternColor:t})}))}),[c,v]),f=(0,a.I4)((e=>{v({theme:P.current,isBlurred:e.target.checked})}),[v]),b=(0,N.Z)();(0,k.Z)({isActive:t,onBack:l});const I=(null==c?void 0:c[0])&&c[0].slug===s.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Ge.Z,{icon:"camera-add",className:"mb-0",disabled:I,onClick:g},b("UploadImage")),a.ZP.createElement(Ge.Z,{icon:"colorize",className:"mb-0",onClick:p},b("SetColor")),a.ZP.createElement(Ge.Z,{icon:"favorite",onClick:E},b("ThemeResetToDefaults")),a.ZP.createElement(tt.Z,{label:b("BackgroundBlurred"),checked:Boolean(o),onChange:f})),c?a.ZP.createElement("div",{className:"settings-wallpapers"},c.map((e=>a.ZP.createElement(Is,{wallpaper:e,theme:d,isSelected:r===e.slug,onClick:C})))):a.ZP.createElement(Oe.Z,null))}))),Ns=(0,fs.xP)((0,fs.wK)("e6ebee")),Ss=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function ws(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 Ms(e,t){let{colorPosition:n,huePosition:a}=e;return[a/(t.hueRect.width-1),n[0]/(t.colorRect.width-1),1-n[1]/(t.colorRect.height-1)]}const Ts=(0,a.X$)((0,i.c$)((e=>{const t=(0,r.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((e=>{let{isActive:t,onReset:n,theme:s,backgroundColor:l}=e;const{setThemeSettings:r}=(0,i.Sv)(),o=(0,a.sO)();o.current=s;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null),u=(0,a.sO)(!0),[h,v]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?(0,fs.xP)((0,fs.wK)(e.replace("#",""))):Ns}(l)),P=(0,a.sO)(h);(0,a.d4)((()=>{P.current=h}),[h]);const[Z,g,p]=(0,b.Z)(),[E,C]=(0,a.eJ)(""),[f,I]=(0,a.eJ)(""),y=(0,a.sO)(),N=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:d.current.offsetLeft,...(0,Le.ei)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...(0,Le.ei)(m.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+c.current.scrollTop),e.height-1)],{huePosition:a}=ws(P.current,y.current);return v(Ms({colorPosition:n,huePosition:a},y.current)),g(),!0}function a(e){const{colorPosition:n}=ws(P.current,y.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return v(Ms({colorPosition:n,huePosition:a},y.current)),g(),!0}y.current={colorRect:e,hueRect:t},(0,z.sf)(d.current,{onCapture:n,onDrag:n,onRelease:p,onClick:p,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,z.sf)(m.current,{onCapture:a,onDrag:a,onRelease:p,onClick:p,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[g,p]);const{colorPosition:S=[0,0],huePosition:w=0}=y.current?ws(h,y.current):{},M=(0,fs.CO)((0,fs.eb)(h)),T=h[0],A=(0,fs.CO)((0,fs.eb)([T,1,1]));(0,a.d4)((()=>{const e=(0,fs.eb)(h),t=`#${(0,fs.CO)(e)}`;if(C(e.join(", ")),I(t),!u.current){const n=(0,fs.uR)(e);r({theme:o.current,background:void 0,backgroundColor:t,patternColor:n})}u.current=!1}),[h,r]),(0,a.d4)((()=>{!function(e,t,n,a){let s,i,l;n.current&&a.current?(s=a.current.colorRect.width,i=a.current.colorRect.height,l=n.current):(s=e.offsetWidth,i=e.offsetHeight,l=e.getContext("2d"),e.width=s,e.height=i,n.current=l);const r=l.createImageData(s,i),o=r.data,c=(0,fs.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);o[d++]=n[0]+(a[0]-n[0])*t,o[d++]=n[1]+(a[1]-n[1])*t,o[d++]=n[2]+(a[2]-n[2])*t,o[d++]=255}}l.putImageData(r,0,0)}(d.current.firstChild,T,N,y)}),[T]),(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,fs.eb)([n,1,1]);s[i++]=a[0],s[i++]=a[1],s[i++]=a[2],s[i++]=255}n.putImageData(a,0,0)}(m.current.firstChild)}),[]);const R=(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())));v((0,fs.xP)(e))}e.currentTarget.value=t}),[]),L=(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}$/)&&v((0,fs.xP)((0,fs.wK)(t.replace("#","")))),e.currentTarget.value=t}),[]),F=(0,a.I4)((e=>{v((0,fs.xP)((0,fs.wK)(e.currentTarget.dataset.color.replace("#",""))))}),[]),x=(0,X.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",Z&&"is-dragging");return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{ref:c,className:x},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:d,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${S[0]}px, ${S[1]}px); background-color: #${M};`})),a.ZP.createElement("div",{ref:m,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${w}px); background-color: #${A};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(Ue.Z,{value:f,label:"HEX",onChange:L}),a.ZP.createElement(Ue.Z,{value:E,label:"RGB",onChange:R}))),a.ZP.createElement("div",{className:"predefined-colors"},Ss.map((e=>a.ZP.createElement("div",{className:e===`#${M}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:F})))))})));var As=n(88957),Rs=n(28406);const Ls=(0,a.X$)((0,i.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})))((e=>{let{isActive:t,onReset:n,hasPrivateChatsNotifications:s,hasPrivateChatsMessagePreview:l,hasGroupNotifications:r,hasGroupMessagePreview:o,hasBroadcastNotifications:c,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,hasPushNotifications:u,hasWebNotifications:h,notificationSoundVolume:v}=e;const{loadNotificationSettings:P,updateContactSignUpNotification:Z,updateNotificationSettings:g,updateWebNotificationSettings:p}=(0,i.Sv)();(0,a.d4)((()=>{P()}),[P]);const E=(0,As.Z)(500,!0),C=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!s:!("group"===t?r:c),i="contact"===t?l:"group"===t?o:d;g({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:i},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[d,c,o,r,l,s,g]),f=(0,a.I4)((e=>{p({hasWebNotifications:e.target.checked})}),[p]),b=(0,a.I4)((e=>{p({hasPushNotifications:e.target.checked})}),[p]),I=(0,a.I4)((e=>{C(e,"contact","silent")}),[C]),y=(0,a.I4)((e=>{C(e,"contact","showPreviews")}),[C]),S=(0,a.I4)((e=>{C(e,"group","silent")}),[C]),w=(0,a.I4)((e=>{C(e,"group","showPreviews")}),[C]),M=(0,a.I4)((e=>{C(e,"broadcast","silent")}),[C]),T=(0,a.I4)((e=>{C(e,"broadcast","showPreviews")}),[C]),A=(0,a.I4)((e=>{Z({isSilent:!e.target.checked})}),[Z]),R=(0,a.I4)((e=>{p({notificationSoundVolume:e}),E((()=>(0,Rs.q3)(void 0,e)))}),[E,p]),L=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),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(tt.Z,{label:"Web notifications",subLabel:L(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:f}),a.ZP.createElement(tt.Z,{label:"Offline notifications",disabled:!h,subLabel:L(u?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:u,onChange:b}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(re.Z,{label:"Sound",min:0,max:10,value:v,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(tt.Z,{label:L("NotificationsForPrivateChats"),subLabel:L(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:I}),a.ZP.createElement(tt.Z,{label:L("MessagePreview"),disabled:!s,subLabel:L(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:y})),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(tt.Z,{label:L("NotificationsForGroups"),subLabel:L(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:S}),a.ZP.createElement(tt.Z,{label:L("MessagePreview"),disabled:!r,subLabel:L(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:w})),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(tt.Z,{label:L("NotificationsForChannels"),subLabel:L(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:M}),a.ZP.createElement(tt.Z,{label:L("MessagePreview"),disabled:!c,subLabel:L(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,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(tt.Z,{label:L("ContactJoined"),checked:m,onChange:A})))}))),Fs=(0,a.X$)((0,i.c$)((e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:n,canChangeSensitive:a,shouldArchiveAndMuteNewNonContact:s},privacy:i},blocked:l,passcode:{hasPasscode:o}}=e;return{isCurrentUserPremium:(0,r.wV)(e),hasPassword:t,hasPasscode:Boolean(o),blockedCount:l.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:n,shouldArchiveAndMuteNewNonContact:s,canChangeSensitive:a,privacyPhoneNumber:i.phoneNumber,privacyLastSeen:i.lastSeen,privacyProfilePhoto:i.profilePhoto,privacyForwarding:i.forwards,privacyVoiceMessages:i.voiceMessages,privacyGroupChats:i.chatInvite,privacyPhoneCall:i.phoneCall,privacyPhoneP2P:i.phoneP2P}}))((e=>{let{isActive:t,isCurrentUserPremium:n,hasPassword:l,hasPasscode:r,blockedCount:o,webAuthCount:c,isSensitiveEnabled:d,canChangeSensitive:m,shouldArchiveAndMuteNewNonContact:u,privacyPhoneNumber:h,privacyLastSeen:v,privacyProfilePhoto:P,privacyForwarding:Z,privacyVoiceMessages:g,privacyGroupChats:p,privacyPhoneCall:E,privacyPhoneP2P:C,onScreenSelect:f,onReset:b}=e;const{loadPrivacySettings:I,loadBlockedContacts:y,loadAuthorizations:S,loadContentSettings:w,updateContentSettings:M,loadGlobalPrivacySettings:T,updateGlobalPrivacySettings:A,loadWebAuthorizations:R,showNotification:L}=(0,i.Sv)();(0,a.d4)((()=>{y(),S(),I(),w(),R()}),[y,S,I,w,R]),(0,a.d4)((()=>{t&&T()}),[t,T]);const F=(0,N.Z)();(0,k.Z)({isActive:t,onBack:b});const x=(0,a.I4)((e=>{A({shouldArchiveAndMuteNewNonContact:e})}),[A]),B=(0,a.I4)((()=>{n?f(s.MT.PrivacyVoiceMessages):L({message:F("PrivacyVoiceMessagesPremiumOnly")})}),[n,F,f,L]);function D(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(Ge.Z,{icon:"delete-user",narrow:!0,onClick:()=>f(s.MT.PrivacyBlockedUsers)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("BlockedUsers")),o>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},F("Users",o)))),c>0&&a.ZP.createElement(Ge.Z,{icon:"web",onClick:()=>f(s.MT.ActiveWebsites)},F("PrivacySettings.WebSessions"),a.ZP.createElement("span",{className:"settings-item__current-value"},c)),a.ZP.createElement(Ge.Z,{icon:"key",narrow:!0,onClick:()=>f(r?s.MT.PasscodeEnabled:s.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(r?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Ge.Z,{icon:"lock",narrow:!0,onClick:()=>f(l?s.MT.TwoFaEnabled:s.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(l?"PasswordOn":"PasswordOff"))))),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(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.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"},D(h)))),a.ZP.createElement(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.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"},D(v)))),a.ZP.createElement(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.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"},D(P)))),a.ZP.createElement(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.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"},D(E)))),a.ZP.createElement(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.MT.PrivacyPhoneP2P)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyP2P")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},D(C)))),a.ZP.createElement(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.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"},D(Z)))),a.ZP.createElement(Ge.Z,{narrow:!0,disabled:!n,allowDisabledClick:!0,rightElement:!n&&a.ZP.createElement("i",{className:"icon-lock-badge settings-icon-locked"}),className:"no-icon",onClick:B},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},F("PrivacyVoiceMessages")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},D(g)))),a.ZP.createElement(Ge.Z,{narrow:!0,className:"no-icon",onClick:()=>f(s.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"},D(p))))),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(tt.Z,{label:F("ArchiveAndMute"),subLabel:F("ArchiveAndMuteInfo"),checked:Boolean(u),onCheck:x})),m&&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(tt.Z,{label:F("lng_settings_sensitive_disable_filtering"),subLabel:F("lng_settings_sensitive_about"),checked:Boolean(d),disabled:!m,onCheck:M})))}))),xs=(0,a.X$)((0,i.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})))((e=>{let{isActive:t,onReset:n,languages:s,language:l}=e;const{loadLanguages:r,setSettingOption:o}=(0,i.Sv)(),[c,d]=(0,a.eJ)(l),[m,u,h]=(0,b.Z)();(0,a.d4)((()=>{r()}),[r]);const v=(0,a.I4)((e=>{d(e),u(),(0,vs.m0)(e,(()=>{h(),o({language:e})}))}),[u,h,o]),P=(0,a.Ye)((()=>s?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((e=>{let{langCode:t,nativeName:n,name:a}=e;return{value:t,label:n,subLabel:a}})).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(s):void 0),[s]);return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll settings-item--first"},P?a.ZP.createElement(Ps.Z,{name:"keyboard-send-settings",options:P,selected:c,loadingOption:m?c:void 0,onChange:v}):a.ZP.createElement(Oe.Z,null))})));function Bs(e){switch(e){case s.MT.PrivacyPhoneNumber:case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case s.MT.PrivacyLastSeen:case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case s.MT.PrivacyProfilePhoto:case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case s.MT.PrivacyForwarding:case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyForwardingDeniedContacts:return"forwards";case s.MT.PrivacyVoiceMessages:case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case s.MT.PrivacyGroupChats:case s.MT.PrivacyGroupChatsAllowedContacts:case s.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite";case s.MT.PrivacyPhoneCall:case s.MT.PrivacyPhoneCallAllowedContacts:case s.MT.PrivacyPhoneCallDeniedContacts:return"phoneCall";case s.MT.PrivacyPhoneP2P:case s.MT.PrivacyPhoneP2PAllowedContacts:case s.MT.PrivacyPhoneP2PDeniedContacts:return"phoneP2P"}}const Ds=(0,a.X$)((0,i.c$)(((e,t)=>{let n,{screen:a}=t;const{chats:{byId:i},settings:{privacy:l}}=e;switch(a){case s.MT.PrivacyPhoneNumber:n=l.phoneNumber;break;case s.MT.PrivacyLastSeen:n=l.lastSeen;break;case s.MT.PrivacyProfilePhoto:n=l.profilePhoto;break;case s.MT.PrivacyPhoneCall:n=l.phoneCall;break;case s.MT.PrivacyPhoneP2P:n=l.phoneP2P;break;case s.MT.PrivacyForwarding:n=l.forwards;break;case s.MT.PrivacyVoiceMessages:n=l.voiceMessages;break;case s.MT.PrivacyGroupChats:n=l.chatInvite}return n?{...n,chatsById:i}:{}}))((e=>{let{screen:t,isActive:n,onScreenSelect:l,onReset:r,visibility:o,allowUserIds:c,allowChatIds:d,blockUserIds:m,blockChatIds:u,chatsById:h}=e;const{setPrivacyVisibility:v}=(0,i.Sv)(),P=(0,N.Z)(),Z=(0,a.Ye)((()=>{switch(t){case s.MT.PrivacyProfilePhoto:case s.MT.PrivacyGroupChats:return[{value:"everybody",label:P("P2PEverybody")},{value:"contacts",label:P("P2PContacts")}];default:return[{value:"everybody",label:P("P2PEverybody")},{value:"contacts",label:P("P2PContacts")},{value:"nobody",label:P("P2PNobody")}]}}),[P,t]),g={shouldShowDenied:"nobody"!==o,shouldShowAllowed:"everybody"!==o},p=Bs(t),E=(0,a.Ye)((()=>{switch(t){case s.MT.PrivacyPhoneNumber:return P("PrivacyPhoneTitle");case s.MT.PrivacyLastSeen:return P("LastSeenTitle");case s.MT.PrivacyProfilePhoto:return P("PrivacyProfilePhotoTitle");case s.MT.PrivacyForwarding:return P("PrivacyForwardsTitle");case s.MT.PrivacyVoiceMessages:return P("PrivacyVoiceMessagesTitle");case s.MT.PrivacyGroupChats:return P("WhoCanAddMe");case s.MT.PrivacyPhoneCall:return P("WhoCanCallMe");case s.MT.PrivacyPhoneP2P:return P("PrivacyP2P");default:return}}),[P,t]);(0,k.Z)({isActive:n,onBack:r});const C=(0,a.Ye)((()=>{if(t===s.MT.PrivacyLastSeen)return P("CustomHelp")}),[P,t]),f=(()=>{switch(t){case s.MT.PrivacyPhoneNumber:return s.MT.PrivacyPhoneNumberAllowedContacts;case s.MT.PrivacyLastSeen:return s.MT.PrivacyLastSeenAllowedContacts;case s.MT.PrivacyProfilePhoto:return s.MT.PrivacyProfilePhotoAllowedContacts;case s.MT.PrivacyForwarding:return s.MT.PrivacyForwardingAllowedContacts;case s.MT.PrivacyPhoneCall:return s.MT.PrivacyPhoneCallAllowedContacts;case s.MT.PrivacyPhoneP2P:return s.MT.PrivacyPhoneP2PAllowedContacts;case s.MT.PrivacyVoiceMessages:return s.MT.PrivacyVoiceMessagesAllowedContacts;default:return s.MT.PrivacyGroupChatsAllowedContacts}})(),b=(()=>{switch(t){case s.MT.PrivacyPhoneNumber:return s.MT.PrivacyPhoneNumberDeniedContacts;case s.MT.PrivacyLastSeen:return s.MT.PrivacyLastSeenDeniedContacts;case s.MT.PrivacyProfilePhoto:return s.MT.PrivacyProfilePhotoDeniedContacts;case s.MT.PrivacyForwarding:return s.MT.PrivacyForwardingDeniedContacts;case s.MT.PrivacyPhoneCall:return s.MT.PrivacyPhoneCallDeniedContacts;case s.MT.PrivacyPhoneP2P:return s.MT.PrivacyPhoneP2PDeniedContacts;case s.MT.PrivacyVoiceMessages:return s.MT.PrivacyVoiceMessagesDeniedContacts;default:return s.MT.PrivacyGroupChatsDeniedContacts}})(),I=(0,a.Ye)((()=>c&&d&&h?d.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),c.length):0),[d,c,h]),y=(0,a.Ye)((()=>m&&u&&h?u.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),m.length):0),[u,m,h]),S=(0,a.I4)((e=>{v({privacyKey:p,visibility:e})}),[p,v]);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:P.isRtl?"rtl":void 0},E),a.ZP.createElement(Ps.Z,{name:`visibility-${p}`,options:Z,onChange:S,selected:o}),C&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:P.isRtl?"rtl":void 0},C)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:P.isRtl?"rtl":void 0},P("PrivacyExceptions")),g.shouldShowAllowed&&a.ZP.createElement(Ge.Z,{narrow:!0,icon:"add-user",onClick:()=>{l(f)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},I>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",I),a.ZP.createElement("span",{className:"title"},P("AlwaysAllow")),a.ZP.createElement("span",{className:"subtitle"},P("EditAdminAddUsers")))),g.shouldShowDenied&&a.ZP.createElement(Ge.Z,{narrow:!0,icon:"delete-user",onClick:()=>{l(b)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},y>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"",y),a.ZP.createElement("span",{className:"title"},P("NeverAllow")),a.ZP.createElement("span",{className:"subtitle"},P("EditAdminAddUsers"))))))})));function Os(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 $s=n(83321);const Us={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"},_s=(0,a.X$)((0,i.c$)(((e,t)=>{let{hash:n}=t;return{session:n?e.activeSessions.byHash[n]:void 0}}))((e=>{let{isOpen:t,session:n,onClose:s}=e;const{changeSessionSettings:l,terminateAuthorization:r}=(0,i.Sv)(),o=(0,N.Z)(),c=(0,Fe.Z)(n,!0),d=(0,a.I4)((()=>{l({hash:n.hash,areSecretChatsEnabled:!n.areSecretChatsEnabled})}),[l,n]),m=(0,a.I4)((()=>{l({hash:n.hash,areCallsEnabled:!n.areCallsEnabled})}),[l,n]),u=(0,a.I4)((()=>{r({hash:n.hash}),s()}),[s,n,r]);if(c)return a.ZP.createElement($e.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:o.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:o("Close"),onClick:s},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},o("SessionPreview.Title")),a.ZP.createElement(D.Z,{color:"danger",onClick:u,className:(0,X.Z)("modal-action-button",Us.headerButton)},o("SessionPreview.TerminateSession"))),isOpen:t,hasCloseButton:!0,onClose:s,className:Us.SettingsActiveSession},a.ZP.createElement("div",{className:(0,X.Z)(Us.iconDevice,c&&Us[`iconDevice__${Os(c)}`])}),a.ZP.createElement("h3",{className:Us.title,dir:"auto"},null==c?void 0:c.deviceModel),a.ZP.createElement("div",{className:Us.date,"aria-label":o("PrivacySettings.LastSeen")},(0,ie.SA)(1e3*c.dateActive,o.code)),a.ZP.createElement("dl",{className:Us.box},a.ZP.createElement("dt",null,o("SessionPreview.App")),a.ZP.createElement("dd",null,null==c?void 0:c.appName," ",null==c?void 0:c.appVersion,","," ",null==c?void 0:c.platform," ",null==c?void 0:c.systemVersion),a.ZP.createElement("dt",null,o("SessionPreview.Ip")),a.ZP.createElement("dd",null,null==c?void 0:c.ip),a.ZP.createElement("dt",null,o("SessionPreview.Location")),a.ZP.createElement("dd",null,c&&function(e){return[e.region,e.country].filter(Boolean).join(", ")}(c))),a.ZP.createElement("p",{className:Us.note},o("SessionPreview.IpDesc")),a.ZP.createElement("h4",{className:Us.actionHeader},o("AuthSessions.View.AcceptTitle")),a.ZP.createElement(Ge.Z,{onClick:d},a.ZP.createElement("span",{className:Us.actionName},o("SessionPreview.Accept.Secret")),a.ZP.createElement($s.Z,{id:"accept_secrets",label:"On",checked:c.areSecretChatsEnabled})),a.ZP.createElement(Ge.Z,{onClick:m},a.ZP.createElement("span",{className:Us.actionName},o("SessionPreview.Accept.Calls")),a.ZP.createElement($s.Z,{id:"accept_calls",label:"On",checked:c.areCallsEnabled})))})));function Gs(e){return[e.region,e.country].filter(Boolean).join(", ")}const Vs=(0,a.X$)((0,i.c$)((e=>e.activeSessions))((e=>{let{isActive:t,onReset:n,byHash:s,orderedHashes:l,ttlDays:r}=e;const{terminateAuthorization:o,terminateAllAuthorizations:c,changeSessionTtl:d}=(0,i.Sv)(),m=(0,N.Z)(),[u,h,v]=(0,b.Z)(),[P,Z]=(0,a.eJ)(),[g,p,E]=(0,b.Z)(),C=(0,a.Ye)((()=>{if(void 0!==r)return r<=7?"7":r<=30?"30":r<=93?"90":r<=183?"183":r>183?"365":void 0}),[r]),f=(0,a.Ye)((()=>{const e=[{label:m("Weeks",1,"i"),value:"7"},{label:m("Months",1,"i"),value:"30"},{label:m("Months",3,"i"),value:"90"},{label:m("Months",6,"i"),value:"183"}];return r&&r>=365&&e.push({label:m("Years",1,"i"),value:"365"}),e}),[m,r]),I=(0,a.I4)((e=>{o({hash:e})}),[o]),y=(0,a.I4)((()=>{v(),c()}),[v,c]),S=(0,a.I4)((e=>{Z(e),p()}),[p]),w=(0,a.I4)((()=>{Z(void 0),E()}),[E]),M=(0,a.I4)((e=>{d({days:Number(e)})}),[d]),T=(0,a.Ye)((()=>{const e=l.find((e=>s[e].isCurrent));return e?s[e]:void 0}),[s,l]),A=(0,a.Ye)((()=>l.filter((e=>!s[e].isCurrent))),[s,l]),R=Boolean(A.length);return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll SettingsActiveSessions"},T&&(F=T,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("AuthSessions.CurrentSession")),a.ZP.createElement(Ge.Z,{narrow:!0,inactive:!0,icon:`device-${Os(F)} icon-device`},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},F.deviceModel),a.ZP.createElement("span",{className:"subtitle black tight"},F.appName," ",F.appVersion,", ",F.platform," ",F.systemVersion),a.ZP.createElement("span",{className:"subtitle"},F.ip," - ",Gs(F)))),R&&a.ZP.createElement(Ge.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:h},m("TerminateAllSessions")))),R&&(L=A,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("OtherSessions")),L.map((function(e){const t=s[e];return a.ZP.createElement(Ge.Z,{key:t.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{I(t.hash)}}],icon:`device-${Os(t)} icon-device`,onClick:()=>{S(t.hash)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,ie.VX)(m,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," ",Gs(t))))})))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("TerminateOldSessionHeader")),a.ZP.createElement("p",null,m("IfInactiveFor")),a.ZP.createElement(Ps.Z,{name:"session_ttl",options:f,selected:C,onChange:M})),R&&a.ZP.createElement(Qe.Z,{isOpen:u,onClose:v,text:m("AreYouSureSessions"),confirmLabel:m("TerminateAllSessions"),confirmHandler:y,confirmIsDestructive:!0}),a.ZP.createElement(_s,{isOpen:g,hash:P,onClose:w}));var L,F}))),Js=(0,a.X$)((0,i.c$)(((e,t)=>{let{hash:n}=t;const a=n?e.activeWebSessions.byHash[n]:void 0;return{session:a,bot:a?e.users.byId[a.botId]:void 0}}))((e=>{let{isOpen:t,session:n,bot:s,onClose:r}=e;const{terminateWebAuthorization:o}=(0,i.Sv)(),c=(0,N.Z)(),d=(0,Fe.Z)(n,!0),m=(0,Fe.Z)(s,!0),u=(0,a.I4)((()=>{o({hash:n.hash}),r()}),[r,n,o]);if(d)return a.ZP.createElement($e.Z,{header:a.ZP.createElement("div",{className:"modal-header-condensed",dir:c.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:c("Close"),onClick:r},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},c("WebSessionsTitle")),a.ZP.createElement(D.Z,{color:"danger",onClick:u,className:(0,X.Z)("modal-action-button","hlKLEbMQAsx572pUREy0")},c("AuthSessions.LogOut"))),isOpen:t,hasCloseButton:!0,onClose:r,className:"OeRWKjYQC6t7Uxv8I3j0"},a.ZP.createElement(Me.Z,{className:"oy_023CG29VsnL9L5ulf",user:m,size:"large"}),a.ZP.createElement("h3",{className:"bg8UD_Pu2JWogmjuvVXg",dir:"auto"},(0,l.Js)(m)),a.ZP.createElement("div",{className:"n6IYAeXnJBCHqpqItrnY","aria-label":c("PrivacySettings.LastSeen")},null==d?void 0:d.domain),a.ZP.createElement("dl",{className:"HSyJbRkyhkeT0s2QA4Ku"},a.ZP.createElement("dt",null,c("AuthSessions.View.Browser")),a.ZP.createElement("dd",null,null==d?void 0:d.browser),a.ZP.createElement("dt",null,c("SessionPreview.Ip")),a.ZP.createElement("dd",null,null==d?void 0:d.ip),a.ZP.createElement("dt",null,c("SessionPreview.Location")),a.ZP.createElement("dd",null,null==d?void 0:d.region)),a.ZP.createElement("p",{className:"TgiK64wG1hkOWSiXybQf"},c("AuthSessions.View.LocationInfo")))}))),Xs={avatar:"n3bBygyO4j5MQyJ70Twt","clear-help":"vUICy6ZQCYFSrvvxXe7f",clearHelp:"vUICy6ZQCYFSrvvxXe7f"},zs=(0,a.X$)((0,i.c$)((e=>{const{byHash:t,orderedHashes:n}=e.activeWebSessions;return{byHash:t,orderedHashes:n}}))((e=>{let{isActive:t,byHash:n,orderedHashes:s,onReset:r}=e;const{terminateWebAuthorization:o,terminateAllWebAuthorizations:c}=(0,i.Sv)(),d=(0,N.Z)(),[m,u,h]=(0,b.Z)(),[v,P]=(0,a.eJ)(),[Z,g,p]=(0,b.Z)(),E=(0,a.I4)((e=>{o({hash:e})}),[o]),C=(0,a.I4)((()=>{h(),c()}),[h,c]),f=(0,a.I4)((e=>{P(e),g()}),[g]),I=(0,a.I4)((()=>{P(void 0),p()}),[p]);var y;if((0,a.d4)((()=>{s.length||r()}),[r,s]),(0,k.Z)({isActive:t,onBack:r}),s.length)return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(Ge.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:u},d("AuthSessions.LogOutApplications")),a.ZP.createElement("p",{className:(0,X.Z)("settings-item-description",Xs.clearHelp)},d("ClearOtherWebSessionsHelp"))),(y=s,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:d.isRtl?"rtl":void 0},d("WebSessionsTitle")),y.map((function(e){const t=n[e],s=(0,i.Rd)().users.byId[t.botId];return a.ZP.createElement(Ge.Z,{key:t.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{E(t.hash)}}],onClick:()=>f(t.hash)},a.ZP.createElement(Me.Z,{className:Xs.avatar,user:s,size:"tiny"}),a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,ie.VX)(d,1e3*t.dateActive)),a.ZP.createElement("span",{className:"title"},(0,l.Js)(s)),a.ZP.createElement("span",{className:(0,X.Z)("subtitle","black","tight",Xs.platform)},t.domain,", ",t.browser,", ",t.platform),a.ZP.createElement("span",{className:"subtitle"},t.ip," ",t.region)))})))),a.ZP.createElement(Qe.Z,{isOpen:m,onClose:h,title:d("AuthSessions.LogOutApplications"),text:d("AreYouSureWebSessions"),confirmHandler:C,confirmIsDestructive:!0}),a.ZP.createElement(Js,{isOpen:Z,hash:v,onClose:I}))}))),js=(0,a.X$)((0,i.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:null==a?void 0:a.userIds,localContactIds:e.userSearch.localUserIds,currentUserId:s}}))((e=>{let{usersById:t,blockedIds:n,contactIds:s,localContactIds:r,currentUserId:o,isOpen:c,onClose:d}=e;const{setUserSearchQuery:m,blockContact:u}=(0,i.Sv)(),h=(0,N.Z)(),[v,P]=(0,a.eJ)(""),Z=(0,a.sO)(null);(0,a.d4)((()=>{m({query:v})}),[v,m]);const g=(0,a.Ye)((()=>{const e=(0,Le.Tw)([...s||[],...r||[]].filter((e=>e!==o&&!n.includes(e))));return(0,l.kK)(e,t,v).sort(((e,n)=>{const a=(0,l.Js)(t[e])||"",s=(0,l.Js)(t[n])||"";return a.localeCompare(s)}))}),[n,s,o,v,r,t]),p=(0,a.I4)((e=>{const{id:n,accessHash:a}=t[e]||{};n&&a&&(u({contactId:n,accessHash:a}),d())}),[u,d,t]);return a.ZP.createElement(Xe,{isOpen:c,chatOrUserIds:g,filterRef:Z,filterPlaceholder:h("BlockedUsers.BlockUser"),filter:v,onFilterChange:P,onSelectChatOrUser:p,onClose:d})}))),Hs=(0,a.X$)((0,i.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}}))((e=>{let{isActive:t,onReset:n,chatsByIds:s,usersByIds:r,blockedIds:o,phoneCodeList:c}=e;const{unblockContact:d}=(0,i.Sv)(),u=(0,N.Z)(),[h,v,P]=(0,b.Z)(),Z=(0,a.I4)((e=>{d({contactId:e})}),[d]);return(0,k.Z)({isActive:t,onBack:n}),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:u.isRtl?"rtl":void 0},u("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=o&&o.length?a.ZP.createElement("div",{className:"scroll-container"},o.map(((e,t)=>function(e,t,n){const i=(0,l.YC)(e),o=i?r[e]:void 0,d=i?void 0:s[e],h=(0,X.Z)("Chat chat-item-clickable blocked-list-item small-icon",i?"private":"group");return a.ZP.createElement(Ge.Z,{key:e,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{Z(e)}}],style:`top: ${(0+t)*m.rS}px;`},a.ZP.createElement(Me.Z,{size:"medium",user:o,chat:d,noVideo:!0}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,we.Z)((i?(0,l.Js)(o):(0,l.U)(u,d))||"")),(null==o?void 0:o.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,mt.WZ)(c,o.phoneNumber)),o&&!o.phoneNumber&&o.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",o.username)))}(e,t)))):o&&!o.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},u("NoBlocked")):a.ZP.createElement(Oe.Z,{key:"loading"}))),a.ZP.createElement(Ga.Z,{isShown:!0,onClick:v,ariaLabel:u("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(js,{isOpen:h,onClose:P}))})));var qs=n(21179),Ys=n(2092);const Ws=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:i}=e;const l=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(qs.Z,{tgsUrl:Vn.l.Lock,previewUrl:Ys,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,we.Z)(l("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Ge.Z,{icon:"edit",onClick:()=>i(s.MT.TwoFaChangePasswordCurrent)},l("ChangePassword")),a.ZP.createElement(Ge.Z,{icon:"password-off",onClick:()=>i(s.MT.TwoFaTurnOff)},l("TurnPasswordOff")),a.ZP.createElement(Ge.Z,{icon:"email",onClick:()=>i(s.MT.TwoFaRecoveryEmailCurrentPassword)},l("SetRecoveryEmail"))))}));var Ks=n(93490),Qs=n(99364);const ei=(0,a.X$)((e=>{let{isActive:t,onReset:n,error:s,isLoading:i,shouldDisablePasswordManager:l,expectedPassword:r,placeholder:o="Current Password",hint:c,submitLabel:d,clearError:m,onSubmit:u}=e;const[h,v]=(0,a.eJ)(""),[P,Z]=(0,a.eJ)(!1),g=(0,a.I4)((e=>{r&&e!==r?v("Passwords Should Be Equal"):u(e)}),[u,r]),p=(0,a.I4)((()=>{m&&m(),v("")}),[m]),E=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content password-form custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Ks.Z,{isBig:!0,isPasswordVisible:P})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Qs.Z,{error:h||s,hint:c,placeholder:o,shouldDisablePasswordManager:l,submitLabel:d||E("Next"),clearError:p,isLoading:i,isPasswordVisible:P,shouldResetValue:t,onChangePasswordVisibility:Z,onSubmit:g})))})),ti=(0,a.X$)((e=>{let{isActive:t,onReset:n,onStart:s}=e;const i=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(qs.Z,{tgsUrl:Vn.l.Lock,previewUrl:Ys,size:160,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},i("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:s},i("EditAdminTransferSetPassword"))))}));var ni=n(45601);const ai=d.wB?550:400,si=(0,a.X$)((0,i.c$)(((e,t)=>{let{icon:n}=t;return{animatedEmoji:(0,r.zB)(e,"email"===n?"💌":"💡")}}))((e=>{let{animatedEmoji:t,type:n="text",isLoading:s,error:i,placeholder:l,shouldConfirm:r,clearError:o,onSubmit:c,isActive:m,onReset:u}=e;const h=(0,a.sO)(null),[v,P]=(0,a.eJ)(""),[Z,g,p]=(0,b.Z)(!1);(0,a.d4)((()=>{d.$b||setTimeout((()=>{h.current.focus()}),ai)}),[]);const E=(0,a.I4)((e=>{i&&o&&o(),P(e.target.value)}),[o,i]),C=(0,a.I4)((()=>{c()}),[c]),f=(0,a.I4)((()=>{p(),c()}),[c,p]),I=(0,N.Z)();return(0,k.Z)({isActive:m,onBack:u}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(ni.Z,{sticker:t,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&c(v)}},a.ZP.createElement(Ue.Z,{ref:h,value:v,inputMode:n,label:l,error:i,onChange:E}),v?a.ZP.createElement(D.Z,{type:"submit",isLoading:s,ripple:!0},I("Continue")):a.ZP.createElement(D.Z,{isText:!0,isLoading:s,ripple:!0,onClick:r?g:C},I("YourEmailSkip"))),r&&a.ZP.createElement($e.Z,{className:"narrow",isOpen:Z,title:I("YourEmailSkipWarning"),onClose:p},(0,we.Z)(I("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(D.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:f},I("YourEmailSkip")),a.ZP.createElement(D.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:p},I("Cancel"))))))}))),ii=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:i}=e;const l=(0,N.Z)(),r=(0,a.I4)((()=>{i(s.MT.Privacy)}),[i]);return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Qa.Z,{size:m.K2,tgsUrl:Vn.l.Congratulations,className:"settings-content-icon"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},l("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:r},l("TwoStepVerificationPasswordReturnSettings"))))})),li=d.wB?550:400,ri=(0,a.X$)((0,i.c$)((e=>({animatedEmoji:(0,r.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((e=>{let{animatedEmoji:t,codeLength:n,isLoading:s,error:i,clearError:l,onSubmit:r,isActive:o,onReset:c}=e;const m=(0,a.sO)(null),[u,h]=(0,a.eJ)("");(0,a.d4)((()=>{d.$b||setTimeout((()=>{m.current.focus()}),li)}),[]);const v=(0,N.Z)();(0,k.Z)({isActive:o,onBack:c});const P=(0,a.I4)((e=>{i&&l&&l();const t=e.target.value.slice(0,n);t.length===n&&r(t),h(t),e.target.value=t}),[l,n,i,r]);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(ni.Z,{sticker:t,size:160,className:"settings-content-icon"})),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(Ue.Z,{value:u,ref:m,inputMode:"decimal",label:v("YourEmailCode"),error:i,onChange:P}),s&&a.ZP.createElement(Oe.Z,null)))}))),oi=(0,a.X$)((0,i.c$)((e=>({...e.twoFaSettings})))((e=>{let{currentScreen:t,shownScreen:n,state:l,hint:r,isLoading:o,error:c,waitingEmailCodeLength:d,dispatch:m,isActive:u,onScreenSelect:h,onReset:v}=e;const{updatePassword:P,checkPassword:Z,clearTwoFaError:g,updateRecoveryEmail:p,provideTwoFaEmailCode:E,clearPassword:C}=(0,i.Sv)();(0,a.d4)((()=>{d&&(t===s.MT.TwoFaNewPasswordEmail?h(s.MT.TwoFaNewPasswordEmailCode):t===s.MT.TwoFaRecoveryEmail&&h(s.MT.TwoFaRecoveryEmailCode))}),[t,h,d]);const f=(0,a.I4)((()=>{m({type:"reset"}),h(s.MT.TwoFaNewPassword)}),[m,h]),b=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),h(s.MT.TwoFaNewPasswordConfirm)}),[m,h]),I=(0,a.I4)((()=>{h(s.MT.TwoFaNewPasswordHint)}),[h]),y=(0,a.I4)((e=>{m({type:"setHint",payload:e}),h(s.MT.TwoFaNewPasswordEmail)}),[m,h]),k=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),P({...l,email:e,onSuccess:()=>{h(s.MT.TwoFaCongratulations)}})}),[m,h,l,P]),S=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),Z({currentPassword:e,onSuccess:()=>{h(s.MT.TwoFaChangePasswordNew)}})}),[Z,m,h]),w=(0,a.I4)((e=>{m({type:"setPassword",payload:e}),h(s.MT.TwoFaChangePasswordConfirm)}),[m,h]),M=(0,a.I4)((()=>{h(s.MT.TwoFaChangePasswordHint)}),[h]),T=(0,a.I4)((e=>{m({type:"setHint",payload:e}),P({...l,hint:e,onSuccess:()=>{h(s.MT.TwoFaCongratulations)}})}),[m,h,l,P]),A=(0,a.I4)((e=>{C({currentPassword:e,onSuccess:()=>{h(s.MT.Privacy)}})}),[C,h]),R=(0,a.I4)((e=>{m({type:"setCurrentPassword",payload:e}),Z({currentPassword:e,onSuccess:()=>{h(s.MT.TwoFaRecoveryEmail)}})}),[Z,m,h]),L=(0,a.I4)((e=>{m({type:"setEmail",payload:e}),p({...l,email:e,onSuccess:()=>{h(s.MT.TwoFaCongratulations)}})}),[m,h,l,p]),F=(0,a.I4)((e=>{E({code:e})}),[E]),x=(0,N.Z)();switch(t){case s.MT.TwoFaDisabled:return a.ZP.createElement(ti,{onStart:f,isActive:u||[s.MT.TwoFaNewPassword,s.MT.TwoFaNewPasswordConfirm,s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaNewPassword:return a.ZP.createElement(ei,{placeholder:x("PleaseEnterPassword"),submitLabel:x("Continue"),onSubmit:b,isActive:u||[s.MT.TwoFaNewPasswordConfirm,s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(ei,{expectedPassword:l.password,placeholder:x("PleaseReEnterPassword"),submitLabel:x("Continue"),onSubmit:I,isActive:u||[s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaNewPasswordHint:return a.ZP.createElement(si,{icon:"hint",placeholder:x("PasswordHintPlaceholder"),onSubmit:y,isActive:u||[s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(si,{icon:"email",type:"email",isLoading:o,error:c,clearError:g,placeholder:x("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:k,isActive:u||[s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(ri,{isLoading:o,error:c,clearError:g,onSubmit:F,isActive:u||n===s.MT.TwoFaCongratulations,onReset:v});case s.MT.TwoFaCongratulations:return a.ZP.createElement(ii,{onScreenSelect:h,isActive:u,onReset:v});case s.MT.TwoFaEnabled:return a.ZP.createElement(Ws,{onScreenSelect:h,isActive:u||[s.MT.TwoFaChangePasswordCurrent,s.MT.TwoFaChangePasswordNew,s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaTurnOff,s.MT.TwoFaRecoveryEmailCurrentPassword,s.MT.TwoFaRecoveryEmail,s.MT.TwoFaRecoveryEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(ei,{isLoading:o,error:c,clearError:g,hint:r,onSubmit:S,isActive:u||[s.MT.TwoFaChangePasswordNew,s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaChangePasswordNew:return a.ZP.createElement(ei,{placeholder:x("PleaseEnterNewFirstPassword"),onSubmit:w,isActive:u||[s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(ei,{expectedPassword:l.password,placeholder:x("PleaseReEnterPassword"),onSubmit:M,isActive:u||[s.MT.TwoFaChangePasswordHint,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaChangePasswordHint:return a.ZP.createElement(si,{isLoading:o,error:c,clearError:g,icon:"hint",placeholder:x("PasswordHintPlaceholder"),onSubmit:T,isActive:u||n===s.MT.TwoFaCongratulations,onReset:v});case s.MT.TwoFaTurnOff:return a.ZP.createElement(ei,{isLoading:o,error:c,clearError:g,hint:r,onSubmit:A,isActive:u,onReset:v});case s.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(ei,{isLoading:o,error:c,clearError:g,hint:r,onSubmit:R,isActive:u||[s.MT.TwoFaRecoveryEmail,s.MT.TwoFaRecoveryEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaRecoveryEmail:return a.ZP.createElement(si,{icon:"email",type:"email",placeholder:x("RecoveryEmailTitle"),onSubmit:L,isActive:u||[s.MT.TwoFaRecoveryEmailCode,s.MT.TwoFaCongratulations].includes(n),onReset:v});case s.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(ri,{isLoading:o,error:c,clearError:g,onSubmit:F,isActive:u||n===s.MT.TwoFaCongratulations,onReset:v});default:return}})));var ci=n(11820);function di(e,t){const{privacy:n}=e.settings;switch(t){case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case s.MT.PrivacyPhoneCallAllowedContacts:case s.MT.PrivacyPhoneCallDeniedContacts:return n.phoneCall;case s.MT.PrivacyPhoneP2PAllowedContacts:case s.MT.PrivacyPhoneP2PDeniedContacts:return n.phoneP2P;case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyForwardingDeniedContacts:return n.forwards;case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:return n.voiceMessages;case s.MT.PrivacyGroupChatsDeniedContacts:case s.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const mi=(0,a.X$)((0,i.c$)(((e,t)=>{let{screen:n}=t;return{currentUserId:e.currentUserId,settings:di(e,n)}}))((e=>{let{isAllowList:t,screen:n,isActive:r,onScreenSelect:o,onReset:c,currentUserId:d,settings:u}=e;const{setPrivacySettings:h}=(0,i.Sv)(),v=(0,N.Z)(),P=(0,a.Ye)((()=>u?t?[...u.allowUserIds,...u.allowChatIds]:[...u.blockUserIds,...u.blockChatIds]:[]),[t,u]),[Z,g]=(0,a.eJ)(""),[p,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(P),b=(0,Ka.d7)(m.Nf),I=(0,Ka.d7)(m.WS),y=(0,a.Ye)((()=>{const e=(0,i.Rd)().chats.byId,t=(0,Le.Tw)([...b||[],...I||[]]).filter((t=>{const n=e[t];return n&&(0,l.YC)(n.id)&&n.id!==d}));return(0,Le.Tw)([...P,...(0,l.$l)(v,t,e,Z)])}),[b,I,P,v,Z,d]),S=(0,a.I4)((e=>{f(e),E(!0)}),[]),w=(0,a.I4)((()=>{h({privacyKey:Bs(n),isAllowList:Boolean(t),contactsIds:C}),o(s.MT.Privacy)}),[t,C,o,n,h]);return(0,k.Z)({isActive:r,onBack:c}),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(ci.Z,{itemIds:y||[],selectedIds:C,filterValue:Z,filterPlaceholder:v(t?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:S,onFilterChange:g}),a.ZP.createElement(Ga.Z,{isShown:p,onClick:w,ariaLabel:v(t?"AlwaysAllow":"NeverAllow")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),ui=(0,a.X$)((0,i.c$)((e=>{const{availableReactions:t,appConfig:n}=e,a=(0,r.wV)(e);return{availableReactions:t,selectedReaction:null==n?void 0:n.defaultReaction,isPremium:a}}))((e=>{let{isActive:t,availableReactions:n,isPremium:s,selectedReaction:l,onReset:r}=e;const{setDefaultReaction:o}=(0,i.Sv)();(0,k.Z)({isActive:t,onBack:r});const c=(null==n?void 0:n.filter((e=>!(e.isInactive||!s&&e.isPremium))).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Un.Z,{reaction:e.reaction}),e.title),value:e.reaction}))))||[],d=(0,a.I4)((e=>{o({reaction:e})}),[o]);return a.ZP.createElement("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction"},a.ZP.createElement(Ps.Z,{name:"quick-reaction-settings",options:c,selected:l,onChange:d}))})));var hi=n(95281);const vi=(0,a.X$)((e=>{let{isActive:t,onReset:n,onStart:s}=e;const i=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(qs.Z,{tgsUrl:Vn.l.Lock,previewUrl:Ys,size:m.Iz,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 WebZ."),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 WebZ and log in again.")),a.ZP.createElement("div",{className:"settings-item pt-0"},a.ZP.createElement(D.Z,{onClick:s},i("EnablePasscode"))))})),Pi=(0,a.X$)((e=>{let{isActive:t,onReset:n,onScreenSelect:i}=e;const l=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(qs.Z,{tgsUrl:Vn.l.Lock,previewUrl:Ys,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(Ge.Z,{icon:"edit",onClick:()=>i(s.MT.PasscodeChangePasscodeCurrent)},l("Passcode.Change")),a.ZP.createElement(Ge.Z,{icon:"password-off",onClick:()=>i(s.MT.PasscodeTurnOff)},l("Passcode.TurnOff"))))})),Zi=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const s=(0,N.Z)(),i=(0,a.I4)((()=>{n(!0)}),[n]);return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content local-passcode custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Qa.Z,{size:m.Iz,tgsUrl:Vn.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(D.Z,{onClick:i},s("Back"))))})),gi=(0,a.X$)((0,i.c$)((e=>({...e.passcode})))((e=>{let{passcode:t,currentScreen:n,shownScreen:l,error:r,isActive:o,isLoading:c,onScreenSelect:d,onSetPasscode:m,onReset:u}=e;const{setPasscode:h,clearPasscode:v,setPasscodeError:P,clearPasscodeError:Z}=(0,i.Sv)(),g=(0,N.Z)(),p=(0,a.I4)((()=>{m(""),d(s.MT.PasscodeNewPasscode)}),[d,m]),E=(0,a.I4)((e=>{m(e),d(s.MT.PasscodeNewPasscodeConfirm)}),[d,m]),C=(0,a.I4)((()=>{h({passcode:t}),m(""),d(s.MT.PasscodeCongratulations)}),[d,m,t,h]),f=(0,a.I4)((e=>{m(""),(0,hi.so)(e).then((()=>{d(s.MT.PasscodeChangePasscodeNew)}),(()=>{P({error:g("PasscodeController.Error.Current")})}))}),[g,d,m,P]),b=(0,a.I4)((e=>{m(e),d(s.MT.PasscodeChangePasscodeConfirm)}),[d,m]),I=(0,a.I4)((e=>{(0,hi.so)(e).then((()=>{v(),d(s.MT.Privacy)}),(()=>{P({error:g("PasscodeController.Error.Current")})}))}),[v,g,d,P]);switch(n){case s.MT.PasscodeDisabled:return a.ZP.createElement(vi,{onStart:p,isActive:o||[s.MT.PasscodeNewPasscode,s.MT.PasscodeNewPasscodeConfirm,s.MT.PasscodeCongratulations].includes(l),onReset:u});case s.MT.PasscodeNewPasscode:return a.ZP.createElement(ei,{shouldDisablePasswordManager:!0,placeholder:g("EnterNewPasscode"),submitLabel:g("Continue"),onSubmit:E,isActive:o||[s.MT.PasscodeNewPasscodeConfirm,s.MT.PasscodeCongratulations].includes(l),onReset:u});case s.MT.PasscodeNewPasscodeConfirm:return a.ZP.createElement(ei,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:g("ReEnterYourPasscode"),submitLabel:g("Continue"),isLoading:c,onSubmit:C,isActive:o||[s.MT.PasscodeCongratulations].includes(l),onReset:u});case s.MT.PasscodeCongratulations:return a.ZP.createElement(Zi,{isActive:o,onReset:u});case s.MT.PasscodeEnabled:return a.ZP.createElement(Pi,{onScreenSelect:d,isActive:o||[s.MT.PasscodeChangePasscodeCurrent,s.MT.PasscodeChangePasscodeNew,s.MT.PasscodeChangePasscodeConfirm,s.MT.PasscodeCongratulations,s.MT.PasscodeTurnOff].includes(l),onReset:u});case s.MT.PasscodeChangePasscodeCurrent:return a.ZP.createElement(ei,{shouldDisablePasswordManager:!0,error:r,clearError:Z,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:f,isActive:o||[s.MT.PasscodeChangePasscodeNew,s.MT.PasscodeChangePasscodeConfirm,s.MT.PasscodeCongratulations].includes(l),onReset:u});case s.MT.PasscodeChangePasscodeNew:return a.ZP.createElement(ei,{shouldDisablePasswordManager:!0,placeholder:g("PleaseEnterNewFirstPassword"),onSubmit:b,isActive:o||[s.MT.PasscodeChangePasscodeConfirm,s.MT.PasscodeCongratulations].includes(l),onReset:u});case s.MT.PasscodeChangePasscodeConfirm:return a.ZP.createElement(ei,{shouldDisablePasswordManager:!0,expectedPassword:t,placeholder:g("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:c,onSubmit:C,isActive:o||[s.MT.PasscodeCongratulations].includes(l),onReset:u});case s.MT.PasscodeTurnOff:return a.ZP.createElement(ei,{shouldDisablePasswordManager:!0,error:r?g(r):void 0,clearError:Z,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:I,isActive:o,onReset:u});default:return}}))),pi=(0,a.X$)((e=>{let{size:t=m.DC,stickerSet:n,observeIntersection:s}=e;const i=(0,a.sO)(null),l=(0,ha.Op)(i,s),r=`stickerSet${n.id}`,o=(0,M.Z)(r,!l),c=(0,Mt.Z)(o),d=(0,a.Ye)((()=>{if(!o)return(0,le.Xv)(n.title,2)}),[o,n.title]);return a.ZP.createElement("div",{ref:i,className:"sticker-set-cover"},d,o&&a.ZP.createElement(Ft.Z,{size:t,tgsUrl:o,className:c}))})),Ei=(0,a.X$)((e=>{let{stickerSet:t,observeIntersection:n}=e;const s=(0,a.sO)(null),i=(0,ha.Op)(s,n),l=(0,M.Z)(t.hasThumbnail&&`stickerSet${t.id}`,!i),r=(0,Mt.Z)(l),o=t.isVideos,c=(0,a.Ye)((()=>{if(o&&!d.Hh||!l)return(0,le.Xv)(t.title,2)}),[o,l,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},c,o?a.ZP.createElement("video",{src:l,className:r,loop:!0,autoPlay:!0,disablePictureInPicture:!0}):a.ZP.createElement("img",{src:l,className:r,alt:""}))}));var Ci=n(73547);const fi=(0,a.X$)((e=>{var t;let{stickerSet:n,className:s,observeIntersection:i,onClick:l}=e;const r=(0,N.Z)(),o=null==n||null===(t=n.stickers)||void 0===t?void 0:t[0],c=(0,a.I4)((()=>{o&&l(o)}),[o,l]),d=(0,a.Ye)((()=>{if(n)return n.hasThumbnail||!o?a.ZP.createElement(D.Z,{ariaLabel:n.title,color:"translucent",isRtl:r.isRtl},n.isLottie?a.ZP.createElement(pi,{size:m.Mw,stickerSet:n,observeIntersection:i}):a.ZP.createElement(Ei,{stickerSet:n,observeIntersection:i})):a.ZP.createElement(Ci.Z,{sticker:o,size:m.Mw,title:n.title,observeIntersection:i,clickArg:void 0,noContextMenu:!0,isCurrentUserPremium:!0})}),[o,r.isRtl,i,n]);if(n&&n.stickers)return a.ZP.createElement(Ge.Z,{narrow:!0,className:(0,X.Z)("StickerSetCard",s),inactive:!o,onClick:c},d,a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},n.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",n.count,"i"))))})),bi=(0,a.X$)((0,i.c$)((e=>{var t;return{...(0,Le.ei)(e.settings.byKey,["shouldSuggestStickers","shouldLoopStickers"]),addedSetIds:e.stickers.added.setIds,customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:null===(t=e.appConfig)||void 0===t?void 0:t.defaultReaction}}))((e=>{let{isActive:t,addedSetIds:n,customEmojiSetIds:l,stickerSetsById:r,defaultReaction:o,shouldSuggestStickers:c,shouldLoopStickers:d,onReset:m,onScreenSelect:u}=e;const{setSettingOption:h,openStickerSet:v}=(0,i.Sv)(),P=(0,N.Z)(),Z=(0,a.sO)(null),{observe:g}=(0,ha.S1)({rootRef:Z}),p=(0,a.I4)((e=>{v({stickerSetInfo:e.stickerSetInfo})}),[v]),E=(0,a.I4)((e=>{h({shouldSuggestStickers:e})}),[h]),C=(0,a.I4)((e=>{h({shouldLoopStickers:e})}),[h]),f=(0,a.Ye)((()=>n&&Object.values((0,Le.ei)(r,n))),[n,r]);return(0,k.Z)({isActive:t,onBack:m}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(tt.Z,{label:P("SuggestStickers"),checked:c,onCheck:E}),a.ZP.createElement(tt.Z,{label:P("LoopAnimatedStickers"),checked:d,onCheck:C}),a.ZP.createElement(Ge.Z,{className:"mt-4",onClick:()=>u(s.MT.CustomEmoji),icon:"smile"},P("StickersList.EmojiItem"),l&&a.ZP.createElement("span",{className:"settings-item__current-value"},l.length)),o&&a.ZP.createElement(Ge.Z,{className:"SettingsDefaultReaction",onClick:()=>u(s.MT.QuickReaction)},a.ZP.createElement(Un.Z,{reaction:o}),a.ZP.createElement("div",{className:"title"},P("DoubleTapSetting")))),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:Z},f.map((e=>a.ZP.createElement(fi,{key:e.id,stickerSet:e,observeIntersection:g,onClick:p})))),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},(0,we.Z)(P("StickersBotInfo"),["links"]))))}))),Ii=(0,a.X$)((0,i.c$)((e=>({customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById})))((e=>{let{isActive:t,customEmojiSetIds:n,stickerSetsById:s,onReset:l}=e;const{openStickerSet:r}=(0,i.Sv)(),o=(0,N.Z)(),c=(0,a.sO)(null),{observe:d}=(0,ha.S1)({rootRef:c});(0,k.Z)({isActive:t,onBack:l});const m=(0,a.I4)((e=>{r({stickerSetInfo:e.stickerSetInfo})}),[r]),u=(0,a.Ye)((()=>n&&Object.values((0,Le.ei)(s,n))),[n,s]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},u&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("div",{ref:c},u.map((e=>a.ZP.createElement(fi,{key:e.id,stickerSet:e,observeIntersection:d,onClick:m})))),a.ZP.createElement("p",{className:"settings-item-description mt-3",dir:"auto"},(0,we.Z)(o("EmojiBotInfo"),["links"]))))}))),yi=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const{requestConfetti:s}=(0,i.Sv)(),l=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header no-border"},a.ZP.createElement(Qa.Z,{tgsUrl:Vn.l.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),a.ZP.createElement("p",{className:"settings-item-description",dir:"auto"},l("lng_settings_experimental_about"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement(Ge.Z,{onClick:()=>s(),icon:"animations"},a.ZP.createElement("div",{className:"title"},"Launch some confetti!"))))})),ki=Object.keys(s.MT).length/2,Ni=[s.MT.TwoFaDisabled,s.MT.TwoFaNewPassword,s.MT.TwoFaNewPasswordConfirm,s.MT.TwoFaNewPasswordHint,s.MT.TwoFaNewPasswordEmail,s.MT.TwoFaNewPasswordEmailCode,s.MT.TwoFaCongratulations,s.MT.TwoFaEnabled,s.MT.TwoFaChangePasswordCurrent,s.MT.TwoFaChangePasswordNew,s.MT.TwoFaChangePasswordConfirm,s.MT.TwoFaChangePasswordHint,s.MT.TwoFaTurnOff,s.MT.TwoFaRecoveryEmailCurrentPassword,s.MT.TwoFaRecoveryEmail,s.MT.TwoFaRecoveryEmailCode],Si=[s.MT.PasscodeDisabled,s.MT.PasscodeEnabled],wi=[s.MT.Folders,s.MT.FoldersCreateFolder,s.MT.FoldersEditFolder,s.MT.FoldersEditFolderFromChatList,s.MT.FoldersIncludedChats,s.MT.FoldersIncludedChatsFromChatList,s.MT.FoldersExcludedChats,s.MT.FoldersExcludedChatsFromChatList],Mi=[s.MT.PrivacyBlockedUsers,s.MT.ActiveWebsites],Ti=[s.MT.PrivacyPhoneNumberAllowedContacts,s.MT.PrivacyPhoneNumberDeniedContacts],Ai=[s.MT.PrivacyLastSeenAllowedContacts,s.MT.PrivacyLastSeenDeniedContacts],Ri=[s.MT.PrivacyProfilePhotoAllowedContacts,s.MT.PrivacyProfilePhotoDeniedContacts],Li=[s.MT.PrivacyPhoneCallAllowedContacts,s.MT.PrivacyPhoneCallDeniedContacts],Fi=[s.MT.PrivacyPhoneP2PAllowedContacts,s.MT.PrivacyPhoneP2PDeniedContacts],xi=[s.MT.PrivacyForwardingAllowedContacts,s.MT.PrivacyForwardingDeniedContacts],Bi=[s.MT.PrivacyVoiceMessagesAllowedContacts,s.MT.PrivacyVoiceMessagesDeniedContacts],Di=[s.MT.PrivacyGroupChatsAllowedContacts,s.MT.PrivacyGroupChatsDeniedContacts],Oi=(0,a.X$)((e=>{let{isActive:t,currentScreen:n,foldersState:i,foldersDispatch:l,onScreenSelect:r,onReset:o,shouldSkipTransition:c}=e;const[m,u]=(0,Fa.Z)(Ba,xa),[h,v]=(0,a.eJ)(""),P=(0,a.I4)((e=>{!0!==e?(n!==s.MT.FoldersCreateFolder&&n!==s.MT.FoldersEditFolder&&n!==s.MT.FoldersEditFolderFromChatList||setTimeout((()=>{l({type:"reset"})}),200),n!==s.MT.FoldersIncludedChats&&n!==s.MT.FoldersExcludedChats?o():"create"===i.mode?r(s.MT.FoldersCreateFolder):r(s.MT.FoldersEditFolder)):o(!0)}),[i.mode,l,n,o,r]),Z=(0,a.I4)((()=>{l({type:"saveFilters"}),P()}),[l,P]);function g(e,o,c){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Da,{currentScreen:n,onReset:P,onSaveFilter:Z,onScreenSelect:r,editedFolderId:i.folderId}),function(e,o){const c={[s.MT.PrivacyPhoneNumber]:Ti.includes(o),[s.MT.PrivacyLastSeen]:Ai.includes(o),[s.MT.PrivacyProfilePhoto]:Ri.includes(o),[s.MT.PrivacyPhoneCall]:Li.includes(o),[s.MT.PrivacyPhoneP2P]:Fi.includes(o),[s.MT.PrivacyForwarding]:xi.includes(o),[s.MT.PrivacyVoiceMessages]:Bi.includes(o),[s.MT.PrivacyGroupChats]:Di.includes(o)},d=Ni.includes(o),Z=Si.includes(o),g=wi.includes(o),p=Mi.includes(o)||d||Z||Object.keys(c).includes(o.toString())||Object.values(c).find((e=>!0===e));switch(n){case s.MT.Main:return a.ZP.createElement(Ua,{onScreenSelect:r,isActive:t,onReset:P});case s.MT.EditProfile:return a.ZP.createElement(Ya,{isActive:t&&e,onReset:P});case s.MT.General:return a.ZP.createElement(Es,{onScreenSelect:r,isActive:e||o===s.MT.GeneralChatBackgroundColor||o===s.MT.GeneralChatBackground||o===s.MT.QuickReaction||o===s.MT.CustomEmoji||p||g,onReset:P});case s.MT.QuickReaction:return a.ZP.createElement(ui,{isActive:e,onReset:P});case s.MT.CustomEmoji:return a.ZP.createElement(Ii,{isActive:e,onReset:P});case s.MT.Notifications:return a.ZP.createElement(Ls,{isActive:e,onReset:P});case s.MT.DataStorage:return a.ZP.createElement(Wa,{isActive:e,onReset:P});case s.MT.Privacy:return a.ZP.createElement(Fs,{onScreenSelect:r,isActive:e||p,onReset:P});case s.MT.Language:return a.ZP.createElement(xs,{isActive:e,onReset:P});case s.MT.Stickers:return a.ZP.createElement(bi,{isActive:e,onReset:P,onScreenSelect:r});case s.MT.Experimental:return a.ZP.createElement(yi,{isActive:e,onReset:P});case s.MT.GeneralChatBackground:return a.ZP.createElement(ks,{onScreenSelect:r,isActive:e||o===s.MT.GeneralChatBackgroundColor,onReset:P});case s.MT.GeneralChatBackgroundColor:return a.ZP.createElement(Ts,{isActive:e,onReset:P});case s.MT.ActiveSessions:return a.ZP.createElement(Vs,{isActive:e,onReset:P});case s.MT.ActiveWebsites:return a.ZP.createElement(zs,{isActive:e,onReset:P});case s.MT.PrivacyBlockedUsers:return a.ZP.createElement(Hs,{isActive:e,onReset:P});case s.MT.PrivacyPhoneNumber:case s.MT.PrivacyLastSeen:case s.MT.PrivacyProfilePhoto:case s.MT.PrivacyPhoneCall:case s.MT.PrivacyPhoneP2P:case s.MT.PrivacyForwarding:case s.MT.PrivacyVoiceMessages:case s.MT.PrivacyGroupChats:return a.ZP.createElement(Ds,{screen:n,onScreenSelect:r,isActive:e||c[n],onReset:P});case s.MT.PrivacyPhoneNumberAllowedContacts:case s.MT.PrivacyLastSeenAllowedContacts:case s.MT.PrivacyProfilePhotoAllowedContacts:case s.MT.PrivacyPhoneCallAllowedContacts:case s.MT.PrivacyPhoneP2PAllowedContacts:case s.MT.PrivacyForwardingAllowedContacts:case s.MT.PrivacyVoiceMessagesAllowedContacts:case s.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(mi,{isAllowList:!0,screen:n,onScreenSelect:r,isActive:e||c[n],onReset:P});case s.MT.PrivacyPhoneNumberDeniedContacts:case s.MT.PrivacyLastSeenDeniedContacts:case s.MT.PrivacyProfilePhotoDeniedContacts:case s.MT.PrivacyPhoneCallDeniedContacts:case s.MT.PrivacyPhoneP2PDeniedContacts:case s.MT.PrivacyForwardingDeniedContacts:case s.MT.PrivacyVoiceMessagesDeniedContacts:case s.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(mi,{screen:n,onScreenSelect:r,isActive:e,onReset:P});case s.MT.Folders:case s.MT.FoldersCreateFolder:case s.MT.FoldersEditFolder:case s.MT.FoldersEditFolderFromChatList:case s.MT.FoldersIncludedChats:case s.MT.FoldersIncludedChatsFromChatList:case s.MT.FoldersExcludedChats:case s.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(hs,{currentScreen:n,shownScreen:o,state:i,dispatch:l,isActive:e,onScreenSelect:r,onReset:P});case s.MT.TwoFaDisabled:case s.MT.TwoFaNewPassword:case s.MT.TwoFaNewPasswordConfirm:case s.MT.TwoFaNewPasswordHint:case s.MT.TwoFaNewPasswordEmail:case s.MT.TwoFaNewPasswordEmailCode:case s.MT.TwoFaCongratulations:case s.MT.TwoFaEnabled:case s.MT.TwoFaChangePasswordCurrent:case s.MT.TwoFaChangePasswordNew:case s.MT.TwoFaChangePasswordConfirm:case s.MT.TwoFaChangePasswordHint:case s.MT.TwoFaTurnOff:case s.MT.TwoFaRecoveryEmailCurrentPassword:case s.MT.TwoFaRecoveryEmail:case s.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(oi,{currentScreen:n,state:m,dispatch:u,shownScreen:o,isActive:e,onScreenSelect:r,onReset:P});case s.MT.PasscodeDisabled:case s.MT.PasscodeNewPasscode:case s.MT.PasscodeNewPasscodeConfirm:case s.MT.PasscodeChangePasscodeCurrent:case s.MT.PasscodeChangePasscodeNew:case s.MT.PasscodeChangePasscodeConfirm:case s.MT.PasscodeCongratulations:case s.MT.PasscodeEnabled:case s.MT.PasscodeTurnOff:return a.ZP.createElement(gi,{currentScreen:n,passcode:h,onSetPasscode:v,shownScreen:o,isActive:e,onScreenSelect:r,onReset:P});default:return}}(e,c))}return a.ZP.createElement($.Z,{id:"Settings",name:c?"none":d.s0,activeKey:n,renderCount:ki},g)})),$i=(0,a.X$)((0,i.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{isActive:t,filter:n,usersById:s,userStatusesById:r,contactIds:o,serverTimeOffset:c,onReset:m}=e;const{openChat:u,openNewContactDialog:h}=(0,i.Sv)(),v=(0,N.Z)();(0,k.Z)({isActive:t,onBack:m});const P=(0,a.I4)((e=>{u({id:e,shouldReplaceHistory:!0})}),[u]),Z=(0,a.Ye)((()=>{if(!o)return;const e=(0,l.kK)(o,s,n);return(0,l.Z0)(e,s,r,void 0,c)}),[o,n,s,r,c]),[g,p]=(0,xe.Z)(void 0,Z,Boolean(n));return a.ZP.createElement(_e.Z,{items:g,onLoadMore:p,className:"chat-list custom-scroll"},null!=g&&g.length?g.map((e=>a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable",onClick:()=>P(e),ripple:!d.wB},a.ZP.createElement(Je.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):g&&!g.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},n.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(Oe.Z,{key:"loading"}),a.ZP.createElement(Ga.Z,{key:"create-new-contact",isShown:!0,onClick:h,ariaLabel:v("CreateNewContact")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))}))),Ui=(0,a.X$)((0,i.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:i,localResults:l}=e.globalSearch,{userIds:r}=i||{},{userIds:o}=l||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:null==s?void 0:s.chats,globalUserIds:r,localUserIds:o}}))((e=>{let{isChannel:t,isActive:n,selectedMemberIds:s,onSelectedMemberIdsChange:r,onNextStep:o,onReset:c,chatsById:d,localContactIds:m,searchQuery:u,isSearching:h,localUserIds:v,globalUserIds:P}=e;const{setGlobalSearchQuery:Z}=(0,i.Sv)(),g=(0,N.Z)();(0,k.Z)({isActive:n,onBack:c});const p=(0,a.I4)((e=>{Z({query:e})}),[Z]),E=(0,a.Ye)((()=>{const e=(0,i.Rd)().users.byId,t=m?(0,l.kK)(m,e,u):[];return(0,l.ih)((0,Le.Tw)([...t,...v||[],...P||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,l.cS)(n))})),d,!1,s)}),[m,d,u,v,P,s]),C=(0,a.I4)((()=>{(s.length||t)&&(Z({query:""}),o())}),[s.length,t,Z,o]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:c,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,g("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(ci.Z,{itemIds:E,selectedIds:s,filterValue:u,filterPlaceholder:g("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:r,onFilterChange:p}),a.ZP.createElement(Ga.Z,{isShown:Boolean(s.length||t),onClick:C,ariaLabel:t?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),_i=(0,a.X$)((0,i.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}))((e=>{let{isChannel:t,isActive:n,memberIds:l,onReset:r,creationProgress:o,creationError:c}=e;const{createGroupChat:d,createChannel:m}=(0,i.Sv)(),u=(0,N.Z)();(0,k.Z)({isActive:n,onBack:r});const[h,v]=(0,a.eJ)(""),[P,Z]=(0,a.eJ)(""),[g,p]=(0,a.eJ)(),[E,C]=(0,a.eJ)(),f="Chat title can't be empty",b="Channel title can't be empty",I="Sorry, creating supergroups is not yet supported",y=o===s.Nh.InProgress,S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");v(n),n!==t&&(e.currentTarget.value=n)}),[]),w=(0,a.I4)((e=>{Z(e.currentTarget.value)}),[]),M=(0,a.I4)((()=>{h.length?l.length>199?C(I):d({title:h,photo:g,memberIds:l}):C(f)}),[h,l,d,g,f,I]),T=(0,a.I4)((()=>{h.length?m({title:h,about:P,photo:g,memberIds:l}):C(b)}),[h,m,P,g,l,b]);(0,a.d4)((()=>{o===s.Nh.Complete&&r(!0)}),[o,r]);const A=c&&u(c)||(E!==f&&E!==b?E:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>r(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,u(t?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(_a.Z,{onChange:p,title:u("AddPhoto")}),a.ZP.createElement(Ue.Z,{value:h,onChange:S,label:u(t?"EnterChannelName":"GroupName"),error:E===f||E===b?E:void 0}),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Ue.Z,{value:P,onChange:w,label:u("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},u("DescriptionInfo"))),A&&a.ZP.createElement("p",{className:"error"},A),l.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},u("GroupInfo.ParticipantCount",l.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},l.map((e=>a.ZP.createElement(Ge.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Je.Z,{userId:e}))))))),a.ZP.createElement(Ga.Z,{isShown:0!==h.length,onClick:t?T:M,disabled:y,ariaLabel:t?u("ChannelIntro.CreateChannel"):"Create Group"},y?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Gi=Object.keys(s.du).length/2,Vi=(0,a.X$)((e=>{let{isActive:t,isChannel:n=!1,content:i,onContentChange:l,onReset:r}=e;const[o,c]=(0,a.eJ)([]),m=(0,a.I4)((()=>{l(n?s.du.NewChannelStep2:s.du.NewGroupStep2)}),[n,l]);return a.ZP.createElement($.Z,{id:"NewChat",name:d.s0,renderCount:Gi,activeKey:i},(e=>{switch(i){case s.du.NewChannelStep1:case s.du.NewGroupStep1:return a.ZP.createElement(Ui,{isChannel:n,isActive:t,selectedMemberIds:o,onSelectedMemberIdsChange:c,onNextStep:m,onReset:r});case s.du.NewChannelStep2:case s.du.NewGroupStep2:return a.ZP.createElement(_i,{isChannel:n,isActive:e&&t,memberIds:o,onReset:r});default:return}}))}));var Ji=n(1080);const Xi=(0,a.X$)((e=>{let{isActive:t,onReset:n}=e;const s=(0,N.Z)();return(0,k.Z)({isActive:t,onBack:n}),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,s("ArchivedChats"))),a.ZP.createElement(Ji.Z,{folderType:"archived",isActive:t}))}));var zi=n(51218);const ji=(0,a.X$)((0,i.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((e=>{let{isOpen:t,chatId:n,foldersById:s,folderOrderedIds:l,onClose:r,onCloseAnimationEnd:o}=e;const{editChatFolders:c}=(0,i.Sv)(),d=(0,N.Z)(),u=(0,a.Ye)((()=>s?Object.keys(s).reduce(((e,t)=>{const{includedChatIds:a,pinnedChatIds:i}=s[Number(t)];return(a.includes(n)||null!=i&&i.includes(n))&&e.push(t),e}),[]):[]),[n,s]),[h,v]=(0,a.eJ)(u),P=(0,a.Ye)((()=>(null==l?void 0:l.filter((e=>e!==m.Nf)).map((e=>({label:s?s[e].title:"",value:String(e)}))))||[]),[l,s]),Z=(0,a.I4)((()=>{const e=u.filter((e=>!h.includes(e))).map(Number),t=h.filter((e=>!u.includes(e))).map(Number);c({chatId:n,idsToRemove:e,idsToAdd:t}),r()}),[n,c,u,r,h]);if(s&&l)return a.ZP.createElement($e.Z,{isOpen:t,onClose:r,onCloseAnimationEnd:o,onEnter:Z,className:"delete",title:d("FilterAddTo")},a.ZP.createElement(zi.Z,{options:P,selected:h,onChange:v,round:!0}),a.ZP.createElement(D.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:Z},d("FilterAddTo")),a.ZP.createElement(D.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},d("Cancel")))})));var Hi=n(64319),qi=n(40647),Yi=n(60998);function Wi(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let Ki,Qi;const el={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},tl=e=>"changedTouches"in e?e.changedTouches[0].clientY:0,nl=e=>{const t="deltaY"in e?e.deltaY:tl(e);if(!Ki||!Ki.contains(e.target)||Ki.scrollTop<=0&&t<=0||Ki.scrollTop>=Ki.scrollHeight-Ki.offsetHeight&&t>=0){if(Qi&&e.target.closest(Qi))return;e.preventDefault()}};function al(e){el[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 sl(e,t){Ki=e,Qi=t,document.addEventListener("wheel",nl,{passive:!1}),document.addEventListener("touchmove",nl,{passive:!1}),document.onkeydown=al}function il(){Ki=void 0,Qi=void 0,document.removeEventListener("wheel",nl),document.removeEventListener("touchmove",nl),document.onkeydown=null}var ll=n(63394),rl=n(66902),ol=n(17921);const cl=d.FW?24:32,dl=(0,X.y)("ReactionSelectorReaction"),ml=(0,a.X$)((e=>{var t;let{reaction:n,previewIndex:s,onSendReaction:i,isReady:l,isCurrentUserPremium:r}=e;const o=(0,a.sO)(null),c=(0,M.Z)(`document${null===(t=n.selectAnimation)||void 0===t?void 0:t.id}`,!l),[m,u,h]=(0,b.Z)(),[v,P]=(0,b.Z)(),Z=Boolean(l&&c),{transitionClassNames:g}=(0,ne.Z)(Z),{shouldRender:p,transitionClassNames:E}=(0,ne.Z)(!l||!v,void 0,!0);return a.ZP.createElement("div",{className:dl("&",d.FW&&"compact"),onClick:function(){if(!o.current)return;const{x:e,y:t}=o.current.getBoundingClientRect();i(n.reaction,e,t)},ref:o,onMouseEnter:l?u:void 0},p&&a.ZP.createElement("div",{className:dl("static",r&&"premium",l?[E]:void 0),style:`background-position-x: ${s*-cl}px;`}),Z&&a.ZP.createElement(Ft.Z,{className:dl("animated",[g]),tgsUrl:c,play:m,noLoop:!0,size:cl,onLoad:P,onEnded:h}))})),ul=(0,X.y)("ReactionSelector"),hl=(0,a.X$)((e=>{let{availableReactions:t,enabledReactions:n,onSendReaction:s,isPrivate:l,isReady:r,canBuyPremium:o,isCurrentUserPremium:c}=e;const{openPremiumModal:m}=(0,i.Sv)(),u=(0,a.sO)(null),[h,v]=(0,b.Z)(!1);(0,jn.Z)(u.current,!h),(0,a.bt)((()=>{v()}),[v]);const P=e=>{u&&("deltaY"in e?e.deltaY:tl(e))&&e.preventDefault()};if((l||null!=n&&n.length)&&t)return a.ZP.createElement("div",{className:ul("&",d.FW&&"compact"),onWheelCapture:P,onTouchMove:P},a.ZP.createElement("div",{className:ul("bubble-big")}),a.ZP.createElement("div",{className:ul("bubble-small")}),a.ZP.createElement("div",{className:ul("items-wrapper")},a.ZP.createElement("div",{className:ul("items",["no-scrollbar"]),ref:u},null==t?void 0:t.map(((e,t)=>{if(!(e.isInactive||e.isPremium&&!c)&&(l||n&&n.includes(e.reaction)))return a.ZP.createElement(ml,{key:e.reaction,previewIndex:t,isReady:r,onSendReaction:s,reaction:e,isCurrentUserPremium:c})})),o&&Boolean(t.filter((e=>e.isPremium&&(!n||n.includes(e.reaction)))).length)&&a.ZP.createElement(D.Z,{round:!0,color:"translucent",className:ul("blocked-button"),onClick:()=>m({initialSection:"unique_reactions"})},a.ZP.createElement("i",{className:"icon-lock-badge"})))))})),vl=(0,a.X$)((e=>{var t,n,s,r,o;let{availableReactions:c,isOpen:m,message:u,isPrivate:h,isCurrentUserPremium:v,enabledReactions:P,anchor:Z,canSendNow:g,canReschedule:p,canBuyPremium:E,canReply:C,canEdit:f,canPin:I,canUnpin:y,canDelete:k,canReport:S,canForward:M,canFaveSticker:T,canUnfaveSticker:A,canCopy:R,canCopyLink:L,canSelect:F,canDownload:x,canSaveGif:B,canRevote:D,canClosePoll:O,isDownloading:$,canShowSeenBy:U,canShowReactionsCount:G,canRemoveReaction:V,canShowReactionList:J,seenByRecentUsers:z,hasCustomEmoji:j,customEmojiSets:H,onReply:q,onEdit:Y,onPin:W,onUnpin:K,onForward:Q,onDelete:ee,onReport:te,onFaveSticker:ne,onUnfaveSticker:ae,onSelect:se,onSend:ie,onReschedule:le,onClose:re,onCloseAnimationEnd:ce,onCopyLink:de,onCopyNumber:me,onDownload:ue,onSaveGif:he,onCancelVote:ve,onClosePoll:Pe,onShowSeenBy:Ze,onShowReactors:ge,onSendReaction:pe,onCopyMessages:Ee,onAboutAds:Ce,onSponsoredHide:fe}=e;const{showNotification:be,openStickerSet:Ie,openCustomEmojiSets:ye}=(0,i.Sv)(),ke=(0,a.sO)(null),Ne=(0,a.sO)(null),Se=(0,N.Z)(),Te=!(h||null!=P&&P.length),Ae=J&&!Te,Re=!("id"in u),Le=Re?"":u.id,[Fe,xe,Be]=(0,b.Z)(),De=(0,a.I4)((()=>{be({message:Se("Share.Link.Copied")}),re()}),[Se,re,be]),Oe=(0,a.I4)((()=>{H&&(1===H.length?Ie({stickerSetInfo:{shortName:H[0].shortName}}):ye({setIds:H.map((e=>e.id))}),re())}),[H,re,ye,Ie]),$e=Re?[]:function(e,t,n,a,s){const i=[],r=(0,l.UD)(e),o=(0,l.O$)(e)||((0,l.Cg)(e)?void 0:(0,l.F$)(e)),c=(0,l.nl)(e),d=(0,l.Ti)(e,"inline"),m=o&&(d||(0,l.BM)(e))&&Hi.yl,u=window.getSelection();if(m&&i.push({label:"lng_context_copy_image",icon:"copy-media",handler:()=>{Promise.resolve(d?qi.he(d,w.IU.BlobUrl):o.blobUrl).then(Hi.VP),null==t||t()}}),r){var h;const n=Boolean((null==u||null===(h=u.anchorNode)||void 0===h?void 0:h.parentNode)&&u.anchorNode.parentNode.closest(".Message .content-inner")&&""!==u.toString().replace(/(?:\r\n|\r|\n)/g,""));i.push({label:Wi(n),icon:"copy",handler:()=>{const s=(0,Yi.Z)();if(null!=s&&s.length&&a)a(s);else{const t=n&&u?u.toString():(0,l.EU)(e);(0,Hi.TE)(t)}null==t||t()}})}return n&&i.push({label:"lng_context_copy_message_link",icon:"link",handler:()=>{n(),null==t||t()}}),c&&s&&i.push({label:"lng_profile_copy_phone",icon:"copy",handler:()=>{s(),null==t||t()}}),i}(u,De,L?de:void 0,Ee,me),Ue=(0,a.I4)((()=>Re?document.querySelector(".Transition__slide--active > .MessageList .SponsoredMessage"):document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${Le}"]`)),[Re,Le]),_e=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),Ge=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),Ve=(0,a.I4)((()=>{var e;const t=d.wB&&(null===(e=document.querySelector(".AudioPlayer-content"))||void 0===e?void 0:e.offsetHeight)||0,n=document.querySelector(".HeaderPinnedMessage-wrapper"),a=(d.wB&&!t||!d.wB&&(null==n?void 0:n.classList.contains("full-width")))&&(null==n?void 0:n.offsetHeight)||0;return{extraPaddingX:10,extraTopPadding:document.querySelector(".MiddleHeader").offsetHeight,marginSides:Ae?32:void 0,extraMarginTop:a+t}}),[Ae]),Je=(0,a.I4)((()=>{pe(void 0,0,0)}),[pe]);(0,a.d4)((()=>{m?setTimeout((()=>{xe()}),200):Be()}),[m,xe,Be]);const{positionX:Xe,positionY:ze,transformOriginX:je,transformOriginY:He,style:qe,menuStyle:Ye,withScroll:We}=(0,ll.Z)(Z,Ue,_e,Ge,Ve);return(0,a.d4)((()=>(sl(We?Ne.current:void 0,".ReactionSelector"),il)),[We]),a.ZP.createElement(oe.Z,{ref:ke,isOpen:m,transformOriginX:je,transformOriginY:He,positionX:Xe,positionY:ze,style:qe,bubbleStyle:Ye,className:(0,X.Z)("MessageContextMenu","fluid",Ae&&"with-reactions"),onClose:re,onCloseAnimationEnd:ce},J&&a.ZP.createElement(hl,{enabledReactions:P,onSendReaction:pe,isPrivate:h,availableReactions:c,isReady:Fe,canBuyPremium:E,isCurrentUserPremium:v}),a.ZP.createElement("div",{className:"scrollable-content custom-scroll",style:Ye,ref:Ne},V&&a.ZP.createElement(_.Z,{icon:"heart-outline",onClick:Je},"Remove Reaction"),g&&a.ZP.createElement(_.Z,{icon:"send-outline",onClick:ie},Se("MessageScheduleSend")),p&&a.ZP.createElement(_.Z,{icon:"schedule",onClick:le},Se("MessageScheduleEditTime")),C&&a.ZP.createElement(_.Z,{icon:"reply",onClick:q},Se("Reply")),f&&a.ZP.createElement(_.Z,{icon:"edit",onClick:Y},Se("Edit")),T&&a.ZP.createElement(_.Z,{icon:"favorite",onClick:ne},Se("AddToFavorites")),A&&a.ZP.createElement(_.Z,{icon:"favorite",onClick:ae},Se("Stickers.RemoveFromFavorites")),R&&$e.map((e=>a.ZP.createElement(_.Z,{key:e.label,icon:e.icon,onClick:e.handler},Se(e.label)))),I&&a.ZP.createElement(_.Z,{icon:"pin",onClick:W},Se("DialogPin")),y&&a.ZP.createElement(_.Z,{icon:"unpin",onClick:K},Se("DialogUnpin")),B&&a.ZP.createElement(_.Z,{icon:"gifs",onClick:he},Se("lng_context_save_gif")),D&&a.ZP.createElement(_.Z,{icon:"revote",onClick:ve},Se("lng_polls_retract")),O&&a.ZP.createElement(_.Z,{icon:"stop",onClick:Pe},Se("lng_polls_stop")),x&&a.ZP.createElement(_.Z,{icon:"download",onClick:ue},Se($?"lng_context_cancel_download":"lng_media_download")),M&&a.ZP.createElement(_.Z,{icon:"forward",onClick:Q},Se("Forward")),F&&a.ZP.createElement(_.Z,{icon:"select",onClick:se},Se("Common.Select")),S&&a.ZP.createElement(_.Z,{icon:"flag",onClick:te},Se("lng_context_report_msg")),(U||G)&&!Re&&a.ZP.createElement(_.Z,{className:"MessageContextMenu--seen-by",icon:G?"heart-outline":"group",onClick:G?ge:Ze,disabled:!(G||null!==(t=u.seenByUserIds)&&void 0!==t&&t.length)},a.ZP.createElement("span",{className:"MessageContextMenu--seen-by-label"},G&&null!==(n=u.reactors)&&void 0!==n&&n.count?U&&null!==(s=u.seenByUserIds)&&void 0!==s&&s.length?Se("Chat.OutgoingContextMixedReactionCount",[u.reactors.count,u.seenByUserIds.length]):Se("Chat.ContextReactionCount",u.reactors.count,"i"):1===(null===(r=u.seenByUserIds)||void 0===r?void 0:r.length)&&z?(0,l.Js)(z[0]):null!==(o=u.seenByUserIds)&&void 0!==o&&o.length?Se("Conversation.ContextMenuSeen",u.seenByUserIds.length,"i"):Se("Conversation.ContextMenuNoViews")),a.ZP.createElement("div",{className:"avatars"},null==z?void 0:z.map((e=>a.ZP.createElement(Me.Z,{size:"micro",user:e,noVideo:!0}))))),k&&a.ZP.createElement(_.Z,{destructive:!0,icon:"delete",onClick:ee},Se("Delete")),j&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(rl.Z,null),!H&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(ol.Z,{inline:!0,className:"menu-loading-row"}),a.ZP.createElement(ol.Z,{inline:!0,className:"menu-loading-row"})),H&&1===H.length&&a.ZP.createElement(_.Z,{withWrap:!0,onClick:Oe,className:"menu-custom-emoji-sets"},(0,we.Z)(Se("MessageContainsEmojiPack",H[0].title),["simple_markdown","emoji"])),H&&H.length>1&&a.ZP.createElement(_.Z,{withWrap:!0,onClick:Oe,className:"menu-custom-emoji-sets"},(0,we.Z)(Se("MessageContainsEmojiPacks",H.length),["simple_markdown"]))),Re&&a.ZP.createElement(_.Z,{icon:"help",onClick:Ce},Se("SponsoredMessageInfo")),Re&&fe&&a.ZP.createElement(_.Z,{icon:"stop",onClick:fe},Se("HideAd"))))})),Pl=2*u.Gw,Zl=(0,a.X$)((0,i.c$)(((e,t)=>{var n,a,s;let{message:i,messageListType:o}=t;const{threadId:c}=(0,r.Bt)(e)||{},d=(0,r.xs)(e,i.chatId),u=(0,r.Z1)(e,i.chatId),{seenByExpiresAt:h,seenByMaxChatMembers:v}=e.appConfig||{},{noOptions:P,canReply:Z,canPin:g,canUnpin:p,canDelete:E,canReport:C,canEdit:f,canForward:b,canFaveSticker:I,canUnfaveSticker:y,canCopy:k,canCopyLink:N,canSelect:S,canDownload:w,canSaveGif:M,canRevote:T,canClosePoll:A}=c&&(0,r._k)(e,i,c)||{},R="pinned"===o,L="scheduled"===o,F=u&&(0,l.eA)(u),x=(0,l.CI)(i),B=Boolean(u&&v&&h&&(0,l.Bf)(u)&&(0,l.B4)(i)&&!L&&u.membersCount&&u.membersCount<=v&&i.date>Date.now()/1e3-h),D=u&&(0,l.YC)(u.id),O=(0,l.Lo)(i),$=!x&&!F&&!L&&!O&&!D&&i.reactions&&!(0,l.JE)(i.reactions)&&i.reactions.canSeeList,U=D&&(null===(n=i.reactions)||void 0===n||null===(a=n.results)||void 0===a?void 0:a.some((e=>e.isChosen))),_=(0,r.EV)(e,i),G=Boolean(i.content.contact),V=(0,r.wV)(e),J=(0,r.q_)(e,i),X=null==J?void 0:J.map((t=>(0,r.Ny)(e,t))),z=null!=X&&X.every(Boolean)?X:void 0;return{availableReactions:e.availableReactions,noOptions:P,canSendNow:L,canReschedule:L,canReply:!R&&!L&&Z,canPin:!L&&g,canUnpin:!L&&p,canDelete:E,canReport:C,canEdit:!R&&f,canForward:!_&&!L&&b,canFaveSticker:!L&&I,canUnfaveSticker:!L&&y,canCopy:G||!_&&k,canCopyLink:!_&&!L&&N,canSelect:S,canDownload:!_&&w,canSaveGif:!_&&M,canRevote:T,canClosePoll:!L&&A,activeDownloads:d,canShowSeenBy:B,enabledReactions:null!=u&&u.isForbidden||null==u||null===(s=u.fullInfo)||void 0===s?void 0:s.enabledReactions,isPrivate:D,isCurrentUserPremium:V,hasFullInfo:Boolean(null==u?void 0:u.fullInfo),canShowReactionsCount:$,canShowReactionList:!x&&!O&&!L&&(null==u?void 0:u.id)!==m.aw,canRemoveReaction:U,canBuyPremium:!V&&!(0,r.oe)(e),customEmojiSetsInfo:J,customEmojiSets:z}}))((e=>{var t;let{availableReactions:n,isOpen:s,messageListType:r,chatUsername:o,message:c,customEmojiSetsInfo:d,customEmojiSets:u,album:h,anchor:v,onClose:P,onCloseAnimationEnd:Z,noOptions:g,canSendNow:p,hasFullInfo:E,canReschedule:C,canReply:f,canPin:I,canUnpin:y,canDelete:k,canReport:S,canShowReactionsCount:w,canShowReactionList:M,canRemoveReaction:T,canEdit:A,enabledReactions:R,isPrivate:L,isCurrentUserPremium:F,canForward:x,canBuyPremium:D,canFaveSticker:O,canUnfaveSticker:$,canCopy:U,canCopyLink:_,canSelect:G,canDownload:V,canSaveGif:J,canRevote:z,canClosePoll:j,activeDownloads:H,canShowSeenBy:q}=e;const{setReplyingToId:Y,setEditingId:W,pinMessage:K,openForwardMenu:Q,faveSticker:ee,unfaveSticker:te,toggleMessageSelection:ae,sendScheduledMessages:se,rescheduleMessage:le,downloadMessageMedia:re,cancelMessageMediaDownload:oe,loadSeenBy:ce,openSeenByModal:de,sendReaction:me,openReactorListModal:ue,loadFullChat:he,loadReactors:ve,copyMessagesByIds:Pe,saveGif:Ze,loadStickers:ge,cancelPollVote:pe,closePoll:Ee}=(0,i.Sv)(),Ce=(0,N.Z)(),{transitionClassNames:fe}=(0,ne.Z)(s,Z,void 0,!1),[be,Ie]=(0,a.eJ)(!0),[ye,ke]=(0,a.eJ)(!1),[Ne,Se]=(0,a.eJ)(!1),[we,Me]=(0,a.eJ)(!1),[Te,Ae,Re]=(0,b.Z)(),[Le,Fe,xe]=(0,b.Z)(),Be=void 0===d||Boolean(d.length);(0,a.d4)((()=>{q&&s&&ce({chatId:c.chatId,messageId:c.id})}),[ce,s,c.chatId,c.id,q]),(0,a.d4)((()=>{w&&s&&ve({chatId:c.chatId,messageId:c.id})}),[w,s,ve,c.chatId,c.id]),(0,a.d4)((()=>{null!=d&&d.length&&(null==u?void 0:u.length)!==d.length&&d.forEach((e=>{ge({stickerSetInfo:e})}))}),[d,u,ge]),(0,a.d4)((()=>{E||L||!s||he({chatId:c.chatId})}),[E,s,L,he,c.chatId]);const De=(0,a.Ye)((()=>{var e,t,n;if(null!==(e=c.reactions)&&void 0!==e&&null!==(t=e.recentReactions)&&void 0!==t&&t.length){var a,s;const e=(0,i.Rd)().users.byId;return null===(a=c.reactions)||void 0===a||null===(s=a.recentReactions)||void 0===s?void 0:s.slice(0,3).map((t=>{let{userId:n}=t;return e[n]})).filter(Boolean)}if(!c.seenByUserIds)return;const l=(0,i.Rd)().users.byId;return null===(n=c.seenByUserIds)||void 0===n?void 0:n.slice(0,3).map((e=>l[e])).filter(Boolean)}),[null===(t=c.reactions)||void 0===t?void 0:t.recentReactions,c.seenByUserIds]),Oe=h?h.messages.some((e=>H.includes(e.id))):H.includes(c.id),$e=(0,a.I4)((()=>{Ie(!1),ke(!0)}),[]),Ue=(0,a.I4)((()=>{Ie(!1),Se(!0)}),[]),_e=(0,a.I4)((()=>{Ie(!1),P()}),[P]),Ge=(0,a.I4)((()=>{ke(!1),P()}),[P]),Ve=(0,a.I4)((()=>{Se(!1),P()}),[P]),Je=(0,a.I4)((()=>{Me(!1),P()}),[P]),Xe=(0,a.I4)((()=>{Re(),P()}),[Re,P]),ze=(0,a.I4)((()=>{Y({messageId:c.id}),_e()}),[Y,c.id,_e]),je=(0,a.I4)((()=>{W({messageId:c.id}),_e()}),[W,c.id,_e]),He=(0,a.I4)((()=>{Ie(!1),Me(!0)}),[]),qe=(0,a.I4)((()=>{K({messageId:c.id,isUnpin:!0}),_e()}),[K,c.id,_e]),Ye=(0,a.I4)((()=>{if(_e(),null!=h&&h.messages){const e=h.messages.map((e=>{let{id:t}=e;return t}));Q({fromChatId:c.chatId,messageIds:e})}else Q({fromChatId:c.chatId,messageIds:[c.id]})}),[Q,c,_e,h]),We=(0,a.I4)((()=>{_e(),ee({sticker:c.content.sticker})}),[_e,c.content.sticker,ee]),Ke=(0,a.I4)((()=>{_e(),te({sticker:c.content.sticker})}),[_e,c.content.sticker,te]),et=(0,a.I4)((()=>{_e(),pe({chatId:c.chatId,messageId:c.id})}),[_e,c,pe]),tt=(0,a.I4)((()=>{_e(),Ee({chatId:c.chatId,messageId:c.id})}),[_e,c,Ee]),nt=(0,a.I4)((()=>{const e=null!=h&&h.messages?{messageId:c.id,childMessageIds:h.messages.map((e=>{let{id:t}=e;return t})),withShift:!1}:{messageId:c.id,withShift:!1};ae(e),_e()}),[_e,c.id,ae,h]),at=(0,a.I4)((()=>{se({chatId:c.chatId,id:c.id}),_e()}),[_e,c.chatId,c.id,se]),st=(0,a.I4)((()=>{Ie(!1),Ae()}),[Ae]),it=(0,a.I4)((()=>{_e(),de({chatId:c.chatId,messageId:c.id})}),[_e,c.chatId,c.id,de]),lt=(0,a.I4)((()=>{_e(),ue({chatId:c.chatId,messageId:c.id})}),[_e,ue,c.chatId,c.id]),rt=(0,a.I4)((e=>{le({chatId:c.chatId,messageId:c.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[c.chatId,c.id,le]),ot=(0,a.I4)((e=>{Pe({messageIds:e}),_e()}),[_e,Pe]),dt=(0,a.I4)((()=>{(0,Hi.TE)(`${m.zH}${o||`c/${c.chatId.replace("-","")}`}/${c.id}`),_e()}),[o,_e,c]),mt=(0,a.I4)((()=>{(0,Hi.TE)(c.content.contact.phoneNumber),_e()}),[_e,c]),ut=(0,a.I4)((()=>{((null==h?void 0:h.messages)||[c]).forEach((e=>{Oe?oe({message:e}):re({message:e})})),_e()}),[h,c,_e,Oe,oe,re]),ht=(0,a.I4)((()=>{const e=(0,l.b7)(c);Ze({gif:e}),_e()}),[_e,c,Ze]),vt=(0,a.I4)(((e,t,n)=>{me({chatId:c.chatId,messageId:c.id,reaction:e,x:t,y:n,startSize:Pl}),_e()}),[_e,c.chatId,c.id,me]),Pt=(0,a.Ye)((()=>(h?h.messages:[c]).map((e=>{let{id:t}=e;return t}))),[h,c]);if(g)return void _e();const Zt=new Date;return Zt.setFullYear(Zt.getFullYear()+1),a.ZP.createElement("div",{className:(0,X.Z)("ContextMenuContainer",fe)},a.ZP.createElement(vl,{availableReactions:n,message:c,isPrivate:L,isCurrentUserPremium:F,canBuyPremium:D,isOpen:be,enabledReactions:R,anchor:v,canShowReactionsCount:w,canShowReactionList:M,canRemoveReaction:T,canSendNow:p,canReschedule:C,canReply:f,canDelete:k,canReport:S,canPin:I,canUnpin:y,canEdit:A,canForward:x,canFaveSticker:O,canUnfaveSticker:$,canCopy:U,canCopyLink:_,canSelect:G,canDownload:V,canSaveGif:J,canRevote:z,canClosePoll:j,canShowSeenBy:q,hasCustomEmoji:Be,customEmojiSets:u,isDownloading:Oe,seenByRecentUsers:De,onReply:ze,onEdit:je,onPin:He,onUnpin:qe,onForward:Ye,onDelete:$e,onReport:Ue,onFaveSticker:We,onUnfaveSticker:Ke,onSelect:nt,onSend:at,onReschedule:st,onClose:_e,onCopyLink:dt,onCopyMessages:ot,onCopyNumber:mt,onDownload:ut,onSaveGif:ht,onCancelVote:et,onClosePoll:Fe,onShowSeenBy:it,onSendReaction:vt,onShowReactors:lt}),a.ZP.createElement(Rn,{isOpen:ye,isSchedule:"scheduled"===r,onClose:Ge,album:h,message:c}),a.ZP.createElement(B.Z,{isOpen:Ne,onClose:Ve,messageIds:Pt}),a.ZP.createElement(Ln,{isOpen:we,messageId:c.id,chatId:c.chatId,onClose:Je}),a.ZP.createElement(Qe.Z,{isOpen:Le,onClose:xe,text:Ce("lng_polls_stop_warning"),confirmLabel:Ce("lng_polls_stop_sure"),confirmHandler:tt}),C&&a.ZP.createElement(ct,{isOpen:Te,withTimePicker:!0,selectedAt:1e3*c.date,maxAt:(0,ie._F)(Zt),isFutureMode:!0,onClose:Xe,onSubmit:rt}))}))),gl=(0,a.X$)((0,i.c$)((e=>({canBuyPremium:!(0,r.wV)(e)&&!(0,r.oe)(e)})))((e=>{let{message:t,anchor:n,onAboutAds:s,onClose:l,onCloseAnimationEnd:r,canBuyPremium:o}=e;const{openPremiumModal:c}=(0,i.Sv)(),[d,,m]=(0,b.Z)(!0),{transitionClassNames:u}=(0,ne.Z)(d,r,void 0,!1),h=(0,a.I4)((()=>{s(),m()}),[m,s]),v=(0,a.I4)((()=>{m(),c(),l()}),[m,l,c]);if(n)return a.ZP.createElement("div",{className:(0,X.Z)("ContextMenuContainer",u)},a.ZP.createElement(vl,{isOpen:d,anchor:n,message:t,onClose:m,onCloseAnimationEnd:m,onAboutAds:h,onSponsoredHide:o?v:void 0}))})));var pl=n(33057);const El=(0,a.X$)((0,i.c$)(((e,t)=>{let{fromSticker:n,stickerSetShortName:a}=t;const s=(0,r.Bt)(e),{chatId:i,threadId:o}=s||{},c=i&&(0,r.Z1)(e,i),d=c?(0,l.H5)(c):void 0,m=Boolean(c&&o&&(0,l.Qm)(c,o)&&(null==d?void 0:d.canSendStickers)),u=Boolean(i)&&(0,r.FM)(e,i),h=n?n.stickerSetInfo:a?{shortName:a}:void 0,v=h?(0,r.Ny)(e,h):void 0,P=v&&(0,r.FW)(v);return{canScheduleUntilOnline:Boolean(i)&&(0,r.Eh)(e,i),canSendStickers:m,isSavedMessages:u,shouldSchedule:(0,r.Aq)(e),stickerSet:v,isCurrentUserPremium:(0,r.wV)(e),isSetPremium:P}}))((e=>{let{isOpen:t,fromSticker:n,stickerSetShortName:s,stickerSet:l,canSendStickers:r,canScheduleUntilOnline:o,shouldSchedule:c,isSavedMessages:d,isSetPremium:u,isCurrentUserPremium:h,onClose:v}=e;const{loadStickers:P,toggleStickerSet:Z,sendMessage:g,openPremiumModal:p}=(0,i.Sv)(),E=(0,a.sO)(null),C=(0,N.Z)(),f=(0,S.Z)(l),b=l||f,I=null==b?void 0:b.isEmoji,y=!(null!=b&&b.installedDate)&&u&&!h,[k,w]=(0,pl.Z)(o),{observe:M}=(0,ha.S1)({rootRef:E,throttleMs:200,isDisabled:!t});(0,a.d4)((()=>{!t||null!=b&&b.stickers||P({stickerSetInfo:n?n.stickerSetInfo:{shortName:s}})}),[t,n,P,s,b]);const T=(0,a.I4)(((e,t,n)=>{e={...e,isPreloadedGlobally:!0},c||n?k((n=>{g({sticker:e,isSilent:t,scheduledAt:n}),v()})):(g({sticker:e,isSilent:t}),v())}),[v,k,g,c]),A=(0,a.I4)((()=>{if(b){if(y)return void p({initialSection:"animated_emoji"});Z({stickerSetId:b.id}),v()}}),[y,v,p,b,Z]);return a.ZP.createElement($e.Z,{className:"StickerSetModal",isOpen:t,onClose:v,hasCloseButton:!0,title:b?(0,we.Z)(b.title,["emoji","links"]):C("AccDescrStickerSet")},null!=b&&b.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:E,className:"stickers custom-scroll"},b.stickers.map((e=>a.ZP.createElement(Ci.Z,{sticker:e,size:I?m.lH:m.yK,observeIntersection:M,onClick:r&&!I?T:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:h})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(D.Z,{size:"smaller",fluid:!0,color:b.installedDate?"danger":"primary",isShiny:y,withPremiumGradient:y,onClick:A},(()=>{if(!b)return C("Loading");if(y)return C("EmojiInput.UnlockPack",b.title);const e=I?"Emoji":"Sticker";return C(b.installedDate?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,b.count,"i")})()))):a.ZP.createElement(Oe.Z,null),w)}))),Cl={root:"Qzt_zq5gWHne6P2rw7Wj",sets:"Ay41sqhq2QmXdgDHnt2E"},fl=(0,a.X$)((0,i.c$)(((e,t)=>{let{customEmojiSetIds:n}=t;return{customEmojiSets:null==n?void 0:n.map((t=>e.stickers.setsById[t]))}}))((e=>{let{customEmojiSets:t,onClose:n}=e;const{openStickerSet:s}=(0,i.Sv)(),l=(0,a.sO)(null),{observe:r}=(0,ha.S1)({rootRef:l}),o=(0,S.Z)(t),c=t||o,d=(0,a.I4)((e=>{s({stickerSetInfo:e.stickerSetInfo})}),[s]);return a.ZP.createElement($e.Z,{isOpen:Boolean(t),className:Cl.root,onClose:n,hasCloseButton:!0,title:"Sets of used emoji"},a.ZP.createElement("div",{className:(0,X.Z)(Cl.sets,"custom-scroll"),ref:l},null==c?void 0:c.map((e=>a.ZP.createElement(fi,{key:e.id,className:Cl.setCard,stickerSet:e,onClick:d,observeIntersection:r})))))})));var bl=n(62898);const Il={settings:{icon:"bots",label:"BotSettings"},privacy:{icon:"info",label:"Privacy"},help:{icon:"help",label:"BotHelp"}},yl=(0,a.X$)((0,i.c$)(((e,t)=>{var n,a,s,i,o;let{chatId:c}=t;const d=(0,r.Z1)(e,c);if(!d||d.isRestricted)return{};const u=(0,l.YC)(d.id),h=u?(0,r.dy)(e,c):void 0,v=h&&(0,l.kw)(h),P=(0,l.eA)(d)||(0,l.Bf)(d)||h&&!h.isSelf,Z=c!==m.FV?(0,r.IK)(e,c):void 0,g=Boolean(e.lastSyncTime&&(null==h||null===(n=h.fullInfo)||void 0===n||null===(a=n.premiumGifts)||void 0===a?void 0:a.length)&&!(0,r.oe)(e));return{chat:d,isMuted:(0,l.i4)(d,(0,r.dZ)(e),(0,r.NJ)(e)),isPrivate:u,canAddContact:v,canReportChat:P,canDeleteChat:(0,l.cc)(d),canGiftPremium:g,hasLinkedChat:Boolean(null==d||null===(s=d.fullInfo)||void 0===s?void 0:s.linkedChatId),botCommands:null==Z||null===(i=Z.fullInfo)||void 0===i||null===(o=i.botInfo)||void 0===o?void 0:o.commands}}))((e=>{let{chatId:t,isOpen:n,withExtraActions:s,anchor:l,isChannel:r,botCommands:o,canStartBot:c,canRestartBot:m,canSubscribe:u,canSearch:h,canCall:v,canMute:P,canViewStatistics:Z,canLeave:g,canEnterVoiceChat:p,canCreateVoiceChat:E,chat:C,isPrivate:f,isMuted:b,canReportChat:I,canDeleteChat:y,canGiftPremium:k,hasLinkedChat:S,canAddContact:w,onSubscribeChannel:M,onSearchClick:T,onClose:A,onCloseAnimationEnd:R}=e;const{updateChatMutedState:L,enterMessageSelectMode:F,sendBotCommand:x,restartBot:D,joinGroupCall:O,createGroupCall:$,openLinkedChat:U,openAddContactDialog:G,requestCall:V,toggleStatistics:J,openGiftPremiumModal:X}=(0,i.Sv)(),[z,j]=(0,a.eJ)(!0),[H,q]=(0,a.eJ)(!1),[Y,W]=(0,a.eJ)(!1),{x:K,y:Q}=l;(0,ne.Z)(n,R,void 0,!1);const ee=(0,a.I4)((()=>{j(!1),W(!0)}),[]),te=(0,a.I4)((()=>{W(!1),A()}),[A]),ae=(0,a.I4)((()=>{j(!1),q(!0)}),[]),se=(0,a.I4)((()=>{j(!1),A()}),[A]),ie=(0,a.I4)((()=>{q(!1),A()}),[A]),le=(0,a.I4)((()=>{x({command:"/start"})}),[x]),re=(0,a.I4)((()=>{D({chatId:t})}),[t,D]),ce=(0,a.I4)((()=>{L({chatId:t,isMuted:!b}),se()}),[t,se,b,L]),de=(0,a.I4)((()=>{E?$({chatId:t}):O({chatId:t}),se()}),[se,E,t,O,$]),me=(0,a.I4)((()=>{U({id:t}),se()}),[t,se,U]),ue=(0,a.I4)((()=>{X({forUserId:t}),se()}),[X,t,se]),he=(0,a.I4)((()=>{G({userId:t}),se()}),[G,t,se]),ve=(0,a.I4)((()=>{M(),se()}),[se,M]),Pe=(0,a.I4)((()=>{V({userId:t,isVideo:!0}),se()}),[t,se,V]),Ze=(0,a.I4)((()=>{V({userId:t}),se()}),[t,se,V]),ge=(0,a.I4)((()=>{T(),se()}),[se,T]),pe=(0,a.I4)((()=>{J(),se()}),[se,J]),Ee=(0,a.I4)((()=>{F(),se()}),[se,F]);(0,a.d4)((()=>(sl(),il)),[]);const Ce=(0,N.Z)(),fe=(0,a.Ye)((()=>null==o?void 0:o.map((e=>{let{command:t}=e;const n=Il[t];if(n)return a.ZP.createElement(_.Z,{key:t,icon:n.icon,onClick:()=>{x({command:`/${t}`}),se()}},Ce(n.label))}))),[o,se,Ce,x]);return a.ZP.createElement(bl.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(oe.Z,{isOpen:z,positionX:"right",style:`left: ${K}px;top: ${Q}px;`,onClose:se},s&&c&&a.ZP.createElement(_.Z,{icon:"bots",onClick:le},Ce("BotStart")),s&&m&&a.ZP.createElement(_.Z,{icon:"bots",onClick:re},Ce("BotRestart")),s&&u&&a.ZP.createElement(_.Z,{icon:r?"channel":"group",onClick:ve},Ce(r?"ProfileJoinChannel":"ProfileJoinGroup")),w&&a.ZP.createElement(_.Z,{icon:"add-user",onClick:he},Ce("AddContact")),d.wB&&v&&a.ZP.createElement(_.Z,{icon:"phone",onClick:Ze},Ce("Call")),v&&a.ZP.createElement(_.Z,{icon:"video-outlined",onClick:Pe},Ce("VideoCall")),d.wB&&h&&a.ZP.createElement(_.Z,{icon:"search",onClick:ge},Ce("Search")),P&&a.ZP.createElement(_.Z,{icon:b?"unmute":"mute",onClick:ce},Ce(b?"ChatsUnmute":"ChatsMute")),(p||E)&&a.ZP.createElement(_.Z,{icon:"voice-chat",onClick:de},Ce(E?"StartVoipChat":"VoipGroupJoinCall")),S&&a.ZP.createElement(_.Z,{icon:r?"comments":"channel",onClick:me},Ce(r?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(_.Z,{icon:"select",onClick:Ee},Ce("ReportSelectMessages")),Z&&a.ZP.createElement(_.Z,{icon:"stats",onClick:pe},Ce("Statistics")),I&&a.ZP.createElement(_.Z,{icon:"flag",onClick:ee},Ce("ReportPeer.Report")),fe,k&&a.ZP.createElement(_.Z,{icon:"gift",onClick:ue},Ce("GiftPremium")),g&&a.ZP.createElement(_.Z,{destructive:!0,icon:"delete",onClick:ae},Ce(f?"DeleteChatUser":y?"GroupInfo.DeleteAndExit":r?"LeaveChannel":"Group.LeaveGroup"))),C&&a.ZP.createElement(Yn.Z,{isOpen:H,onClose:ie,chat:C}),I&&(null==C?void 0:C.id)&&a.ZP.createElement(B.Z,{isOpen:Y,onClose:te,subject:"peer",chatId:C.id})))})));var kl=n(69589);const Nl=(0,H.Ds)((e=>e()),200,!1),Sl=(0,a.X$)((0,i.c$)((e=>{const t=(0,r.jr)(e);if(!t)return{};const{query:n,results:a}=(0,r.n5)(e)||{},{totalCount:s,foundIds:i}=a||{};return{chat:t,query:n,totalCount:s,foundIds:i,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}))((e=>{let{isActive:t,chat:n,query:s,totalCount:l,foundIds:r,isHistoryCalendarOpen:o}=e;const{setLocalTextSearchQuery:c,searchTextMessagesLocal:d,focusMessage:m,closeLocalTextSearch:u,openHistoryCalendar:h}=(0,i.Sv)(),v=(0,a.sO)(null),[P,Z]=(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===v.current){const{pageTop:n,height:a}=e;t.style.transform=`translateY(${n}px)`,t.style.height=`${a}px`,document.documentElement.scrollTop=n}else t.style.transform="",t.style.height=""};return e.addEventListener("resize",n),()=>{e.removeEventListener("resize",n)}}),[]),(0,a.d4)((()=>{null!=n&&n.id&&null!=r&&r.length?(m({chatId:n.id,messageId:r[0]}),Z(0)):Z(-1)}),[null==n?void 0:n.id,m,r]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((e=>{e.disabled=Boolean(t&&e!==v.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((e=>{e.contentEditable=t?"false":"true"}))}),[t]),(0,a.d4)((()=>{t||v.current.blur()}),[t]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[o]);const g=(0,a.I4)((e=>{c({query:e}),e.length&&Nl(d)}),[d,c]),p=(0,a.I4)((()=>{if(n&&r){const e=P+1;m({chatId:n.id,messageId:r[e]}),Z(e)}}),[n,P,m,r]),E=(0,a.I4)((()=>{if(n&&r){const e=P-1;m({chatId:n.id,messageId:r[e]}),Z(e)}}),[n,P,m,r]);return a.ZP.createElement("div",{id:"MobileSearch",className:t?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(D.Z,{size:"smaller",round:!0,color:"translucent",onClick:u},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(kl.Z,{ref:v,value:s,onChange:g})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},s?null!=r&&r.length?`${P+1} of ${l}`:r&&!r.length?"No results":"":a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>h({selectedAt:(0,ie._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!r||!r.length||P===r.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(D.Z,{round:!0,size:"smaller",color:"translucent",onClick:E,disabled:!r||!r.length||0===P},a.ZP.createElement("i",{className:"icon-down"}))))})));var wl=n(15376),Ml=n(21262),Tl=n(29295),Al=n(72162),Rl=n(17240),Ll=n(70971),Fl=n(47002),xl=n(13616);function Bl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];const l=e[i?"scrollLeft":"scrollTop"],r=l+e[i?"offsetWidth":"offsetHeight"],o="string"==typeof t?e.querySelectorAll(t):t,{length:c}=o,d=[];let m=!1;for(let e=0;e<c;e++){const t=o[e],c=t[i?"offsetLeft":"offsetTop"],u=c+t[i?"offsetWidth":"offsetHeight"];if(s?u>=l-n&&u<=r+n:c<=r+n&&u>=l-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:o,visibleIndexes:d}}const Dl=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],i=t[n?"offsetLeft":"offsetTop"],l=i+t[n?"offsetWidth":"offsetHeight"];return i>a&&l<s};var Ol=n(60539);function $l(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:i}=Bl(a,e,8,!0,!0);if(!i.length||!i[t])return;const l=s[0];if(!s.includes(t)||t===l&&!Dl(a,i[l])){const e=t>s[s.length-1]?"start":"end";(0,Ol.Z)(a,i[t],e,10)}}function Ul(e){let{isActive:t,isHorizontal:n,shouldSaveSelectionOnUpdateItems:s,shouldRemoveSelectionOnReset:i,noArrowNavigation:l,items:r,shouldSelectOnTab:o,onSelect:c,onClose:d}=e;const[m,u]=(0,a.eJ)(-1),h=(0,a.I4)((e=>r?(0,Lt.Z)(r.length,e):-1),[r]),v=(0,a.I4)(((e,t)=>{t.preventDefault(),u((t=>h(t+e)))}),[u,h]),P=(0,a.I4)((e=>{if(r&&r.length&&m>-1){const t=r[m];t&&(e.preventDefault(),c(t))}}),[r,c,m]),Z=!r||m>r.length-1;return(0,a.d4)((()=>{s&&!Z||u(i?-1:0)}),[Z,i,s]),(0,a.d4)((()=>t?(0,xn.Z)({onEsc:d,onUp:l||n?void 0:e=>v(-1,e),onDown:l||n?void 0:e=>v(1,e),onLeft:l||!n?void 0:e=>v(-1,e),onRight:l||!n?void 0:e=>v(1,e),onTab:o?P:void 0,onEnter:P}):void 0),[l,v,P,t,n,d,o]),m}const _l=(0,a.X$)((e=>{let{isOpen:t,onClose:n,onInsertUserName:s,filteredUsers:l}=e;const r=(0,a.sO)(null),{shouldRender:o,transitionClassNames:c}=(0,ne.Z)(t,void 0,void 0,!1),d=(0,a.I4)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(0,i.Rd)().users.byId,a=n[e];a&&s(a,t)}),[s]),m=(0,a.I4)((e=>{d(e.id,!0)}),[d]),u=Ul({isActive:t,items:l,onSelect:m,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});(0,a.d4)((()=>{$l(".chat-item-clickable",u,r)}),[u]),(0,a.d4)((()=>{l&&!l.length&&n()}),[l,n]);const h=(0,S.Z)(null!=l&&l.length?l:void 0,o),v=l&&!l.length?h:l;if(!o||v&&!v.length)return;const P=(0,X.Z)("MentionTooltip composer-tooltip custom-scroll",c);return a.ZP.createElement("div",{className:P,ref:r},null==v?void 0:v.map(((e,t)=>{let{id:n}=e;return a.ZP.createElement(Ge.Z,{key:n,className:"chat-item-clickable scroll-item",onClick:()=>d(n),focus:u===t},a.ZP.createElement(Je.Z,{userId:n,avatarSize:"small",withUsername:!0}))})))}));var Gl=n(19830),Vl=n(67146);const Jl=(0,a.X$)((e=>{let{chatId:t,threadId:n,attachments:s,caption:i,canShowCustomSendMenu:l,captionLimit:r,isReady:o,isChatWithSelf:d,currentUserId:u,groupChatMembers:h,recentEmojis:v,baseEmojiKeywords:P,emojiKeywords:Z,shouldSchedule:g,addRecentEmoji:p,onCaptionUpdate:E,onSend:C,onFileAppend:f,onClear:I,onSendSilent:y,onSendScheduled:k}=e;const w=(0,Ll.Y)(i),M=(0,Ll.Y)(null),T=(0,a.sO)(),A=(0,S.Z)(s),R=s.length?s:A,L=Boolean(s.length),[F,x,B]=(0,b.Z)(),O=Boolean(R&&R.every((e=>e.quick))),$=(0,N.Z)(),{isMentionTooltipOpen:U,closeMentionTooltip:_,insertMention:G,mentionFilteredUsers:V}=(0,Tl.Z)(L,w,E,m.nY,h,void 0,u),{isEmojiTooltipOpen:J,closeEmojiTooltip:X,filteredEmojis:z,insertEmoji:j}=(0,Al.Z)(L,w,v,m.nY,E,P,Z,!o);(0,a.d4)((()=>L?(0,c.Z)(I):void 0),[L,I]);const{isContextMenuOpen:H,handleContextMenu:q,handleContextMenuClose:Y,handleContextMenuHide:W}=(0,Rl.Z)(M,!l||!L),K=(0,a.I4)((()=>{L&&(g?k():C())}),[L,k,C,g]),Q=(0,a.I4)((async e=>{e.preventDefault(),B();const{dataTransfer:t}=e,n=await(0,Ml.Z)(t.items);if(null!=n&&n.length){const e=O?Array.from(n).filter((e=>e.type&&m.dI.has(e.type))):Array.from(n);f(e,O)}}),[O,f,B]);if(!R)return;const ee=R.every((e=>m.oG.has(e.mimeType))),te=R.every((e=>m.wG.has(e.mimeType))),ne=R.every((e=>m.e7.has(e.mimeType)));let ae="";ae=$(ee?"PreviewSender.SendPhoto":te?"PreviewSender.SendVideo":ne?"PreviewSender.SendAudio":"PreviewSender.SendFile",R.length,"i");const se=r-i.length<=100?r-i.length:void 0;return a.ZP.createElement($e.Z,{isOpen:L,onClose:I,header:function(){if(R)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:$.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:I},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},ae),a.ZP.createElement("div",{className:"AttachmentModal--send-wrapper"},a.ZP.createElement(D.Z,{ref:M,color:"primary",size:"smaller",className:"modal-action-button",onClick:K,onContextMenu:l?q:void 0},$("Send")),l&&a.ZP.createElement(Vl.Z,{isOpen:H,isOpenToBottom:!0,onSendSilent:d?void 0:y,onSendSchedule:k,onClose:Y,onCloseAnimationEnd:W,isSavedMessages:d})))}(),className:"AttachmentModal "+(F?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:x,onDrop:Q,onDragOver:function(e){e.preventDefault(),T.current&&(window.clearTimeout(T.current),T.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(T.current=window.setTimeout(B,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),B())},"data-attach-description":$("Preview.Dragging.AddItems",10),"data-dropzone":!0},O?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},R.map((e=>e.mimeType.startsWith("image/")?a.ZP.createElement("img",{src:e.blobUrl,alt:""}):a.ZP.createElement("video",{src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0})))):a.ZP.createElement("div",{className:"document-wrapper custom-scroll"},R.map((e=>a.ZP.createElement(Fl.Z,{name:e.filename,extension:(0,wl.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(_l,{isOpen:U,onClose:_,onInsertUserName:G,filteredUsers:V}),a.ZP.createElement(Gl.Z,{isOpen:J,emojis:z,onClose:X,onEmojiSelect:j,addRecentEmoji:p}),a.ZP.createElement(xl.Z,{id:"caption-input-text",chatId:t,threadId:n,isAttachmentModalInput:!0,html:i,editableInputId:m.nY,placeholder:$("Caption"),onUpdate:E,onSend:K,canAutoFocus:Boolean(o&&s.length),captionLimit:se}))))}));var Xl=n(83099);const zl=(0,a.X$)((e=>{let{isOpen:t,isQuiz:n,shouldBeAnonymous:s,onSend:i,onClear:l}=e;const r=(0,a.sO)(null),o=(0,a.sO)(null),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(""),[h,v]=(0,a.eJ)([""]),[P,Z]=(0,a.eJ)(!0),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(n||!1),[f,b]=(0,a.eJ)(""),[I,y]=(0,a.eJ)(),[k,S]=(0,a.eJ)(!1),w=(0,N.Z)(),M=(0,a.I4)((e=>{t&&e.current&&e.current.focus()}),[t]);(0,a.d4)((()=>t?(0,c.Z)(l):void 0),[t,l]),(0,a.d4)((()=>{t||(u(""),v([""]),Z(!0),p(!1),C(n||!1),b(""),y(""),S(!1))}),[n,t]),(0,a.d4)((()=>M(r)),[M,t]),(0,a.bt)((()=>{const e=d.current;e&&f!==e.innerHTML&&(e.innerHTML=f)}),[f]);const T=(0,a.I4)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];v([...e,""]),requestAnimationFrame((()=>{const e=o.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),A=(0,a.I4)((()=>{if(S(!1),!t)return;const e=m.trim().substring(0,255),n=h.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!e||n.length<2)return u(e),n.length?n.length<2?T(n):v(n):T(),void S(!0);if(E&&(!I||!n[Number(I)]))return void S(!0);const a={summary:{question:e,answers:n.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===I&&{correct:!0}}))),...!P&&{isPublic:!0},...g&&{multipleChoice:!0},...E&&{quiz:!0}}};if(E){const{text:e,entities:t}=f&&(0,Xl.Z)(f.substring(0,200))||{};a.quiz={correctAnswers:[I],...e&&{solution:e},...t&&{solutionEntities:t}}}i(a)}),[t,m,h,E,I,P,g,i,T,f]),R=(0,a.I4)(((e,t)=>{const n=[...h];n[e]=t,n[n.length-1].trim().length&&n.length<10?T(n):v(n)}),[h,T]),L=(0,a.I4)((e=>{const t=[...h];t.splice(e,1),v(t),requestAnimationFrame((()=>{o.current&&o.current.classList.toggle("overflown",o.current.scrollHeight>320)}))}),[h]),F=(0,a.I4)((e=>{y(e)}),[y]),x=(0,a.I4)((e=>{Z(e.target.checked)}),[]),B=(0,a.I4)((e=>{p(e.target.checked)}),[]),O=(0,a.I4)((e=>{C(e.target.checked)}),[]),$=(0,a.I4)((e=>{13===e.keyCode&&A()}),[A]),U=(0,a.I4)((e=>{u(e.target.value)}),[]),_=(0,a.I4)((()=>{if(k&&!m.trim().length)return w("lng_polls_choose_question")}),[k,w,m]),G=(0,a.I4)((e=>{const t=h.map((e=>e.trim())).filter((e=>e.length));if(k&&t.length<2&&!h[e].trim().length)return w("lng_polls_choose_answers")}),[k,w,h]);function V(){return h.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(Ue.Z,{label:t!==h.length-1||10===h.length?w("OptionHint"):w("CreatePoll.AddOption"),error:G(t),value:e,onChange:e=>R(t,e.currentTarget.value),onKeyPress:$}),t!==h.length-1&&a.ZP.createElement(D.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:w("Delete"),onClick:()=>L(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement($e.Z,{isOpen:t,onClose:l,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(D.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},w("NewPoll")),a.ZP.createElement(D.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:A},w("Create"))),className:"PollModal"},a.ZP.createElement(Ue.Z,{ref:r,label:w("AskAQuestion"),value:m,error:_(),onChange:U,onKeyPress:$}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:o},a.ZP.createElement("h3",{className:"options-header"},w("PollOptions")),k&&function(){const e=h.map((e=>e.trim())).filter((e=>e.length));return E&&(!I||!e[Number(I)])&&a.ZP.createElement("p",{className:"error"},w("lng_polls_choose_correct"))}(),E?a.ZP.createElement(Ps.Z,{name:"correctOption",options:V().map(((e,t)=>({value:String(t),label:e,hidden:t===h.length-1}))),onChange:F}):V()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},!s&&a.ZP.createElement(tt.Z,{label:w("PollAnonymous"),checked:P,onChange:x}),a.ZP.createElement(tt.Z,{label:w("PollMultiple"),checked:g,disabled:E,onChange:B}),a.ZP.createElement(tt.Z,{label:w("PollQuiz"),checked:E,disabled:g||void 0!==n,onChange:O}),E&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},w("lng_polls_solution_title")),a.ZP.createElement("div",{ref:d,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>b(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},w("CreatePoll.ExplanationInfo")))))}));var jl=n(56503),Hl=n(34284);const ql=(0,a.X$)((e=>{let{emoji:t,focus:n,onClick:s}=e;const i=(0,a.I4)((e=>{e.preventDefault(),s(t.native,t.id)}),[t,s]),l=(0,X.Z)("EmojiButton",n&&"focus"),r=`./img-apple-64/${t.image}.png`,o=Hl.Uz.has(r);return a.ZP.createElement("div",{className:l,onMouseDown:i,title:`:${t.names[0]}:`},d.op?t.native:a.ZP.createElement("img",{src:r,className:o?void 0:"opacity-transition shown",alt:t.native,loading:"lazy","data-path":r,onLoad:o?void 0:Hl.mE}))})),Yl=(0,a.X$)((e=>{let{category:t,index:n,allEmojis:s,observeIntersection:i,shouldRender:l,onEmojiSelect:r}=e;const o=(0,a.sO)(null);(0,ha._N)(o,i);const c=(0,Mt.Z)(l),u=(0,N.Z)(),v=d.wB?Math.floor((h.Z.get().width-8)/50):8,P=50*Math.ceil(t.emojis.length/v);return a.ZP.createElement("div",{ref:o,key:t.id,id:`emoji-category-${n}`,className:"symbol-set"},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},u(t.id===m.s3?"RecentStickers":`Emoji${n}`))),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",c),style:`height: ${P}px;`,dir:u.isRtl?"rtl":void 0},l&&t.emojis.map((e=>{const t=s[e];if(!t)return;const n="id"in t?t:t[1];return a.ZP.createElement(ql,{key:n.id,emoji:n,onClick:r})}))))})),Wl={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"},Kl=[];let Ql,er,tr;const nr=(0,a.X$)((0,i.c$)((e=>(0,Le.ei)(e,["recentEmojis"])))((e=>{let{className:t,recentEmojis:s,onEmojiSelect:i}=e;const l=(0,a.sO)(null),r=(0,a.sO)(null),[o,c]=(0,a.eJ)(),[u,h]=(0,a.eJ)(),[v,P]=(0,a.eJ)(0),{observe:Z}=(0,ha.S1)({rootRef:l,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-",""));Kl[n]=e.isIntersecting}));const t=Kl.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&P(t[Math.floor(t.length/2)].index)}));(0,jn.Z)(r.current,!d.wB),(0,a.d4)((()=>{if(!o)return;const e=r.current;if(!e)return;const t=42*v-e.offsetWidth/2+21;(0,ft.Z)(e,t)}),[o,v]);const g=(0,N.Z)(),p=(0,a.Ye)((()=>{if(!o)return zn.D;const e=[...o];return null!=s&&s.length&&e.unshift({id:m.s3,name:g("RecentStickers"),emojis:s}),e}),[o,g,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c(tr.categories),h(tr.emojis)};tr?e():async function(){return Ql||(Ql=n.e(7501).then(n.t.bind(n,47501,19)),er=(await Ql).default,tr=(0,Hl.NM)(er)),Ql}().then(e)}),200)}),[]);const E=(0,a.I4)((e=>{P(e);const t=document.getElementById(`emoji-category-${e}`);(0,Ol.Z)(l.current,t,"start",50,800)}),[]),C=(0,a.I4)(((e,t)=>{i(e,t)}),[i]),f=(0,ua.Z)([],m.kU),b=(0,X.Z)("EmojiPicker",t);return u&&f?a.ZP.createElement("div",{className:b},a.ZP.createElement("div",{ref:r,className:"EmojiPicker-header",dir:g.isRtl?"rtl":""},p.map((function(e,t){const n=Wl[e.id];return n&&a.ZP.createElement(D.Z,{className:"symbol-set-button "+(t===v?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>E(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:l,className:(0,X.Z)("EmojiPicker-main no-selection",d.$b?"no-scrollbar":"custom-scroll")},p.map(((e,t)=>a.ZP.createElement(Yl,{category:e,index:t,allEmojis:u,observeIntersection:Z,shouldRender:v>=t-1&&v<=t+1,onEmojiSelect:C}))))):a.ZP.createElement("div",{className:b},a.ZP.createElement(Oe.Z,null))})));var ar=n(56389);const sr=d.wB?8:16,ir=d.wB?8:10,lr=(0,a.X$)((e=>{var t;let{stickerSet:n,loadAndPlay:s,index:l,shouldRender:r,favoriteStickers:o,isSavedMessages:c,observeIntersection:u,onStickerSelect:v,onStickerUnfave:P,onStickerFave:Z,onStickerRemoveRecent:g,isCurrentUserPremium:p}=e;const{clearRecentStickers:E}=(0,i.Sv)(),C=(0,a.sO)(null),[f,I,y]=(0,b.Z)(),[k,S]=(0,b.Z)(!n.isEmoji),w=(0,N.Z)();(0,ha._N)(C,u);const M=(0,Mt.Z)(r),T=n.isEmoji,A=(0,a.I4)((()=>{E(),y()}),[E,y]),R=!c&&T&&!p&&(null===(t=n.stickers)||void 0===t?void 0:t.some((e=>!e.isFree))),L=T?m.eX:m.Q,F=T?8:5,x=T?ir:sr,B=d.wB?Math.floor((h.Z.get().width-8)/(L+x)):F,O=T&&!k&&!n.installedDate&&n.id!==m.s3,$=O?3*B:1/0,U=Math.ceil((O?Math.min($,n.count):n.count)/B)*(L+x),_=(0,a.Ye)((()=>o?new Set(o.map((e=>{let{id:t}=e;return t}))):void 0),[o]),G=n.id===m.s3;return a.ZP.createElement("div",{ref:C,key:n.id,id:`sticker-set-${l}`,className:(0,X.Z)("symbol-set",R&&"symbol-set-locked")},a.ZP.createElement("div",{className:"symbol-set-header"},a.ZP.createElement("p",{className:"symbol-set-name"},R&&a.ZP.createElement("i",{className:"symbol-set-locked-icon icon-lock-badge"}),n.title),G&&a.ZP.createElement("i",{className:"symbol-set-remove icon-close",onClick:I})),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",M),style:`height: ${U}px;`},r&&n.stickers&&n.stickers.slice(0,k?n.stickers.length:$-1).map((e=>a.ZP.createElement(Ci.Z,{key:e.id,sticker:e,size:L,observeIntersection:u,noAnimate:!s,onClick:v,clickArg:e,onUnfaveClick:n.id===m.k&&null!=_&&_.has(e.id)?P:void 0,onFaveClick:null!=_&&_.has(e.id)?void 0:Z,onRemoveRecentClick:G?g:void 0,isSavedMessages:c,canViewSet:!0,isCurrentUserPremium:p}))),!k&&n.count>$-1&&a.ZP.createElement(D.Z,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:S},"+",n.count-$+1)),G&&a.ZP.createElement(Qe.Z,{text:w("ClearRecentStickersAlertMessage"),isOpen:f,onClose:y,confirmHandler:A,confirmIsDestructive:!0}))})),rr=[],or=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{setsById:a,added:s,recent:i,favorite:l,premiumSet:o}=e.stickers,c=(0,r.FM)(e,n);return{chat:(0,r.Z1)(e,n),recentStickers:i.stickers,favoriteStickers:l.stickers,premiumStickers:o.stickers,stickerSetsById:a,addedSetIds:s.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers,isSavedMessages:c,isCurrentUserPremium:(0,r.wV)(e)}}))((e=>{let{chat:t,threadId:n,className:s,loadAndPlay:l,canSendStickers:r,recentStickers:o,favoriteStickers:c,premiumStickers:u,addedSetIds:h,stickerSetsById:v,shouldPlay:P,isSavedMessages:Z,onStickerSelect:g,isCurrentUserPremium:p}=e;const{loadRecentStickers:E,addRecentSticker:C,unfaveSticker:f,faveSticker:b,removeRecentSticker:I}=(0,i.Sv)(),y=(0,a.sO)(null),k=(0,a.sO)(null),[S,w]=(0,a.eJ)(0),M=(0,ar.Z)(t.id,n),{observe:T}=(0,ha.S1)({rootRef:y,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("sticker-set-"))return;const n=Number(t.replace("sticker-set-",""));rr[n]=e.isIntersecting}));const t=rr.map(((e,t)=>({index:t,isIntersecting:e}))).filter((e=>{let{isIntersecting:t}=e;return t}));t.length&&w(t[Math.floor(t.length/2)].index)})),{observe:A}=(0,ha.S1)({rootRef:k}),R=(0,N.Z)(),L=Boolean(h),F=(0,a.Ye)((()=>{var e;if(!h)return zn.D;const n=[],a=Object.values((0,Le.q0)(v,h));if(c.length&&n.push({id:m.k,title:R("FavoriteStickers"),stickers:c,count:c.length}),o.length&&n.push({id:m.s3,title:R("RecentStickers"),stickers:o,count:o.length}),p){const e=a.map((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.filter((e=>e.hasEffect))})).flat().filter(Boolean),t=(0,Le.od)([...e,...u],"id");t.length&&n.push({id:m.BR,title:R("PremiumStickers"),stickers:t,count:t.length})}if(null!=t&&null!==(e=t.fullInfo)&&void 0!==e&&e.stickerSet){const e=v[t.fullInfo.stickerSet.id];e&&n.push({id:m.dW,title:R("GroupStickers"),stickers:e.stickers,count:e.stickers.length})}return[...n,...a]}),[h,v,c,o,p,t,R,u]),x=(0,a.Ye)((()=>L&&0===F.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[F,L]);(0,a.d4)((()=>{l&&(E(),M({type:"chooseSticker"}))}),[l,E,M]),(0,jn.Z)(k.current),(0,a.d4)((()=>{if(!L)return;const e=k.current;if(!e)return;const t=52*S-(e.offsetWidth/2-26);(0,ft.Z)(e,t)}),[L,S]);const B=(0,a.I4)((e=>{w(e);const t=document.getElementById(`sticker-set-${e}`);(0,Ol.Z)(y.current,t,"start",void 0,500)}),[]),O=(0,a.I4)(((e,t,n)=>{g(e,t,n),C({sticker:e})}),[C,g]),$=(0,a.I4)((e=>{f({sticker:e})}),[f]),U=(0,a.I4)((e=>{b({sticker:e})}),[b]),_=(0,a.I4)((()=>{M({type:"chooseSticker"})}),[M]),G=(0,a.I4)((e=>{I({sticker:e})}),[I]),V=(0,ua.Z)([],m.Y),J=(0,X.Z)("StickerPicker",s);return L&&V&&!x&&r?a.ZP.createElement("div",{className:J},a.ZP.createElement("div",{ref:k,className:"StickerPicker-header no-selection no-scrollbar"},F.map((function(e,n){var s;const i=null===(s=e.stickers)||void 0===s?void 0:s[0],l=(0,X.Z)("symbol-set-button sticker-set-button",n===S&&"activated");return e.id===m.s3||e.id===m.k||e.id===m.dW||e.id===m.BR||e.hasThumbnail||!i?a.ZP.createElement(D.Z,{key:e.id,className:l,ariaLabel:e.title,round:!0,faded:e.id===m.s3||e.id===m.k,color:"translucent",onClick:()=>B(n)},e.id===m.BR?a.ZP.createElement(_n.Z,{withGradient:!0,big:!0}):e.id===m.s3?a.ZP.createElement("i",{className:"icon-recent"}):e.id===m.k?a.ZP.createElement("i",{className:"icon-favorite"}):e.id===m.dW?a.ZP.createElement(Me.Z,{chat:t,size:"small",noVideo:!0}):e.isLottie?a.ZP.createElement(pi,{stickerSet:e,observeIntersection:A}):a.ZP.createElement(Ei,{stickerSet:e,observeIntersection:A})):a.ZP.createElement(Ci.Z,{key:e.id,sticker:i,size:m.DC,title:e.title,className:l,observeIntersection:A,onClick:B,clickArg:n,noContextMenu:!0,isCurrentUserPremium:!0})}))),a.ZP.createElement("div",{ref:y,onMouseMove:_,className:(0,X.Z)("StickerPicker-main no-selection",d.$b?"no-scrollbar":"custom-scroll")},F.map(((e,t)=>a.ZP.createElement(lr,{key:e.id,stickerSet:e,loadAndPlay:Boolean(P&&l),index:t,observeIntersection:T,shouldRender:S>=t-1&&S<=t+1,onStickerSelect:O,onStickerUnfave:$,onStickerFave:U,onStickerRemoveRecent:G,favoriteStickers:c,isSavedMessages:Z,isCurrentUserPremium:p}))))):a.ZP.createElement("div",{className:J},r?x?a.ZP.createElement("div",{className:"picker-disabled"},R("NoStickers")):a.ZP.createElement(Oe.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},R("ErrorSendRestrictedStickersAll")))})));var cr=n(30386);function dr(){return dr=Object.assign||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},dr.apply(this,arguments)}const mr=(0,a.X$)((e=>{var t,n;let{gif:s,isDisabled:i,className:l,observeIntersection:r,onClick:o,onUnsaveClick:c,isSavedMessages:m}=e;const u=(0,a.sO)(null),h=(0,a.sO)(null),v=(0,N.Z)(),P=Boolean(null===(t=s.thumbnail)||void 0===t?void 0:t.dataUri),Z=`gif${s.id}`,g=(0,ha.Op)(u,r)&&!i,p=(0,M.Z)(`${Z}?size=m`,!g,w.IU.BlobUrl),E=(0,wt.Z)(null===(n=s.thumbnail)||void 0===n?void 0:n.dataUri,Boolean(p)),C=(0,M.Z)(Z,!g,w.IU.BlobUrl),f=Boolean(g&&C),{isBuffered:b,bufferingHandlers:I}=(0,ee.Z)(!0),y=g&&!b,k=g&&b;(0,ae.Z)(h,[f]);const{isContextMenuOpen:S,contextMenuPosition:T,handleBeforeContextMenu:A,handleContextMenu:R,handleContextMenuClose:L,handleContextMenuHide:F}=(0,Rl.Z)(u),x=(0,a.I4)((()=>u.current),[]),B=(0,a.I4)((()=>u.current.closest(".custom-scroll, .no-scrollbar")),[]),O=(0,a.I4)((()=>u.current.querySelector(".gif-context-menu .bubble")),[]),{positionX:$,positionY:U,transformOriginX:G,transformOriginY:V,style:J}=(0,ll.Z)(T,x,B,O),z=(0,a.I4)((()=>{!S&&o&&o({...s,blobUrl:C})}),[S,o,s,C]),j=(0,a.I4)((e=>{e.stopPropagation(),e.preventDefault(),c(s)}),[c,s]),H=(0,a.I4)((()=>{null==c||c(s)}),[s,c]),q=(0,a.I4)((()=>{o({...s,blobUrl:C},!0)}),[s,o,C]),Y=(0,a.I4)((()=>{o({...s,blobUrl:C},void 0,!0)}),[s,o,C]),W=(0,a.I4)((e=>{(0,cr.b)(e),A(e)}),[A]);(0,a.d4)((()=>{i&&L()}),[L,i]);const Q=(0,X.Z)("GifButton",s.width&&s.height&&s.width<s.height?"vertical":"horizontal",o&&"interactive",Z,l);return a.ZP.createElement("div",{ref:u,className:Q,onMouseDown:W,onClick:z,onContextMenu:R},!d.$b&&c&&a.ZP.createElement(D.Z,{className:"gif-unsave-button",color:"dark",pill:!0,onClick:j},a.ZP.createElement("i",{className:"icon-close gif-unsave-button-icon"})),P&&a.ZP.createElement("canvas",{ref:E,className:"thumbnail",style:k?"display: none;":void 0}),p&&!k&&a.ZP.createElement("img",{src:p,alt:"",className:"preview"}),f&&a.ZP.createElement("video",dr({ref:h,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none"},I),a.ZP.createElement("source",{src:C})),y&&a.ZP.createElement(K.Z,{color:p||P?"white":"black"}),o&&void 0!==T&&a.ZP.createElement(oe.Z,{isOpen:S,transformOriginX:G,transformOriginY:V,positionX:$,positionY:U,style:J,className:"gif-context-menu",autoClose:!0,onClose:L,onCloseAnimationEnd:F},!m&&a.ZP.createElement(_.Z,{onClick:q,icon:"mute"},v("SendWithoutSound")),a.ZP.createElement(_.Z,{onClick:Y,icon:"calendar"},v(m?"SetReminder":"ScheduleMessage")),c&&a.ZP.createElement(_.Z,{destructive:!0,icon:"delete",onClick:H},v("Delete"))))})),ur=(0,a.X$)((0,i.c$)((e=>{const{chatId:t}=(0,r.Bt)(e)||{},n=Boolean(t)&&(0,r.FM)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:n}}))((e=>{let{className:t,loadAndPlay:n,canSendGifs:s,savedGifs:l,isSavedMessages:r,onGifSelect:o}=e;const{loadSavedGifs:c,saveGif:u}=(0,i.Sv)(),h=(0,a.sO)(null),{observe:v}=(0,ha.S1)({rootRef:h,debounceMs:300});(0,a.d4)((()=>{n&&c()}),[n,c]);const P=(0,a.I4)((e=>{u({gif:e,shouldUnsave:!0})}),[u]),Z=(0,ua.Z)([],m.Y);return a.ZP.createElement("div",{ref:h,className:(0,X.Z)("GifPicker",t,d.$b?"no-scrollbar":"custom-scroll")},s?Z&&l&&l.length?l.map((e=>a.ZP.createElement(mr,{key:e.id,gif:e,observeIntersection:v,isDisabled:!n,onClick:s?o:void 0,onUnsaveClick:P,isSavedMessages:r}))):Z&&l?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(Oe.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let hr;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(hr||(hr={}));const vr={[hr.Emoji]:"Emoji",[hr.Stickers]:"AccDescrStickers",[hr.GIFs]:"GifsTab"},Pr={[hr.Emoji]:"icon-smile",[hr.Stickers]:"icon-stickers",[hr.GIFs]:"icon-gifs"},Zr=(0,a.X$)((e=>{let{activeTab:t,onSwitchTab:n,onRemoveSymbol:s,onSearchOpen:i}=e;const l=(0,N.Z)();function r(e){return a.ZP.createElement(D.Z,{className:"symbol-tab-button "+(t===e?"activated":""),onClick:()=>n(e),ariaLabel:l(vr[e]),round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:Pr[e]}))}const o=(0,a.I4)((()=>{i(t===hr.Stickers?"stickers":"gifs")}),[t,i]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:l.isRtl?"rtl":void 0},t!==hr.Emoji&&a.ZP.createElement(D.Z,{className:"symbol-search-button",ariaLabel:t===hr.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:o},a.ZP.createElement("i",{className:"icon-search"})),r(hr.Emoji),r(hr.Stickers),r(hr.GIFs),t===hr.Emoji&&a.ZP.createElement(D.Z,{className:"symbol-delete-button",onClick:s,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let gr=!1;const pr=(0,a.X$)((0,i.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown,isCurrentUserPremium:(0,r.wV)(e)})))((e=>{let{chatId:t,threadId:n,isOpen:s,canSendStickers:l,canSendGifs:r,isLeftColumnShown:o,isCurrentUserPremium:c,onLoad:m,onClose:u,onEmojiSelect:h,onStickerSelect:v,onGifSelect:P,onRemoveSymbol:Z,onSearchOpen:g,addRecentEmoji:p}=e;const{loadPremiumSetStickers:E}=(0,i.Sv)(),[C,f]=(0,a.eJ)(0),[b,I]=(0,a.eJ)([]),[y,k]=(0,jl.Z)(s,u,void 0,d.wB),{shouldRender:S,transitionClassNames:w}=(0,ne.Z)(s,u,!1,!1);!gr&&s&&(gr=!0),(0,a.d4)((()=>{m()}),[m]),(0,a.d4)((()=>{c&&E()}),[c,E]),(0,a.bt)((()=>{if(d.wB)return s&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{s&&(0,H.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[s]);const M=(0,a.sO)(b);M.current=b,(0,a.d4)((()=>{M.current.length&&!s&&(M.current.forEach((e=>{p({emoji:e})})),I([]))}),[s,p]);const T=(0,a.I4)(((e,t)=>{I((e=>[...e,t])),h(e)}),[h]),A=(0,a.I4)((e=>{u(),g(e)}),[u,g]),R=(0,a.I4)(((e,t,n)=>{v(e,t,n,!0)}),[v]),L=(0,N.Z)();function F(e,i){switch(C){case hr.Emoji:return a.ZP.createElement(nr,{className:"picker-tab",onEmojiSelect:T});case hr.Stickers:return a.ZP.createElement(or,{className:"picker-tab",loadAndPlay:!!l&&s&&(e||i),canSendStickers:l,onStickerSelect:R,chatId:t,threadId:n});case hr.GIFs:return a.ZP.createElement(ur,{className:"picker-tab",loadAndPlay:!!r&&s&&(e||i),canSendGifs:r,onGifSelect:P})}}const x=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},gr&&a.ZP.createElement($.Z,{name:"slide",activeKey:C,renderCount:Object.values(vr).length},F)),d.wB&&a.ZP.createElement(D.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:L("Close"),className:"symbol-close-button",size:"tiny",onClick:u},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Zr,{activeTab:C,onSwitchTab:f,onRemoveSymbol:Z,onSearchOpen:A}));if(d.wB){if(!S)return;const e=(0,X.Z)("SymbolMenu mobile-menu",w,o&&"left-column-open");return a.ZP.createElement(bl.Z,null,a.ZP.createElement("div",{className:e},x))}return a.ZP.createElement(oe.Z,{isOpen:s,positionX:"left",positionY:"bottom",onClose:u,className:"SymbolMenu",onCloseAnimationEnd:u,onMouseEnter:d.$b?void 0:y,onMouseLeave:d.$b?void 0:k,noCloseOnBackdrop:!d.$b,noCompact:!0},x)}))),Er=(0,a.X$)((e=>{let{withAvatar:t,focus:n,botCommand:s,bot:i,onClick:l}=e;return a.ZP.createElement(Ge.Z,{key:s.command,className:(0,X.Z)("BotCommand chat-item-clickable scroll-item",t&&"with-avatar"),multiline:!0,onClick:()=>l(s),focus:n},t&&a.ZP.createElement(Me.Z,{size:"small",user:i,noVideo:!0}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",s.command),a.ZP.createElement("span",{className:"subtitle"},(0,we.Z)(s.description))))})),Cr=(0,a.X$)((0,i.c$)((e=>({usersById:e.users.byId})))((e=>{let{usersById:t,isOpen:n,withUsername:s,botCommands:l,onClick:r,onClose:o}=e;const{sendBotCommand:c}=(0,i.Sv)(),d=(0,a.sO)(null),{shouldRender:m,transitionClassNames:u}=(0,ne.Z)(n,void 0,void 0,!1),h=(0,a.I4)((e=>{let{botId:n,command:a}=e;const i=t[n];c({command:`/${a}${s&&i?`@${i.username}`:""}`,botId:n}),r()}),[r,c,t,s]),v=Ul({isActive:n,items:l,onSelect:h,onClose:o});(0,a.d4)((()=>{l&&!l.length&&o()}),[l,o]),(0,a.d4)((()=>{$l(".chat-item-clickable",v,d)}),[v]);const P=(0,S.Z)(l&&l.length?l:void 0,m),Z=l&&!l.length?P:l;if(!m||Z&&!Z.length)return;const g=(0,X.Z)("BotCommandTooltip composer-tooltip custom-scroll",u);return a.ZP.createElement("div",{className:g,ref:d},Z&&Z.map(((e,n)=>a.ZP.createElement(Er,{key:`${e.botId}_${e.command}`,botCommand:e,bot:t[e.botId],withAvatar:!0,onClick:h,focus:v===n}))))}))),fr=(0,a.X$)((e=>{let{isOpen:t,botCommands:n,onClose:s}=e;const{sendBotCommand:l}=(0,i.Sv)(),[r,o]=(0,jl.Z)(t,s,void 0,d.wB),c=(0,a.I4)((e=>{l({command:`/${e.command}`,botId:e.botId}),s()}),[s,l]);return a.ZP.createElement(oe.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:s,className:"BotCommandMenu",onCloseAnimationEnd:s,onMouseEnter:d.$b?void 0:r,onMouseLeave:d.$b?void 0:o,noCloseOnBackdrop:!d.$b,noCompact:!0},n.map((e=>a.ZP.createElement(Er,{key:e.command,botCommand:e,onClick:c}))))})),br=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{stickers:a}=e.stickers.forEmoji;return{stickers:a,isSavedMessages:(0,r.FM)(e,n),isCurrentUserPremium:(0,r.wV)(e)}}))((e=>{let{chatId:t,threadId:n,isOpen:s,stickers:l,isSavedMessages:r,onStickerSelect:o,isCurrentUserPremium:d}=e;const{clearStickersForEmoji:u}=(0,i.Sv)(),h=(0,a.sO)(null),{shouldRender:v,transitionClassNames:P}=(0,ne.Z)(s,void 0,void 0,!1),Z=(0,S.Z)(l,!0),g=l||Z,p=(0,ar.Z)(t,n),{observe:E}=(0,ha.S1)({rootRef:h,throttleMs:200});(0,a.d4)((()=>s?(0,c.Z)(u):void 0),[s,u]);const C=(0,X.Z)("StickerTooltip composer-tooltip custom-scroll",P,!(null!=g&&g.length)&&"hidden");return a.ZP.createElement("div",{ref:h,className:C,onMouseMove:()=>{p({type:"chooseSticker"})}},v&&g?g.map((e=>a.ZP.createElement(Ci.Z,{key:e.id,sticker:e,size:m.Q,observeIntersection:E,onClick:s?o:void 0,clickArg:e,isSavedMessages:r,canViewSet:!0,isCurrentUserPremium:d}))):v?a.ZP.createElement(Oe.Z,null):void 0)}))),Ir=(0,a.X$)((e=>{let{isOpen:t,isOpenToBottom:n=!1,isSavedMessages:s,onSendSilent:i,onSendSchedule:l,onClose:r,onCloseAnimationEnd:o}=e;const[c,m]=(0,jl.Z)(t,r),u=(0,N.Z)();return a.ZP.createElement(oe.Z,{isOpen:t,autoClose:!0,positionX:"right",positionY:n?"top":"bottom",className:"CustomSendMenu",onClose:r,onCloseAnimationEnd:o,onMouseEnter:d.$b?void 0:c,onMouseLeave:d.$b?void 0:m,noCloseOnBackdrop:!d.$b},i&&a.ZP.createElement(_.Z,{icon:"mute",onClick:i},u("SendWithoutSound")),l&&a.ZP.createElement(_.Z,{icon:"schedule",onClick:l},u(s?"SetReminder":"ScheduleMessage")))}));var yr=n(12420),kr=n(72087),Nr=n(52678);const Sr=(0,a.X$)((e=>{let{isOpen:t,emojis:n,onClose:s,onEmojiSelect:i,addRecentEmoji:l}=e;const r=(0,a.sO)(null),{shouldRender:o,transitionClassNames:c}=(0,ne.Z)(t,void 0,void 0,!1),d=(0,Nr.Z)(n.length?n:void 0,350)||[],m=(0,a.I4)((e=>{i(e.native),l({emoji:e.id})}),[l,i]),u=(0,a.I4)(((e,t)=>{i(e),l({emoji:t})}),[l,i]),h=Ul({isActive:t,isHorizontal:!0,items:n,onSelect:m,onClose:s});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=Bl(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const i=a[0];if(!a.includes(e)||e===i&&!Dl(n,s[i],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,ft.Z)(n,t)}}(h,r)}),[h]);const v=(0,X.Z)("EmojiTooltip composer-tooltip custom-scroll-x",c);return a.ZP.createElement("div",{ref:r,className:v},o&&d?d.map(((e,t)=>a.ZP.createElement(ql,{key:e.id,emoji:e,focus:h===t,onClick:u}))):o?a.ZP.createElement(Oe.Z,null):void 0)})),wr=(0,a.X$)((e=>{let t,{title:n,description:s,thumbnail:i,thumbUrl:l,focus:r,transitionClassNames:o="",onClick:c}=e;const d=(0,M.Z)(i?`webDocument:${i.url}`:void 0);return l=l||d,l?t=a.ZP.createElement("img",{src:l,className:o,alt:"",decoding:"async",draggable:"false"}):n&&(t=(0,le.Xv)(n,1)),a.ZP.createElement(Ge.Z,{focus:r,className:"BaseResult chat-item-clickable",onMouseDown:cr.b,onClick:c},a.ZP.createElement("span",{className:"thumb"},"string"==typeof t?(0,we.Z)(t):t),a.ZP.createElement("div",{className:"content-inner"},n&&a.ZP.createElement("div",{className:"title"},n),s&&a.ZP.createElement("div",{className:"description"},s)))})),Mr=(0,a.X$)((e=>{var t;let n,s,i,{focus:l,isForGallery:r,inlineResult:o,onClick:c}=e;"photo"in o&&(n=o.photo),"thumbnail"in o&&(s=o.thumbnail),"webThumbnail"in o&&r&&(i=o.webThumbnail);const d=(0,M.Z)(i?`webDocument:${i.url}`:void 0),m=(0,M.Z)(n&&`photo${n.id}?size=m`),u=(0,Mt.Z)(m),h=(0,a.I4)((()=>{c(o)}),[o,c]);var v,P;if(r)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:h},a.ZP.createElement("img",{src:(null===(v=n)||void 0===v||null===(P=v.thumbnail)||void 0===P?void 0:P.dataUri)||d,alt:""}),a.ZP.createElement("img",{src:m,className:(0,X.Z)("full-media",u),alt:""}));const{title:Z,description:g}=o;return a.ZP.createElement(wr,{focus:l,thumbUrl:m||(null===(t=s)||void 0===t?void 0:t.dataUri)||d,transitionClassNames:u,title:Z,description:g,onClick:h})})),Tr=(0,a.X$)((e=>{let{focus:t,inlineResult:n,onClick:s}=e;const{title:i,url:l,description:r,webThumbnail:o}=n,c=(0,a.I4)((()=>{s(n)}),[n,s]);return a.ZP.createElement(wr,{focus:t,thumbnail:o,title:i||l,description:r,onClick:c})})),Ar=(0,a.X$)((e=>{let{inlineResult:t,isSavedMessages:n,canSendGifs:s,observeIntersection:i,onClick:l}=e;const{gif:r}=t,o=(0,a.I4)(((e,n,a)=>{l(t,n,a)}),[t,l]);if(r)return a.ZP.createElement(mr,{gif:r,observeIntersection:i,className:"chat-item-clickable",onClick:s?o:void 0,isSavedMessages:n})})),Rr=(0,a.X$)((e=>{let{inlineResult:t,isSavedMessages:n,observeIntersection:s,onClick:i,isCurrentUserPremium:l}=e;const{sticker:r}=t;if(r)return a.ZP.createElement(Ci.Z,{sticker:r,size:m.zq,observeIntersection:s,title:r.emoji,className:"chat-item-clickable",onClick:i,clickArg:t,isSavedMessages:n,canViewSet:!0,isCurrentUserPremium:l})})),Lr=(0,H.P2)((e=>e()),500,!0),Fr=(0,a.X$)((e=>{let{isOpen:t,botId:n,isGallery:l,inlineBotResults:r,switchPm:o,isSavedMessages:c,canSendGifs:m,loadMore:u,onClose:h,onSelectResult:v,isCurrentUserPremium:P}=e;const{openChat:Z,startBot:g}=(0,i.Sv)(),p=(0,a.sO)(null),{shouldRender:E,transitionClassNames:C}=(0,ne.Z)(t,void 0,void 0,!1),{observe:f}=(0,ha.S1)({rootRef:p,debounceMs:200,isDisabled:!t}),b=(0,a.I4)((e=>{let{direction:t}=e;t===s.Uq.Backwards&&Lr(u)}),[u]),I=Ul({isActive:t,shouldRemoveSelectionOnReset:l,noArrowNavigation:l,items:r,onSelect:v,onClose:h});(0,a.d4)((()=>{$l(".chat-item-clickable",I,p)}),[I]);const y=(0,a.I4)((()=>{Z({id:n}),g({botId:n,param:o.startParam})}),[n,Z,g,o]),k=(0,S.Z)(null!=r&&r.length?r:void 0,E),N=r&&!r.length?k:r;if(!E||!(null!=N&&N.length||o))return;const w=(0,X.Z)("InlineBotTooltip composer-tooltip",d.$b?"no-scrollbar":"custom-scroll",l&&"gallery",C);return a.ZP.createElement(_e.Z,{ref:p,className:w,items:N,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:b,sensitiveArea:160},o&&a.ZP.createElement(Ge.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:y},a.ZP.createElement("span",{className:"title"},o.text)),(null==N?void 0:N.length)&&N.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(Ar,{key:e.id,inlineResult:e,observeIntersection:f,onClick:v,isSavedMessages:c,canSendGifs:m});case"photo":return a.ZP.createElement(Mr,{key:e.id,isForGallery:l,inlineResult:e,onClick:v});case"sticker":return a.ZP.createElement(Rr,{key:e.id,inlineResult:e,observeIntersection:f,onClick:v,isSavedMessages:c,isCurrentUserPremium:P});case"video":case"file":case"game":return a.ZP.createElement(Mr,{key:e.id,focus:I===t,inlineResult:e,onClick:v});case"article":case"audio":return a.ZP.createElement(Tr,{key:e.id,focus:I===t,inlineResult:e,onClick:v});default:return}})))})),xr=(0,a.X$)((e=>{let{isOpen:t,onClose:n,chatId:s,selectedSendAsId:r,sendAsIds:o}=e;const{saveDefaultSendAs:c}=(0,i.Sv)(),m=(0,i.Rd)().users.byId,u=(0,i.Rd)().chats.byId,h=(0,N.Z)(),v=(0,a.sO)(null),[P,Z,g]=(0,jl.Z)(t,n,void 0);(0,a.d4)((()=>{t&&g()}),[t,g]);const p=(0,a.I4)((e=>{n(),c({chatId:s,sendAsId:e})}),[s,n,c]),E=Ul({isActive:t,items:o,onSelect:p,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:n});return(0,a.d4)((()=>{$l(".chat-item-clickable",E,v)}),[E]),(0,a.d4)((()=>{o&&!o.length&&n()}),[o,n]),a.ZP.createElement(oe.Z,{isOpen:t,positionX:"left",positionY:"bottom",onClose:n,className:"SendAsMenu",onCloseAnimationEnd:n,onMouseEnter:d.$b?void 0:P,onMouseLeave:d.$b?void 0:Z,noCloseOnBackdrop:!d.$b,noCompact:!0},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},h("SendMessageAsTitle")),m&&u&&(null==o?void 0:o.map(((e,t)=>{const n=(0,l.YC)(e)?m[e]:void 0,s=n?void 0:u[e],i=n?(0,l.Js)(n):null==s?void 0:s.title;return a.ZP.createElement(Ge.Z,{key:e,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>p(e),focus:E===t},a.ZP.createElement(Me.Z,{size:"small",user:n,chat:s,className:(0,X.Z)(r===e&&"selected")}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},i&&(0,we.Z)(i))),a.ZP.createElement("span",{className:"subtitle"},n?h("VoipGroupPersonalAccount"):h("Subscribers",null==s?void 0:s.membersCount,"i"))))}))))}));var Br=n(76844);const Dr=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.Z1)(e,n),s=a&&(0,r.Zw)(e,a.id);if(!a||!s)return{};const{query:i,results:l}=(0,r.n5)(e)||{},{totalCount:o,foundIds:c}=l||{};return{chat:a,messagesById:s,query:i,totalCount:o,foundIds:c}}))((e=>{let{chatId:t,threadId:n,onClose:s,isActive:o,chat:c,messagesById:d,query:m,totalCount:u,foundIds:h}=e;const{searchTextMessagesLocal:v,focusMessage:P}=(0,i.Sv)(),Z=(0,a.sO)(null),g=(0,N.Z)();(0,k.Z)({isActive:o,onBack:s});const[p,E]=(0,xe.Z)(v,h),C=(0,a.Ye)((()=>m&&null!=p&&p.length&&d?p.map((e=>{const a=d[e];if(!a)return;const s=a.senderId?(0,r.dy)((0,i.Rd)(),a.senderId):void 0;let o;if(c&&(0,l.eA)(c))o=c;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;o=e&&t?(0,r.Z1)((0,i.Rd)(),t):void 0}else o=a.senderId?(0,r.Z1)((0,i.Rd)(),a.senderId):void 0;return{message:a,senderUser:s,senderChat:o,onClick:()=>P({chatId:t,threadId:n,messageId:e})}})).filter(Boolean):zn.D),[m,p,d,c,P,t,n]),b=(0,Be.Z)(Z,!0,(e=>{const t=null==C?void 0:C[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0),I=(null==p?void 0:p[0])===(null==h?void 0:h[0]);return a.ZP.createElement(_e.Z,{ref:Z,className:"RightSearch custom-scroll",items:C,preloadBackwards:0,onLoadMore:E,onKeyDown:b},I&&a.ZP.createElement("p",{key:"helper-text",className:"helper-text",dir:"auto"},m?0!==u&&C.length?1===u?"1 message found":`${C.length&&(u||C.length)} messages found`:g("lng_search_no_results"):g("lng_dlg_search_for_messages")),C.map((e=>{let{message:t,senderUser:n,senderChat:s,onClick:i}=e;const r=s?(0,l.U)(g,s):(0,l.Js)(n),o=(0,f.e)(g,t,void 0,m);return a.ZP.createElement(Ge.Z,{key:t.id,teactOrderKey:-t.date,className:"chat-item-clickable search-result-message m-0",onClick:i},a.ZP.createElement(Me.Z,{chat:s,user:n}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,we.Z)(r)),a.ZP.createElement(Br.Z,{message:t})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},o)))})))}))),Or=(0,a.X$)((0,i.c$)(((e,t)=>{let{stickerSetId:n}=t;return{set:(0,r.Ny)(e,n),shouldPlay:(0,r.yB)(e),isCurrentUserPremium:(0,r.wV)(e)}}))((e=>{let{stickerSetId:t,observeIntersection:n,set:s,shouldPlay:l,isModalOpen:r,isCurrentUserPremium:o}=e;const{loadStickers:c,toggleStickerSet:d,openStickerSet:u}=(0,i.Sv)(),h=(0,N.Z)(),v=s&&Boolean(s.installedDate),P=Boolean(null==s?void 0:s.stickers),Z=(0,a.Ye)((()=>{var e,t;if(!s)return[];const n=(null!==(e=null===(t=s.stickers)||void 0===t?void 0:t.filter((e=>{let{hasEffect:t}=e;return t})))&&void 0!==e?e:[]).slice(0,3),a=(s.covers||[]).map((e=>{let{id:t}=e;return t})),i=s.stickers?s.stickers.filter((e=>{let{id:t}=e;return!a.includes(t)})):[];return[...n,...s.covers||[],...i].slice(0,5)}),[s]);(0,a.d4)((()=>{!P&&Z.length<5&&s&&c({stickerSetInfo:{shortName:s.shortName}})}),[P,Z.length,c,s,t]);const g=(0,a.I4)((()=>{d({stickerSetId:t})}),[d,t]),p=(0,a.I4)((e=>{u({stickerSetInfo:e.stickerSetInfo})}),[u]);if(!s)return;const E=Z.length>0;return a.ZP.createElement("div",{key:s.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"},s.title),a.ZP.createElement("p",{className:"count",dir:"auto"},h("Stickers",s.count,"i"))),a.ZP.createElement(D.Z,{className:v?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:g},h(v?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!E&&a.ZP.createElement(K.Z,null),E&&Z.map((e=>a.ZP.createElement(Ci.Z,{sticker:e,size:m.Y7,observeIntersection:n,noAnimate:!l||r,clickArg:e,onClick:p,noContextMenu:!0,isCurrentUserPremium:o})))))}))),$r=(0,H.P2)((e=>e()),6e4,!0),Ur=(0,a.X$)((0,i.c$)((e=>{const t=(0,r.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a,isModalOpen:Boolean(e.openedStickerSetShortName)}}))((e=>{let{isActive:t,query:n,featuredIds:s,resultIds:l,isModalOpen:r,onClose:o}=e;const{loadFeaturedStickers:c}=(0,i.Sv)(),d=(0,a.sO)(null),m=(0,N.Z)(),{observe:u}=(0,ha.S1)({rootRef:d,throttleMs:200});return(0,a.d4)((()=>{$r((()=>{c()}))})),(0,k.Z)({isActive:t,onBack:o}),a.ZP.createElement("div",{ref:d,className:"StickerSearch custom-scroll",dir:m.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&s?s.map((e=>a.ZP.createElement(Or,{key:e,stickerSetId:e,observeIntersection:u,isModalOpen:r}))):l?l.length?l.map((e=>a.ZP.createElement(Or,{key:e,stickerSetId:e,observeIntersection:u,isModalOpen:r}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(Oe.Z,null)}())}))),_r=(0,a.X$)((0,i.c$)((e=>{const t=(0,r.yN)(e),{query:n,results:a}=t||{},{chatId:s,threadId:i}=(0,r.Bt)(e)||{},o=s?(0,r.Z1)(e,s):void 0;return{query:n,results:a,chat:o,isChatWithBot:o?(0,r.xo)(e,o):void 0,isSavedMessages:Boolean(s)&&(0,r.FM)(e,s),canPostInChat:Boolean(o)&&Boolean(i)&&(0,l.Qm)(o,i),canScheduleUntilOnline:Boolean(s)&&(0,r.Eh)(e,s)}}))((e=>{let{isActive:t,query:n,results:s,chat:r,isChatWithBot:o,canScheduleUntilOnline:c,isSavedMessages:m,canPostInChat:u,onClose:h}=e;const{searchMoreGifs:v,sendMessage:P,setGifSearchQuery:Z}=(0,i.Sv)(),g=(0,a.sO)(null),[p,E]=(0,pl.Z)(c),{observe:C}=(0,ha.S1)({rootRef:g,debounceMs:300}),f=u&&(0,l.H5)(r,o).canSendGifs,b=(0,a.I4)(((e,t,n)=>{f&&(n?p((n=>{P({gif:e,scheduledAt:n,isSilent:t})})):P({gif:e,isSilent:t})),d.$b&&Z({query:void 0})}),[f,p,P,Z]),I=(0,N.Z)();(0,k.Z)({isActive:t,onBack:h});const y=Boolean(void 0!==n&&s&&s.length);return a.ZP.createElement("div",{className:"GifSearch",dir:I.isRtl?"rtl":void 0},a.ZP.createElement(_e.Z,{ref:g,className:(0,X.Z)("gif-container custom-scroll",y&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:v},function(){if(void 0!==n)return s?s.length?s.map((e=>a.ZP.createElement(mr,{key:e.id,gif:e,observeIntersection:C,onClick:f?b:void 0,isSavedMessages:m}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},I("NoGIFsFound")):a.ZP.createElement(Oe.Z,null)}()),E)})));var Gr=n(71226);const Vr=[[{name:"followers",title:"ChannelStats.Overview.Followers"},{name:"enabledNotifications",title:"ChannelStats.Overview.EnabledNotifications",isPercentage:!0}],[{name:"viewsPerPost",title:"ChannelStats.Overview.ViewsPerPost"},{name:"sharesPerPost",title:"ChannelStats.Overview.SharesPerPost"}]],Jr=[[{name:"members",title:"Stats.GroupMembers"},{name:"messages",title:"Stats.GroupMessages"}],[{name:"viewers",title:"Stats.GroupViewers"},{name:"posters",title:"Stats.GroupPosters"}]],Xr=[[{name:"views",title:"Stats.Message.Views",isPlain:!0},{name:"forwards",title:"Stats.Message.PrivateShares",isPlain:!0,isApproximate:!0}],[{name:"publicForwards",title:"Stats.Message.PublicShares",isPlain:!0}]],zr=(0,a.X$)((e=>{let{isGroup:t,isMessage:n,statistics:s}=e;const i=(0,N.Z)(),{period:l}=s;return a.ZP.createElement("div",{className:"StatisticsOverview"},a.ZP.createElement("div",{className:"StatisticsOverview__header"},a.ZP.createElement("div",{className:"StatisticsOverview__title"},i("StatisticOverview")),l&&a.ZP.createElement("div",{className:"StatisticsOverview__caption"},(0,ie.Tu)(i,1e3*l.minDate)," — ",(0,ie.Tu)(i,1e3*l.maxDate))),a.ZP.createElement("table",{className:"StatisticsOverview__table"},(n?Xr:t?Jr:Vr).map((e=>a.ZP.createElement("tr",null,e.map((e=>{const t=s[e.name];return e.isPlain?a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},e.isApproximate?`${(0,le.kh)(t)}`:(0,le.kh)(t)),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},i(e.title))):e.isPercentage?a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},t.percentage,"%"),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},i(e.title))):a.ZP.createElement("td",{className:"StatisticsOverview__table-cell"},a.ZP.createElement("b",{className:"StatisticsOverview__table-value"},(0,le.bi)(t.current))," ",(e=>{let{change:t,percentage:n}=e;if(!t)return;const s=Number(t)<0;return a.ZP.createElement("span",{className:(0,X.Z)("StatisticsOverview__value",s&&"negative")},s?`-${(0,le.bi)(Math.abs(t))}`:`+${(0,le.bi)(t)}`,n&&a.ZP.createElement(a.ZP.Fragment,null," ","(",n,"%)"))})(t),a.ZP.createElement("h3",{className:"StatisticsOverview__table-heading"},i(e.title)))})))))))})),jr=(0,a.X$)((e=>{let{message:t}=e;const n=(0,N.Z)(),{toggleMessageStatistics:s}=(0,i.Sv)(),r=(0,l.DH)(t),o=(0,M.Z)((0,l.Ti)(t,"micro")),c=Boolean((0,l.Y5)(t)),d=(0,a.I4)((()=>{s({messageId:t.id})}),[s,t.id]);return a.ZP.createElement("div",{className:(0,X.Z)("StatisticsRecentMessage",Boolean(o||r)&&"StatisticsRecentMessage--with-image"),onClick:d},a.ZP.createElement("div",{className:"StatisticsRecentMessage__title"},a.ZP.createElement("div",{className:"StatisticsRecentMessage__summary"},function(e,t,n,s){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:(0,X.Z)("media-preview__image",s&&"round")}),(0,l.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,f.e)(e,t,!0)):(0,f.e)(e,t)}(n,t,o||r,c)),a.ZP.createElement("div",{className:"StatisticsRecentMessage__meta"},n("ChannelStats.ViewsCount",t.views,"i"))),a.ZP.createElement("div",{className:"StatisticsRecentMessage__info"},a.ZP.createElement("div",{className:"StatisticsRecentMessage__date"},(0,ie.SA)(1e3*t.date,n.code)),a.ZP.createElement("div",{className:"StatisticsRecentMessage__meta"},t.forwards?n("ChannelStats.SharesCount",t.forwards):"No shares")))}));let Hr,qr;const Yr={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"},Wr=Object.keys(Yr),Kr={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},Qr=Object.keys(Kr),eo=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.aT)(e,a),i=(0,r.Z1)(e,a);return{statistics:s,dcId:null==i||null===(n=i.fullInfo)||void 0===n?void 0:n.statisticsDcId,isGroup:"chatTypeSuperGroup"===(null==i?void 0:i.type)}}))((e=>{var t;let{chatId:s,statistics:l,dcId:r,isGroup:o}=e;const c=(0,N.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!1),h=(0,a.sO)([]),{loadStatistics:v,loadStatisticsAsyncGraph:P}=(0,i.Sv)(),Z=(0,I.Z)();(0,a.d4)((()=>{v({chatId:s,isGroup:o})}),[s,v,o]);const g=(0,a.Ye)((()=>o?Qr:Wr),[o]),p=(0,a.Ye)((()=>o?Kr:Yr),[o]);return(0,a.d4)((()=>{l&&g.forEach((e=>{const t=l[e];"string"==typeof t&&P({name:e,chatId:s,token:t,isPercentage:"languagesGraph"===e})}))}),[g,s,l,P]),(0,a.d4)((()=>{(async()=>{await async function(){return Hr||(Hr=n.e(8878).then(n.bind(n,18878)),qr=await Hr),Hr}(),m?l&&d.current&&(g.forEach(((e,t)=>{const n=l[e];if("string"==typeof n||h.current.includes(e))return;if(!n)return void h.current.push(e);const{zoomToken:a}=n;qr.create(d.current.children[t],{title:c(p[e]),...a?{onZoom:e=>(0,Gr.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:c("Graph.ZoomOut")}:{},...n}),h.current.push(e),d.current.children[t].classList.remove("hidden")})),Z()):u(!0)})()}),[g,p,m,l,c,s,P,r,Z]),m&&l?a.ZP.createElement("div",{className:(0,X.Z)("Statistics custom-scroll",m&&"ready")},a.ZP.createElement(zr,{statistics:l,isGroup:o}),!h.current.length&&a.ZP.createElement(Oe.Z,null),a.ZP.createElement("div",{ref:d},g.map((e=>a.ZP.createElement("div",{key:e,className:"Statistics__graph hidden"})))),Boolean(null===(t=l.recentTopMessages)||void 0===t?void 0:t.length)&&a.ZP.createElement("div",{className:"Statistics__messages"},a.ZP.createElement("h2",{className:"Statistics__messages-title"},c("ChannelStats.Recent.Header")),l.recentTopMessages.map((e=>a.ZP.createElement(jr,{message:e}))))):a.ZP.createElement(Oe.Z,null)}))),to=(0,a.X$)((e=>{let{data:t}=e;const n=(0,N.Z)(),{openChatByUsername:s}=(0,i.Sv)(),l=(0,a.I4)((()=>{s({username:t.chat.username,messageId:t.messageId})}),[t,s]);return a.ZP.createElement("div",{className:"StatisticsPublicForward",onClick:l},a.ZP.createElement(Me.Z,{size:"medium",chat:t.chat}),a.ZP.createElement("div",{className:"StatisticsPublicForward__info"},a.ZP.createElement("div",{className:"StatisticsPublicForward__title"},t.title),a.ZP.createElement("div",{className:"StatisticsPublicForward__views"},n("ChannelStats.ViewsCount",t.views,"i"))))}));let no,ao;const so={viewsGraph:"Stats.MessageInteractionsTitle"},io=Object.keys(so),lo=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.Z1)(e,a),i=null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.statisticsDcId;return{statistics:e.statistics.currentMessage,dcId:i,messageId:e.statistics.currentMessageId}}))((e=>{let{chatId:t,isActive:s,statistics:l,dcId:r,messageId:o}=e;const c=(0,N.Z)(),d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!1),h=(0,a.sO)([]),{loadMessageStatistics:v,loadStatisticsAsyncGraph:P}=(0,i.Sv)(),Z=(0,I.Z)();return(0,a.d4)((()=>{o&&v({chatId:t,messageId:o})}),[t,v,o]),(0,a.d4)((()=>{s&&!o||(h.current=[],u(!1))}),[s,o]),(0,a.d4)((()=>{l&&io.forEach((e=>{const n=l[e];"string"==typeof n&&P({name:e,chatId:t,token:n})}))}),[t,l,P]),(0,a.d4)((()=>{(async()=>{await async function(){return no||(no=n.e(8878).then(n.bind(n,18878)),ao=await no),no}(),m?l&&d.current&&(io.forEach(((e,t)=>{const n=l[e];if("string"==typeof n||h.current.includes(e))return;if(!n)return void h.current.push(e);const{zoomToken:a}=n;ao.create(d.current.children[t],{title:c(so[e]),...a?{onZoom:e=>(0,Gr.t9)("fetchStatisticsAsyncGraph",{token:a,x:e,dcId:r}),zoomOutLabel:c("Graph.ZoomOut")}:{},...n}),h.current.push(e)})),Z()):u(!0)})()}),[m,l,c,t,o,P,r,Z]),m&&l&&o?a.ZP.createElement("div",{className:(0,X.Z)("Statistics custom-scroll",m&&"ready")},a.ZP.createElement(zr,{statistics:l,isMessage:!0}),!h.current.length&&a.ZP.createElement(Oe.Z,null),a.ZP.createElement("div",{ref:d},io.map((e=>a.ZP.createElement("div",{className:(0,X.Z)("Statistics__graph",!h.current.includes(e)&&"hidden")})))),Boolean(l.publicForwards)&&a.ZP.createElement("div",{className:"Statistics__public-forwards"},a.ZP.createElement("h2",{className:"Statistics__public-forwards-title"},c("Stats.Message.PublicShares")),l.publicForwardsData.map((e=>a.ZP.createElement(to,{data:e}))))):a.ZP.createElement(Oe.Z,null)}))),ro=(0,a.X$)((0,i.c$)(((e,t)=>{let{answer:n}=t;const{voters:a,offsets:s}=e.pollResults;return{voters:null==a?void 0:a[n.option],offset:(null==s?void 0:s[n.option])||""}}))((e=>{let{chat:t,message:n,answer:s,answerVote:l,totalVoters:r,voters:o,offset:c}=e;const{loadPollOptionResults:d,openChat:m,closePollResults:u}=(0,i.Sv)(),h=(0,S.Z)(l.votersCount),[v,P]=(0,a.eJ)(!0),Z=Boolean(o),{option:g,text:p}=s,E=(0,N.Z)();(0,a.d4)((()=>{Z&&h===l.votersCount||d({chat:t,messageId:n.id,option:g,offset:c,limit:4,shouldResetVoters:!0})}),[l.votersCount,Z]);const C=(0,a.I4)((()=>{P(!0),d({chat:t,messageId:n.id,option:g,offset:c,limit:50})}),[t,d,n.id,c,g]);(0,a.d4)((()=>{P(!1)}),[o]);const f=(0,a.I4)((e=>{m({id:e}),u()}),[u,m]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},o?o.map((e=>a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable",onClick:()=>f(e)},a.ZP.createElement(Je.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(Oe.Z,null),o&&function(){const e=l.votersCount-o.length;return l.votersCount>4&&e>0&&a.ZP.createElement(rs,{count:e,itemName:"voter",isLoading:v,onClick:C})}()),a.ZP.createElement("div",{className:"answer-head",dir:E.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},p),a.ZP.createElement("span",{className:"answer-percent",dir:E.isRtl?"auto":void 0},(b=l.votersCount,(I=r)>0?(b/I*100).toFixed():0),"%")));var b,I}))),oo=(0,a.X$)((0,i.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,r.Z1)(e,t),message:(0,r.hj)(e,t,n),lastSyncTime:a}:{}}))((e=>{let{onClose:t,isActive:n,chat:s,message:i,lastSyncTime:r}=e;const o=(0,N.Z)();if((0,k.Z)({isActive:n,onBack:t}),!i||!s)return a.ZP.createElement(Oe.Z,null);const{summary:c,results:d}=(0,l.t9)(i);if(!d.results)return;const m=(0,Le.ee)(d.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,we.Z)(c.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},r&&c.answers.map((e=>a.ZP.createElement(ro,{key:`${i.id}-${e.option}`,chat:s,message:i,answer:e,answerVote:m[e.option],totalVoters:d.totalVoters}))),!r&&a.ZP.createElement(Oe.Z,null)))}))),co="Please provide first name",mo=(0,a.X$)((0,i.c$)(((e,t)=>{let{userId:n}=t;const a=(0,r.dy)(e,n),s=(0,r.Z1)(e,n),{progress:i}=e.management;return{user:a,progress:i,isMuted:(0,l.i4)(s,(0,r.dZ)(e),(0,r.NJ)(e))}}))((e=>{let{userId:t,user:n,progress:l,isMuted:r,onClose:o,isActive:c}=e;const{updateContact:d,deleteContact:m,closeManagement:u}=(0,i.Sv)(),[h,v,P]=(0,b.Z)(),[Z,g]=(0,a.eJ)(!1),[p,E]=(0,a.eJ)(),C=(0,N.Z)();(0,k.Z)({isActive:c,onBack:o});const f=n&&n.firstName||"",I=n&&n.lastName||"",[y,S]=(0,a.eJ)(f),[w,M]=(0,a.eJ)(I),[T,A]=(0,a.eJ)(!r);(0,a.d4)((()=>{A(!r)}),[r]),(0,a.d4)((()=>{g(!1),P()}),[P,t]),(0,a.d4)((()=>{S(f),M(I)}),[f,I,n]),(0,a.d4)((()=>{l===s.wv.Complete&&(g(!1),E(void 0),P())}),[P,l]);const R=(0,a.I4)((e=>{S(e.target.value),g(!0)}),[]),L=(0,a.I4)((e=>{M(e.target.value),g(!0)}),[]),F=(0,a.I4)((e=>{A(e.target.checked),g(!0)}),[]),x=(0,a.I4)((()=>{const e=y.trim(),n=w.trim();e.length||E(co),d({userId:t,isMuted:!T,firstName:e,lastName:n})}),[y,w,d,t,T]),B=(0,a.I4)((()=>{m({userId:t}),P(),u()}),[P,u,m,t]);if(!n)return;const D=l===s.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(Je.Z,{userId:n.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(Ue.Z,{id:"user-first-name",label:C("UserInfo.FirstNamePlaceholder"),onChange:R,value:y,error:p===co?p:void 0}),a.ZP.createElement(Ue.Z,{id:"user-last-name",label:C("UserInfo.LastNamePlaceholder"),onChange:L,value:w}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(tt.Z,{checked:T,label:C("Notifications"),subLabel:C(T?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:F}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:v},C("DeleteContact")))),a.ZP.createElement(Ga.Z,{isShown:Z,onClick:x,disabled:D,ariaLabel:C("Save")},D?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Qe.Z,{isOpen:h,onClose:P,text:C("AreYouSureDeleteContact"),confirmLabel:C("DeleteContact"),confirmHandler:B,confirmIsDestructive:!0}))}))),uo="Group title can't be empty",ho=(0,a.X$)((0,i.c$)(((e,t)=>{var n,a,s;let{chatId:i}=t;const o=(0,r.Z1)(e,i),{progress:c}=e.management,d=Boolean(null===(n=o.fullInfo)||void 0===n?void 0:n.linkedChatId),m=(0,l.G9)(o),{invites:u}=e.management.byChatId[i]||{};return{chat:o,progress:c,isBasicGroup:m,hasLinkedChannel:d,canChangeInfo:m?o.isCreator:(0,l.VE)(o,"changeInfo"),canBanUsers:m?o.isCreator:(0,l.VE)(o,"banUsers"),canInvite:m?o.isCreator:(0,l.VE)(o,"inviteUsers"),exportedInvites:u,lastSyncTime:e.lastSyncTime,availableReactionsCount:null===(a=e.availableReactions)||void 0===a?void 0:a.filter((e=>!e.isInactive)).length,isChannelsPremiumLimitReached:"channels"===(null===(s=e.limitReachedModal)||void 0===s?void 0:s.limit)}}))((e=>{var t,n,r,o,c,d,m;let{chatId:u,chat:h,progress:v,isBasicGroup:P,hasLinkedChannel:Z,canChangeInfo:g,canBanUsers:p,canInvite:E,onScreenSelect:C,onClose:f,isActive:I,exportedInvites:y,lastSyncTime:S,availableReactionsCount:T,isChannelsPremiumLimitReached:A}=e;const{togglePreHistoryHidden:R,updateChat:L,deleteChat:F,leaveChannel:x,deleteChannel:B,closeManagement:D,openChat:O,loadExportedChatInvites:$,loadChatJoinRequests:U}=(0,i.Sv)(),[_,G,V]=(0,b.Z)(),J=h.title,X=h.fullInfo&&h.fullInfo.about||"",[z,j]=(0,a.eJ)(!1),[H,q]=(0,a.eJ)(J||""),[Y,W]=(0,a.eJ)(X),[Q,ee]=(0,a.eJ)(),[te,ne]=(0,a.eJ)(),ae=(0,l.RT)(h),se=(0,M.Z)(ae,!1,w.IU.BlobUrl),ie=h.username||Z,re=(0,N.Z)(),oe=(0,a.sO)(null);(0,k.Z)({isActive:I,onBack:f}),(0,a.d4)((()=>{S&&E&&($({chatId:u}),$({chatId:u,isRevoked:!0}),U({chatId:u}))}),[u,$,S,E,U]),(0,a.d4)((()=>{v===s.wv.Complete&&(j(!1),ne(void 0))}),[v]);const ce=(0,a.I4)((()=>{C(s.u1.ChatPrivacyType)}),[C]),de=(0,a.I4)((()=>{C(s.u1.Discussion)}),[C]),me=(0,a.I4)((()=>{C(s.u1.Reactions)}),[C]),ue=(0,a.I4)((()=>{C(s.u1.GroupPermissions)}),[C]),he=(0,a.I4)((()=>{C(s.u1.ChatAdministrators)}),[C]),ve=(0,a.I4)((()=>{C(s.u1.Invites)}),[C]),Pe=(0,a.I4)((()=>{C(s.u1.JoinRequests)}),[C]),Ze=(0,a.I4)((e=>{ee(e),j(!0)}),[]),ge=(0,a.I4)((e=>{q(e.target.value),j(!0)}),[]),pe=(0,a.I4)((e=>{W(e.target.value),j(!0)}),[]),Ee=(0,a.I4)((()=>{const e=H.trim(),t=Y.trim();e.length?L({chatId:u,title:e,about:t,photo:Q}):ne(uo)}),[Y,u,Q,H,L]),Ce=(0,a.I4)((()=>{C(s.u1.GroupMembers)}),[C]),fe=(0,a.I4)((()=>{if(!h.fullInfo)return;const{isPreHistoryHidden:e}=h.fullInfo;R({chatId:h.id,isEnabled:!e})}),[h,R]);(0,a.d4)((()=>{var e,t;A&&((null===(e=oe.current)||void 0===e?void 0:e.querySelector("input")).checked=!(null!==(t=h.fullInfo)&&void 0!==t&&t.isPreHistoryHidden))}),[A,null===(t=h.fullInfo)||void 0===t?void 0:t.isPreHistoryHidden]);const be=(null===(n=h.fullInfo)||void 0===n||null===(r=n.enabledReactions)||void 0===r?void 0:r.length)||0,Ie=(0,a.Ye)((()=>{if(!h.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!h.defaultBannedRights[e])).length;const{sendStickers:t,sendGifs:n}=h.defaultBannedRights;return t||n||(e+=1),e}),[h]),ye=(null===(o=h.fullInfo)||void 0===o||null===(c=o.adminMembers)||void 0===c?void 0:c.length)||0,ke=(0,a.I4)((()=>{P?F({chatId:h.id}):h.isCreator?B({chatId:h.id}):x({chatId:h.id}),V(),D(),O({id:void 0})}),[P,h.isCreator,h.id,V,D,x,B,F,O]);if(h.isRestricted||h.isForbidden)return;const Ne=v===s.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(_a.Z,{currentAvatarBlobUrl:se,onChange:Ze,disabled:!g}),a.ZP.createElement(Ue.Z,{id:"group-title",label:re("GroupName"),onChange:ge,value:H,error:te===uo?te:void 0,disabled:!g}),a.ZP.createElement(ja,{id:"group-about",className:"mb-2",label:re("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-Y.length).toString(),onChange:pe,value:Y,disabled:!g}),h.isCreator&&a.ZP.createElement(Ge.Z,{icon:"lock",multiline:!0,onClick:ce},a.ZP.createElement("span",{className:"title"},re("GroupType")),a.ZP.createElement("span",{className:"subtitle"},h.username?re("TypePublic"):re("TypePrivate"))),Z&&a.ZP.createElement(Ge.Z,{icon:"message",multiline:!0,onClick:de},a.ZP.createElement("span",{className:"title"},re("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},re("DiscussionUnlink"))),a.ZP.createElement(Ge.Z,{icon:"permissions",multiline:!0,onClick:ue,disabled:!p},a.ZP.createElement("span",{className:"title"},re("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},Ie,"/",8)),a.ZP.createElement(Ge.Z,{icon:"heart-outline",multiline:!0,onClick:me,disabled:!g},a.ZP.createElement("span",{className:"title"},re("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},be,"/",T)),a.ZP.createElement(Ge.Z,{icon:"admin",multiline:!0,onClick:he},a.ZP.createElement("span",{className:"title"},re("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,le.kh)(ye))),E&&a.ZP.createElement(Ge.Z,{icon:"link",onClick:ve,multiline:!0,disabled:!y},a.ZP.createElement("span",{className:"title"},re("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},y?(0,le.kh)(y.length):re("Loading"))),Boolean(null===(d=h.joinRequests)||void 0===d?void 0:d.length)&&a.ZP.createElement(Ge.Z,{icon:"add-user-filled",onClick:Pe,multiline:!0},a.ZP.createElement("span",{className:"title"},re("MemberRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,le.kh)(h.joinRequests.length)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"group",multiline:!0,onClick:Ce},a.ZP.createElement("span",{className:"title"},re("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,le.kh)(null!==(m=h.membersCount)&&void 0!==m?m:0))),!ie&&h.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection",ref:oe},a.ZP.createElement(tt.Z,{checked:!h.fullInfo.isPreHistoryHidden,label:re("ChatHistory"),onChange:fe,disabled:!p}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:G},re("DeleteMega")))),a.ZP.createElement(Ga.Z,{isShown:z,onClick:Ee,disabled:Ne,ariaLabel:re("Save")},Ne?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Qe.Z,{isOpen:_,onClose:V,textParts:(0,we.Z)(P||!h.isCreator?re("AreYouSureDeleteAndExit"):re("AreYouSureDeleteThisChatWithGroup",h.title),["br","simple_markdown"]),confirmLabel:P||!h.isCreator?re("DeleteMega"):re("DeleteGroupForAll"),confirmHandler:ke,confirmIsDestructive:!0}))}))),vo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,r.Z1)(e,n),currentUserId:e.currentUserId}}))((e=>{let{onScreenSelect:t,onChatMemberSelect:n,chat:l,currentUserId:r,onClose:o,isActive:c}=e;const{updateChatDefaultBannedRights:d}=(0,i.Sv)(),[m,u]=(0,a.eJ)({}),[h,v]=(0,a.eJ)(!1),[P,Z]=(0,a.eJ)(!1),g=(0,N.Z)();(0,k.Z)({isActive:c,onBack:o});const p=(0,a.I4)((()=>{t(s.u1.GroupRemovedUsers)}),[t]),E=(0,a.I4)((()=>{t(s.u1.GroupUserPermissionsCreate)}),[t]),C=(0,a.I4)((e=>{n(e.userId,e.promotedByUserId===r),t(s.u1.GroupUserPermissions)}),[r,n,t]);(0,a.d4)((()=>{u((null==l?void 0:l.defaultBannedRights)||{}),v(!1),setTimeout((()=>{Z(!1)}),250)}),[l]);const f=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}u((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),v(!0)}),[]),b=(0,a.I4)((()=>{l&&(Z(!0),d({chatId:l.id,bannedRights:m}))}),[l,m,d]),I=(0,a.Ye)((()=>l&&l.fullInfo&&l.fullInfo.kickedMembers?l.fullInfo.kickedMembers.length:0),[l]),y=(0,a.Ye)((()=>l&&l.fullInfo&&l.fullInfo.members?l.fullInfo.members.filter((e=>{let{bannedRights:t}=e;return Boolean(t)})):[]),[l]),S=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!l)return;const{defaultBannedRights:n}=l;return Object.keys(t).reduce(((e,a)=>{if(!t[a]||null!=n&&n[a]||"sendInline"===a||"viewMessages"===a||"sendGames"===a)return e;const s=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";default:return}}(a);if(!s)return e;const i=g(s);return`${e}${e.length?`, ${i}`:i}`}),"")}),[l,g]);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",dir:"auto"},g("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendMessages",checked:!m.sendMessages,label:g("UserRestrictionsSend"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendMedia",checked:!m.sendMedia,label:g("UserRestrictionsSendMedia"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:g("UserRestrictionsSendStickers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendPolls",checked:!m.sendPolls,label:g("UserRestrictionsSendPolls"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"embedLinks",checked:!m.embedLinks,label:g("UserRestrictionsEmbedLinks"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:g("UserRestrictionsInviteUsers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"pinMessages",checked:!m.pinMessages,label:g("UserRestrictionsPinMessages"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!m.changeInfo,label:g("UserRestrictionsChangeInfo"),blocking:!0,onChange:f}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:p},a.ZP.createElement("span",{className:"title"},g("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},I))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},g("PrivacyExceptions")),a.ZP.createElement(Ge.Z,{icon:"add-user",onClick:E},g("ChannelAddException")),y.map((e=>a.ZP.createElement(Ge.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>C(e)},a.ZP.createElement(Je.Z,{userId:e.userId,status:S(e)})))))),a.ZP.createElement(Ga.Z,{isShown:h,onClick:b,ariaLabel:g("Save"),disabled:P},P?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Po=(0,a.X$)((0,i.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}))((e=>{var t;let{chat:n,currentUserId:s,isOpen:r,onClose:o}=e;const{loadMoreMembers:c,deleteChatMember:d}=(0,i.Sv)(),m=(0,N.Z)(),[u,h]=(0,a.eJ)(""),v=(0,a.sO)(null),P=(0,a.Ye)((()=>{var e;const t=((null===(e=n.fullInfo)||void 0===e?void 0:e.members)||[]).reduce(((e,t)=>(t.isAdmin||t.isOwner||t.userId===s||e.push(t.userId),e)),[]),a=(0,i.Rd)().users.byId;return(0,l.kK)(t,a,u)}),[null===(t=n.fullInfo)||void 0===t?void 0:t.members,s,u]),Z=(0,a.I4)((e=>{d({chatId:n.id,userId:e}),o()}),[n.id,d,o]);return a.ZP.createElement(Xe,{isOpen:r,chatOrUserIds:P,filterRef:v,filterPlaceholder:m("ChannelBlockUser"),filter:u,onFilterChange:h,loadMore:c,onSelectChatOrUser:Z,onClose:o})}))),Zo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.Z1)(e,n),{byId:s}=e.users;return{chat:a,usersById:s,canDeleteMembers:a&&((0,l.VE)(a,"banUsers")||a.isCreator),isChannel:a&&(0,l.eA)(a)}}))((e=>{let{chat:t,usersById:n,canDeleteMembers:s,isChannel:r,onClose:o,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,i.Sv)(),m=(0,N.Z)(),[u,h,v]=(0,b.Z)();(0,k.Z)({isActive:c,onBack:o});const P=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.kickedMembers?t.fullInfo.kickedMembers:[]),[t]),Z=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const t=n[e.kickedByUserId];return t?m("UserRemovedBy",(0,l.Js)(t)):void 0}),[m,n]),g=(0,a.I4)((e=>{if(t)return[{title:m("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:t.id,userId:e.userId,bannedRights:{}})}]}),[m,t,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(r?"NoBlockedChannel2":"NoBlockedGroup2")),P.map((e=>a.ZP.createElement(Ge.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:g(e)},a.ZP.createElement(Je.Z,{userId:e.userId,status:Z(e)})))),s&&a.ZP.createElement(Ga.Z,{isShown:!0,onClick:h,ariaLabel:m("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),t&&s&&a.ZP.createElement(Po,{chat:t,isOpen:u,onClose:v}))))}))),go="Channel title can't be empty",po=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.Z1)(e,a),{progress:i}=e.management,o=Boolean(null==s?void 0:s.isSignaturesShown),{invites:c}=e.management.byChatId[a]||{};return{chat:s,progress:i,isSignaturesShown:o,canChangeInfo:(0,l.VE)(s,"changeInfo"),canInvite:(0,l.VE)(s,"inviteUsers"),lastSyncTime:e.lastSyncTime,exportedInvites:c,availableReactionsCount:null===(n=e.availableReactions)||void 0===n?void 0:n.filter((e=>!e.isInactive)).length}}))((e=>{var t,n,r,o,c,d,m,u,h;let{chatId:v,chat:P,progress:Z,isSignaturesShown:g,canChangeInfo:p,canInvite:E,exportedInvites:C,lastSyncTime:f,availableReactionsCount:I,onScreenSelect:y,onClose:S,isActive:T}=e;const{updateChat:A,toggleSignatures:R,closeManagement:L,leaveChannel:F,deleteChannel:x,openChat:B,loadExportedChatInvites:D,loadChatJoinRequests:O}=(0,i.Sv)(),$=P&&P.title||"",U=null!=P&&P.fullInfo&&P.fullInfo.about||"",_=null==P||null===(t=P.fullInfo)||void 0===t?void 0:t.linkedChatId,[G,V,J]=(0,b.Z)(),[X,z]=(0,a.eJ)(!1),[j,H]=(0,a.eJ)($),[q,Y]=(0,a.eJ)(U),[W,Q]=(0,a.eJ)(),[ee,te]=(0,a.eJ)(),ne=P&&(0,l.RT)(P),ae=(0,M.Z)(ne,!1,w.IU.BlobUrl),se=(0,N.Z)();(0,k.Z)({isActive:T,onBack:S}),(0,a.d4)((()=>{f&&(D({chatId:v}),D({chatId:v,isRevoked:!0}),O({chatId:v}))}),[v,D,f,O]),(0,a.d4)((()=>{Z===s.wv.Complete&&(z(!1),te(void 0))}),[Z]);const ie=(null==P||null===(n=P.fullInfo)||void 0===n||null===(r=n.adminMembers)||void 0===r?void 0:r.length)||0,re=(null==P||null===(o=P.fullInfo)||void 0===o||null===(c=o.kickedMembers)||void 0===c?void 0:c.length)||0,oe=(0,a.I4)((()=>{y(s.u1.ChatPrivacyType)}),[y]),ce=(0,a.I4)((()=>{y(s.u1.Discussion)}),[y]),de=(0,a.I4)((()=>{y(s.u1.Reactions)}),[y]),me=(0,a.I4)((()=>{y(s.u1.ChatAdministrators)}),[y]),ue=(0,a.I4)((()=>{y(s.u1.Invites)}),[y]),he=(0,a.I4)((()=>{y(s.u1.JoinRequests)}),[y]),ve=(0,a.I4)((e=>{Q(e),z(!0)}),[]),Pe=(0,a.I4)((e=>{H(e.target.value),z(!0)}),[]),Ze=(0,a.I4)((e=>{Y(e.target.value),z(!0)}),[]),ge=(0,a.I4)((()=>{const e=j.trim(),t=q.trim();e.length?A({chatId:v,title:e,about:t,photo:W}):te(go)}),[q,v,W,j,A]),pe=(0,a.I4)((()=>{R({chatId:v,isEnabled:!g})}),[v,g,R]),Ee=(0,a.I4)((()=>{y(s.u1.ChannelSubscribers)}),[y]),Ce=(0,a.I4)((()=>{y(s.u1.ChannelRemovedUsers)}),[y]),fe=(0,a.I4)((()=>{P.isCreator?x({chatId:P.id}):F({chatId:P.id}),J(),L(),B({id:void 0})}),[P.isCreator,P.id,J,L,F,x,B]),be=(null===(d=P.fullInfo)||void 0===d||null===(m=d.enabledReactions)||void 0===m?void 0:m.length)||0;if(P.isRestricted||P.isForbidden)return;const Ie=Z===s.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(_a.Z,{currentAvatarBlobUrl:ae,onChange:ve,disabled:!p}),a.ZP.createElement(Ue.Z,{id:"channel-title",label:se("EnterChannelName"),onChange:Pe,value:j,error:ee===go?ee:void 0,disabled:!p}),a.ZP.createElement(ja,{id:"channel-about",className:"mb-2",label:se("DescriptionPlaceholder"),onChange:Ze,value:q,maxLength:255,maxLengthIndicator:(255-q.length).toString(),disabled:!p}),P.isCreator&&a.ZP.createElement(Ge.Z,{icon:"lock",multiline:!0,onClick:oe},a.ZP.createElement("span",{className:"title"},se("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},P.username?se("TypePublic"):se("TypePrivate"))),a.ZP.createElement(Ge.Z,{icon:"message",multiline:!0,onClick:ce,disabled:!p},a.ZP.createElement("span",{className:"title"},se("Discussion")),a.ZP.createElement("span",{className:"subtitle"},se(_?"DiscussionUnlink":"Add"))),E&&a.ZP.createElement(Ge.Z,{icon:"link",onClick:ue,multiline:!0,disabled:!C},a.ZP.createElement("span",{className:"title"},se("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},C?(0,le.kh)(C.length):se("Loading"))),Boolean(null===(u=P.joinRequests)||void 0===u?void 0:u.length)&&a.ZP.createElement(Ge.Z,{icon:"add-user-filled",onClick:he,multiline:!0},a.ZP.createElement("span",{className:"title"},se("SubscribeRequests")),a.ZP.createElement("span",{className:"subtitle"},(0,le.kh)(P.joinRequests.length))),a.ZP.createElement(Ge.Z,{icon:"heart-outline",multiline:!0,onClick:de,disabled:!p},a.ZP.createElement("span",{className:"title"},se("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},be,"/",I)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(tt.Z,{checked:g,label:se("ChannelSignMessages"),onChange:pe}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"admin",multiline:!0,onClick:me},a.ZP.createElement("span",{className:"title"},se("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},ie)),a.ZP.createElement(Ge.Z,{icon:"group",multiline:!0,onClick:Ee},a.ZP.createElement("span",{className:"title",dir:"auto"},se("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},se("Subscribers",null!==(h=P.membersCount)&&void 0!==h?h:0,"i"))),a.ZP.createElement(Ge.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:Ce},a.ZP.createElement("span",{className:"title"},se("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},re))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:V},P.isCreator?se("ChannelDelete"):se("LeaveChannel")))),a.ZP.createElement(Ga.Z,{isShown:X,onClick:ge,disabled:Ie,ariaLabel:se("Save")},Ie?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Qe.Z,{isOpen:G,onClose:J,text:P.isCreator?se("ChannelDeleteAlert"):se("ChannelLeaveAlert"),confirmLabel:P.isCreator?se("ChannelDelete"):se("LeaveChannel"),confirmHandler:fe,confirmIsDestructive:!0}))}))),Eo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.Z1)(e,n),{isUsernameAvailable:s}=(0,r.aW)(e,n);return{chat:a,isChannel:(0,l.eA)(a),progress:e.management.progress,isUsernameAvailable:s,isProtected:null==a?void 0:a.isProtected,maxPublicLinks:(0,tn.M)(e,"channelsPublic")}}))((e=>{var t;let{chat:n,onClose:l,isActive:r,isChannel:o,progress:c,isUsernameAvailable:d,isProtected:m,maxPublicLinks:u}=e;const{checkPublicLink:h,updatePublicLink:v,updatePrivateLink:P,toggleIsProtected:Z,openLimitReachedModal:g}=(0,i.Sv)(),p=Boolean(n.username),E=null===(t=n.fullInfo)||void 0===t?void 0:t.inviteLink,[C,f]=(0,a.eJ)(p?"public":"private"),[I,y]=(0,a.eJ)(),[S,w,M]=(0,b.Z)(),T=Boolean("public"===C&&I&&d||"private"===C&&p);(0,k.Z)({isActive:r,onBack:l}),(0,a.d4)((()=>{C&&!E&&P()}),[C,E,P]);const A=(0,a.I4)(((e,t)=>{if(Object.values((0,i.Rd)().chats.byId).filter((e=>e.isCreator&&e.username)).length>=u&&"public"===e){g({limit:"channelsPublic"});const e=t.currentTarget.closest(".radio-group");return e.querySelector("[value=public]").checked=!1,void(e.querySelector("[value=private]").checked=!0)}f(e)}),[u,g]),R=(0,a.I4)((e=>{Z({chatId:n.id,isProtected:"protected"===e})}),[n.id,Z]),L=(0,a.I4)((()=>{v({username:"public"===C?I:""})}),[C,v,I]),F=(0,a.I4)((()=>{M(),P()}),[M,P]),x=(0,N.Z)(),B=o?"Channel":"Mega",D=o?"Channel":"Group",O=[{value:"private",label:x(`${B}Private`),subLabel:x(`${B}PrivateInfo`)},{value:"public",label:x(`${B}Public`),subLabel:x(`${B}PublicInfo`)}],$=[{value:"allowed",label:x("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:x("ChannelVisibility.Forwarding.Disabled")}],U=c===s.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:x.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},x(`${D}Type`)),a.ZP.createElement(Ps.Z,{selected:C,name:"channel-type",options:O,onChange:A})),"private"===C?a.ZP.createElement("div",{className:"section",dir:x.isRtl?"rtl":void 0},E?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Tn.Z,{url:E,className:"group-link",text:E}),a.ZP.createElement("p",{className:"section-info",dir:x.isRtl?"rtl":void 0},x(`${B}PrivateLinkHelp`)),a.ZP.createElement(Ge.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:w},x("RevokeLink")),a.ZP.createElement(Qe.Z,{isOpen:S,onClose:M,text:x("RevokeAlert"),confirmLabel:x("RevokeButton"),confirmHandler:F,confirmIsDestructive:!0})):a.ZP.createElement(Oe.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(za,{asLink:!0,currentUsername:n.username,isLoading:U,isUsernameAvailable:d,checkUsername:h,onChange:y}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},x(`${D}.Username.CreatePublicLinkHelp`))),a.ZP.createElement("div",{className:"section",dir:x.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},x(o?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(Ps.Z,{selected:m?"protected":"allowed",name:"forwarding-type",options:$,onChange:R}),a.ZP.createElement("p",{className:"section-info"},x(o?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(Ga.Z,{isShown:T,disabled:U,ariaLabel:x("Save"),onClick:L},U?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Co=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.Z1)(e,a),{forDiscussionIds:i,byId:o}=e.chats;return{chat:s,chatsByIds:o,forDiscussionIds:i,linkedChat:null!=s&&null!==(n=s.fullInfo)&&void 0!==n&&n.linkedChatId?(0,r.Z1)(e,s.fullInfo.linkedChatId):void 0,isChannel:s&&(0,l.eA)(s)}}))((e=>{let{chat:t,onClose:n,isActive:l,chatId:r,chatsByIds:o,linkedChat:c,forDiscussionIds:d,isChannel:u,onScreenSelect:h}=e;const{loadGroupsForDiscussion:v,linkDiscussionGroup:P,unlinkDiscussionGroup:Z,toggleJoinRequest:g,toggleJoinToSend:p}=(0,i.Sv)(),[E,C]=(0,a.eJ)(),[f,I,y]=(0,b.Z)(),[S,w,M]=(0,b.Z)(),[T,A]=(0,a.eJ)(null==c?void 0:c.isJoinToSend),[R,L]=(0,a.eJ)(null==c?void 0:c.isJoinRequest),F=(0,N.Z)(),x=null==c?void 0:c.id;(0,k.Z)({isActive:l,onBack:n}),(0,a.d4)((()=>{v()}),[v]),(0,a.d4)((()=>{l&&(A((null==c?void 0:c.isJoinToSend)||!1),L((null==c?void 0:c.isJoinRequest)||!1))}),[c,l]);const B=(0,a.I4)((()=>{y(),Z({channelId:u?r:x}),u||h(s.u1.Initial)}),[y,Z,u,r,x,h]),D=(0,a.I4)((()=>{M(),P({channelId:r,chatId:E})}),[M,P,r,E]),O=(0,a.I4)((e=>{A(e),p({chatId:x,isEnabled:e}),e||L(!1)}),[x,p]),$=(0,a.I4)((e=>{L(e),g({chatId:x,isEnabled:e})}),[x,g]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Qa.Z,{tgsUrl:Vn.l.DiscussionGroups,size:m.bM,className:"section-icon"}),c&&a.ZP.createElement("div",null,a.ZP.createElement(Ge.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Ve.Z,{chatId:c.id})),a.ZP.createElement(Ge.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:I},F(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Qe.Z,{isOpen:f,onClose:y,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(Me.Z,{size:"tiny",chat:c}),a.ZP.createElement("div",{className:"modal-title"},F(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,we.Z)(F(u?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:F(u?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:B,confirmIsDestructive:!0})),!c&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},F("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Ge.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},F("DiscussionCreateGroup")),d?d.map(((e,t)=>a.ZP.createElement(Ge.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{C(e),w()}},a.ZP.createElement(Ve.Z,{chatId:e})))):a.ZP.createElement(ia.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},F("DiscussionChannelHelp2")),a.ZP.createElement(Qe.Z,{isOpen:S,onClose:M,header:function(){const e=o[E];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(Me.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},F("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const e=o[E];if(e)return e.hasPrivateLink?(0,we.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?`,["br","simple_markdown"]):(0,we.Z)(`Do you want to make **${e.title}** the discussion board for **${t.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:F("DiscussionLinkGroup"),confirmHandler:D,isButtonsInOneRow:!0}))),c&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading"},F("ChannelSettingsJoinTitle")),a.ZP.createElement(tt.Z,{checked:T,onCheck:O,label:F("ChannelSettingsJoinToSend")}),T&&a.ZP.createElement(tt.Z,{checked:R,onCheck:$,label:F("ChannelSettingsJoinRequest")}),a.ZP.createElement("p",{className:"text-muted"},F(T?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")))))}))),fo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,r.Z1)(e,n);return{chat:s,isFormFullyDisabled:!(s.isCreator||a)}}))((e=>{let{chat:t,selectedChatMemberId:n,onScreenSelect:l,isFormFullyDisabled:r,onClose:o,isActive:c}=e;const{updateChatMemberBannedRights:d}=(0,i.Sv)(),[m,u]=(0,a.eJ)({}),[h,v]=(0,a.eJ)(!1),[P,Z]=(0,a.eJ)(!1),[g,p,E]=(0,b.Z)(),C=(0,N.Z)();(0,k.Z)({isActive:c,onBack:o});const f=(0,a.Ye)((()=>{if(t&&t.fullInfo&&t.fullInfo.members)return t.fullInfo.members.find((e=>{let{userId:t}=e;return t===n}))}),[t,n]);(0,a.d4)((()=>{null!=t&&t.fullInfo&&n&&!f&&l(s.u1.GroupPermissions)}),[t,l,f,n]),(0,a.d4)((()=>{u((null==f?void 0:f.bannedRights)||(null==t?void 0:t.defaultBannedRights)||{}),v(!1),Z(!1)}),[t,f]);const I=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}u((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),v(!0)}),[]),y=(0,a.I4)((()=>{t&&n&&(Z(!0),d({chatId:t.id,userId:n,bannedRights:m}))}),[t,n,m,d]),S=(0,a.I4)((()=>{t&&n&&d({chatId:t.id,userId:n,bannedRights:{viewMessages:!0}})}),[t,n,d]),w=(0,a.I4)((e=>!!r||!(!t||!t.defaultBannedRights)&&t.defaultBannedRights[e]),[t,r]);if(f)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Je.Z,{userId:f.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},C("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendMessages",checked:!m.sendMessages,label:C("UserRestrictionsSend"),blocking:!0,disabled:w("sendMessages"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendMedia",checked:!m.sendMedia,label:C("UserRestrictionsSendMedia"),blocking:!0,disabled:w("sendMedia"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendStickers",checked:!m.sendStickers&&!m.sendGifs,label:C("UserRestrictionsSendStickers"),blocking:!0,disabled:w("sendStickers"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"sendPolls",checked:!m.sendPolls,label:C("UserRestrictionsSendPolls"),blocking:!0,disabled:w("sendPolls"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"embedLinks",checked:!m.embedLinks,label:C("UserRestrictionsEmbedLinks"),blocking:!0,disabled:w("embedLinks"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"inviteUsers",checked:!m.inviteUsers,label:C("UserRestrictionsInviteUsers"),blocking:!0,disabled:w("inviteUsers"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"pinMessages",checked:!m.pinMessages,label:C("UserRestrictionsPinMessages"),blocking:!0,disabled:w("pinMessages"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!m.changeInfo,label:C("UserRestrictionsChangeInfo"),blocking:!0,disabled:w("changeInfo"),onChange:I}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ge.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:p},C("UserRestrictionsBlock")))),a.ZP.createElement(Ga.Z,{isShown:h,onClick:y,ariaLabel:C("Save"),disabled:P},P?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Qe.Z,{isOpen:g,onClose:E,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:S,confirmIsDestructive:!0}))}))),bo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.Z1)(e,n);return{chat:a,currentUserId:e.currentUserId,isChannel:(0,l.eA)(a)}}))((e=>{let{chat:t,isChannel:n,currentUserId:r,onScreenSelect:o,onChatMemberSelect:c,onClose:d,isActive:m}=e;const u=(0,N.Z)();(0,k.Z)({isActive:m,onBack:d});const h=(0,a.I4)((()=>{o(s.u1.GroupRecentActions)}),[o]),v=(0,a.Ye)((()=>t.fullInfo&&t.fullInfo.adminMembers?t.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),P=(0,a.I4)((e=>{c(e.userId,e.promotedByUserId===r),o(s.u1.ChatAdminRights)}),[r,c,o]),Z=(0,a.I4)((()=>{o(s.u1.GroupAddAdmins)}),[o]),g=(0,a.I4)((e=>{if(e.isOwner)return u("ChannelCreator");const t=(0,i.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?u("EditAdminPromotedBy",(0,l.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(Ge.Z,{icon:"recent",multiline:!0,onClick:h},a.ZP.createElement("span",{className:"title"},u("EventLog")),a.ZP.createElement("span",{className:"subtitle"},u(n?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:u.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},n?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),v.map((e=>a.ZP.createElement(Ge.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>P(e)},a.ZP.createElement(Je.Z,{userId:e.userId,status:g(e),forceShowSelf:!0})))),a.ZP.createElement(Ga.Z,{isShown:!0,onClick:Z,ariaLabel:u("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))))}))),Io=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;return{chat:(0,r.Z1)(e,n)}}))((e=>{let{chat:t,onClose:n,isActive:s}=e;const i=(0,N.Z)();(0,k.Z)({isActive:s,onBack:n});const l=(0,a.Ye)((()=>t&&t.fullInfo&&t.fullInfo.adminMembers?t.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[t]),r=(0,a.I4)((e=>e.isOwner?i("ChannelCreator"):i("ChannelAdmin")),[i]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:i.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},"Actions"),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:i.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},i("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:!0,label:i("EventLogAllAdmins"),onChange:void 0})),l.map((e=>a.ZP.createElement(Ge.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(tt.Z,{label:"",checked:!0}),a.ZP.createElement(Je.Z,{userId:e.userId,status:r(e),forceShowSelf:!0})))))))}))),yo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n,isPromotedByCurrentUser:a}=t;const s=(0,r.Z1)(e,n),{byId:i}=e.users,{currentUserId:o}=e;return{chat:s,usersById:i,currentUserId:o,isChannel:(0,l.eA)(s),isFormFullyDisabled:!(s.isCreator||a),defaultRights:s.adminRights}}))((e=>{var t;let{isNewAdmin:n,selectedUserId:r,defaultRights:o,onScreenSelect:c,chat:d,usersById:m,currentUserId:u,isChannel:h,isFormFullyDisabled:v,onClose:P,isActive:Z}=e;const{updateChatAdmin:g}=(0,i.Sv)(),[p,E]=(0,a.eJ)({}),[C,f]=(0,a.eJ)(Boolean(n)),[I,y]=(0,a.eJ)(!1),[S,w,M]=(0,b.Z)(),[T,A]=(0,a.eJ)(""),R=(0,N.Z)();(0,k.Z)({isActive:Z,onBack:P});const L=(0,a.Ye)((()=>{var e,t;const a=null===(e=d.fullInfo)||void 0===e||null===(t=e.adminMembers)||void 0===t?void 0:t.find((e=>{let{userId:t}=e;return t===r}));if(!n||!a&&r){if(n){const e=(0,i.Rd)().users.byId[r];return e?{userId:e.id,adminRights:o,customTitle:R("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return a}}),[null===(t=d.fullInfo)||void 0===t?void 0:t.adminMembers,o,n,R,r]);(0,a.d4)((()=>{null!=d&&d.fullInfo&&r&&!L&&c(s.u1.ChatAdministrators)}),[d,c,L,r]),(0,a.d4)((()=>{E((null==L?void 0:L.adminRights)||{}),A(((null==L?void 0:L.customTitle)||"").substr(0,16)),f(Boolean(n)),y(!1)}),[o,n,L]);const F=(0,a.I4)((e=>{const{name:t}=e.target;E((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),f(!0)}),[]),x=(0,a.I4)((()=>{r&&(y(!0),g({chatId:d.id,userId:r,adminRights:p,customTitle:T}))}),[r,g,d.id,p,T]),B=(0,a.I4)((()=>{r&&(g({chatId:d.id,userId:r,adminRights:{}}),M())}),[d.id,M,r,g]),D=(0,a.I4)((e=>!((0,l.G9)(d)||!v&&d.adminRights&&d.adminRights[e])),[d,v]),O=(0,a.Ye)((()=>{if(n||!L)return;if(L.isOwner)return R("ChannelCreator");const e=L.promotedByUserId?m[L.promotedByUserId]:void 0;return e?R("EditAdminPromotedBy",(0,l.Js)(e)):R("ChannelAdmin")}),[n,L,m,R]),$=(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(Ge.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Je.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 no-selection"},a.ZP.createElement(tt.Z,{name:"changeInfo",checked:Boolean(p.changeInfo),label:R(h?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:D("changeInfo"),onChange:F})),h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"postMessages",checked:Boolean(p.postMessages),label:R("EditAdminPostMessages"),blocking:!0,disabled:D("postMessages"),onChange:F})),h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"editMessages",checked:Boolean(p.editMessages),label:R("EditAdminEditMessages"),blocking:!0,disabled:D("editMessages"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"deleteMessages",checked:Boolean(p.deleteMessages),label:R(h?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:D("deleteMessages"),onChange:F})),!h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"banUsers",checked:Boolean(p.banUsers),label:R("EditAdminBanUsers"),blocking:!0,disabled:D("banUsers"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"inviteUsers",checked:Boolean(p.inviteUsers),label:R("EditAdminAddUsers"),blocking:!0,disabled:D("inviteUsers"),onChange:F})),!h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"pinMessages",checked:Boolean(p.pinMessages),label:R("EditAdminPinMessages"),blocking:!0,disabled:D("pinMessages"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"addAdmins",checked:Boolean(p.addAdmins),label:R("EditAdminAddAdmins"),blocking:!0,disabled:D("addAdmins"),onChange:F})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"manageCall",checked:Boolean(p.manageCall),label:R("StartVoipChatPermission"),blocking:!0,disabled:D("manageCall"),onChange:F})),!h&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"anonymous",checked:Boolean(p.anonymous),label:R("EditAdminSendAnonymously"),blocking:!0,disabled:D("anonymous"),onChange:F})),v&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},R("Channel.EditAdmin.CannotEdit")),!h&&a.ZP.createElement(Ue.Z,{id:"admin-title",label:R("EditAdminRank"),onChange:$,value:T,disabled:v,maxLength:16}),u!==r&&!v&&!n&&a.ZP.createElement(Ge.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:w},R("EditAdminRemoveAdmin")))),a.ZP.createElement(Ga.Z,{isShown:C,onClick:x,ariaLabel:R("Save"),disabled:I},I?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),!n&&a.ZP.createElement(Qe.Z,{isOpen:S,onClose:M,text:"Are you sure you want to dismiss this admin?",confirmLabel:R("Channel.Admin.Dismiss"),confirmHandler:B,confirmIsDestructive:!0}))}))),ko=(0,a.X$)((0,i.c$)(((e,t)=>{var n,a;let{chatId:s}=t;const i=(0,r.Z1)(e,s),{statusesById:o}=e.users,c=null==i||null===(n=i.fullInfo)||void 0===n?void 0:n.members,d=null==i||null===(a=i.fullInfo)||void 0===a?void 0:a.adminMembers,m=i&&(0,l.eA)(i),{userIds:u}=e.contactList||{},{query:h,fetchingStatus:v,globalUserIds:P,localUserIds:Z}=e.userSearch;return{members:c,adminMembers:d,userStatusesById:o,isChannel:m,localContactIds:u,searchQuery:h,isSearching:v,globalUserIds:P,localUserIds:Z,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{noAdmins:t,members:n,adminMembers:r,userStatusesById:o,isChannel:c,isActive:d,globalUserIds:m,localContactIds:u,localUserIds:h,isSearching:v,searchQuery:P,serverTimeOffset:Z,onClose:g,onScreenSelect:p,onChatMemberSelect:E}=e;const{openChat:C,setUserSearchQuery:f,closeManagement:b}=(0,i.Sv)(),I=(0,N.Z)(),y=(0,a.sO)(null),S=(0,a.sO)(null),w=(0,a.Ye)((()=>t&&(null==r?void 0:r.map((e=>{let{userId:t}=e;return t})))||[]),[r,t]),M=(0,a.Ye)((()=>{const e=(0,i.Rd)().users.byId;if(!n||!e)return[];const a=(0,l.Z0)(n.map((e=>{let{userId:t}=e;return t})),e,o,void 0,Z);return t?a.filter((e=>!w.includes(e))):a}),[n,o,Z,t,w]),T=(0,a.Ye)((()=>{const e=(0,i.Rd)().users.byId,n=(0,i.Rd)().chats.byId,a=Boolean(P),s=a?u?(0,l.kK)(u,e,P):[]:M;return(0,l.ih)((0,Le.Tw)([...s,...a&&h||[],...a&&m||[]]).filter((n=>{const a=e[n];return!a||(c||a.canBeInvitedToGroup||!(0,l.cS)(a))&&(!t||!w.includes(n))})),n,!0)}),[M,u,P,h,m,c,t,w]),[A,R]=(0,xe.Z)(void 0,T,Boolean(P)),L=(0,a.I4)((e=>{t?(E(e,!1),p(s.u1.ChatNewAdminRights)):(b(),C({id:e}))}),[b,t,E,p,C]),F=(0,a.I4)((e=>{f({query:e.target.value})}),[f]),x=(0,Be.Z)(S,d,(e=>{A&&A.length>0&&L(A[-1===e?0:e])}),".ListItem-button",!0);return(0,k.Z)({isActive:d,onBack:g}),a.ZP.createElement("div",{className:"Management"},t&&a.ZP.createElement("div",{className:"Management__filter",dir:I.isRtl?"rtl":void 0},a.ZP.createElement(Ue.Z,{ref:y,value:P,onChange:F,placeholder:I("Search")})),a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},null!=A&&A.length?a.ZP.createElement(_e.Z,{className:"picker-list custom-scroll",items:T,onLoadMore:R,noScrollRestore:Boolean(P),ref:S,onKeyDown:x},A.map((e=>a.ZP.createElement(Ge.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>L(e)},a.ZP.createElement(Je.Z,{userId:e,forceShowSelf:!0}))))):v||!A||A.length?a.ZP.createElement(Oe.Z,null):a.ZP.createElement(ia.Z,{teactOrderKey:0,key:"nothing-found",text:c?"No subscribers found":"No members found"}))))}))),No=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.Z1)(e,a),{byId:i,statusesById:o}=e.users;return{members:null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.members,usersById:i,userStatusesById:o,isChannel:s&&(0,l.eA)(s),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{usersById:t,userStatusesById:n,members:i,isChannel:r,onScreenSelect:o,onChatMemberSelect:c,onClose:d,isActive:m,serverTimeOffset:u}=e;(0,k.Z)({isActive:m,onBack:d});const h=(0,a.Ye)((()=>{if(i&&t)return(0,l.Z0)(i.filter((e=>!e.isOwner)).map((e=>{let{userId:t}=e;return t})),t,n,void 0,u)}),[i,u,t,n]),v=(0,a.I4)((e=>{c(e),o(s.u1.GroupUserPermissions)}),[c,o]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},h?h.map(((e,t)=>a.ZP.createElement(Ge.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>v(e)},a.ZP.createElement(Je.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(ia.Z,{teactOrderKey:0,key:"nothing-found",text:r?"No subscribers found":"No members found"}))))})));var So=n(82267);function wo(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:i,usage:l=0,date:r}=t;return n||i?Number(n)-Number(i):a||l?l-a:r-s}const Mo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{invites:a,revokedInvites:s}=e.management.byChatId[n],i=(0,r.Z1)(e,n),o=i&&(0,l.eA)(i);return{exportedInvites:a,revokedExportedInvites:s,chat:i,serverTimeOffset:e.serverTimeOffset,isChannel:o}}))((e=>{let{chatId:t,chat:n,exportedInvites:l,revokedExportedInvites:r,isActive:o,isChannel:c,serverTimeOffset:u,onClose:h,onScreenSelect:v}=e;const{setEditingExportedInvite:P,showNotification:Z,editExportedChatInvite:g,deleteExportedChatInvite:p,deleteRevokedExportedChatInvites:E,setOpenedInviteInfo:C}=(0,i.Sv)(),f=(0,N.Z)(),[y,S,w]=(0,b.Z)(),[M,T,A]=(0,b.Z)(),[R,L]=(0,a.eJ)(),[F,x,B]=(0,b.Z)(),[O,$]=(0,a.eJ)();(0,k.Z)({isActive:o,onBack:h});const G=(0,a.Ye)((()=>{if(l)return l.some((e=>{let{expireDate:t}=e;return t&&t-(0,So.b)(u)<ie.xR/1e3}))}),[l,u]),V=(0,I.Z)();(0,vt.Z)((()=>{V()}),G?1e3:void 0);const J=null==l?void 0:l.find((e=>{let{isPermanent:t}=e;return t})),X=null!=n&&n.username?`${m.zH}${n.username}`:null==J?void 0:J.link,z=(0,a.Ye)((()=>{const e=null!=n&&n.username?l:null==l?void 0:l.filter((e=>{let{isPermanent:t}=e;return!t}));return null==e?void 0:e.sort(wo)}),[null==n?void 0:n.username,l]),j=(0,a.I4)((e=>{const{link:n,title:a,isRequestNeeded:s,expireDate:i,usageLimit:l}=e;g({chatId:t,link:n,title:a,isRequestNeeded:s,expireDate:i,usageLimit:l,isRevoked:!0})}),[t,g]),H=(0,a.I4)((e=>{L(e),T()}),[T]),q=(0,a.I4)((()=>{R&&(j(R),L(void 0),A())}),[A,j,R]),Y=(0,a.I4)((()=>{v(s.u1.EditInvite)}),[v]),W=(0,a.I4)((()=>{J&&H(J)}),[H,J]),K=(0,a.I4)((()=>{E({chatId:t}),w()}),[t,w,E]),Q=(0,a.I4)((e=>{C({chatId:t,invite:e}),v(s.u1.InviteInfo)}),[t,v,C]),ee=(0,a.I4)((e=>{p({chatId:t,link:e.link})}),[t,p]),te=(0,a.I4)((e=>{$(e),x()}),[x]),ne=(0,a.I4)((()=>{O&&(ee(O),$(void 0),B())}),[B,ee,O]),ae=(0,a.I4)((e=>{(0,Hi.TE)(e),Z({message:f("LinkCopied")})}),[f,Z]),se=(0,a.I4)((()=>{ae(X)}),[ae,X]),le=e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:i,isRevoked:l}=e;let r="";if(r=!l&&n&&t<n?f("CanJoin",n-t):t?f("PeopleJoined",t):f("NoOneJoined"),l)return r+=`${f("Revoked")}`,r;if(i&&(r+=`${f("JoinRequests",i)}`),void 0!==n&&t===n)r+=`${f("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,So.b)(u));r+=" • ",r+=e>0?f("InviteLink.ExpiresIn",(0,ie.D)(f,e)):f("InviteLink.Expired")}else s&&(r+=`${f("Permanent")}`);return r},re=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,So.b)(u))<=0?"link-status-icon-red":"link-status-icon-blue"},oe=e=>{const n=[];return n.push({title:f("Copy"),icon:"copy",handler:()=>ae(e.link)}),e.isPermanent||e.isRevoked||n.push({title:f("Edit"),icon:"edit",handler:()=>(e=>{P({chatId:t,invite:e}),v(s.u1.EditInvite)})(e)}),e.isRevoked?n.push({title:f("DeleteLink"),icon:"delete",handler:()=>te(e),destructive:!0}):n.push({title:f("RevokeButton"),icon:"delete",handler:()=>H(e),destructive:!0}),n},ce=(0,a.Ye)((()=>e=>{let{onTrigger:t,isOpen:n}=e;return a.ZP.createElement(D.Z,{round:!0,ripple:!d.wB,size:"smaller",color:"translucent",className:n?"active":"",onClick:t,ariaLabel:"Actions"},a.ZP.createElement("i",{className:"icon-more"}))}),[]);return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Qa.Z,{tgsUrl:Vn.l.Invite,size:m.jV,className:"section-icon"}),a.ZP.createElement("p",{className:"text-muted"},f(c?"PrimaryLinkHelpChannel":"PrimaryLinkHelp"))),X&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",{className:"text-muted"},null!=n&&n.username?f("PublicLink"):f("lng_create_permanent_link_title")),a.ZP.createElement("div",{className:"primary-link"},a.ZP.createElement("input",{className:"form-control primary-link-input",value:X,readOnly:!0,onClick:se}),a.ZP.createElement(U.Z,{className:"primary-link-more-menu",trigger:ce,positionX:"right"},a.ZP.createElement(_.Z,{icon:"copy",onClick:se},f("Copy")),!(null!=n&&n.username)&&a.ZP.createElement(_.Z,{icon:"delete",onClick:W,destructive:!0},f("RevokeButton")))),a.ZP.createElement(D.Z,{onClick:se},f("CopyLink"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement(D.Z,{isText:!0,key:"create",className:"create-link",onClick:Y},f("CreateNewLink")),(!z||!z.length)&&a.ZP.createElement(ia.Z,{text:"No links found",key:"nothing"}),null==z?void 0:z.map((e=>a.ZP.createElement(Ge.Z,{leftElement:a.ZP.createElement("i",{className:`icon-link link-status-icon ${re(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>Q(e),contextActions:oe(e),key:e.link},a.ZP.createElement("span",{className:"title invite-title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},le(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},f("ManageLinksInfoHelp"))),r&&Boolean(r.length)&&a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{className:"text-muted",key:"title"},f("RevokedLinks")),a.ZP.createElement(Ge.Z,{icon:"delete",destructive:!0,key:"delete",onClick:S},a.ZP.createElement("span",{className:"title"},f("DeleteAllRevokedLinks"))),null==r?void 0:r.map((e=>a.ZP.createElement(Ge.Z,{leftElement:a.ZP.createElement("i",{className:`icon-link link-status-icon ${re(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>Q(e),contextActions:oe(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},le(e))))))),a.ZP.createElement(Qe.Z,{isOpen:y,onClose:w,title:f("DeleteAllRevokedLinks"),text:f("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:f("DeleteAll"),confirmHandler:K}),a.ZP.createElement(Qe.Z,{isOpen:M,onClose:A,title:f("RevokeLink"),text:f("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:f("RevokeButton"),confirmHandler:q}),a.ZP.createElement(Qe.Z,{isOpen:F,onClose:B,title:f("DeleteLink"),text:f("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:f("Delete"),confirmHandler:ne}))}))),To=[1,10,100],Ao={hour:36e5,day:864e5,week:6048e5},Ro=Ao.hour,Lo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{editingInvite:a}=e.management.byChatId[n];return{editingInvite:a,serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,editingInvite:n,isActive:l,serverTimeOffset:r,onClose:o,onScreenSelect:c}=e;const{editExportedChatInvite:d,exportChatInvite:m}=(0,i.Sv)(),u=(0,N.Z)(),[h,v,P]=(0,b.Z)(),[Z,g]=(0,a.eJ)(!1),[p,E]=(0,a.eJ)(""),[C,f]=(0,a.eJ)(Date.now()+Ro),[I,y]=(0,a.eJ)("unlimited"),[S,w]=(0,a.eJ)(10),[M,T]=(0,a.eJ)("0"),[A,L]=(0,a.eJ)(!1);(0,k.Z)({isActive:l,onBack:o}),(0,R.Z)((e=>{let[t]=e;if(t!==n)if(n){const{title:e,usageLimit:t,expireDate:a,isRequestNeeded:s}=n;if(e&&E(e),t&&(T(To.includes(t)?t.toString():"custom"),w(t)),a){const e=(0,So.b)(r)+Ro;y("custom"),f(1e3*Math.max(a,e))}s&&g(!0)}else E(""),y("unlimited"),T("0"),f(1e3*(0,So.b)(r)+Ro),w(10),g(!1)}),[n,r]);const F=(0,a.I4)((e=>{g(e.target.checked)}),[]),x=(0,a.I4)((e=>{E(e.target.value)}),[]),B=(0,a.I4)((e=>{w(Number.parseInt(e.target.value,10))}),[]),O=(0,a.I4)((e=>{f(e.getTime()),P()}),[P]),$=(0,a.I4)((()=>{L(!0);const e="custom"===M?S:M;let a;switch(I){case"custom":a=(0,So.b)(r)+(C-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,So.b)(r)+Ao[I]/1e3;break;case"unlimited":a=0;break;default:a=void 0}n?d({link:n.link,chatId:t,title:p,isRequestNeeded:Z,expireDate:a,usageLimit:e}):m({chatId:t,title:p,isRequestNeeded:Z,expireDate:a,usageLimit:e}),c(s.u1.Invites)}),[t,C,S,d,n,m,Z,I,M,p,c,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(tt.Z,{label:u("ApproveNewMembers"),subLabel:u("ApproveNewMembersDescription"),checked:Z,onChange:F})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ue.Z,{className:"link-name",placeholder:u("LinkNameHint"),value:p,onChange:x}),a.ZP.createElement("p",{className:"text-muted hint"},u("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},u("LimitByPeriod")),a.ZP.createElement(Ps.Z,{name:"expireOptions",options:[{value:"hour",label:u("Hours",1)},{value:"day",label:u("Days",1)},{value:"week",label:u("Weeks",1)},{value:"unlimited",label:u("NoLimit")},{value:"custom",label:u("lng_group_invite_expire_custom")}],onChange:y,selected:I}),"custom"===I&&a.ZP.createElement(D.Z,{className:"expire-limit",isText:!0,onClick:v},(0,ie.Tu)(u,C)," ",(0,ie.mr)(u,C)),a.ZP.createElement("p",{className:"text-muted hint"},u("TimeLimitHelp"))),!Z&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},u("LimitNumberOfUses")),a.ZP.createElement(Ps.Z,{name:"usageOptions",options:[...To.map((e=>({value:e.toString(),label:e}))),{value:"0",label:u("NoLimit")},{value:"custom",label:u("lng_group_invite_usage_custom")}],onChange:T,selected:M}),"custom"===M&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:S,onChange:B}),a.ZP.createElement("p",{className:"text-muted hint"},u("UsesLimitHelp"))),a.ZP.createElement(Ga.Z,{isShown:!0,onClick:$,disabled:A,ariaLabel:u(n?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon-check"}))),a.ZP.createElement(ct,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:P,onSubmit:O,selectedAt:C,submitButtonLabel:u("Save")}))}))),Fo=(0,a.X$)((0,i.c$)(((e,t)=>{var n;let{chatId:a}=t;const s=(0,r.Z1)(e,a);return{enabledReactions:null===(n=s.fullInfo)||void 0===n?void 0:n.enabledReactions,availableReactions:e.availableReactions,chat:s}}))((e=>{let{availableReactions:t,enabledReactions:n,chat:s,isActive:l,onClose:r}=e;const{setChatEnabledReactions:o}=(0,i.Sv)(),c=(0,N.Z)(),[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)(!1),[v,P]=(0,a.eJ)(n||[]);(0,k.Z)({isActive:l,onBack:r});const Z=(0,a.I4)((()=>{s&&(h(!0),o({chatId:s.id,enabledReactions:v}))}),[s,v,o]);(0,a.d4)((()=>{h(!1),m(!1),P(n||[])}),[n]);const g=(0,a.Ye)((()=>null==t?void 0:t.filter((e=>!e.isInactive))),[t]),p=(0,a.I4)((e=>{if(!s||!g)return;const{name:t,checked:n}=e.currentTarget,a="all"===t?n?g.map((e=>e.reaction)):[]:n?[...v,t]:v.filter((e=>e!==t));P(a),m(!0)}),[g,s,v]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:"all",checked:!v||v.length>0,label:c("EnableReactions"),onChange:p})),null==g?void 0:g.map((e=>{let{reaction:t,title:n}=e;return a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(tt.Z,{name:t,checked:!v||(null==v?void 0:v.includes(t)),disabled:0===(null==v?void 0:v.length),label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(Un.Z,{reaction:t}),n),onChange:p}))})))),a.ZP.createElement(Ga.Z,{isShown:d,onClick:Z,ariaLabel:c("Save"),disabled:u},u?a.ZP.createElement(K.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),xo=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const{inviteInfo:a}=e.management.byChatId[n],{invite:s,importers:i,requesters:o}=a||{},c=(0,r.Z1)(e,n);return{invite:s,importers:i,requesters:o,isChannel:c&&(0,l.eA)(c),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{chatId:t,invite:n,importers:s,requesters:l,isChannel:r,isActive:o,serverTimeOffset:c,onClose:d}=e;const{showNotification:m,loadChatInviteImporters:u,loadChatInviteRequesters:h,openChat:v}=(0,i.Sv)(),P=(0,N.Z)(),{usage:Z=0,usageLimit:g,link:p,adminId:E}=n||{},C=(null==n?void 0:n.expireDate)&&1e3*(n.expireDate-(0,So.b)(c))+Date.now(),f=((null==n?void 0:n.expireDate)||0)-(0,So.b)(c)<0;(0,a.d4)((()=>{p&&(u({chatId:t,link:p}),h({chatId:t,link:p}))}),[t,p,u,h]);const b=(0,a.I4)((()=>{(0,Hi.TE)(n.link),m({message:P("LinkCopied")})}),[n,P,m]);return(0,k.Z)({isActive:o,onBack:d}),a.ZP.createElement("div",{className:"Management ManageInviteInfo"},a.ZP.createElement("div",{className:"custom-scroll"},!n&&a.ZP.createElement("p",{className:"text-muted"},P("Loading")),n&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"link-title"},n.title||n.link),a.ZP.createElement("input",{className:"form-control",value:n.link,readOnly:!0,onClick:b}),a.ZP.createElement(D.Z,{className:"copy-link",onClick:b},P("CopyLink")),C&&a.ZP.createElement("p",{className:"text-muted"},f?P("ExpiredLink"):P("LinkExpiresIn",`${(0,ie.Tu)(P,C)} ${(0,ie.mr)(P,C)}`))),E&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,P("LinkCreatedeBy")),a.ZP.createElement(Ge.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>v({id:E})},a.ZP.createElement(Je.Z,{userId:E,status:(0,ie.ZK)(P,1e3*n.date,!0),forceShowSelf:!0}))),(()=>{if(null!=s&&s.length||null==l||!l.length)return s?a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,s.length?P("PeopleJoined",Z):P("NoOneJoined")),a.ZP.createElement("p",{className:"text-muted"},!s.length&&(g?P("PeopleCanJoinViaLinkCount",g-Z):P("NoOneJoinedYet")),s.map((e=>a.ZP.createElement(Ge.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>v({id:e.userId})},a.ZP.createElement(Je.Z,{userId:e.userId,status:(0,ie.ZK)(P,1e3*e.date,!0),forceShowSelf:!0})))))):a.ZP.createElement(K.Z,null)})(),(()=>{if(null==n||!n.isRevoked){if(!l&&s)return a.ZP.createElement(K.Z,null);if(null!=l&&l.length)return a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",null,P(r?"SubscribeRequests":"MemberRequests")),a.ZP.createElement("p",{className:"text-muted"},l.map((e=>a.ZP.createElement(Ge.Z,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>v({id:e.userId})},a.ZP.createElement(Je.Z,{userId:e.userId,status:(0,ie.ZK)(P,1e3*e.date,!0),forceShowSelf:!0}))))))}})())))}))),Bo=(0,a.X$)((0,i.c$)(((e,t)=>{let{userId:n}=t;return{user:(0,r.dy)(e,n),serverTimeOffset:e.serverTimeOffset}}))((e=>{let{userId:t,about:n,date:s,isChannel:r,user:o,serverTimeOffset:c,chatId:d}=e;const{openChat:m,hideChatJoinRequest:u}=(0,i.Sv)(),h=(0,X.y)("JoinRequest"),v=(0,N.Z)(),P=(0,l.Js)(o),Z=1e3*(s-(0,So.b)(c))+Date.now(),g=(0,ie.zk)(new Date(Z))?(0,ie.mr)(v,Z):(0,ie.j1)(v,Z,!0,!1,!0),p=(0,a.I4)((()=>{u({chatId:d,userId:t,isApproved:!0})}),[d,u,t]),E=(0,a.I4)((()=>{u({chatId:d,userId:t,isApproved:!1})}),[d,u,t]);return a.ZP.createElement("div",{className:h("&")},a.ZP.createElement("div",{className:h("top")},a.ZP.createElement("div",{className:h("user"),onClick:()=>{m({id:t})}},a.ZP.createElement(Me.Z,{key:t,size:"medium",user:o}),a.ZP.createElement("div",{className:h("user-info")},a.ZP.createElement("div",{className:h("user-name")},P),a.ZP.createElement("div",{className:h("user-subtitle")},n))),a.ZP.createElement("div",{className:h("date")},g)),a.ZP.createElement("div",{className:h("buttons")},a.ZP.createElement(D.Z,{className:h("button"),onClick:p},v(r?"ChannelAddToChannel":"ChannelAddToGroup")),a.ZP.createElement(D.Z,{className:h("button"),isText:!0,onClick:E},v("DismissRequest"))))}))),Do=(0,a.X$)((0,i.c$)(((e,t)=>{let{chatId:n}=t;const a=(0,r.Z1)(e,n);return{chat:a,serverTimeOffset:e.serverTimeOffset,isChannel:a&&(0,l.eA)(a)}}))((e=>{var t,n,s;let{chat:r,chatId:o,isActive:c,isChannel:d,onClose:u}=e;const{hideAllChatJoinRequests:h,loadChatJoinRequests:v}=(0,i.Sv)(),[P,Z,g]=(0,b.Z)(),[p,E,C]=(0,b.Z)(),f=(0,N.Z)();(0,k.Z)({isActive:c,onBack:u}),(0,a.d4)((()=>{null!=r&&r.joinRequests||(0,l.YC)(o)||v({chatId:o})}),[r,o,v]);const I=(0,a.I4)((()=>{h({chatId:o,isApproved:!0}),g()}),[h,o,g]),y=(0,a.I4)((()=>{h({chatId:o,isApproved:!1}),C()}),[h,o,C]);return a.ZP.createElement("div",{className:"Management ManageJoinRequests"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Qa.Z,{tgsUrl:Vn.l.JoinRequest,size:m.PM,className:"section-icon"}),Boolean(null==r||null===(t=r.joinRequests)||void 0===t?void 0:t.length)&&a.ZP.createElement("div",{className:"bulk-actions"},a.ZP.createElement(D.Z,{className:"bulk-action-button",onClick:Z},"Accept all"),a.ZP.createElement(D.Z,{className:"bulk-action-button",onClick:E,isText:!0},"Dismiss all"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement("p",{key:"title"},null!=r&&r.joinRequests?r.joinRequests.length?f("JoinRequests",r.joinRequests.length):f("NoMemberRequests"):f("Loading")),!(null!=r&&r.joinRequests)&&a.ZP.createElement(K.Z,{key:"loading"}),0===(null==r||null===(n=r.joinRequests)||void 0===n?void 0:n.length)&&a.ZP.createElement("p",{className:"text-muted",key:"empty"},f(d?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")),null==r||null===(s=r.joinRequests)||void 0===s?void 0:s.map((e=>{let{userId:t,about:n,date:s}=e;return a.ZP.createElement(Bo,{userId:t,about:n,date:s,isChannel:d,chatId:o,key:t})})))),a.ZP.createElement(Qe.Z,{isOpen:P,onClose:g,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:I}),a.ZP.createElement(Qe.Z,{isOpen:p,onClose:C,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:y}))}))),Oo=(0,a.X$)((0,i.c$)((e=>({managementType:(0,r.pP)(e)})))((e=>{let{chatId:t,currentScreen:n,selectedChatMemberId:i,isPromotedByCurrentUser:l,onScreenSelect:r,onChatMemberSelect:o,onClose:c,isActive:d,managementType:m}=e;switch(n){case s.u1.Initial:switch(m){case"user":return a.ZP.createElement(mo,{key:t,userId:t,onClose:c,isActive:d});case"group":return a.ZP.createElement(ho,{key:t,chatId:t,onScreenSelect:r,onClose:c,isActive:d||[s.u1.ChatPrivacyType,s.u1.Discussion,s.u1.GroupPermissions,s.u1.ChatAdministrators,s.u1.GroupRemovedUsers,s.u1.GroupUserPermissionsCreate,s.u1.GroupUserPermissions,s.u1.ChatAdminRights,s.u1.ChatNewAdminRights,s.u1.GroupRecentActions].includes(n)});case"channel":return a.ZP.createElement(po,{key:t,chatId:t,onScreenSelect:r,onClose:c,isActive:d||[s.u1.ChannelSubscribers,s.u1.ChatAdministrators,s.u1.ChannelRemovedUsers,s.u1.Discussion,s.u1.ChatPrivacyType,s.u1.ChatAdminRights,s.u1.ChatNewAdminRights,s.u1.GroupRecentActions].includes(n)})}break;case s.u1.ChatPrivacyType:return a.ZP.createElement(Eo,{chatId:t,isActive:d,onClose:c});case s.u1.Discussion:return a.ZP.createElement(Co,{chatId:t,onScreenSelect:r,isActive:d,onClose:c});case s.u1.GroupPermissions:return a.ZP.createElement(vo,{chatId:t,onScreenSelect:r,onChatMemberSelect:o,isActive:d||[s.u1.GroupRemovedUsers,s.u1.GroupUserPermissionsCreate,s.u1.GroupUserPermissions].includes(n),onClose:c});case s.u1.ChannelRemovedUsers:case s.u1.GroupRemovedUsers:return a.ZP.createElement(Zo,{chatId:t,isActive:d,onClose:c});case s.u1.GroupUserPermissionsCreate:return a.ZP.createElement(No,{chatId:t,onChatMemberSelect:o,onScreenSelect:r,isActive:d||[s.u1.GroupUserPermissions].includes(n),onClose:c});case s.u1.GroupUserPermissions:return a.ZP.createElement(fo,{chatId:t,selectedChatMemberId:i,isPromotedByCurrentUser:l,onScreenSelect:r,isActive:d,onClose:c});case s.u1.ChatAdministrators:return a.ZP.createElement(bo,{chatId:t,onScreenSelect:r,onChatMemberSelect:o,isActive:d||[s.u1.ChatAdminRights,s.u1.ChatNewAdminRights,s.u1.GroupRecentActions].includes(n),onClose:c});case s.u1.GroupRecentActions:return a.ZP.createElement(Io,{chatId:t,isActive:d,onClose:c});case s.u1.ChatNewAdminRights:case s.u1.ChatAdminRights:return a.ZP.createElement(yo,{chatId:t,isNewAdmin:n===s.u1.ChatNewAdminRights,selectedUserId:i,isPromotedByCurrentUser:l,onScreenSelect:r,isActive:d,onClose:c});case s.u1.ChannelSubscribers:case s.u1.GroupMembers:return a.ZP.createElement(ko,{chatId:t,isActive:d,onClose:c});case s.u1.Invites:return a.ZP.createElement(Mo,{chatId:t,isActive:d,onClose:c,onScreenSelect:r});case s.u1.EditInvite:return a.ZP.createElement(Lo,{chatId:t,isActive:d,onClose:c,onScreenSelect:r});case s.u1.GroupAddAdmins:return a.ZP.createElement(ko,{chatId:t,noAdmins:!0,isActive:d,onClose:c,onScreenSelect:r,onChatMemberSelect:o});case s.u1.Reactions:return a.ZP.createElement(Fo,{chatId:t,isActive:d,onClose:c});case s.u1.InviteInfo:return a.ZP.createElement(xo,{chatId:t,isActive:d,onClose:c});case s.u1.JoinRequests:return a.ZP.createElement(Do,{chatId:t,isActive:d,onClose:c})}}))),$o=/^4[0-9]{12}(?:[0-9]{1,3})?$/,Uo=/^5[1-5][0-9]{11,14}$/,_o=/^2[2-7][0-9]{11,14}$/,Go=/^220[0-4]/;let Vo;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard",e[e.Mir=3]="Mir"}(Vo||(Vo={}));const Jo={[Vo.Default]:"",[Vo.Visa]:"visa",[Vo.Mastercard]:"mastercard",[Vo.Mir]:"mir"};function Xo(e){return e=e.replace(/\s/g,""),$o.test(e)?Vo.Visa:Go.test(e)?Vo.Mir:Uo.test(e)||_o.test(e)?Vo.Mastercard:Vo.Default}const zo={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},jo=(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"resetState":return{...zo};default:return e}};function Ho(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400;(0,a.d4)((()=>{d.$b||setTimeout((()=>{(0,H.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const qo=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:i,error:l,ref:r,placeholder:o,tabIndex:c,onChange:d,children:m}=e,u=l||s,h=(0,X.Z)("input-group",n&&"touched",l&&"error",u&&"with-label",i&&"with-arrow","input-group");return a.ZP.createElement("div",{className:h},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:d,placeholder:o||s,tabIndex:c,ref:r},m),u&&t&&a.ZP.createElement("label",{htmlFor:t},u))})),Yo=(0,a.X$)((e=>{let{state:t,needEmail:n,needPhone:s,needName:i,needAddress:l,countryList:r,dispatch:o}=e;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null);(0,a.d4)((()=>{m.current&&m.current.value!==t.countryIso2&&(m.current.value=t.countryIso2)}),[t.countryIso2]);const u=(0,N.Z)();Ho(c);const h=(0,a.I4)((e=>{o({type:"changeAddress1",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeAddress2",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeCity",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeState",payload:e.target.value})}),[o]),g=(0,a.I4)((e=>{o({type:"changeCountry",payload:r.find((t=>t.iso2===e.target.value))})}),[r,o]),p=(0,a.I4)((e=>{o({type:"changePostCode",payload:e.target.value})}),[o]),E=(0,a.I4)((e=>{o({type:"changeFullName",payload:e.target.value})}),[o]),C=(0,a.I4)((e=>{o({type:"changeEmail",payload:e.target.value})}),[o]),f=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,d.current&&(d.current.value=t),o({type:"changePhone",payload:t})}),[o]),b=(0,a.I4)((e=>{o({type:"changeSaveInfo",payload:e.target.value})}),[o]),{formErrors:I}=t;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,l?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,u("PaymentShippingAddress")),a.ZP.createElement(Ue.Z,{ref:c,label:u("PaymentShippingAddress1Placeholder"),onChange:h,value:t.streetLine1,inputMode:"text",tabIndex:0,error:I.streetLine1}),a.ZP.createElement(Ue.Z,{label:u("PaymentShippingAddress2Placeholder"),onChange:v,value:t.streetLine2,inputMode:"text",tabIndex:0,error:I.streetLine2}),a.ZP.createElement(Ue.Z,{label:u("PaymentShippingCityPlaceholder"),onChange:P,value:t.city,inputMode:"text",tabIndex:0,error:I.city}),a.ZP.createElement(Ue.Z,{label:u("PaymentShippingStatePlaceholder"),onChange:Z,value:t.state,inputMode:"text",error:I.state}),a.ZP.createElement(qo,{label:u("PaymentShippingCountry"),placeholder:u("PaymentShippingCountry"),onChange:g,value:t.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:I.countryIso2,ref:m,tabIndex:0},r.map((e=>{let{defaultName:n,name:s,iso2:i}=e;return a.ZP.createElement("option",{value:i,className:"county-item",selected:i===t.countryIso2},n||s)}))),a.ZP.createElement(Ue.Z,{label:u("PaymentShippingZipPlaceholder"),onChange:p,value:t.postCode,inputMode:"text",tabIndex:0,error:I.postCode})):void 0,i||n||s?a.ZP.createElement("h5",null,u("PaymentShippingReceiver")):void 0,i&&a.ZP.createElement(Ue.Z,{label:u("PaymentShippingName"),onChange:E,value:t.fullName,inputMode:"text",tabIndex:0,error:I.fullName}),n&&a.ZP.createElement(Ue.Z,{label:u("PaymentShippingEmailPlaceholder"),onChange:C,value:t.email,inputMode:"email",tabIndex:0,error:I.email}),s&&a.ZP.createElement(Ue.Z,{label:u("PaymentShippingPhoneNumber"),onChange:f,value:t.phone,inputMode:"tel",tabIndex:0,error:I.phone,ref:d}),a.ZP.createElement(tt.Z,{label:u("PaymentShippingSave"),subLabel:u("PaymentShippingSaveInfo"),checked:Boolean(t.saveInfo),tabIndex:0,onChange:b})))})),Wo=(0,a.X$)((e=>{let{state:t,shippingOptions:n,currency:s,dispatch:i}=e;const l=(0,N.Z)();(0,a.d4)((()=>{n&&!t.shipping&&i({type:"changeShipping",payload:n[0].id})}),[n,t.shipping,i]);const r=(0,a.I4)((e=>{i({type:"changeShipping",payload:e})}),[i]),o=(0,a.Ye)((()=>n.map((e=>{let{id:t,title:n,amount:a}=e;return{label:n,subLabel:(0,bt.x)(a,s,l.code),value:t}}))),[n,s,l.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,l("PaymentShippingMethod")),a.ZP.createElement(Ps.Z,{name:"shipping-options",options:o,onChange:r,selected:t.shipping})))})),Ko={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","invoice-info":"MyMLGHhiEKOVIoG3aQTS",invoiceInfo:"MyMLGHhiEKOVIoG3aQTS","checkout-info-item":"gLWXe4qIIINtZ3q9CmIX",checkoutInfoItem:"gLWXe4qIIINtZ3q9CmIX","checkout-info-item-icon":"YqZr6__8x50n06_r2wD8",checkoutInfoItemIcon:"YqZr6__8x50n06_r2wD8",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"};function Qo(e,t,n,s){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return a.ZP.createElement("div",{className:(0,X.Z)(Ko.priceInfoItem,i&&Ko.priceInfoItemMain)},a.ZP.createElement("div",{className:Ko.priceInfoItemTitle},t),a.ZP.createElement("div",null,(0,bt.x)(n,s,e)))}function ec(e,t,n){return a.ZP.createElement("div",{className:Ko.checkoutInfoItem},a.ZP.createElement("i",{className:(0,X.Z)(e,Ko.checkoutInfoItemIcon)}," "),a.ZP.createElement("div",{className:Ko.checkoutInfoItemInfo},a.ZP.createElement("div",{className:Ko.checkoutInfoItemInfoTitle},t),a.ZP.createElement("p",{className:Ko.checkoutInfoItemInfoData},n)))}const tc=(0,a.X$)((e=>{var t,n;let{chat:s,invoiceContent:i,prices:r,shippingPrices:o,checkoutInfo:c,currency:d,totalPrice:m,isTosAccepted:u,onAcceptTos:h}=e;const v=(0,N.Z)(),{photo:P,title:Z,text:g,isRecurring:p,recurringTermsUrl:E}=i||{},{paymentMethod:C,paymentProvider:f,shippingAddress:b,name:I,phone:y,shippingMethod:k}=c||{},S=(0,M.Z)((0,l.O9)(P));return a.ZP.createElement("div",{className:Ko.root},a.ZP.createElement("div",{className:Ko.description},S&&a.ZP.createElement("img",{className:Ko.checkoutPicture,src:S,alt:""}),!S&&P&&a.ZP.createElement(ol.Z,{width:null===(t=P.dimensions)||void 0===t?void 0:t.width,height:null===(n=P.dimensions)||void 0===n?void 0:n.height,className:Ko.checkoutPicture,forceAspectRatio:!0}),a.ZP.createElement("div",{className:Ko.text},a.ZP.createElement("h5",{className:Ko.checkoutTitle},Z),g&&a.ZP.createElement("div",{className:Ko.checkoutDescription},(0,we.Z)(g,["br","links","emoji"])))),a.ZP.createElement("div",{className:Ko.priceInfo},r&&r.map((e=>Qo(v.code,e.label,e.amount,d))),o&&o.map((e=>Qo(v.code,e.label,e.amount,d))),void 0!==m&&Qo(v.code,v("Checkout.TotalAmount"),m,d,!0)),a.ZP.createElement("div",{className:Ko.invoiceInfo},C&&ec("icon-card",C,v("PaymentCheckoutMethod")),f&&ec((0,X.Z)(Ko.provider,Ko[f.toLowerCase()]),f,v("PaymentCheckoutProvider")),b&&ec("icon-location",b,v("PaymentShippingAddress")),I&&ec("icon-user",I,v("PaymentCheckoutName")),y&&ec("icon-phone",y,v("PaymentCheckoutPhoneNumber")),k&&ec("icon-truck",k,v("PaymentCheckoutShippingMethod")),p&&(w=E,a.ZP.createElement(tt.Z,{label:function(e,t){const n=v("PaymentCheckoutAcceptRecurrent",null==s?void 0:s.title).split("*");return a.ZP.createElement(a.ZP.Fragment,null,n[0],a.ZP.createElement(Tn.Z,{url:e,text:"",isRtl:t},n[1]),n.slice(2))}(w,v.isRtl),name:"checkout_tos",checked:Boolean(u),className:Ko.tosCheckbox,tabIndex:0,onCheck:h}))));var w})),nc=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const i=(0,N.Z)(),l=(0,a.I4)((e=>{const n=e.target.value;t.endsWith("/")&&t.length>n.length?s(n):s(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return null!=t&&t[0]&&Number(t[0])>12&&(t[0]="12"),null!=t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))}),[s,t]);return a.ZP.createElement(Ue.Z,{label:i("PaymentCardExpireDate"),onChange:l,value:t,error:n,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})})),ac=n.p+"mastercard.790db81f7978635f77d8.svg",sc=n.p+"visa.538e537ba818f53b0a8f.svg",ic=n.p+"mir.e3a390b90e2e3e292621.svg",lc=(0,a.X$)((e=>{let{value:t,error:n,onChange:s}=e;const i=(0,N.Z)(),l=(0,a.sO)(null);Ho(l);const[r,o]=(0,a.eJ)(Vo.Default);(0,a.d4)((()=>{const e=Xo(t);o(e)}),[]);const c=(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),n=Xo(e.target.value);o(n),s(t)}),[s]),d=function(e){switch(e){case Vo.Mastercard:return a.ZP.createElement("img",{src:ac,alt:""});case Vo.Visa:return a.ZP.createElement("img",{src:sc,alt:""});case Vo.Mir:return a.ZP.createElement("img",{src:ic,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement(Ue.Z,{ref:l,label:i("PaymentCardNumber"),onChange:c,value:t,inputMode:"numeric",className:r?"has-right-addon":"",error:n,tabIndex:0,maxLength:23,teactExperimentControlled:!0}),a.ZP.createElement("span",{className:"right-addon"},d))})),rc=(0,a.X$)((e=>{let{state:t,canSaveCredentials:n,needCardholderName:s,needCountry:i,needZip:l,countryList:r,dispatch:o}=e;const c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==t.billingCountry&&(c.current.value=t.billingCountry)}),[t.billingCountry]);const d=(0,a.I4)((e=>{o({type:"changeCardNumber",payload:e})}),[o]),m=(0,a.I4)((e=>{o({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[o]),u=(0,a.I4)((e=>{o({type:"changeExpiryDate",payload:e})}),[o]),h=(0,a.I4)((e=>{const t=e.target.value.replace(/[^0-9]/g,"");o({type:"changeCvvCode",payload:t})}),[o]),v=(0,a.I4)((e=>{o({type:"changeBillingCountry",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeBillingZip",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeSaveCredentials",payload:e.target.value})}),[o]),g=(0,N.Z)(),{formErrors:p={}}=t;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,g("PaymentCardTitle")),a.ZP.createElement(lc,{onChange:d,value:t.cardNumber,error:p.cardNumber}),s&&a.ZP.createElement(Ue.Z,{label:g("Checkout.NewCard.CardholderNamePlaceholder"),onChange:m,value:t.cardholder,inputMode:"text",tabIndex:0,error:p.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(nc,{value:t.expiry,onChange:u,error:p.expiry}),a.ZP.createElement(Ue.Z,{label:g("lng_payments_card_cvc"),onChange:h,value:t.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:p.cvv,teactExperimentControlled:!0})),i||l?a.ZP.createElement("h5",null,g("PaymentBillingAddress")):void 0,i&&a.ZP.createElement(qo,{label:g("PaymentShippingCountry"),placeholder:g("PaymentShippingCountry"),onChange:v,value:t.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:p.billingCountry,tabIndex:0,ref:c},r.map((e=>{let{defaultName:n,name:s}=e;return a.ZP.createElement("option",{value:n,className:"county-item",selected:n===t.billingCountry},n||s)}))),l&&a.ZP.createElement(Ue.Z,{label:g("PaymentShippingZipPlaceholder"),onChange:P,value:t.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:p.billingZip}),n&&a.ZP.createElement(tt.Z,{label:g("PaymentCardSavePaymentInformation"),checked:t.saveCredentials,tabIndex:0,onChange:Z})))})),oc=(0,a.X$)((e=>{let{url:t}=e;const{closePaymentModal:n,openTelegramLink:s}=(0,i.Sv)(),l=(0,N.Z)(),r=(0,a.I4)((e=>{try{const t=JSON.parse(e.data),{eventType:a,eventData:i}=t;if("web_app_open_tg_link"!==a)return;const l=m.zH+i.path_full;s({url:l}),n()}catch(e){}}),[n,s]);return(0,a.d4)((()=>(window.addEventListener("message",r),()=>window.removeEventListener("message",r))),[r]),a.ZP.createElement("div",{className:"ConfirmPayment"},a.ZP.createElement("iframe",{src:t,title:l("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"}))})),cc=new Set(["stripe","smartglocal"]),dc=(0,a.X$)((0,i.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:i,invoiceContent:l,nativeProvider:o,nativeParams:c,passwordMissing:d,error:m,confirmPaymentUrl:u,inputInvoice:h}=e.payment,v=h&&"chatId"in h?(0,r.Z1)(e,h.chatId):void 0,P=Boolean(i&&(!o||!cc.has(o))),{needCardholderName:Z,needCountry:g,needZip:p}=c||{},{nameRequested:E,phoneRequested:C,emailRequested:f,shippingAddressRequested:b,flexible:I,phoneToProvider:y,emailToProvider:k,currency:N,prices:S}=i||{};return{step:t,chat:v,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:o,passwordMissing:d,nameRequested:E,shippingAddressRequested:b,phoneRequested:C,emailRequested:f,flexible:I,phoneToProvider:y,emailToProvider:k,currency:N,prices:S,isProviderError:P,invoiceContent:l,needCardholderName:Z,needCountry:g,needZip:p,error:m,confirmPaymentUrl:u,countryList:e.countryList.general}}))((e=>{let{isOpen:t,onClose:n,step:l,chat:r,shippingOptions:o,savedInfo:c,canSaveCredentials:d,nameRequested:m,shippingAddressRequested:u,phoneRequested:h,emailRequested:v,phoneToProvider:P,emailToProvider:Z,currency:g,passwordMissing:p,isProviderError:E,invoiceContent:C,nativeProvider:f,prices:b,needCardholderName:I,needCountry:y,needZip:k,confirmPaymentUrl:S,error:w,countryList:M}=e;const{validateRequestedInfo:T,sendPaymentForm:A,setPaymentStep:R,sendCredentialsInfo:L,clearPaymentError:F}=(0,i.Sv)(),[x,B]=(0,Fa.Z)(jo,zo),[O,U]=(0,a.eJ)(!1),[_,G]=(0,a.eJ)(!1),V=(0,N.Z)(),J=l!==s.KB.ConfirmPayment;(0,a.d4)((()=>{(l||w)&&U(!1)}),[l,w]),(0,a.d4)((()=>{null!=w&&w.field&&B({type:"setFormErrors",payload:{[w.field]:w.message}})}),[w,B]),(0,a.d4)((()=>{if(c){const{name:e,phone:t,email:n,shippingAddress:a}=c,{countryIso2:s,...i}=a||{},l=s&&M.find((e=>{let{iso2:t}=e;return t===s})).defaultName;B({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...l&&{country:l,countryIso2:s,...i}}})}}),[c,B,M]);const z=(0,a.I4)((()=>{F()}),[F]),j=(0,a.Ye)((()=>l!==s.KB.Checkout?0:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const a=t?uc(t,n):[];let s=0;const i=e.concat(a||[]);return s=i.reduce(((e,t)=>e+t.amount),s),s}(b,o,x.shipping)),[l,x.shipping,b,o]),H=(0,a.Ye)((()=>{if(l===s.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=Xo(e);return Jo[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:i,fullName:l}=e,r=t?mc(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:l,phone:i,shippingMethod:null==r?void 0:r.title}}(x,o,f||"")}),[l,x,o,f]),q=(0,a.I4)((()=>{const{saveInfo:e}=x,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:i,postCode:l,fullName:r,phone:o,email:c}=e;return{name:r,phone:o,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:i,postCode:l}}}(x);T({requestInfo:t,saveInfo:e})}),[T,x]),Y=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:i,billingZip:l}=e,[r,o]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:r,expiryYear:o,cvv:s,country:i,zip:l}}}(x);L({credentials:e})}),[L,x]),W=(0,a.I4)((()=>{A({shippingOptionId:x.shipping,saveCredentials:x.saveCredentials})}),[A,x]),Q=(0,a.I4)((e=>{R({step:e})}),[R]),ee=(0,a.I4)((()=>{switch(U(!0),l){case s.KB.ShippingInfo:q();break;case s.KB.Shipping:Q(s.KB.PaymentInfo);break;case s.KB.PaymentInfo:Y();break;case s.KB.Checkout:W()}}),[l,q,Q,Y,W]),te=(0,a.I4)((()=>{B({type:"resetState"}),G(!1)}),[B]),ne=(0,a.Ye)((()=>{switch(l){case s.KB.ShippingInfo:return V("PaymentShippingInfo");case s.KB.Shipping:return V("PaymentShippingMethod");case s.KB.PaymentInfo:return V("PaymentCardInfo");case s.KB.Checkout:return V("PaymentCheckout");case s.KB.ConfirmPayment:return V("Checkout.WebConfirmation.Title");default:return""}}),[l,V]),ae=l===s.KB.Checkout?V("Checkout.PayPrice",(0,bt.x)(j,g,V.code)):V("Next"),se=O||Boolean(l===s.KB.Checkout&&(null==C?void 0:C.isRecurring)&&!_);return E?a.ZP.createElement($e.Z,{className:"error",isOpen:t,onClose:n},a.ZP.createElement("p",null,"Sorry, Telegram WebZ 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(D.Z,{isText:!0,onClick:n},V("OK"))):a.ZP.createElement($e.Z,{className:(0,X.Z)("PaymentModal",(null==C?void 0:C.isRecurring)&&"recurring"),isOpen:t,onClose:n,onCloseAnimationEnd:te},a.ZP.createElement("div",{className:"header",dir:V.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null,ne)),void 0!==l?a.ZP.createElement($.Z,{name:"slide",activeKey:l},a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case s.KB.ShippingInfo:return a.ZP.createElement(Yo,{state:x,dispatch:B,needAddress:Boolean(u),needEmail:Boolean(v||Z),needPhone:Boolean(h||P),needName:Boolean(m),countryList:M});case s.KB.Shipping:return a.ZP.createElement(Wo,{state:x,dispatch:B,shippingOptions:o||[],currency:g});case s.KB.PaymentInfo:return a.ZP.createElement(rc,{state:x,dispatch:B,canSaveCredentials:Boolean(!p&&d),needCardholderName:I,needCountry:y,needZip:k,countryList:M});case s.KB.Checkout:return a.ZP.createElement(tc,{chat:r,prices:b,shippingPrices:x.shipping&&o?uc(o,x.shipping):void 0,totalPrice:j,invoiceContent:C,checkoutInfo:H,currency:g,isTosAccepted:_,onAcceptTos:G});case s.KB.ConfirmPayment:return a.ZP.createElement(oc,{url:S});default:return}}(l))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(K.Z,{color:"gray"})),J&&a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(D.Z,{type:"submit",onClick:ee,disabled:se,isLoading:O},ae)),w&&!w.field&&function(){if(w)return a.ZP.createElement($e.Z,{className:"error",isOpen:Boolean(w),onClose:z},a.ZP.createElement("h4",null,w.description||"Error"),a.ZP.createElement("p",null,w.description||"Error"),a.ZP.createElement(D.Z,{isText:!0,onClick:F},V("OK")))}())})));function mc(e,t){return e.find((e=>{let{id:n}=e;return n===t}))}function uc(e,t){const n=mc(e,t);return null==n?void 0:n.prices}const hc=(0,a.X$)((0,i.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:i,credentialsTitle:l,shippingPrices:r,shippingMethod:o,photo:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:i,credentialsTitle:l,shippingPrices:r,shippingMethod:o,photo:c,text:d,title:m}}))((e=>{let{isOpen:t,onClose:n,prices:s,shippingPrices:i,totalAmount:l,currency:r,info:o,photo:c,text:d,title:m,credentialsTitle:u,shippingMethod:h}=e;const v=(0,N.Z)(),P=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=null!=a&&a.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:i,name:l}=t;return{paymentMethod:e,shippingAddress:s,name:l,phone:i,shippingMethod:n}}(u,o,h)),[o,h,u]);return a.ZP.createElement($e.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:t,onClose:n},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:n,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null," ",v("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(tc,{prices:s,shippingPrices:i,totalPrice:l,invoiceContent:{photo:c,text:d,title:m},checkoutInfo:P,currency:r}))))})))},93490:(e,t,n)=>{n.d(t,{Z:()=>v});var a=n(14050),s=n(83716),i=n(77361),l=n(13365),r=n(97799),o=n(28183),c=n(60706);const d=[0,50],m=[0,20],u=[20,0],h=i.wB?s.qp:s.z7,v=(0,a.X$)((e=>{let{isPasswordVisible:t,isBig:n}=e;const[i,v]=(0,c.Z)(!1),[P,Z]=(0,c.Z)(!1);(0,o.Z)(Z,2e3);const g=(0,a.I4)(v,[v]);return a.ZP.createElement("div",{id:"monkey",className:n?"big":""},!i&&a.ZP.createElement("div",{className:"monkey-preview"}),a.ZP.createElement(r.Z,{size:n?s.K2:h,className:P?"hidden":"shown",tgsUrl:l.l.MonkeyClose,playSegment:d,noLoop:!0,onLoad:g}),a.ZP.createElement(r.Z,{size:n?s.K2:h,className:P?"shown":"hidden",tgsUrl:l.l.MonkeyPeek,playSegment:t?m:u,noLoop:!0}))}))},90710:(e,t,n)=>{n.d(t,{Z:()=>Z});var a=n(14050),s=n(46752),i=n(83716),l=n(71394),r=n(59107),o=n(231),c=n(13103),d=n(34288);const m={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let u,h,v;const P=(0,a.X$)((e=>{let{file:t,onChange:s,onClose:P}=e;const[Z,g]=(0,a.eJ)(!1);(0,a.d4)((()=>{t&&(Z?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;v=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,l.YJ)(e);await v.bind({url:s})}catch(e){i.eM&&console.error(e)}}(t):async function(){return h||(h=Promise.all([n.e(5099),n.e(3472)]).then(n.bind(n,23472)),u=(await h).default),h}().then((()=>g(!0))))}),[t,Z]);const p=(0,r.Z)(),E=(0,a.I4)((async()=>{if(!v)return;const e=await v.result(m),t="string"==typeof e?e:(0,l.hl)(e,"avatar.jpg");s(t)}),[s]);return a.ZP.createElement(c.Z,{isOpen:Boolean(t),onClose:P,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},Z?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(o.Z,{className:"confirm-button",round:!0,color:"primary",onClick:E,ariaLabel:p("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),Z=(0,a.X$)((e=>{let{title:t="Change your profile picture",disabled:n,currentAvatarBlobUrl:i,onChange:l}=e;const[r,o]=(0,a.eJ)(),[c,d]=(0,a.eJ)(i);(0,a.d4)((()=>{d(i)}),[i]);const m=(0,a.I4)((e=>{o(void 0),l(e),c&&URL.revokeObjectURL(c),d(URL.createObjectURL(e))}),[c,l]),u=(0,a.I4)((()=>{o(void 0)}),[]),h=(0,s.Z)(c&&"filled",n&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:h,role:"button",tabIndex:0,title:t},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(o(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),c&&a.ZP.createElement("img",{src:c,alt:"Avatar"})),a.ZP.createElement(P,{file:r,onClose:u,onChange:m}))}))}}]);
//# sourceMappingURL=3779.f36c3c587d1b7b752d4a.js.map