telegram-tt/dist/442.f81b4eb30975dff27660.js
Alexander Zinchuk b8909192b3 [Build]
2022-01-24 04:57:29 +01:00

2 lines
301 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([[442],{1442:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>ts,AttachMenu:()=>gr,AttachmentModal:()=>Js,BotCommandMenu:()=>Cr,BotCommandTooltip:()=>Er,CalendarModal:()=>Ke,ChatFolderModal:()=>as,ContactList:()=>Va,ContextMenuContainer:()=>fs,CustomSendMenu:()=>br,DeleteMessageModal:()=>We,Dialogs:()=>Ue,DropArea:()=>Ir.Z,EmojiInteractionAnimation:()=>ut,EmojiTooltip:()=>Sr,ForwardPicker:()=>Be,GifSearch:()=>Gr,HeaderMenuContainer:()=>ys,HistoryCalendar:()=>qe,InlineBotTooltip:()=>Rr,LeftSearch:()=>en,Management:()=>Eo,MediaViewer:()=>be,MentionTooltip:()=>Os,MessageSelectToolbar:()=>rt,MobileSearch:()=>ws,NewChat:()=>Qa,NewChatStep1:()=>Ka,NewChatStep2:()=>qa,Notifications:()=>Ge,PaymentModal:()=>zo,PinMessageModal:()=>Qe,PollModal:()=>_s,PollResults:()=>Xr,ReactorListModal:()=>ct,ReceiptModal:()=>Vo,RightSearch:()=>$r,SafeLinkModal:()=>_e,SeenByModal:()=>ot,SendAsMenu:()=>Fr,Settings:()=>Ya,StickerSearch:()=>Or,StickerSetModal:()=>bs,StickerTooltip:()=>fr,SymbolMenu:()=>vr,TextFormatter:()=>yr.Z,UnpinAllMessagesModal:()=>et});var a=n(4050),s=n(5116),r=n(6137),o=n(1713),i=n(3716),l=n(2937),c=n(5326),d=n(8674),m=n(6590),u=n(9107),h=n(6202),Z=n(2566),P=n(7204),v=n(2858),g=n(1638),p=n(396),E=n(3989),C=n(1174),f=n(7361),b=n(3858),I=n(4399),y=n(935),N=n(3227);function S(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if(a.draggable=!1,a.oncontextmenu=N.Z,"string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,n.appendChild(a),t===o.bZ.ProfileAvatar||t===o.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===o.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===o.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function w(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 k(e,t){Object.assign(e.style,t)}function M(e,t){let n,a;switch(e){case o.bZ.Album:case o.bZ.ScheduledAlbum:n=`.Transition__slide--active > .MessageList #album-media-${t.id}`,a=".full-media";break;case o.bZ.SharedMedia:n=`#shared-media${t.id}`,a="img";break;case o.bZ.SearchResult:n=`#search-media${t.id}`,a="img";break;case o.bZ.MiddleHeaderAvatar:n=".MiddleHeader .Transition__slide--active .ChatInfo .Avatar",a="img.avatar-media";break;case o.bZ.SettingsAvatar:n="#Settings .ProfileInfo .Transition__slide--active .ProfilePhoto",a="img.avatar-media";break;case o.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .Transition__slide--active .ProfilePhoto",a="img.avatar-media";break;case o.bZ.ScheduledInline:case o.bZ.Inline:default:n=`.Transition__slide--active > .MessageList #message${t.id}`,a=".message-content .full-media, .message-content .thumbnail"}const s=document.querySelector(n),r=s&&s.querySelectorAll(a);return{container:s,mediaEl:null==r?void 0:r[r.length-1]}}function T(e,t){switch(t){case o.bZ.Album:case o.bZ.ScheduledAlbum:case o.bZ.Inline:case o.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case o.bZ.SharedMedia:case o.bZ.SettingsAvatar:case o.bZ.ProfileAvatar:case o.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case o.bZ.MiddleHeaderAvatar:e.classList.add("circle")}}var L=n(231),A=n(126),R=n(2255),F=n(3106),B=n(8964),$=n(9196);const D=(0,a.X$)((0,s.c$)(((e,{message:t})=>({isDownloading:!!t&&(0,g.te)(e,t),isProtected:(0,g.EV)(e,t)})))((({mediaData:e,isVideo:t,isZoomed:n,message:r,fileName:o,isAvatar:i,isDownloading:l,isProtected:c,onCloseMediaViewer:d,onForward:m,onZoomToggle:h})=>{const{downloadMessageMedia:P,cancelMessageMediaDownload:g}=(0,s.uC)(),{loadProgress:p}=(0,Z.Z)(r&&(0,v.Ti)(r,"download"),!l),E=(0,a.I4)((()=>{l?g({message:r}):P({message:r})}),[g,P,l,r]),C=(0,u.Z)(),b=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]);if(f.wB){if(c)return;return a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(F.Z,{trigger:b,positionX:"right"},!i&&a.ZP.createElement(B.Z,{icon:"forward",onClick:m},C("Forward")),t?a.ZP.createElement(B.Z,{icon:l?"close":"download",onClick:E},l?`${Math.round(100*p)}% Downloading...`:"Download"):a.ZP.createElement(B.Z,{icon:"download",href:e,download:o},C("AccActionDownload"))),l&&a.ZP.createElement($.Z,{progress:p,size:"s",noCross:!0}))}return a.ZP.createElement("div",{className:"MediaViewerActions"},!i&&!c&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("Forward"),onClick:m},a.ZP.createElement("i",{className:"icon-forward"}))),function(){if(!c)return t?a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("AccActionDownload"),onClick:E},l?a.ZP.createElement($.Z,{progress:p,size:"s",onClick:E}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(L.Z,{href:e,download:o,round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"}))}(),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:n?"Zoom Out":"Zoom In",onClick:h},a.ZP.createElement("i",{className:n?"icon-zoom-out":"icon-zoom-in"})),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:C("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})))})));var x=n(2202),U=n(9933),O=n(275),G=n(9118),J=n(9204),X=n(6752);const _=({text:e="",isHidden:t,isForVideo:n,onClick:s})=>{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*I.Gw)};t();const n=(0,G.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const i=(0,X.Z)("MediaViewerFooter",n&&"is-for-video",t&&"is-hidden");return a.ZP.createElement("div",{className:i,onClick:function(t){e&&t.stopPropagation()}},e&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:f.wB?void 0:s},a.ZP.createElement("p",{className:"media-text custom-scroll "+(r?"multiline":""),dir:"auto"},e)))};var z=n(1212),Y=n(2019);const H=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var V=n(6898),j=n(4753),K=n(790);const q=["bytes","kB","MB","GB","TB","PB"],W=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${q[t]}`},Q=e=>{e.stopPropagation()},ee=({bufferedProgress:e,currentTime:t,duration:n,fileSize:s,isForceVisible:r,isForceMobileVersion:o,isPlayed:i,isFullscreenSupported:l,isFullscreen:c,onChangeFullscreen:d,onPlayPause:m,onSeek:h})=>{const[Z,P]=(0,a.eJ)(!0),v=(0,a.sO)(null),g=(0,a.sO)(!1);(0,a.d4)((()=>{r&&P(r)}),[r]),(0,a.d4)((()=>{let e;return r||(f.wB?P(!1):e=window.setTimeout((()=>{P(!1)}),800)),()=>{e&&window.clearTimeout(e)}}),[r]),(0,a.d4)((()=>((Z||r)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[r,Z]);const p=(0,u.Z)(),E=(0,a.I4)((e=>{if(g.current&&v.current){const{width:t,left:a}=v.current.getBoundingClientRect(),s=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;h(Math.max(Math.min(n*((s-a)/t),n),0))}}),[n,h]),b=(0,a.I4)((e=>{g.current=!0,E(e)}),[E]),I=(0,a.I4)((()=>{g.current=!1}),[]);var y,N;if((0,a.d4)((()=>{if(v.current&&Z)return(0,C.s)(v.current,{onCapture:b,onRelease:I,onClick:I,onDrag:E})}),[Z,b,E,I]),Z||r)return a.ZP.createElement("div",{className:"VideoPlayerControls "+(o?"mobile":""),onClick:Q},function(e,t,n,s){const r=e/t*100,o=100*n;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},a.ZP.createElement("div",{className:"player-seekline-buffered",style:`width: ${o||0}%`}),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${r||0}%`})))}(t,n,e,v),a.ZP.createElement(L.Z,{ariaLabel:p("AccActionPlay"),size:"tiny",ripple:!f.wB,color:"translucent-white",className:"play",onClick:m},a.ZP.createElement("i",{className:i?"icon-pause":"icon-play"})),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,K.k9)(e)} / ${(0,K.k9)(t)}`)}(t,n),e<1&&(y=e,N=s,a.ZP.createElement("div",{className:"player-file-size"},`${W(N*y)} / ${W(N)}`)),l&&a.ZP.createElement(L.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:d},a.ZP.createElement("i",{className:c?"icon-smallscreen":"icon-fullscreen"})))};function te(){return(te=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}).apply(this,arguments)}const ne=(0,a.X$)((({url:e,isGif:t,posterData:n,posterSize:s,loadProgress:r,fileSize:o,isMediaViewerOpen:i,noPlay:l,onClose:c})=>{const d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!f.$b||!f.cj),[h,Z]=(0,a.eJ)(0),[P,v]=(0,a.eJ)(!0),[g,p,E]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(H&&document[H]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(H&&document[H]))},a=()=>{s(!0)},r=()=>{s(!1),t(!1)},o=e.current;return document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),o&&(o.addEventListener("webkitbeginfullscreen",a,!1),o.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",n,!1),document.removeEventListener("webkitfullscreenchange",n,!1),document.removeEventListener("mozfullscreenchange",n,!1),o&&(o.removeEventListener("webkitbeginfullscreen",a,!1),o.removeEventListener("webkitendfullscreen",r,!1))}}),[]),H||"iOS"===f.Lt?[n,()=>{e.current&&(H||"iOS"===f.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]}(d,u),{isBuffered:C,bufferedProgress:b,bufferingHandlers:I}=(0,Y.Z)(),{shouldRender:y,transitionClassNames:N}=(0,z.Z)(!C,void 0,void 0,"slow"),{shouldRender:S,transitionClassNames:w}=(0,z.Z)(f.cj&&!m&&!y,void 0,void 0,"slow");(0,a.d4)((()=>{l||!i?d.current.pause():e&&!f.$b&&(0,j.Z)(d.current)}),[l,i,e]),(0,a.d4)((()=>{d.current.currentTime===d.current.duration?(Z(0),u(!1)):Z(d.current.currentTime)}),[h]);const k=(0,a.I4)((e=>{e.stopPropagation(),m?(d.current.pause(),u(!1)):((0,j.Z)(d.current),u(!0),f.wB&&v(!1))}),[m]);(0,V.Z)(d,[]);const M=(0,a.I4)((()=>{v(!0)}),[]),T=(0,a.I4)((()=>{v(!1)}),[]),A=(0,a.I4)((e=>{Z(e.currentTarget.currentTime)}),[]),R=(0,a.I4)((()=>{Z(0),u(!1),v(!0)}),[]),F=(0,a.I4)((()=>{g&&E?E():!g&&p&&p()}),[E,g,p]),B=(0,a.I4)((e=>{d.current.currentTime=e}),[]),D=(0,a.I4)((e=>{e.stopPropagation(),v(!P),P||(d.current.pause(),u(!1))}),[P]);(0,a.d4)((()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[k]);const x=s&&`width: ${s.width}px; height: ${s.height}px`,U=`background-image: url(${n})`;return a.ZP.createElement("div",{className:"VideoPlayer",onClick:!t&&f.wB?D:void 0,onMouseOver:t||f.$b?void 0:M,onMouseOut:t||f.$b?void 0:T},a.ZP.createElement("div",{style:x},a.ZP.createElement("video",te({ref:d,autoPlay:f.$b,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:U,onPlay:f.cj?()=>u(!0):void 0,onEnded:R,onClick:f.wB?void 0:k,onDoubleClick:F},I,{onTimeUpdate:A}),e&&a.ZP.createElement("source",{src:e}))),S&&a.ZP.createElement(L.Z,{round:!0,className:`play-button ${w}`,onClick:k},a.ZP.createElement("i",{className:"icon-play"})),y&&a.ZP.createElement("div",{className:["spinner-container",N].join(" ")},!C&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement($.Z,{size:"xl",progress:C?1:r,square:!0,onClick:c})),!t&&!y&&a.ZP.createElement(ee,{isPlayed:m,bufferedProgress:b,currentTime:h,isFullscreenSupported:Boolean(p),isFullscreen:g,fileSize:o,duration:d.current?d.current.duration:0,isForceVisible:P,isForceMobileVersion:s&&s.width<400,onSeek:B,onChangeFullscreen:F,onPlayPause:k}))})),ae=(0,a.X$)((0,s.c$)(((e,t)=>{const{chatId:n,threadId:a,messageId:s,avatarOwnerId:r,profilePhotoIndex:i,origin:l}=t;if(l===o.bZ.SearchResult){if(!n||!s)return{};const t=(0,g.hj)(e,n,s);return t?{chatId:n,messageId:s,senderId:t.senderId,origin:l,message:t,isProtected:(0,g.EV)(e,t)}:{}}if(r)return{messageId:-1,senderId:r,avatarOwner:(0,g.dy)(e,r)||(0,g.Z1)(e,r),profilePhotoIndex:i||0,origin:l};if(!(n&&a&&s))return{};let c;return c=l&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(l)?(0,g.Tm)(e,n,s):(0,g.hj)(e,n,s),c?{chatId:n,threadId:a,messageId:s,senderId:c.senderId,origin:l,message:c,isProtected:(0,g.EV)(e,c)}:{}}))((e=>{const{messageId:t,isActive:n,avatarOwner:s,chatId:i,message:c,profilePhotoIndex:d,origin:m,animationLevel:u,onClose:P,onFooterClick:g,isFooterHidden:p,isProtected:E}=e,C=c?(0,v.O$)(c):void 0,b=c?(0,v.b7)(c):void 0,S=c?(0,v.F$)(c):void 0,w=c?(0,v.Cg)(c):void 0,k=!!c&&(0,v.rl)(c),M=!!c&&(0,v.hC)(c),T=Boolean(b||w||M),L=Boolean(!T&&(C||S||k)),{isGif:A}=b||w||{},R=Boolean(s||t),F=Boolean(s),B=m===o.bZ.SharedMedia,$=m===o.bZ.SearchResult,D=2===u;function x(e){if(F&&void 0!==d){const{photos:t}=s;return t&&t[d]?`photo${t[d].id}?size=c`:(0,v.RT)(s,e?"big":"normal")}return c&&(0,v.Ti)(c,e?"viewerFull":"viewerPreview")}const U=(0,h.Z)(c&&(B||$)&&(0,v.Ti)(c,"pictogram"),void 0,r.IU.BlobUrl,void 0,D&&350),O=x(),G=(0,h.Z)(O,void 0,r.IU.BlobUrl,void 0,D&&350),{mediaData:X,loadProgress:z}=(0,Z.Z)(x(!0),void 0,c&&(0,v.kG)(c,"viewerFull"),void 0,D&&350),Y=C||b?(C||b).blobUrl:void 0;let H=!T&&(Y||X)||G||U;const V=(0,l.Z)(!H&&c&&(0,v.DH)(c));H||m===o.bZ.SearchResult||(H=V);const j=c?(0,v.c0)(c):void 0;let K;if(c?k||M?K=(0,v.aE)(c).mediaSize:C||S?K=(0,v.bV)(C||S):(b||w)&&(K=(0,v.jC)(b||w)):K=I.vY,F)return a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},se(X||G,(0,I.PA)(I.vY,!1),!f.wB&&!E));if(!c)return;const q=(0,y.X)(c),W=Boolean(q);return a.ZP.createElement("div",{className:"MediaViewerContent "+(W?"has-footer":"")},E&&a.ZP.createElement("div",{onContextMenu:N.Z,className:"protector"}),L&&se(Y||X||G||U,c&&(0,I.PA)(K,W),!f.wB&&!E),T&&(n?a.ZP.createElement(ne,{key:t,url:Y||X,isGif:A,posterData:H,posterSize:c&&(0,I.PA)(K,W,!0),loadProgress:z,fileSize:j,isMediaViewerOpen:R,noPlay:!n,onClose:P}):function(e,t,n){const s=t&&`width: ${t.width}px; height: ${t.height}px`,r=`background-image: url(${e})`;return e?a.ZP.createElement("div",{className:"VideoPlayer"},a.ZP.createElement("div",{style:s},a.ZP.createElement("video",{style:r,draggable:Boolean(n)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(J.Z,{color:"white"}))}(H,c&&(0,I.PA)(K,W,!0),!f.wB&&!E)),q&&a.ZP.createElement(_,{text:q,onClick:g,isHidden:p&&(!T||A),isForVideo:T&&!A}))})));function se(e,t,n){return e?a.ZP.createElement("img",{src:e,alt:"",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(J.Z,{color:"white"}))}function re(){return(re=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}).apply(this,arguments)}const oe=350;let ie;const le={x:0,y:0,scale:1},ce=(0,a.X$)((({messageId:e,getMessageId:t,selectMessage:n,isVideo:s,isGif:r,isPhoto:o,isOpen:i,isActive:l,hasFooter:d,...m})=>{const u=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)(le),P=(0,a.sO)(!1),v=(0,a.sO)(!0),[g,p]=(0,a.eJ)(e),E=(0,c.Z)(),[b,I]=(0,a.eJ)(!1),{isZoomed:y,onClose:N}=m,S=(0,a.I4)((e=>{Z.current=e,E()}),[E]),w=(0,a.I4)((e=>{P.current=e,E()}),[E]),k=(0,a.I4)((e=>{v.current=e,E()}),[E]),M=(0,x.Z)(350,!0),T=(0,x.Z)(500,!0),L=(0,x.Z)(800,!0),A=(0,a.I4)((()=>{f.$b&&(o||r)&&d&&I(!b)}),[d,b,r,o]);if((0,a.d4)((()=>{if(!f.$b||!u.current||y||!g)return;let e={...Z.current};const a={x:0,y:0},s={x:0,y:0},r={x:0,y:0};let o,i,l=Date.now();const c=(0,G.Ds)((()=>{l=Date.now()}),500,!1,!0);return(0,C.s)(u.current,{isNotPassive:!0,excludedClosestSelector:".VideoPlayerControls, .MediaViewerFooter",onCapture:e=>{if("touchstart"!==e.type||!("pageX"in e)||e.pageX>10&&e.pageX<window.innerWidth-10||e.preventDefault(),l=Date.now(),(0,O.Z)(Z.current,le)){if(!h.current)return;if(i=h.current.querySelector("img, video"),!i)return;o=i.getBoundingClientRect()}},onDrag:(t,n,{dragOffsetX:s,dragOffsetY:o})=>{ie&&(ie(),ie=void 0),r.x=a.x-s,r.y=a.y-o,a.x=s,a.y=o;const i=Math.abs(s),l=Math.abs(o),{scale:d,x:m,y:u}=Z.current,h=10;if(c(),1===d)return P.current||Math.abs(m)>h||i>h&&l<h?(P.current=!0,v.current=!1,void S({x:s,y:0,scale:d})):void(P.current||(Math.abs(u)>h||l>h&&i<h)&&S({x:0,y:o,scale:d}));"touches"in t&&1===t.touches.length&&S({x:e.x+s,y:e.y+o,scale:d})},onZoom:(t,{zoomFactor:n,initialCenterX:a,initialCenterY:r,dragOffsetX:o,dragOffsetY:i,currentCenterX:l,currentCenterY:c})=>{const d=Math.min(12,Math.max(e.scale*n,.6)),m=d/e.scale,u=Math.abs(Math.min(e.x,0))+a,h=Math.abs(Math.min(e.y,0))+r;s.x=l,s.y=c;const Z=u-m*u,P=h-m*h;S({x:e.x+Z+o,y:e.y+P+i,scale:d})},onDoubleClick(t,{centerX:n,centerY:a}){const s=n-3*n,r=a-3*a,{scale:o,x:i,y:l}=Z.current;if(1===o){if(0!==i||0!==l)return;e={x:s,y:r,scale:3}}else e={x:0,y:0,scale:1};return(0,U.vr)({from:[i,l,o],to:[e.x,e.y,e.scale],duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>S({x:e[0],y:e[1],scale:e[2]})})},onRelease:()=>{const c=Math.abs(Z.current.x),d=Math.abs(Z.current.y),{scale:m,x:u,y:h}=Z.current;if(m<1)return e=le,(0,U.vr)({from:[u,h,m],to:[0,0,1],duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>S({x:e[0],y:e[1],scale:e[2]})});if(m>1){if(!i||!o)return void(e={x:u,y:h,scale:m});const t=i.getBoundingClientRect(),n=Math.min(m,4),c=n/m;let d=u*c+(s.x-c*s.x),Z=h*c+(s.y-c*s.y);const P=.15;if(e.scale===m){const e=Math.abs(a.x)/(Date.now()-l),t=Math.abs(a.y)/(Date.now()-l);d-=Math.abs(a.x)*e*P*r.x,Z-=Math.abs(a.y)*t*P*r.y}if(t.width>window.innerWidth){const e=-o.left*n,t=window.innerWidth-o.right*n;d=Math.min(e,Math.max(t,d))}else d=(window.innerWidth-window.innerWidth*n)/2;if(t.height>window.innerHeight){const e=-o.top*n,t=window.innerHeight-o.bottom*n;Z=Math.min(e,Math.max(t,Z))}else Z=(window.innerHeight-window.innerHeight*n)/2;return e={x:d,y:Z,scale:n},void(ie=(0,U.vr)({from:[u,h,m],to:[d,Z,n],duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>S({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:u,y:h,scale:m},d>=50)return N();if(d>0)return(0,U.vr)({from:h,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>S({x:0,y:e,scale:m})});const P=u<0?1:-1,v=t(g,u<0?1:-1),E=r.x<0?-1:1;if(v&&c>=50&&P===E){const e=(window.innerWidth+40)*P;Z.current.x+=e,p(v),M((()=>n(v)))}T((()=>w(!1))),L((()=>k(!0))),ie=(0,U.vr)({from:Z.current.x,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>S({y:0,x:e,scale:Z.current.scale})})}})}),[y,N,S,t,g,w,k]),!g)return;const R=t(g,1),F=t(g,-1),B=Z.current.x,$=Z.current.y,{scale:D}=Z.current;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:u},F&&1===D&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(-window.innerWidth+B-40)},a.ZP.createElement(ae,re({},m,{messageId:F,isFooterHidden:b}))),g&&a.ZP.createElement("div",{className:"MediaViewerSlide "+(l?"MediaViewerSlide--active":""),onClick:A,ref:h,style:de(B,$,D)},a.ZP.createElement(ae,re({},m,{messageId:g,isActive:v.current,isFooterHidden:b||y||1!==D}))),R&&1===D&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(window.innerWidth+B+40)},a.ZP.createElement(ae,re({},m,{messageId:R,isFooterHidden:b}))))}));function de(e=0,t=0,n=1){return`transform: translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${n.toFixed(3)});`}var me=n(782);const ue=[1,0,0,1,0,0],he={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5},Ze=150,Pe=(0,a.X$)((({children:e,className:t,noWrap:n,canPan:s,zoomLevel:r,panDeltaX:o,panDeltaY:i,onPan:l})=>{const c=he[r]||r,[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)({dx:o,dy:i,x:0,y:0}),[Z,P]=(0,a.eJ)(ue),v=(0,a.sO)(null),g=(0,a.sO)(null);return(0,a.d4)((()=>{const e=c||Z[0],t=o||Z[4],n=i||Z[5],a=[...Z];Z[0]!==e&&(a[0]=e||a[0],a[3]=e||a[3]),Z[4]!==t&&(a[4]=t),Z[5]!==n&&(a[5]=n),(0,me.et)(Z,a)||P(function(e,t,n){const a=n&&n.querySelector(".Transition__slide--active img");if(!n||!a)return t;const s=n.getBoundingClientRect(),r=a.getBoundingClientRect(),o=r.width/e*t[0],i=r.height/e*t[3],l=(s.width-o)/2+t[4],c=(s.height-i)/2+t[5];return s.width&&s.width-Ze<l?t[4]-=l+s.width-Ze:o&&o+l<Ze&&(t[4]-=o+l-Ze),s.height&&s.height-Ze<c?t[5]-=c+s.height-Ze:i&&i+c<Ze&&(t[5]-=i+c-Ze),t}(Z[0],a,v.current))}),[o,i,c]),(0,a.d4)((()=>{s||P(ue)}),[s]),(0,a.d4)((()=>{g.current&&(g.current.style.transform=`matrix(${Z.toString()})`)}),[n,Z]),n?e:a.ZP.createElement("div",{ref:v,className:`pan-wrapper ${t||""}`,onMouseDown:e=>{if(!s)return;e.stopPropagation(),e.preventDefault();const t={dx:Z[4],dy:Z[5],x:e.pageX,y:e.pageY};h(t),m(!0),v.current&&v.current.classList.add("move")},onMouseUp:()=>{m(!1),v.current&&v.current.classList.remove("move"),l&&l(Z[4],Z[5])},onMouseMove:e=>{if(d){const t=function(e,t){const n=[...Z],a=u.x-e,s=u.y-t;return n[4]=u.dx-a,n[5]=u.dy-s,n}(e.pageX,e.pageY);P(t),g.current&&(g.current.style.transform=`matrix(${Z.toString()})`)}}},a.ZP.createElement("div",{ref:g,className:"pan-container"},e))}));var ve=n(2340),ge=n(172);const pe=(0,s.c$)(((e,{chatId:t,messageId:n,isAvatar:a})=>{if(a&&t)return{sender:(0,v.YC)(t)?(0,g.dy)(e,t):(0,g.Z1)(e,t)};if(!n||!t)return{};const s=(0,g.hj)(e,t,n);return{message:s,sender:s&&(0,g.Ur)(e,s)}}))((({chatId:e,messageId:t,sender:n,isAvatar:r,message:o})=>{const{closeMediaViewer:i,focusMessage:l}=(0,s.uC)(),c=(0,a.I4)((()=>{i(),l({chatId:e,messageId:t})}),[e,l,t,i]),d=(0,u.Z)();if(!n||!o&&!r)return;const m=(0,v.OU)(d,n);return a.ZP.createElement("div",{className:"SenderInfo",onClick:c},(0,v.YC)(n.id)?a.ZP.createElement(ge.Z,{key:n.id,size:"medium",user:n}):a.ZP.createElement(ge.Z,{key:n.id,size:"medium",chat:n}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},m&&(0,ve.Z)(m)),a.ZP.createElement("div",{className:"date",dir:"auto"},r?d("lng_mediaview_profile_photo"):(0,K.ZK)(d,1e3*o.date,!0))))})),Ee=({children:e,...t})=>f.$b?a.ZP.createElement("div",{className:"Transition"},a.ZP.createElement("div",{className:"Transition__slide--active"},e(!0,!0,1))):a.ZP.createElement(R.Z,t,e),Ce=(0,a.X$)((({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:n}=(0,z.Z)(e),s=(0,P.Z)(e),r=(0,a.sO)(null),[o,i]=(0,a.eJ)(1),l=(0,a.sO)(!1);(0,a.d4)((()=>{e&&!s&&i(1.5)}),[e,s]);const c=(0,a.I4)((()=>{l.current=!0}),[]),d=(0,a.I4)((()=>{l.current=!1,1===o&&t(o,!l.current)}),[t,o]);(0,a.d4)((()=>{t(o,!l.current)}),[o,t]);const m=(0,u.Z)(),h=(0,X.Z)("ZoomControls",n);return a.ZP.createElement("div",{className:h},a.ZP.createElement(L.Z,{disabled:1===o,size:"tiny",color:"translucent-white",ariaLabel:m("ZoomOut"),className:"zoom-out",ripple:!f.wB,onClick:()=>{r.current&&i(Math.max(1,o-.5))}},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement(L.Z,{disabled:3===o,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!f.wB,onClick:()=>{r.current&&i(Math.min(3,o+.5))}},a.ZP.createElement("i",{className:"icon-zoom-in"})),a.ZP.createElement("div",{className:"seekline"},a.ZP.createElement("div",{className:"seekline-track"},a.ZP.createElement("div",{className:"seekline-played",style:`width: ${50*(o-1)}%`}),a.ZP.createElement("input",{ref:r,min:1,max:3,step:"0.5",value:o,type:"range",className:"seekline-input",onChange:e=>{i(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:c,onMouseUp:d}))))})),fe=350,be=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,messageId:a,avatarOwnerId:s,profilePhotoIndex:r,origin:i}=e.mediaViewer,{animationLevel:l}=e.settings.byKey;if(i===o.bZ.SearchResult){if(!t||!a)return{animationLevel:l};const n=(0,g.hj)(e,t,a);return n?{chatId:t,messageId:a,senderId:n.senderId,origin:i,message:n,animationLevel:l}:{animationLevel:l}}if(s)return{messageId:-1,senderId:s,avatarOwner:(0,g.dy)(e,s)||(0,g.Z1)(e,s),profilePhotoIndex:r||0,animationLevel:l,origin:i};if(!(t&&n&&a))return{animationLevel:l};let c,d,m;if(c=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,g.Tm)(e,t,a):(0,g.hj)(e,t,a),!c)return{animationLevel:l};if(d=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,g.Fn)(e,t):(0,g.Zw)(e,t),i===o.bZ.Inline||i===o.bZ.Album)m=(0,g.qC)(e,t,n)||(0,g.gb)(e,t,n);else if(i===o.bZ.SharedMedia){const t=(0,g.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};m=n}return{chatId:t,threadId:n,messageId:a,senderId:c.senderId,origin:i,message:c,chatMessages:d,collectionIds:m,animationLevel:l}}))((({chatId:e,threadId:t,messageId:n,senderId:g,origin:N,avatarOwner:F,profilePhotoIndex:B,message:$,chatMessages:x,collectionIds:U,animationLevel:O})=>{const{openMediaViewer:G,closeMediaViewer:J,openForwardMenu:X,focusMessage:_}=(0,s.uC)(),z=Boolean(F||n),Y=N===o.bZ.SharedMedia,H=N===o.bZ.SearchResult,V=$?(0,v.O$)($):void 0,j=$?(0,v.b7)($):void 0,K=$?(0,v.F$)($):void 0,q=$?(0,v.Cg)($):void 0,W=!!$&&(0,v.rl)($),Q=!!$&&(0,v.hC)($),ee=Boolean(j||q||Q),{isGif:te}=j||q||{},ne=Boolean(!ee&&(V||K||W)),ae=Boolean(F),se=Boolean(K||q),re=(0,a.Ye)((()=>se&&n?[n]:(0,v.N0)(x||{},U||[],Y)),[se,n,x,U,Y]),oe=n?re.indexOf(n):-1,ie=0===oe||-1===oe,le=oe===re.length-1||-1===oe,de=(0,a.sO)(),me=(0,P.Z)(g);!z||me&&me===g&&de.current||(de.current=oe);const ue=O>=1&&!f.$b?"mv-slide":"none",he=2===O?"slide-fade":"none",Ze=2===O,[ve,ge]=(0,a.eJ)(!1),[be,Ie]=(0,a.eJ)(!1),[ye,Ne]=(0,a.eJ)(1),[Se,we]=(0,a.eJ)({x:0,y:0});function ke(e){if(ae&&void 0!==B){const{photos:t}=F;return t&&t[B]?`photo${t[B].id}?size=c`:(0,v.RT)(F,e?"big":"normal")}return $&&(0,v.Ti)($,e?"viewerFull":"viewerPreview")}const Me=(0,h.Z)($&&(Y||H)&&(0,v.Ti)($,"pictogram"),void 0,r.IU.BlobUrl,void 0,Ze&&fe),Te=ke(),Le=(0,h.Z)(Te,void 0,r.IU.BlobUrl,void 0,Ze&&fe),{mediaData:Ae}=(0,Z.Z)(ke(!0),void 0,$&&(0,v.kG)($,"viewerFull"),void 0,Ze&&fe),Re=V||j?(V||j).blobUrl:void 0;let Fe=!ee&&(Re||Ae)||Le||Me;const Be=(0,l.Z)(!Fe&&$&&(0,v.DH)($));Fe||N===o.bZ.SearchResult||(Fe=Be);const $e=$?(0,v.ep)($):ae?`avatar${F.id}-${B}.jpg`:void 0;let De;$?W||Q?De=(0,v.aE)($).mediaSize:V||K?De=(0,v.bV)(V||K):(j||q)&&(De=(0,v.jC)(j||q)):De=I.vY,(0,a.d4)((()=>{f.wB&&document.body.classList.toggle("is-media-viewer-open",z)}),[z]);const xe=(0,c.Z)();(0,a.d4)((()=>{const e=window.matchMedia(I.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",xe):"function"==typeof e.addListener&&e.addListener(xe),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",xe):"function"==typeof e.removeListener&&e.removeListener(xe)}}),[xe]);const Ue=(0,P.Z)($),Oe=(0,P.Z)(N),Ge=(0,P.Z)(F),Je=(0,P.Z)(Fe),Xe=$?(0,y.X)($):void 0,_e=Boolean(Xe);(0,a.d4)((()=>{Ze&&z&&!Ue&&!Ge&&((0,d.YW)(fe+i.fK),function(e,t,n,a,s,r){const{mediaEl:l}=M(t,r);if(!l)return;const{width:c}=b.Z.get(),{width:d,height:m}=(0,I.fM)(e,s),{width:u,height:h}=(0,I.jg)(d,m,a.width,a.height),Z=(c-u)/2,P=function(e){const t=window.matchMedia(I.L6);let n=4.125;return e&&(n+=t.matches?.875:3.375),n*I.Gw}(e)+(m-h)/2;let{top:v,left:g,width:p,height:E}=l.getBoundingClientRect();if([o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,r){if(e===t){const o=Math.max(s,r)*(e/t);a-=(o-s)/2,n-=(o-r)/2,s=o,r=o}else if(e>t){const n=s;a-=((s=r*(e/t))-n)/2}else if(t>e){const a=r;n-=((r=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:r}}(u,h,v,g,p,E);v=e.top,g=e.left,p=e.width,E=e.height}const C=g+p/2-(Z+u/2),f=v+E/2-(P+h/2),y=p/u,N=E/h,w=S(n||l);k(w,{top:`${P}px`,left:`${Z}px`,width:`${u}px`,height:`${h}px`,transform:`translate3d(${C}px, ${f}px, 0) scale(${y}, ${N})`}),T(w,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(w),requestAnimationFrame((()=>{w.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(w),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(w)&&document.body.removeChild(w),document.body.classList.remove("ghost-animating")}))}),200+i.fK)}))}))}(_e,N,Fe,De,ee,$)),Ze&&!z&&(Ue||Ge)&&((0,d.YW)(fe+i.fK),function(e,t,n){const{container:a,mediaEl:s}=M(e,n);if(!s)return;const r=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!r||!s)return;const{top:l,left:c,width:d,height:m}=r.getBoundingClientRect(),{top:u,left:h,width:Z,height:P}=s.getBoundingClientRect();let v=u;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:n}=b.Z.get();return t.top<=n&&t.top+t.height>=0}(a)){const{height:e}=b.Z.get();v=u<l?-P:e}const g=c+d/2-(h+Z/2),p=l+m/2-(v+P/2);let E=d/Z,C=m/P;const f=[o.bZ.Inline,o.bZ.ScheduledInline].includes(e)&&!w(a,s)||[o.bZ.Album,o.bZ.ScheduledAlbum].includes(e)&&!w(a,s);[o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(e)&&(E>C?E=C:C>E&&(C=E));const I=document.getElementsByClassName("ghost")[0],y=I||S(t||s,e);I||k(y,{top:`${v}px`,left:`${h}px`,width:`${Z}px`,height:`${P}px`,transform:`translate3d(${g}px, ${p}px, 0) scale(${E}, ${C})`}),requestAnimationFrame((()=>{if(I){const{top:e,left:t,width:n,height:a}=I.getBoundingClientRect();k(y,{transition:"none",top:`${v}px`,left:`${h}px`,transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-v}px, 0) scale(${n/Z}, ${a/P})`,width:`${Z}px`,height:`${P}px`})}document.body.classList.add("ghost-animating"),I||document.body.appendChild(y),requestAnimationFrame((()=>{I&&(I.style.transition=""),y.style.transform="",f&&(y.style.opacity="0"),T(y,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(y)&&document.body.removeChild(y),document.body.classList.remove("ghost-animating")}))}),200+i.fK)}))}))}(Oe,Je,Ue||void 0))}),[Ze,z,N,Oe,$,Ue,Ge,Fe,Je,De,ee,_e]),(0,a.d4)((()=>{let e;return be?ge(!0):e=window.setTimeout((()=>{ge(!1)}),fe),()=>{e&&window.clearTimeout(e)}}),[be]);const ze=()=>{Ie(!1),Ne(1),we({x:0,y:0})},Ye=(0,a.I4)((()=>{Ie(!be),Ne(be?1:1.5),be&&we({x:0,y:0})}),[be]),He=(0,a.I4)(((e,t=!1)=>{Ne(e),1===e&&t&&ze()}),[]),Ve=(0,a.I4)((()=>{J(),ze()}),[J]),je=(0,a.I4)((()=>{Ve(),_({chatId:e,threadId:t,messageId:n})}),[Ve,e,t,_,n]),Ke=(0,a.I4)((()=>{X({fromChatId:e,messageIds:[n]}),ze()}),[X,e,n]),qe=(0,a.I4)((n=>G({chatId:e,threadId:t,messageId:n,origin:N},{forceOnHeavyAnimation:!0})),[e,G,N,t]);(0,a.d4)((()=>z?(0,E.Z)((()=>{be?ze():Ve()})):void 0),[Ve,z,be]),(0,a.d4)((()=>{ee&&!te&&(0,p.Es)()}),[te,ee]),(0,a.d4)((()=>{if(z)return b.Z.disableRefresh(),()=>{b.Z.enableRefresh()}}),[z]);const We=(0,a.I4)(((e,t)=>{if(!e)return;const n=re.indexOf(e);return-1===t&&n>0||1===t&&n<re.length-1?re[n+t]:void 0}),[re]),Qe=We(n,1),et=We(n,-1),tt=(0,a.I4)(((e,t)=>{we({x:e,y:t})}),[]),nt=(0,u.Z)();function at(){return ae?a.ZP.createElement(pe,{key:F.id,chatId:F.id,isAvatar:!0}):a.ZP.createElement(pe,{key:n,chatId:e,messageId:n})}return(0,m.ZP)(z,J,G,{chatId:e,threadId:t,messageId:n,origin:N,avatarOwnerId:F&&F.id}),(0,a.d4)((()=>{if(z)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){switch(e.key){case"Left":case"ArrowLeft":qe(et);break;case"Right":case"ArrowRight":qe(Qe)}}}),[z,Qe,et,qe]),(0,a.d4)((()=>{if(be||f.$b)return;const e=document.querySelector(".MediaViewerSlide--active");if(!e)return;const t=te&&!f.cj;return(0,C.s)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:Ve})}),[Ve,te,be,n]),a.ZP.createElement(A.Z,{id:"MediaViewer",className:be?"zoomed":"",isOpen:z},(()=>a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"media-viewer-head",dir:nt.isRtl?"rtl":void 0},f.wB&&a.ZP.createElement(L.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:nt("Close"),onClick:Ve},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(R.Z,{activeKey:de.current,name:he},at),a.ZP.createElement(D,{mediaData:Ae||Le,isVideo:ee,isZoomed:be,message:$,fileName:$e,onCloseMediaViewer:Ve,onForward:Ke,onZoomToggle:Ye,isAvatar:ae})),a.ZP.createElement(Pe,{noWrap:!ve,canPan:be,panDeltaX:Se.x,panDeltaY:Se.y,zoomLevel:ye,onPan:tt},a.ZP.createElement(Ee,{activeKey:oe,name:ue},(s=>a.ZP.createElement(ce,{messageId:n,getMessageId:We,chatId:e,isPhoto:ne,isGif:te,threadId:t,avatarOwnerId:F&&F.id,profilePhotoIndex:B,origin:N,isOpen:z,hasFooter:_e,isZoomed:be,isActive:s,animationLevel:O,onClose:Ve,selectMessage:qe,onFooterClick:je})))),!ie&&!f.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${ee&&!te&&"inline"}`,"aria-label":nt("AccDescrPrevious"),dir:nt.isRtl?"rtl":void 0,onClick:()=>qe(et)}),!le&&!f.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${ee&&!te&&"inline"}`,"aria-label":nt("Next"),dir:nt.isRtl?"rtl":void 0,onClick:()=>qe(Qe)}),a.ZP.createElement(Ce,{isShown:be,onChangeZoom:He}))))})));var Ie=n(8360),ye=n(7407),Ne=n(2313),Se=n(2515),we=n(4288),ke=n(3103),Me=n(7687),Te=n(1273),Le=n(1876),Ae=n(8799),Re=n(6058);const Fe=(0,a.X$)((({isOpen:e,currentUserId:t,chatOrUserIds:n,filterRef:s,filter:r,filterPlaceholder:o,onFilterChange:i,onClose:l,loadMore:c,onSelectChatOrUser:d})=>{const m=(0,u.Z)(),[h,Z]=(0,ye.Z)(c,n,Boolean(r)),P=(0,a.I4)((()=>{i("")}),[i]);(0,Se.Z)(s,e,P);const g=(0,a.sO)(null),p=(0,a.I4)((e=>{i(e.currentTarget.value)}),[i]),E=(0,Ne.Z)(g,e,(e=>{h&&h.length>0&&d(h[-1===e?0:e])}),".ListItem-button",!0),C=a.ZP.createElement("div",{className:"modal-header",dir:m.isRtl?"rtl":void 0},a.ZP.createElement(L.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Me.Z,{ref:s,value:r,onChange:p,onKeyDown:E,placeholder:o}));return a.ZP.createElement(ke.Z,{isOpen:e,onClose:l,className:"ChatOrUserPicker",header:C},null!=h&&h.length?a.ZP.createElement(Te.Z,{className:"picker-list custom-scroll",items:h,onLoadMore:Z,noScrollRestore:Boolean(r),ref:g,onKeyDown:E},h.map((e=>a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>d(e)},(0,v.YC)(e)?a.ZP.createElement(Re.Z,{status:e===t?m("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Ae.Z,{chatId:e}))))):h&&!h.length?a.ZP.createElement("p",{className:"no-results"},m("lng_blocked_list_not_found")):a.ZP.createElement(we.Z,null))})),Be=(0,a.X$)((0,s.c$)((e=>{var t;const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=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:r}}))((({chatsById:e,activeListIds:t,archivedListIds:n,pinnedIds:o,contactIds:i,currentUserId:l,isOpen:c})=>{const{setForwardChatId:d,exitForwardMode:m,loadMoreChats:h}=(0,s.uC)(),Z=(0,u.Z)(),[P,g]=(0,a.eJ)(""),p=(0,a.sO)(null),E=(0,a.Ye)((()=>{if(!c)return;let a=o||[];l&&(a=(0,me.Tw)([l,...a]));const d=[...t||[],...n||[]].filter((t=>{const n=e[t];return n&&(0,v.Qm)(n,r._f)})),m=(0,s.Rd)().users.byId;return(0,v.ih)((0,me.Tw)([...(0,v.$l)(Z,d,e,P,l),...i?(0,v.kK)(i,m,P):[]]),e,void 0,a)}),[t,n,e,i,l,P,c,Z,o]),C=(0,a.I4)((e=>{d({id:e})}),[d]),f=(0,Ie.Z)(E);return a.ZP.createElement(Fe,{currentUserId:l,isOpen:c,chatOrUserIds:f,filterRef:p,filterPlaceholder:Z("ForwardTo"),filter:P,onFilterChange:g,loadMore:h,onSelectChatOrUser:C,onClose:m})})));var $e=n(1947),De=n(706);function xe(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Ue=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["dialogs"])))((({dialogs:e})=>{const{dismissDialog:t,acceptInviteConfirmation:n,sendMessage:r}=(0,s.uC)(),[o,i,l]=(0,De.Z)(),c=(0,u.Z)();var d,m,h;if((0,a.d4)((()=>{e.length>0&&i()}),[e,i]),e.length)return a.ZP.createElement("div",{id:"Dialogs"},Boolean(e.length)&&("hash"in(d=e[e.length-1])?(e=>{const{hash:s,title:r,about:i,participantsCount:d,isChannel:m,photo:u,isRequestNeeded:h}=e,P=c(m?"Subscribers":"Members",d,"i"),v=c(m?"ChannelJoin":"JoinGroup"),g=c(m?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup");return a.ZP.createElement(ke.Z,{isOpen:o,onClose:l,className:"error",header:Z(r,u),onCloseAnimationEnd:t},i&&a.ZP.createElement("p",{className:"modal-about"},(0,ve.Z)(i)),void 0!==d&&a.ZP.createElement("p",null,P),h&&a.ZP.createElement("p",{className:"modal-help"},c(m?"MemberRequests.RequestToJoinDescriptionChannel":"MemberRequests.RequestToJoinDescriptionGroup")),a.ZP.createElement(L.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{n({hash:s}),l()}},h?g:v),a.ZP.createElement(L.Z,{isText:!0,className:"confirm-dialog-button",onClick:l},c("Cancel")))})(d):"phoneNumber"in d?(m=d,a.ZP.createElement(ke.Z,{isOpen:o,onClose:l,className:"confirm",title:c("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:t},c("AreYouSureShareMyContactInfoBot"),a.ZP.createElement("div",null,a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:()=>{r({contact:(0,me.ei)(m,["firstName","lastName","phoneNumber"])}),l()}},c("OK")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:l},c("Cancel"))))):(h=d,a.ZP.createElement(ke.Z,{isOpen:o,onClose:l,onCloseAnimationEnd:t,className:"error",title:xe(h)},h.hasErrorKey?(0,$e.ZP)(h):(0,ve.Z)(h.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(L.Z,{isText:!0,onClick:l},c("OK")))))));function Z(e,t){return a.ZP.createElement("div",{className:"modal-header"},t&&a.ZP.createElement(ge.Z,{size:"small",photo:t}),a.ZP.createElement("div",{className:"modal-title"},(0,ve.Z)(e)),a.ZP.createElement(L.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:c("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})))}})));var Oe=n(6937);const Ge=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["notifications"])))((({notifications:e})=>{const{dismissNotification:t}=(0,s.uC)();if(e.length)return a.ZP.createElement("div",{id:"Notifications"},e.map((({message:e,localId:n})=>a.ZP.createElement(Oe.Z,{message:(0,ve.Z)(e,["emoji","br","links","simple_markdown"]),onDismiss:()=>t({localId:n})}))))})));var Je=n(1396),Xe=n(7551);const _e=(0,a.X$)((({url:e})=>{const{toggleSafeLinkModal:t}=(0,s.uC)(),n=(0,u.Z)(),r=(0,a.I4)((()=>{window.open((0,Je.X)(e)),t({url:void 0})}),[t,e]),o=(0,a.I4)((()=>{t({url:void 0})}),[t]),i=(0,Ie.Z)(e);return a.ZP.createElement(Xe.Z,{isOpen:Boolean(e),onClose:o,title:n("OpenUrlTitle"),textParts:(0,ve.Z)(n("OpenUrlAlert2",i),["links"]),confirmLabel:n("OpenUrlTitle"),confirmHandler:r})})),ze=2147483647e3,Ye=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function He(e,t,n,a,s){const r=new Date(e,t,n),o=a&&(0,K.$Y)(a),i=s&&(0,K.$Y)(s);return!!(i&&r>i)||!!(o&&r<o)}function Ve(e){return String(e).padStart(2,"0")}function je(e,t,n){return`${e}-${t+1}-${n}`}const Ke=(0,a.X$)((({selectedAt:e,minAt:t,maxAt:n,isFutureMode:s,isPastMode:r,isOpen:o,withTimePicker:i,submitButtonLabel:l,secondButtonLabel:c,onClose:d,onSubmit:m,onSecondButtonClick:h})=>{const Z=(0,u.Z)(),v=new Date,g=(0,a.Ye)((()=>s&&!t?new Date:new Date(Math.max(t||0,0))),[s,t]),p=(0,a.Ye)((()=>r&&!n?new Date:new Date(Math.min(n||ze,ze))),[r,n]),E=(0,a.Ye)((()=>e?new Date(e):new Date),[e]),C=(0,P.Z)(o),[f,b,I]=(0,De.Z)(!1),[y,N]=(0,a.eJ)(E),[S,w]=(0,a.eJ)(new Date(y.getFullYear(),y.getMonth(),1)),[k,M]=(0,a.eJ)(Ve(E.getHours())),[T,A]=(0,a.eJ)(Ve(E.getMinutes())),R=je(y.getFullYear(),y.getMonth(),y.getDate()),F=S.getFullYear(),B=S.getMonth();(0,a.d4)((()=>{!C&&o&&(N(E),w(new Date(E.getFullYear(),E.getMonth(),1)),i&&(M(Ve(E.getHours())),A(Ve(E.getMinutes()))))}),[E,o,C,i]),(0,a.d4)((()=>{s&&!f&&y.getTime()<g.getTime()&&(N(g),M(Ve(g.getHours())),A(Ve(g.getMinutes())))}),[s,f,g,y]),(0,a.d4)((()=>{r&&!f&&y.getTime()>p.getTime()&&(N(p),M(Ve(p.getHours())),A(Ve(p.getMinutes())))}),[s,r,f,p,g,y]),(0,a.d4)((()=>{if(e){const t=new Date(e);N(t),M(Ve(t.getHours())),A(Ve(t.getMinutes()))}}),[e]);const $=r&&F>=v.getFullYear()&&B>=v.getMonth()||p&&F>=p.getFullYear()&&B>=p.getMonth(),D=s&&F<=v.getFullYear()&&B<=v.getMonth(),{prevMonthGrid:x,currentMonthGrid:U,nextMonthGrid:O}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],r=new Date;r.setDate(1),r.setMonth(t),r.setFullYear(e);const o=r.getDay(),i=new Date(e,t,0).getDate();for(let e=1;e<o;e++)n.push(i-o+e+1);for(;r.getMonth()===t;){const e=r.getDate();a.push(e),r.setDate(e+1)}const l=(a.length+n.length)%7;if(l>0)for(let e=1;e<=7-l;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(F,B)),[B,F]),G=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return M(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(y.getTime());a.setHours(n),N(a);const s=Ve(n);M(s),e.target.value=s}),[y]),J=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return A(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(y.getTime());a.setMinutes(n),N(a);const s=Ve(n);A(s),e.target.value=s}),[y]);return a.ZP.createElement(ke.Z,{isOpen:o,onClose:d,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:d},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,Z(`lng_month${B+1}`)," ",F),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",disabled:D,onClick:D?void 0:function(){w((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",disabled:$,onClick:$?void 0:function(){w((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"},Ye.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,Z(e))))),x.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),U.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void N((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(B),n.setFullYear(F),n}));var t},className:(0,X.Z)("day-button",He(F,B,e,g,p)?"disabled":e?"clickable":"",R===je(F,B,e)&&"selected")},!!e&&a.ZP.createElement("span",null,e)))),O.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),i&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:k,onChange:G,onFocus:b,onBlur:I}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:T,onChange:J,onFocus:b,onBlur:I})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(L.Z,{onClick:function(){m(y)}},l||function(e,t){const n=(0,K.xH)(t,e.code);return n===(0,K.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,K.mr)(e,t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,K.mr)(e,t)])}(Z,y)),c&&a.ZP.createElement(L.Z,{onClick:h,isText:!0},c)))})),qe=(0,a.X$)((0,s.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})))((({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:n,closeHistoryCalendar:r}=(0,s.uC)(),o=(0,a.I4)((e=>{n({timestamp:e.valueOf()/1e3}),r()}),[r,n]),i=(0,u.Z)();return a.ZP.createElement(Ke,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:i("JumpToDate"),onClose:r,onSubmit:o})}))),We=(0,a.X$)((0,s.c$)(((e,{message:t,isSchedule:n})=>{const{threadId:a}=(0,g.Bt)(e)||{},{canDeleteForAll:s}=a&&(0,g._k)(e,t,a)||{},r=(0,g.Z1)(e,t.chatId);return{canDeleteForAll:!n&&s,contactName:r&&(0,v.YC)(r.id)?(0,v.Vl)((0,g.dy)(e,(0,v.zX)(r))):void 0,willDeleteForCurrentUserOnly:r&&(0,v.G9)(r)&&!s,willDeleteForAll:r&&(0,v.ZV)(r)}}))((({isOpen:e,isSchedule:t,message:n,album:r,canDeleteForAll:o,contactName:i,willDeleteForCurrentUserOnly:l,willDeleteForAll:c,onClose:d})=>{const{deleteMessages:m,deleteScheduledMessages:h}=(0,s.uC)(),Z=(0,a.I4)((()=>{const e=null!=r&&r.messages?r.messages.map((({id:e})=>e)):[n.id];m({messageIds:e,shouldDeleteForAll:!0}),d()}),[m,n.id,d,r]),P=(0,a.I4)((()=>{const e=null!=r&&r.messages?r.messages.map((({id:e})=>e)):[n.id];t?h({messageIds:e}):m({messageIds:e,shouldDeleteForAll:!1}),d()}),[r,n.id,t,d,h,m]),v=(0,u.Z)();return a.ZP.createElement(ke.Z,{isOpen:e,onClose:d,onEnter:e&&!o?P:void 0,className:"delete",title:v("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,v("AreYouSureDeleteSingleMessage")),l&&a.ZP.createElement("p",null,v("lng_delete_for_me_chat_hint",1,"i")),c&&a.ZP.createElement("p",null,v("lng_delete_for_everyone_hint",1,"i")),o&&a.ZP.createElement(L.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},i&&(0,ve.Z)(v("Conversation.DeleteMessagesFor",i)),!i&&v("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(L.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:P},v(o?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},v("Cancel")))}))),Qe=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.YC)(t),a=(0,g.FM)(e,t),s=(0,g.Z1)(e,t),r=!!s&&(0,v.eA)(s),o=!!s&&(0,v.G9)(s),i=!!s&&(0,v.ZV)(s);return{isPrivateChat:n,isChatWithSelf:a,isChannel:r,isGroup:o,isSuperGroup:i,canPinForAll:n&&!a||i||o,contactName:s&&(0,v.YC)(s.id)?(0,v.Vl)((0,g.dy)(e,(0,v.zX)(s))):void 0}}))((({isOpen:e,messageId:t,chatId:n,isChannel:r,isGroup:o,isSuperGroup:i,canPinForAll:l,contactName:c,onClose:d})=>{const{pinMessage:m}=(0,s.uC)(),h=(0,a.I4)((()=>{m({chatId:n,messageId:t,isUnpin:!1}),d()}),[m,n,t,d]),Z=(0,a.I4)((()=>{m({chatId:n,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),d()}),[n,t,d,m]),P=(0,u.Z)();return a.ZP.createElement(ke.Z,{isOpen:e,onClose:d,className:"pin",title:P("PinMessageAlertTitle")},a.ZP.createElement("p",null,P(r?"PinMessageAlertChannel":o||i?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:Z},P("DialogPin")),l&&a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:h},c?(0,ve.Z)(P("Conversation.PinMessagesFor",c)):P("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},P("Cancel")))}))),et=(0,a.X$)((({isOpen:e,pinnedMessagesCount:t=0,onClose:n,onUnpin:s})=>{const r=(0,u.Z)();return a.ZP.createElement(ke.Z,{isOpen:e,onClose:n,className:"unpin-all",title:r("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,r("Chat.UnpinAllMessagesConfirmation",t,"i")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},r("DialogUnpin")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},r("Cancel")))}));var tt=n(517);const nt=(0,a.X$)((0,s.c$)(((e,{isSchedule:t})=>{const{messageIds:n}=e.selectedMessages||{},{canDeleteForAll:a}=(0,g.xl)(e),s=(0,g.jr)(e);return{selectedMessageIds:n,canDeleteForAll:!t&&a,contactName:s&&(0,v.YC)(s.id)?(0,v.Vl)((0,g.dy)(e,(0,v.zX)(s))):void 0,willDeleteForCurrentUserOnly:s&&(0,v.G9)(s)&&!a,willDeleteForAll:s&&(0,v.ZV)(s)}}))((({isOpen:e,isSchedule:t,selectedMessageIds:n,canDeleteForAll:r,contactName:o,willDeleteForCurrentUserOnly:i,willDeleteForAll:l,onClose:c})=>{const{deleteMessages:d,deleteScheduledMessages:m,exitMessageSelectMode:h}=(0,s.uC)(),Z=(0,P.Z)(e),v=(0,a.I4)((()=>{c(),d({messageIds:n,shouldDeleteForAll:!0})}),[d,n,c]),g=(0,a.I4)((()=>{t?m({messageIds:n}):d({messageIds:n,shouldDeleteForAll:!1}),c()}),[t,c,m,n,d]),p=(0,u.Z)();if((0,a.d4)((()=>{!e&&Z&&h()}),[h,e,Z]),n)return a.ZP.createElement(ke.Z,{isOpen:e,onClose:c,onEnter:r?void 0:g,className:"delete",title:p("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,p("AreYouSureDeleteFewMessages")),i&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),l&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),r&&a.ZP.createElement(L.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:v},o?(0,ve.Z)(p("ChatList.DeleteForEveryone",o)):p("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(L.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:g},p(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},p("Cancel")))})));var at=n(4434);const st=(0,a.X$)((({isOpen:e,messageIds:t,onClose:n})=>{const{reportMessages:r,exitMessageSelectMode:o}=(0,s.uC)(),[i,l]=(0,a.eJ)("spam"),[c,d]=(0,a.eJ)(""),m=()=>{r({messageIds:t,reason:i,description:c}),o(),n()},h=(0,a.I4)((e=>{l(e)}),[]),Z=(0,a.I4)((e=>{d(e.target.value)}),[]),P=(0,u.Z)(),v=[{value:"spam",label:P("lng_report_reason_spam")},{value:"violence",label:P("lng_report_reason_violence")},{value:"pornography",label:P("lng_report_reason_pornography")},{value:"childAbuse",label:P("lng_report_reason_child_abuse")},{value:"copyright",label:P("ReportPeer.ReasonCopyright")},{value:"other",label:P("lng_report_reason_other")}];if(t)return a.ZP.createElement(ke.Z,{isOpen:e,onClose:n,onEnter:e?m:void 0,className:"report",title:P("lng_report_message_title")},a.ZP.createElement(at.Z,{name:"report-message",options:v,onChange:h,selected:i}),a.ZP.createElement(Me.Z,{label:P("lng_report_reason_description"),value:c,onChange:Z}),a.ZP.createElement(L.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:m},P("lng_report_button")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},P("Cancel")))})),rt=(0,a.X$)((0,s.c$)((e=>{const{type:t,chatId:n}=(0,g.Bt)(e)||{},{canDelete:a}=(0,g.xl)(e),s=(0,g.nB)(e),r=(0,g.Nu)(e),{messageIds:o}=e.selectedMessages||{},i=!!n&&(0,g.ku)(e,n,o);return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,g.D7)(e),canDeleteMessages:a,canReportMessages:s,canDownloadMessages:r,selectedMessageIds:o,hasProtectedMessage:i}}))((({canPost:e,isActive:t,messageListType:n,isSchedule:r,selectedMessagesCount:o,canDeleteMessages:i,canReportMessages:l,canDownloadMessages:c,hasProtectedMessage:d,selectedMessageIds:m})=>{const{exitMessageSelectMode:h,openForwardMenuForSelectedMessages:Z,downloadSelectedMessages:v}=(0,s.uC)(),[g,p,E]=(0,De.Z)(),[C,f,b]=(0,De.Z)();(0,a.d4)((()=>!t||g||C?void 0:(0,tt.Z)({onBackspace:p,onDelete:p,onEsc:h})),[t,g,C,p,h]);const I=(0,a.I4)((()=>{v(),h()}),[v,h]),y=(0,P.Z)(o||void 0,!0),N=t?o:y,S=(0,u.Z)(),w=S("VoiceOver.Chat.MessagesSelected",N,"i"),k=(0,X.Z)("MessageSelectToolbar",e&&"with-composer",t&&"shown"),M=(e,t,n,s,r)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,X.Z)("item",s&&"disabled",r&&"destructive"),onClick:s?void 0:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:k},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(L.Z,{color:"translucent",round:!0,onClick:h,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:w},w),!!o&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==n&&M("forward",S("Chat.ForwardActionHeader"),Z,d),l&&M("flag",S("Conversation.ReportMessages"),f),c&&M("download",S("lng_media_download"),I,d),M("delete",S("EditAdminGroupDeleteMessages"),p,!i,!0))),a.ZP.createElement(nt,{isOpen:g,isSchedule:r,onClose:E}),a.ZP.createElement(st,{isOpen:C,onClose:b,messageIds:m}))}))),ot=(0,a.X$)((0,s.c$)((e=>{var t;const{chatId:n,messageId:a}=e.seenByModal||{};return n&&a?{memberIds:null===(t=(0,g.hj)(e,n,a))||void 0===t?void 0:t.seenByUserIds}:{}}))((({isOpen:e,memberIds:t})=>{const{openChat:n,closeSeenByModal:r}=(0,s.uC)(),o=(0,u.Z)(),i=(0,a.I4)((e=>{r(),setTimeout((()=>{n({id:e})}),100)}),[r,n]),l=(0,Ie.Z)(t,!0);return a.ZP.createElement(ke.Z,{isOpen:e,onClose:r,className:"narrow",title:"Which users read the message"},a.ZP.createElement("div",{dir:o.isRtl?"rtl":void 0},l&&l.map((e=>a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>i(e)},a.ZP.createElement(Re.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},o("Close")))})));var it=n(2155),lt=n(8198);const ct=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,messageId:n}=e.reactorModal||{},a=t&&n?(0,g.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}}))((({isOpen:e,reactors:t,reactions:n,chatId:r,messageId:i,seenByUserIds:l})=>{const{loadReactors:c,closeReactorListModal:d,openChat:m}=(0,s.uC)(),h=(0,s.Rd)().users.byId,Z=(0,u.Z)(),[P,g,p]=(0,De.Z)(!1),[E,C]=(0,a.eJ)(void 0),f=t&&n&&t.count>=10&&n.results.length>1,b=(0,a.sO)();(0,a.d4)((()=>{P&&!e&&(p(),C(void 0))}),[P,e,p]);const I=(0,a.I4)((()=>{b.current&&m({id:b.current}),d()}),[d,m]),y=(0,a.I4)((()=>{g()}),[g]),N=(0,a.I4)((e=>{b.current=e,y()}),[y]),S=(0,a.I4)((()=>{c({chatId:r,messageId:i})}),[r,c,i]),w=(0,a.Ye)((()=>null!=t&&t.reactions?(0,me.Tw)(t.reactions.map((e=>e.reaction))):[]),[null==t?void 0:t.reactions]),k=(0,a.Ye)((()=>E?null==t?void 0:t.reactions.filter((e=>e.reaction===E)).map((e=>e.userId)):(0,me.Tw)((null==t?void 0:t.reactions.map((e=>e.userId)).concat(l||[]))||[])),[E,null==t?void 0:t.reactions,l]),[M,T]=(0,ye.Z)(S,k,t&&void 0===t.nextOffset);return(0,a.d4)((()=>{null==T||T({direction:o.Uq.Backwards})}),[T]),a.ZP.createElement(ke.Z,{isOpen:e&&!P,onClose:y,className:"ReactorListModal narrow",title:Z("Reactions"),onCloseAnimationEnd:I},f&&a.ZP.createElement("div",{className:"Reactions"},a.ZP.createElement(L.Z,{className:(0,X.Z)(!E&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(void 0)},a.ZP.createElement("i",{className:"icon-reaction-filled"}),(null==t?void 0:t.count)&&(0,it.bi)(t.count)),w.map((e=>{var t;const s=null==n||null===(t=n.results.find((t=>t.reaction===e)))||void 0===t?void 0:t.count;return a.ZP.createElement(L.Z,{className:(0,X.Z)(E===e&&"chosen"),size:"tiny",ripple:!0,onClick:()=>C(e)},a.ZP.createElement(lt.Z,{reaction:e,className:"reaction-filter-emoji"}),s&&(0,it.bi)(s))}))),a.ZP.createElement("div",{dir:Z.isRtl?"rtl":void 0},null!=M&&M.length?a.ZP.createElement(Te.Z,{className:"reactor-list custom-scroll",items:M,onLoadMore:T},null==M?void 0:M.map((e=>{var n;const s=h[e],r=(0,v.Js)(s),o=null==t||null===(n=t.reactions.find((t=>t.userId===e)))||void 0===n?void 0:n.reaction;return a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable reactors-list-item",onClick:()=>N(e)},a.ZP.createElement(ge.Z,{user:s,size:"medium"}),a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,ve.Z)(r))),o&&a.ZP.createElement(lt.Z,{className:"reactors-list-emoji",reaction:o}))}))):a.ZP.createElement(we.Z,null)),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:d},Z("Close")))})));var dt=n(7324),mt=n(7799);const ut=(0,a.X$)((0,s.c$)(((e,{emojiInteraction:t})=>{const n=void 0!==t.animatedEffect&&(0,g.tH)(e,t.animatedEffect);return{effectAnimationId:n?n.id:void 0,localEffectAnimation:!n&&t.animatedEffect&&Object.keys(dt.x).includes(t.animatedEffect)?t.animatedEffect:void 0,isReversed:t.isReversed}}))((({emojiInteraction:e,effectAnimationId:t,localEffectAnimation:n,isReversed:o})=>{const{stopActiveEmojiInteraction:i}=(0,s.uC)(),[l,c]=(0,De.Z)(!1),[m,u]=(0,De.Z)(!1),Z=(0,a.I4)((()=>{c(),setTimeout((()=>{i()}),250)}),[c,i]);(0,a.d4)((()=>(document.addEventListener("touchstart",Z),document.addEventListener("touchmove",Z),document.addEventListener("mousedown",Z),document.addEventListener("wheel",Z),()=>{document.removeEventListener("touchstart",Z),document.removeEventListener("touchmove",Z),document.removeEventListener("mousedown",Z),document.removeEventListener("wheel",Z)})),[Z]),(0,a.bt)((()=>{const e=(0,d.YW)();setTimeout((()=>{Z(),e()}),3e3)}),[Z]);const P=(0,h.Z)(`sticker${t}`,!t,r.IU.Lottie),[v,g]=(0,a.eJ)();(0,a.d4)((()=>{n&&(0,dt.Z)(n).then((e=>{g(e)}))}),[n]);const p=(e.startSize||0)/240;return a.ZP.createElement("div",{className:(0,X.Z)("EmojiInteractionAnimation",l&&"hiding",m&&"playing",o&&"reversed"),style:`--scale: ${p}; --start-x: ${e.x}px; --start-y: ${e.y}px;`},a.ZP.createElement(mt.Z,{id:`effect_${t}`,size:240,animationData:v||P,play:m,isLowPriority:f.wZ,forceOnHeavyAnimation:!0,noLoop:!0,onLoad:u}))})));var ht=n(3133),Zt=n(735),Pt=n(1470);const vt=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))),[n]),t};var gt=n(329),pt=n(742);const Et=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),a=n&&(0,v.zX)(n);return{chat:n,user:a?(0,g.dy)(e,a):void 0,isPinned:(0,g.ep)(e,t),isMuted:n?(0,v.i4)(n,(0,g.dZ)(e),(0,g.NJ)(e)):void 0}}))((({chatId:e,chat:t,user:n,isPinned:s,isMuted:r,withUsername:o,onClick:i})=>{const[l,c,d]=(0,De.Z)(),[m,u,h]=(0,De.Z)(),Z=(0,Pt.Z)({chat:t,user:n,isPinned:s,isMuted:r,handleDelete:c,handleChatFolderChange:u},!0),P=()=>{i(e)},g=vt(P);if(t)return a.ZP.createElement(Le.Z,{className:"chat-item-clickable search-result",onClick:P,contextActions:Z,buttonRef:g},(0,v.YC)(e)?a.ZP.createElement(Re.Z,{userId:e,withUsername:o,avatarSize:"large"}):a.ZP.createElement(Ae.Z,{chatId:e,withUsername:o,avatarSize:"large"}),a.ZP.createElement(gt.Z,{isOpen:l,onClose:d,chat:t}),a.ZP.createElement(pt.Z,{isOpen:m,onClose:h,chatId:e}))})));var Ct=n(8781);const ft=(0,G.P2)((e=>e()),6e4,!0),bt=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}))((({topUserIds:e,usersById:t,recentlyFoundChatIds:n,onReset:r})=>{const{loadTopUsers:o,loadContactList:i,openChat:l,addRecentlyFoundChatId:c,clearRecentlyFoundChats:d}=(0,s.uC)(),m=(0,a.sO)(null);(0,a.d4)((()=>{ft((()=>{o(),i()}))}),[o,i]),(0,Ct.Z)(m.current,!e);const h=(0,a.I4)((e=>{l({id:e,shouldReplaceHistory:!0}),r(),setTimeout((()=>{c({id:e})}),250)}),[l,c,r]),Z=(0,u.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},e&&a.ZP.createElement("div",{className:"top-peers-section",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:m,className:"top-peers no-selection"},e.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>h(e),dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(ge.Z,{user:t[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,ve.Z)((0,v.Vl)(t[e])||" "))))))),n&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:Z.isRtl?"rtl":void 0},Z("Recent"),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:d,isRtl:Z.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),n.map((e=>a.ZP.createElement(Et,{chatId:e,onClick:h})))))})));var It=n(9411),yt=n(8033);const Nt=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t);if(!n)return{};const a=(0,v.zX)(n);return{chat:n,lastSyncTime:e.lastSyncTime,...a&&{privateChatUser:(0,g.dy)(e,a)}}}))((({message:e,searchQuery:t,chatId:n,chat:r,privateChatUser:o,lastSyncTime:i})=>{const{focusMessage:l}=(0,s.uC)(),c=(0,v.DH)(e),d=(0,h.Z)((0,v.Ti)(e,"micro")),m=Boolean((0,v.Y5)(e)),Z=(0,a.I4)((()=>{l({chatId:n,messageId:e.id})}),[n,l,e.id]),P=(0,u.Z)(),g=vt(Z);if(r)return a.ZP.createElement(Le.Z,{className:"ChatMessage chat-item-clickable",ripple:!f.wB,onClick:Z,buttonRef:g},a.ZP.createElement(ge.Z,{chat:r,user:o,isSavedMessages:null==o?void 0:o.isSelf,lastSyncTime:i}),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,ve.Z)((0,v.U)(P,r,o))),r.isVerified&&a.ZP.createElement(It.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(yt.Z,{className:"date"},(0,K.VX)(P,1e3*e.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,r){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:r?"round":void 0}),(0,v.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,ve.Z)((0,v.MK)(e,t,!0),["emoji","highlight"],{highlight:s})):(0,ve.Z)((0,v.MK)(e,t))}(P,e,d||c,t,m)))))}))),St=(0,a.X$)((({searchDate:e,onSelect:t})=>{const n=(0,a.Ye)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,K.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,K.xH)(a)})}return t}(e)),[e]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},n.map((({date:e,text:n})=>a.ZP.createElement("div",{onClick:()=>t(e),className:"date-item",key:n},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,n)))))}));var wt=n(7262),kt=n(9187);const Mt=(0,G.P2)((e=>e()),500,!0),Tt=(0,a.X$)((0,s.c$)((e=>{var t;const{byId:n}=e.chats,{userIds:a}=e.contactList||{};if(!a)return{chatsById:n};const{currentUserId:s,messages:r,lastSyncTime:o}=e,{fetchingStatus:i,globalResults:l,localResults:c,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=l||{},{chatIds:h,userIds:Z}=c||{},{byChatId:P}=r;return{currentUserId:s,localContactIds:a,localChatIds:h,localUserIds:Z,globalChatIds:m,globalUserIds:u,foundIds:null==d||null===(t=d.text)||void 0===t?void 0:t.foundIds,globalMessagesByChatId:P,chatsById:n,fetchingStatus:i,lastSyncTime:o}}))((({searchQuery:e,searchDate:t,dateSearchQuery:n,currentUserId:r,localContactIds:i,localChatIds:l,localUserIds:c,globalChatIds:d,globalUserIds:m,foundIds:h,globalMessagesByChatId:Z,chatsById:P,fetchingStatus:g,lastSyncTime:p,onReset:E,onSearchDateSelect:C})=>{const{openChat:b,addRecentlyFoundChatId:I,searchMessagesGlobal:y,setGlobalSearchChatId:N}=(0,s.uC)(),S=(0,u.Z)(),[w,k]=(0,a.eJ)(!1),[M,T]=(0,a.eJ)(!1),L=(0,a.I4)((({direction:t})=>{p&&t===o.Uq.Backwards&&Mt((()=>{y({type:"text",query:e})}))}),[p,y,e]),A=(0,a.I4)((e=>{b({id:e,shouldReplaceHistory:!0}),e!==r&&I({id:e}),f.wB||E()}),[r,b,I,E]),R=(0,a.I4)((e=>{N({id:e})}),[N]),F=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return Zt.D;const t=[...r?[r]:[],...i||[]],n=(0,s.Rd)().users.byId,a=(0,v.kK)(t,n,e,r,S("SavedMessages"));return[...(0,v.ih)((0,me.Tw)([...a||[],...l||[],...c||[]]),P,void 0,r?[r]:void 0)]}),[e,r,i,S,l,c,P]),B=(0,a.Ye)((()=>!e||e.length<4||!d||!m?Zt.D:(0,v.ih)((0,me.Tw)([...d,...m]),P,!0)),[P,d,m,e]),$=(0,a.Ye)((()=>(e||t)&&h&&0!==h.length?h.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)):Zt.D),[h,Z,e,t]),D=(0,a.I4)((()=>{k(!w)}),[w]),x=(0,a.I4)((()=>{T(!M)}),[M]),U=g&&!g.chats&&!g.messages&&!F.length&&!B.length&&!$.length;return e||t?a.ZP.createElement(Te.Z,{className:"LeftSearch custom-scroll",items:$,onLoadMore:L,noScrollRestoreOnTop:!0,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(St,{searchDate:n,onSelect:C})),U&&a.ZP.createElement(wt.Z,{text:S("ChatList.Search.NoResults"),description:S("ChatList.Search.NoResultsDescription")}),!!F.length&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:S.isRtl?"rtl":void 0},F.map((e=>a.ZP.createElement(kt.Z,{chatOrUserId:e,onClick:R,clickArg:e})))),!!F.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},F.length>5&&a.ZP.createElement(yt.Z,{onClick:D},S(w?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),S("DialogList.SearchSectionDialogs")),F.map(((e,t)=>{if(w||!(t>=5))return a.ZP.createElement(Et,{chatId:e,onClick:A})}))),!!B.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},B.length>5&&a.ZP.createElement(yt.Z,{onClick:x},S(M?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),S("DialogList.SearchSectionGlobal")),B.map(((e,t)=>{if(M||!(t>=5))return a.ZP.createElement(Et,{chatId:e,withUsername:!0,onClick:A})}))),!!$.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},S("SearchMessages")),$.map((function(t){const n=(0,v.MK)(S,t),s=P[t.chatId];if(n&&s)return a.ZP.createElement(Nt,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(bt,{onReset:E})}))),Lt=(0,G.P2)((e=>e()),500,!0),At=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:r,resultsByType:o}=e.globalSearch,{foundIds:i}=(null==o?void 0:o.text)||{};return{currentUserId:n,foundIds:i,globalMessagesByChatId:a,chatsById:t,fetchingStatus:r,lastSyncTime:s}}))((({searchQuery:e,currentUserId:t,dateSearchQuery:n,foundIds:r,globalMessagesByChatId:i,chatsById:l,fetchingStatus:c,lastSyncTime:d,onSearchDateSelect:m})=>{const{searchMessagesGlobal:h}=(0,s.uC)(),Z=(0,u.Z)(),P=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&Lt((()=>{h({type:"text",query:e,chatId:t})}))}),[t,d,h,e]),g=(0,a.Ye)((()=>r&&0!==r.length?r.map((e=>{var t;const[n,a]=e.split("_");return null==i||null===(t=i[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Zt.D),[r,i]),p=c&&!c.chats&&!c.messages&&!g.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content custom-scroll chat-list",items:g,onLoadMore:P,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(St,{searchDate:n,onSelect:m})),p&&a.ZP.createElement(wt.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),!!g.length&&g.map((function(t){const n=(0,v.MK)(Z,t),s=l[t.chatId];if(n&&s)return a.ZP.createElement(Nt,{chatId:t.chatId,message:t,searchQuery:e})}))))})));function Rt(e){return(t,n)=>{var a,s;const{byId:r}=t.chats,{byId:o}=t.users,{fetchingStatus:i,resultsByType:l,chatId:c}=t.globalSearch,d="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:m}=t.messages,u=null==l||null===(a=l[d])||void 0===a?void 0:a.foundIds,h=t.activeDownloads.byChatId;return{theme:(0,g.Pu)(t),isLoading:void 0===u||!!i&&Boolean(i.chats||i.messages),chatsById:r,usersById:o,globalMessagesByChatId:m,foundIds:u,searchChatId:c,activeDownloads:h,isChatProtected:c?null===(s=(0,g.Z1)(t,c))||void 0===s?void 0:s.isProtected:void 0,lastSyncTime:t.lastSyncTime}}}var Ft=n(7891),Bt=n(3709);const $t="media",Dt=(0,G.P2)((e=>e()),500,!0),xt=(0,a.X$)((0,s.c$)(Rt($t))((({searchQuery:e,searchChatId:t,isLoading:n,globalMessagesByChatId:r,foundIds:l,lastSyncTime:c,isChatProtected:d})=>{const{searchMessagesGlobal:m,openMediaViewer:h}=(0,s.uC)(),Z=(0,u.Z)(),P=(0,a.I4)((({direction:n})=>{c&&n===o.Uq.Backwards&&Dt((()=>{m({type:$t,query:e,chatId:t})}))}),[c,m,e,t]),v=(0,a.Ye)((()=>l&&r?l.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):Zt.D),[r,l]),g=(0,a.I4)(((e,t)=>{h({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[h]),p=(0,Ft.Z)([e],i.Y)&&!n,E=p&&l&&l.length>0&&!e,C=p&&l&&l.length>0&&e,f=(0,X.Z)("search-content custom-scroll",C&&"chat-list");return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:f,items:v,itemSelector:e?".ListItem":".Media",onLoadMore:P,noFastList:!0},!p&&a.ZP.createElement(we.Z,null),p&&(!l||0===l.length)&&a.ZP.createElement(wt.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),E&&a.ZP.createElement("div",{className:"media-list",dir:Z.isRtl?"rtl":void 0},v.map((e=>a.ZP.createElement(Bt.Z,{key:e.id,idPrefix:"search-media",message:e,isProtected:d||e.isProtected,onClick:g})))),C&&v.map((e=>a.ZP.createElement(Nt,{key:e.id,chatId:e.chatId,message:e})))))})));var Ut=n(91),Ot=n(5418);const Gt="links",Jt=(0,G.P2)((e=>e()),500,!0),Xt=(0,a.X$)((0,s.c$)(Rt(Gt))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:r,usersById:l,globalMessagesByChatId:c,foundIds:d,lastSyncTime:m,isChatProtected:h})=>{const{searchMessagesGlobal:Z,focusMessage:P}=(0,s.uC)(),v=(0,u.Z)(),g=(0,a.I4)((({direction:n})=>{m&&n===o.Uq.Backwards&&Jt((()=>{Z({type:Gt,query:e,chatId:t})}))}),[m,Z,e,t]),p=(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):Zt.D),[c,d]),E=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),C=(0,Ft.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:g,noFastList:!0},!C&&a.ZP.createElement(we.Z,null),C&&(!d||0===d.length)&&a.ZP.createElement(wt.Z,{text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),C&&d&&d.length>0&&p.map(((e,t)=>{const n=0===t||(0,K.kj)(e.date)!==(0,K.kj)(p[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:v.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:v.isRtl?"rtl":void 0},(0,K.np)(v,new Date(1e3*e.date))),a.ZP.createElement(Ot.Z,{key:e.id,message:e,senderTitle:(0,Ut.F)(v,e,r,l),isProtected:h||e.isProtected,onMessageClick:E}))}))))})));var _t=n(2535);const zt="documents",Yt=(0,G.P2)((e=>e()),500,!0),Ht=(0,a.X$)((0,s.c$)(Rt(zt))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:r,usersById:l,globalMessagesByChatId:c,foundIds:d,activeDownloads:m,lastSyncTime:h})=>{const{searchMessagesGlobal:Z,focusMessage:P}=(0,s.uC)(),g=(0,u.Z)(),p=(0,a.I4)((({direction:n})=>{h&&n===o.Uq.Backwards&&Yt((()=>{Z({type:zt,query:e,chatId:t})}))}),[h,Z,e,t]),E=(0,a.Ye)((()=>d&&c?d.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=c[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,v.aE)(s)?s:void 0})).filter(Boolean):Zt.D),[c,d]),C=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),f=(0,Ft.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:p,noFastList:!0},!f&&a.ZP.createElement(we.Z,null),f&&(!d||0===d.length)&&a.ZP.createElement(wt.Z,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),f&&d&&d.length>0&&E.map(((e,t)=>{var n;const s=0===t||(0,K.kj)(e.date)!==(0,K.kj)(E[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},s&&a.ZP.createElement("p",{className:"section-heading"},(0,K.np)(g,new Date(1e3*e.date))),a.ZP.createElement(_t.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,Ut.F)(g,e,r,l),className:"scroll-item",onDateClick:C,isDownloading:null===(n=m[e.chatId])||void 0===n?void 0:n.includes(e.id)}))}))))})));var Vt=n(4752);const jt=(0,G.P2)((e=>e()),500,!0),Kt=(0,a.X$)((0,s.c$)(Rt("audio"))((({theme:e,isVoice:t,searchQuery:n,searchChatId:r,isLoading:l,chatsById:c,usersById:d,globalMessagesByChatId:m,foundIds:h,lastSyncTime:Z,activeDownloads:P})=>{const{searchMessagesGlobal:v,focusMessage:g,openAudioPlayer:p}=(0,s.uC)(),E=(0,u.Z)(),C=t?"voice":"audio",f=(0,a.I4)((({direction:e})=>{Z&&e===o.Uq.Backwards&&jt((()=>{v({type:C,query:n,chatId:r})}))}),[C,Z,v,n,r]),b=(0,a.Ye)((()=>h&&m?h.map((e=>{var t;const[n,a]=e.split("_");return null===(t=m[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):Zt.D),[m,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]),N=(0,Ft.Z)([n],i.Y)&&!l;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Te.Z,{className:"search-content documents-list custom-scroll",items:b,onLoadMore:f,noFastList:!0},!N&&a.ZP.createElement(we.Z,null),N&&(!h||0===h.length)&&a.ZP.createElement(wt.Z,{text:E("ChatList.Search.NoResults"),description:E("ChatList.Search.NoResultsDescription")}),N&&h&&h.length>0&&b.map(((t,n)=>{var s;const r=0===n||(0,K.kj)(t.date)!==(0,K.kj)(b[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:t.id},r&&a.ZP.createElement("p",{className:"section-heading",dir:E.isRtl?"rtl":void 0},(0,K.np)(E,new Date(1e3*t.date))),a.ZP.createElement(Vt.Z,{key:t.id,theme:e,message:t,origin:o.Cr.Search,senderTitle:(0,Ut.F)(E,t,c,d),date:t.date,lastSyncTime:Z,className:"scroll-item",onPlay:y,onDateClick:I,isDownloading:null===(s=P[t.chatId])||void 0===s?void 0:s.includes(t.id)}))}))))}))),qt=[{type:o.nJ.ChatList,title:"SearchAllChatsShort"},{type:o.nJ.Media,title:"SharedMediaTab2"},{type:o.nJ.Links,title:"SharedLinksTab2"},{type:o.nJ.Files,title:"SharedFilesTab2"},{type:o.nJ.Music,title:"SharedMusicTab2"},{type:o.nJ.Voice,title:"SharedVoiceTab2"}],Wt=[{type:o.nJ.ChatList,title:"All Messages"},...qt.slice(1)],Qt=Object.keys(o.nJ).length/2,en=(0,a.X$)((0,s.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}))((({searchQuery:e,searchDate:t,isActive:n,currentContent:r=o.nJ.ChatList,chatId:i,onReset:l})=>{const{setGlobalSearchContent:c,setGlobalSearchDate:d}=(0,s.uC)(),h=(0,u.Z)(),[Z,P]=(0,a.eJ)(r),v=(0,a.Ye)((()=>(0,K.xk)(e)),[e]),g=(0,a.I4)((e=>{const t=qt[e];c({content:t.type}),P(e)}),[c]),p=(0,a.I4)((e=>{d({date:e.getTime()/1e3})}),[d]);(0,m.ZP)(n,l,void 0,void 0,!0);const E=(0,a.sO)(null),C=(0,Ne.Z)(E,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:E,onKeyDown:C},a.ZP.createElement(ht.Z,{activeTab:Z,tabs:i?Wt:qt,onSwitchTab:g}),a.ZP.createElement(R.Z,{name:h.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:Qt,activeKey:r},(()=>{switch(r){case o.nJ.ChatList:return i?a.ZP.createElement(At,{searchQuery:e,dateSearchQuery:v,onReset:l,onSearchDateSelect:p}):a.ZP.createElement(Tt,{searchQuery:e,searchDate:t,dateSearchQuery:v,onReset:l,onSearchDateSelect:p});case o.nJ.Media:return a.ZP.createElement(xt,{searchQuery:e});case o.nJ.Links:return a.ZP.createElement(Xt,{searchQuery:e});case o.nJ.Files:return a.ZP.createElement(Ht,{searchQuery:e});case o.nJ.Music:return a.ZP.createElement(Kt,{key:"audio",searchQuery:e});case o.nJ.Voice:return a.ZP.createElement(Kt,{key:"voice",isVoice:!0,searchQuery:e});default:return}})))})));var tn=n(1090);const nn={currentPassword:"",password:"",hint:"",email:""},an=(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 nn;default:return e}},sn=(0,a.X$)((({currentScreen:e,editedFolderId:t,onReset:n,onSaveFilter:r,onScreenSelect:i})=>{const{signOut:l,deleteChatFolder:c}=(0,s.uC)(),[d,m]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),P=(0,a.I4)((()=>{m(!0)}),[]),v=(0,a.I4)((()=>{m(!1)}),[]),g=(0,a.I4)((()=>{Z(!0)}),[]),p=(0,a.I4)((()=>{Z(!1)}),[]),E=(0,a.I4)((()=>{v(),l()}),[v,l]),C=(0,a.I4)((()=>{p(),c({id:t}),n()}),[t,p,c,n]),b=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(L.Z,{round:!0,ripple:!f.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]),I=(0,u.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:I("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case o.MT.EditProfile:return a.ZP.createElement("h3",null,I("lng_settings_information"));case o.MT.General:return a.ZP.createElement("h3",null,I("General"));case o.MT.QuickReaction:return a.ZP.createElement("h3",null,I("DoubleTapSetting"));case o.MT.Notifications:return a.ZP.createElement("h3",null,I("Notifications"));case o.MT.DataStorage:return a.ZP.createElement("h3",null,I("DataSettings"));case o.MT.Privacy:return a.ZP.createElement("h3",null,I("PrivacySettings"));case o.MT.Language:return a.ZP.createElement("h3",null,I("Language"));case o.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,I("ChatBackground"));case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,I("SetColor"));case o.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,I("PrivacyPhone"));case o.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,I("PrivacyLastSeen"));case o.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,I("Privacy.ProfilePhoto"));case o.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,I("PrivacyForwards"));case o.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,I("AutodownloadGroupChats"));case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement("h3",null,I("AlwaysShareWith"));case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement("h3",null,I("NeverShareWith"));case o.MT.PrivacyActiveSessions:return a.ZP.createElement("h3",null,I("SessionsTitle"));case o.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,I("BlockedUsers"));case o.MT.TwoFaDisabled:case o.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,I("TwoStepVerification"));case o.MT.TwoFaNewPassword:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,I("PleaseEnterCurrentPassword"));case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,I("PleaseReEnterPassword"));case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,I("PasswordHint"));case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,I("RecoveryEmailTitle"));case o.MT.TwoFaNewPasswordEmailCode:case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case o.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,I("TwoStepVerificationPasswordSet"));case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,I("PleaseEnterCurrentPassword"));case o.MT.Folders:return a.ZP.createElement("h3",null,I("Filters"));case o.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,I("FilterNew"));case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,I("FilterEdit")),t&&a.ZP.createElement(F.Z,{className:"settings-more-menu",trigger:b,positionX:"right"},a.ZP.createElement(B.Z,{icon:"delete",destructive:!0,onClick:g},I("Delete"))));case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},e===o.MT.FoldersIncludedChats||e===o.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,I("FilterInclude")):a.ZP.createElement("h3",null,I("FilterExclude")),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:r,ariaLabel:I("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,I("SETTINGS")),a.ZP.createElement(L.Z,{round:!0,ripple:!f.wB,size:"smaller",color:"translucent",onClick:()=>i(o.MT.EditProfile),ariaLabel:I("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(F.Z,{className:"settings-more-menu",trigger:b,positionX:"right"},a.ZP.createElement(B.Z,{icon:"logout",onClick:P},I("LogOutTitle"))))}}(),a.ZP.createElement(Xe.Z,{isOpen:d,onClose:v,text:I("lng_sure_logout"),confirmLabel:I("AccountSettings.Logout"),confirmHandler:E,confirmIsDestructive:!0}),a.ZP.createElement(Xe.Z,{isOpen:h,onClose:p,text:I("FilterDeleteAlert"),confirmLabel:I("Delete"),confirmHandler:C,confirmIsDestructive:!0}))}));var rn=n(787),on=n(180);const ln=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{currentUser:t?(0,g.dy)(e,t):void 0,lastSyncTime:n}}))((({isActive:e,onScreenSelect:t,onReset:n,currentUser:r,lastSyncTime:i})=>{const{loadProfilePhotos:l}=(0,s.uC)(),c=(0,u.Z)(),d=null==r?void 0:r.id;return(0,a.d4)((()=>{d&&i&&l({profileId:d})}),[i,d,l]),(0,m.ZP)(e,n,t,o.MT.Main),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},r&&a.ZP.createElement(rn.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement(on.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Le.Z,{icon:"settings",onClick:()=>t(o.MT.General)},c("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Le.Z,{icon:"unmute",onClick:()=>t(o.MT.Notifications)},c("Notifications")),a.ZP.createElement(Le.Z,{icon:"lock",onClick:()=>t(o.MT.Privacy)},c("PrivacySettings")),a.ZP.createElement(Le.Z,{icon:"data",onClick:()=>t(o.MT.DataStorage)},c("DataSettings")),a.ZP.createElement(Le.Z,{icon:"folder",onClick:()=>t(o.MT.Folders)},c("Filters")),a.ZP.createElement(Le.Z,{icon:"language",onClick:()=>t(o.MT.Language)},c("Language"))))})));var cn=n(710),dn=n(1151);const mn="https://t.me/",un=/https:\/\/t\.me\/?/i,hn=/^([a-zA-Z0-9_]+)$/,Zn=(0,G.Ds)((e=>e()),250,!1),Pn=(0,a.X$)((({currentUsername:e,asLink:t,isLoading:n,isUsernameAvailable:s,checkUsername:r,onChange:o})=>{const[i,l]=(0,a.eJ)(e||""),c=(0,u.Z)(),d=t?"SetUrl":"Username",m=c(t?"SetUrlPlaceholder":"Username"),[h,Z]=(0,a.Ye)((()=>i.length?i.length<5?[void 0,`${m} is too short`]:i.length>32?[void 0,`${m} is too long`]:hn.test(i)?void 0===s?[]:[s?c(`${d}Available`,"Username"):void 0,!1===s?c(`${d}InUse`):void 0]:[void 0,`${m} contains invalid characters`]:[]),[i,s,c,d,m]);(0,a.d4)((()=>{l(e||"")}),[t,e]);const P=(0,a.I4)((e=>{const n=e.target.value.trim().replace(un,"");l(n),e.target.value=`${t?mn:""}${n}`;const a=function(e){return e.length>=5&&e.length<=32&&hn.test(e)}(n);a&&Zn((()=>{r({username:n})})),o&&o(!!a&&n)}),[t,r,o]);return a.ZP.createElement(Me.Z,{value:`${t?mn:""}${i}`,onChange:P,label:m,error:Z,success:h,readOnly:n})})),vn=(0,G.P2)((e=>e()),6e4,!0),gn="Please provide your first name",pn="Bio can' be longer than 70 characters",En=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,g.dy)(e,t):void 0;if(!s)return{progress:n,isUsernameAvailable:a};const{firstName:r,lastName:o,username:i,fullInfo:l}=s,{bio:c}=l||{};return{currentAvatarHash:(0,v.RT)(s),currentFirstName:r,currentLastName:o,currentBio:c,currentUsername:i,progress:n,isUsernameAvailable:a}}))((({isActive:e,onScreenSelect:t,onReset:n,currentAvatarHash:i,currentFirstName:l,currentLastName:c,currentBio:d,currentUsername:Z,progress:P,isUsernameAvailable:v})=>{const{loadCurrentUser:g,updateProfile:p,checkUsername:E}=(0,s.uC)(),C=(0,u.Z)(),[f,b]=(0,a.eJ)(!1),[I,y]=(0,a.eJ)(!1),[N,S]=(0,a.eJ)(),[w,k]=(0,a.eJ)(),[M,T]=(0,a.eJ)(l||""),[L,A]=(0,a.eJ)(c||""),[R,F]=(0,a.eJ)(d||""),[B,$]=(0,a.eJ)(Z||""),D=(0,h.Z)(i,!1,r.IU.BlobUrl),x=P===o.rN.InProgress,U=!1===B,O=(0,a.Ye)((()=>!U&&(Boolean(w)||I||!0===v)),[w,I,U,v]);(0,m.ZP)(e,n,t,o.MT.EditProfile),(0,a.d4)((()=>{vn((()=>{g()}))}),[g]),(0,a.d4)((()=>{k(void 0)}),[D]),(0,a.d4)((()=>{T(l||""),A(c||""),F(d||"")}),[l,c,d]),(0,a.d4)((()=>{$(Z||"")}),[Z]),(0,a.d4)((()=>{P===o.rN.Complete&&(y(!1),b(!1),S(void 0))}),[P]);const G=(0,a.I4)((e=>{k(e)}),[]),X=(0,a.I4)((e=>{T(e.target.value),y(!0)}),[]),_=(0,a.I4)((e=>{A(e.target.value),y(!0)}),[]),z=(0,a.I4)((e=>{F(e.target.value),y(!0)}),[]),Y=(0,a.I4)((e=>{$(e),b(!0)}),[]),H=(0,a.I4)((()=>{const e=M.trim(),t=L.trim(),n=R.trim();e.length?n.length>70?S(pn):p({photo:w,...I&&{firstName:e,lastName:t,bio:n},...f&&{username:B}}):S(gn)}),[w,M,L,R,I,B,f,p]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile"},a.ZP.createElement(cn.Z,{currentAvatarBlobUrl:D,onChange:G,title:"Edit your profile photo",disabled:x}),a.ZP.createElement(Me.Z,{value:M,onChange:X,label:C("FirstName"),disabled:x,error:N===gn?N:void 0}),a.ZP.createElement(Me.Z,{value:L,onChange:_,label:C("LastName"),disabled:x}),a.ZP.createElement(Me.Z,{value:R,onChange:z,label:C("UserBio"),disabled:x,error:N===pn?N:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:C.isRtl?"rtl":void 0},(0,ve.Z)(C("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("Username")),a.ZP.createElement(Pn,{currentUsername:B||"",isLoading:x,isUsernameAvailable:v,checkUsername:E,onChange:Y}),a.ZP.createElement("p",{className:"settings-item-description",dir:C.isRtl?"rtl":void 0},(0,ve.Z)(C("UsernameHelp"),["br","simple_markdown"])),B&&a.ZP.createElement("p",{className:"settings-item-description",dir:C.isRtl?"rtl":void 0},C("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},"https://t.me/",B)))),a.ZP.createElement(dn.Z,{isShown:O,onClick:H,disabled:x,ariaLabel:"Save changes"},x?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var Cn=n(4605),fn=n(8051);const bn=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])))((({isActive:e,onScreenSelect:t,onReset:n,canAutoLoadPhotoFromContacts:r,canAutoLoadPhotoInPrivateChats:l,canAutoLoadPhotoInGroups:c,canAutoLoadPhotoInChannels:d,canAutoLoadVideoFromContacts:h,canAutoLoadVideoInPrivateChats:Z,canAutoLoadVideoInGroups:P,canAutoLoadVideoInChannels:v,canAutoLoadFileFromContacts:g,canAutoLoadFileInPrivateChats:p,canAutoLoadFileInGroups:E,canAutoLoadFileInChannels:C,canAutoPlayGifs:f,canAutoPlayVideos:b,autoLoadFileMaxSizeMb:I})=>{const{setSettingOption:y}=(0,s.uC)(),N=(0,u.Z)();(0,m.ZP)(e,n,t,o.MT.General);const S=(0,a.I4)((e=>N("AutodownloadSizeLimitUpTo",N("FileSize.MB",String(i.by[e]),"i"))),[N]),w=(0,a.I4)((e=>{y({autoLoadFileMaxSizeMb:i.by[e]})}),[y]);function k(e,t,n,s,r,o){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},e),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>y({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>y({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.GroupChats"),checked:r,onCheck:e=>y({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(Cn.Z,{label:N("AutoDownloadSettings.Channels"),checked:o,onCheck:e=>y({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=i.by.indexOf(I);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(fn.Z,{label:N("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:S,onChange:w}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},k(N("AutoDownloadPhotosTitle"),"Photo",r,l,c,d),k(N("AutoDownloadVideosTitle"),"Video",h,Z,P,v),k("Auto-download files","File",g,p,E,C),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("AutoplayMedia")),a.ZP.createElement(Cn.Z,{label:N("GifsTab2"),checked:f,onCheck:e=>y({canAutoPlayGifs:e})}),a.ZP.createElement(Cn.Z,{label:N("DataAndStorage.Autoplay.Videos"),checked:b,onCheck:e=>y({canAutoPlayVideos:e})})))}))),In=(0,G.P2)((e=>e()),6e4,!0),yn=(0,a.X$)((0,s.c$)((e=>{const{chats:{listIds:t,byId:n},users:{byId:a}}=e,{orderedIds:s,byId:r,recommended:o}=e.chatFolders;return{allListIds:t,chatsById:n,usersById:a,orderedFolderIds:s,foldersById:r,recommendedChatFolders:o,notifySettings:(0,g.dZ)(e),notifyExceptions:(0,g.NJ)(e)}}))((({isActive:e,allListIds:t,chatsById:n,usersById:r,orderedFolderIds:l,foldersById:c,recommendedChatFolders:d,notifySettings:h,notifyExceptions:Z,onCreateFolder:P,onEditFolder:g,onScreenSelect:p,onReset:E})=>{const{loadRecommendedChatFolders:C,addChatFolder:f,showDialog:b}=(0,s.uC)(),[I,y]=(0,a.eJ)(),[N,S]=(0,a.eJ)(!1),w=(0,a.I4)((()=>S(!0)),[]);(0,a.d4)((()=>{I||(0,dt.Z)("FoldersAll").then(y)}),[I]),(0,a.d4)((()=>{In((()=>{C()}))}),[C]);const k=(0,a.I4)((()=>{Object.keys(c).length>=10?b({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):P()}),[c,b,P]),M=(0,u.Z)();(0,m.ZP)(e,E,p,o.MT.Folders);const T=(0,a.Ye)((()=>{if(l)return l.map((e=>{const a=c[e];return{id:a.id,title:a.title,subtitle:(0,v.SB)(M,t,n,r,a,h,Z)}}))}),[M,t,c,n,r,l,h,Z]),A=(0,a.I4)((e=>{Object.keys(c).length>=10?b({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):f({folder:e})}),[c,f,b]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},I&&a.ZP.createElement(mt.Z,{id:"settingsFoldersMain",size:i.ku,animationData:I,play:N,noLoop:!0,onLoad:w})),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},M("CreateNewFilterInfo")),a.ZP.createElement(L.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:k,isRtl:M.isRtl},a.ZP.createElement("i",{className:"icon-add"}),M("CreateNewFilter"))),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("Filters")),null!=T&&T.length?T.map((e=>a.ZP.createElement(Le.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>g(c[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):T&&!T.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(we.Z,null)),d&&!!d.length&&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("FilterRecommended")),d.map((e=>a.ZP.createElement(Le.Z,{className:"mb-2",narrow:!0,onClick:()=>A(e)},a.ZP.createElement("div",{className:"settings-folders-recommended-item"},a.ZP.createElement("div",{className:"multiline-item"},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement(L.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:M.isRtl},M("Add"))))))))})));var Nn=n(3455);const Sn=({count:e,itemName:t,itemPluralName:n,isLoading:s,onClick:r})=>{const o=(0,u.Z)();return a.ZP.createElement(L.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:s,isRtl:o.isRtl,onClick:r},a.ZP.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?n||`${t}s`:t)},wn="Please provide a title for this folder.",kn="ChatList.Filter.Error.Empty",Mn=(0,a.X$)((0,s.c$)((e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}}))((({state:e,dispatch:t,onAddIncludedChats:n,onAddExcludedChats:r,isActive:l,onScreenSelect:c,onReset:d,onBack:h,loadedActiveChatIds:Z,loadedArchivedChatIds:P})=>{const{editChatFolder:g,addChatFolder:p,loadMoreChats:E}=(0,s.uC)(),[C,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(!1),y=(0,a.I4)((()=>I(!0)),[]),[N,S]=(0,a.eJ)(!1),[w,k]=(0,a.eJ)(!1),{selectedChatIds:M,selectedChatTypes:T}=(0,Nn.vb)(e,"included"),{selectedChatIds:L,selectedChatTypes:A}=(0,Nn.vb)(e,"excluded");(0,a.d4)((()=>{C||(0,dt.Z)("FoldersNew").then(f)}),[C]),(0,a.d4)((()=>{S(!1),k(!1)}),[e.folderId]);const[R,F]=(0,a.Ye)((()=>{const e=new Set([...Z||[],...P||[]]),t=(0,me.eL)(M,e),n=(0,me.eL)(L,e);return[N?t:t.slice(0,5-T.length),w?n:n.slice(0,5-A.length)]}),[L,M,T,A,w,N,Z,P]);(0,a.d4)((()=>{(R.length<M.length||F.length<L.length)&&E({listType:"active"})}),[E,L.length,M.length,F.length,R.length]);const B=(0,u.Z)();function $(e){const t="included"===e?T:A,n="included"===e?R:F,s="included"===e?N:w,r=("included"===e?M:L).length-t.length-n.length,o="included"===e?()=>S(!0):()=>k(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?Nn.fi.find((({key:t})=>t===e)):Nn.Yy.find((({key:t})=>t===e));if(n)return a.ZP.createElement(Le.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},B(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Le.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,v.YC)(e)?a.ZP.createElement(Re.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Ae.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(Sn,{count:r,itemName:"chat",onClick:o}))}return(0,m.ZP)(l,h,c,"edit"===e.mode?o.MT.FoldersEditFolder:o.MT.FoldersCreateFolder),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},C&&a.ZP.createElement(mt.Z,{id:"settingsFoldersEdit",size:i.ku,animationData:C,play:b&&String(e.folderId),noLoop:!0,onLoad:y})),"create"===e.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:B.isRtl?"rtl":void 0},B("FilterIncludeInfo")),a.ZP.createElement(Me.Z,{className:"mb-0",label:B("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:n}=e;t({type:"setTitle",payload:n.value.trim()})},error:e.error&&e.error===wn?wn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===kn&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:B.isRtl?"rtl":void 0},B(e.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterInclude")),a.ZP.createElement(Le.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:n},B("FilterAddChats")),$("included")),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterExclude")),a.ZP.createElement(Le.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:r},B("FilterAddChats")),$("excluded"))),a.ZP.createElement(dn.Z,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:n}=e.folder;n?M.length||Object.keys(T).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?g({id:e.folderId,folderUpdate:e.folder}):p({folder:e.folder}),setTimeout((()=>{d()}),500)):t({type:"setError",payload:kn}):t({type:"setError",payload:wn})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var Tn=n(5765);const Ln=(0,a.X$)((({mode:e,chatIds:t,selectedIds:n,selectedChatTypes:s,filterValue:r,onSelectedIdsChange:o,onSelectedChatTypesChange:i,onFilterChange:l,onLoadMore:c})=>{const d=(0,a.sO)(null),m="included"===e?Nn.fi:Nn.Yy,h=n.length+s.length>10,Z=n.length>=100;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{d.current.focus()}))}),500)}),[]);const P=(0,a.I4)((e=>{const t=[...n];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),o(t)}),[n,o]),g=(0,a.I4)((e=>{const t=[...s];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),i(t)}),[s,i]),p=(0,a.I4)((e=>{const{value:t}=e.currentTarget;l(t)}),[l]),E=(0,u.Z)(),[C,f]=(0,ye.Z)(c,t,Boolean(r));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},s.map((function(e){const t=m.find((({key:t})=>e===t));if(t)return a.ZP.createElement(kt.Z,{icon:t.icon,title:E(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(kt.Z,{chatOrUserId:e,isMinimized:h&&t<n.length-5,canClose:!0,onClick:P,clickArg:e}))),Z?a.ZP.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):a.ZP.createElement(Me.Z,{ref:d,value:r,onChange:p,placeholder:E("Search")})),a.ZP.createElement(Te.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:C,onLoadMore:f},(!C||!C.length||C.includes(t[0]))&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{key:"header1",className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("FilterChatTypes")),m.map((function(e){return a.ZP.createElement(Le.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>g(e.key),ripple:!0},a.ZP.createElement("i",{className:`icon-${e.icon}`}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},E(e.title)),a.ZP.createElement(Cn.Z,{label:"",checked:s.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:E.isRtl?"rtl":void 0},E("FilterChats"))),null!=C&&C.length?C.map((function(e){const t=n.includes(e);return a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>P(e),ripple:!0,disabled:!t&&Z},(0,v.YC)(e)?a.ZP.createElement(Re.Z,{userId:e}):a.ZP.createElement(Ae.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(Cn.Z,{label:"",checked:t,round:!0}))})):C&&!C.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(we.Z,{key:"loading"})))})),An=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t,listIds:n,orderedPinnedIds:a}}=e;return{chatsById:t,listIds:n.active,orderedPinnedIds:a.active,archivedPinnedIds:a.archived,archivedListIds:n.archived}}))((({isActive:e,onScreenSelect:t,onReset:n,mode:r,state:i,dispatch:l,chatsById:c,listIds:d,orderedPinnedIds:h,archivedListIds:Z,archivedPinnedIds:P})=>{const{loadMoreChats:g}=(0,s.uC)(),{chatFilter:p}=i,{selectedChatIds:E,selectedChatTypes:C}=(0,Nn.vb)(i,r,!0),f=(0,u.Z)(),b=(0,a.Ye)((()=>{const e=d?(0,v.O)(c,d,h,"all"):void 0,t=Z?(0,v.O)(c,Z,P,"archived"):void 0;if(e||t)return[...(null==e?void 0:e.pinnedChats)||[],...(null==e?void 0:e.otherChats)||[],...(null==t?void 0:t.otherChats)||[]]}),[c,d,h,Z,P]),I=(0,a.Ye)((()=>{if(b)return b.filter((e=>!p||(0,Tn.Z)((0,v.U)(f,e),p)||E.includes(e.id))).map((({id:e})=>e))}),[b,p,f,E]),y=(0,a.I4)((e=>{l({type:"setChatFilter",payload:e})}),[l]),N=(0,a.I4)((e=>{l("included"===r?{type:"setIncludeFilters",payload:{...i.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...i.excludeFilters,excludedChatIds:e}})}),[r,i,l]),S=(0,a.I4)((e=>{const t={};e.forEach((e=>{t[e]=!0})),l("included"===r?{type:"setIncludeFilters",payload:{includedChatIds:E,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:E,...t}})}),[r,E,l]);return(0,m.ZP)(e,n,t,"included"===r?o.MT.FoldersIncludedChats:o.MT.FoldersExcludedChats),I?a.ZP.createElement(Ln,{mode:r,chatIds:I,selectedIds:E,selectedChatTypes:C,filterValue:p,onSelectedIdsChange:N,onSelectedChatTypesChange:S,onFilterChange:y,onLoadMore:g}):a.ZP.createElement(we.Z,null)}))),Rn=(0,a.X$)((({currentScreen:e,shownScreen:t,state:n,dispatch:s,isActive:r,onScreenSelect:i,onReset:l})=>{const c=(0,a.I4)((()=>{e!==o.MT.FoldersCreateFolder&&e!==o.MT.FoldersEditFolder&&e!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),e!==o.MT.FoldersIncludedChats&&e!==o.MT.FoldersExcludedChats?l():"create"===n.mode?i(o.MT.FoldersCreateFolder):i(o.MT.FoldersEditFolder)}),[n.mode,s,e,l,i]),d=(0,a.I4)((()=>{s({type:"reset"}),i(o.MT.FoldersCreateFolder)}),[i,s]),m=(0,a.I4)((e=>{s({type:"editFolder",payload:e}),i(o.MT.FoldersEditFolder)}),[s,i]),u=(0,a.I4)((()=>{s({type:"editIncludeFilters"}),i(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersIncludedChatsFromChatList:o.MT.FoldersIncludedChats)}),[e,s,i]),h=(0,a.I4)((()=>{s({type:"editExcludeFilters"}),i(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersExcludedChatsFromChatList:o.MT.FoldersExcludedChats)}),[e,s,i]);switch(e){case o.MT.Folders:return a.ZP.createElement(yn,{onCreateFolder:d,onEditFolder:m,onScreenSelect:i,isActive:r||[o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onReset:l});case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(Mn,{state:n,dispatch:s,onAddIncludedChats:u,onAddExcludedChats:h,onReset:c,onScreenSelect:i,isActive:r||[o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onBack:l});case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(An,{mode:"included",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(An,{mode:"excluded",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});default:return}}));var Fn=n(711),Bn=n(3657),$n=n(692);const Dn=(0,a.X$)((({size:e=i.DC,stickerSet:t,observeIntersection:n})=>{const s=(0,a.sO)(null),o=(0,Bn.Op)(s,n),l=`stickerSet${t.id}`,c=(0,h.Z)(l,!o,r.IU.Lottie),d=(0,$n.Z)(c),m=(0,a.Ye)((()=>{if(!c)return(0,it.Xv)(t.title,2)}),[c,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},m,c&&a.ZP.createElement(mt.Z,{id:l,size:e,animationData:c,className:d}))})),xn=(0,a.X$)((({stickerSet:e,observeIntersection:t})=>{const n=(0,a.sO)(null),s=(0,Bn.Op)(n,t),r=(0,h.Z)(e.hasThumbnail&&`stickerSet${e.id}`,!s),o=(0,$n.Z)(r),i=(0,a.Ye)((()=>{if(!r)return(0,it.Xv)(e.title,2)}),[r,e.title]);return a.ZP.createElement("div",{ref:n,className:"sticker-set-cover"},i,a.ZP.createElement("img",{src:r,className:o,alt:""}))}));var Un=n(3547);const On=(0,a.X$)((({stickerSet:e,observeIntersection:t,onClick:n})=>{var s;const r=(0,u.Z)();if(!e||!e.stickers)return;const o=null===(s=e.stickers)||void 0===s?void 0:s[0];return e.hasThumbnail||!o?a.ZP.createElement(Le.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!o,onClick:()=>o&&n(o)},a.ZP.createElement(L.Z,{ariaLabel:e.title,color:"translucent",isRtl:r.isRtl},e.isAnimated?a.ZP.createElement(Dn,{size:i.Mw,stickerSet:e,observeIntersection:t}):a.ZP.createElement(xn,{stickerSet:e,observeIntersection:t})),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i")))):a.ZP.createElement(Le.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>n(o)},a.ZP.createElement(Un.Z,{sticker:o,size:i.Mw,title:e.title,observeIntersection:t}),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i"))))}));var Gn=n(4851);const Jn=["Solid and Steady","Nice and Fast","Lots of Stuff"],Xn=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],_n=(0,a.X$)((0,s.c$)((e=>{var t;return{...(0,me.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive","timeFormat"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:null===(t=e.appConfig)||void 0===t?void 0:t.defaultReaction}}))((({isActive:e,onScreenSelect:t,onReset:n,stickerSetIds:r,stickerSetsById:i,defaultReaction:l,messageTextSize:c,animationLevel:d,messageSendKeyCombo:h,shouldSuggestStickers:Z,shouldLoopStickers:P,timeFormat:v})=>{const{setSettingOption:g}=(0,s.uC)(),p=(0,a.sO)(null),{observe:E}=(0,Bn.S1)({rootRef:p}),[C,b,I]=(0,De.Z)(),[y,N]=(0,a.eJ)(),S=(0,u.Z)(),w=f.$b?void 0:[{value:"enter",label:S("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:S(f.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}],k=(0,a.I4)((e=>{Jn.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),g({animationLevel:e})}),[g]),M=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,f.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()),g({messageTextSize:e})}),[g]),T=(0,a.I4)((e=>{g({timeFormat:e}),g({wasTimeFormatSetManually:!0}),(0,Fn.qf)(e)}),[g]),L=(0,a.I4)((e=>{N(e),b()}),[b]),A=r&&r.map((e=>{var t;return!(null==i||null===(t=i[e])||void 0===t||!t.installedDate)&&i[e]})).filter(Boolean);return(0,m.ZP)(e,n,t,o.MT.General),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:S.isRtl?"rtl":void 0},S("SETTINGS")),a.ZP.createElement(fn.Z,{label:S("TextSize"),min:12,max:20,value:c,onChange:M}),a.ZP.createElement(Le.Z,{icon:"photo",onClick:()=>t(o.MT.GeneralChatBackground)},S("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(at.Z,{name:"timeformat",options:Xn,selected:v,onChange:T})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:S.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(fn.Z,{options:Jn,value:d,onChange:k})),w&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("VoiceOver.Keyboard")),a.ZP.createElement(at.Z,{name:"keyboard-send-settings",options:w,onChange:e=>g({messageSendKeyCombo:e}),selected:h})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("AccDescrStickers")),l&&a.ZP.createElement(Le.Z,{className:"SettingsDefaultReaction",onClick:()=>t(o.MT.QuickReaction)},a.ZP.createElement(lt.Z,{reaction:l}),a.ZP.createElement("div",{className:"title"},S("DoubleTapSetting"))),a.ZP.createElement(Cn.Z,{label:S("SuggestStickers"),checked:Z,onCheck:e=>g({shouldSuggestStickers:e})}),a.ZP.createElement(Cn.Z,{label:S("LoopAnimatedStickers"),checked:P,onCheck:e=>g({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:p},A&&A.map((e=>a.ZP.createElement(On,{key:e.id,stickerSet:e,observeIntersection:E,onClick:L})))),y&&a.ZP.createElement(Gn.Z,{isOpen:C,fromSticker:y,onClose:I})))})));let zn;function Yn(e="*",t,n=!1){zn||(zn=document.createElement("input"),zn.setAttribute("type","file")),zn.setAttribute("accept",e),n?zn.removeAttribute("multiple"):zn.setAttribute("multiple","multiple"),zn.onchange=null,zn.value="",zn.onchange=t,zn.click()}var Hn=n(1394);function Vn(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function jn(e){const t=e[0].toString(16),n=e[1].toString(16),a=e[2].toString(16);return(1==t.length?"0"+t:t)+(1==n.length?"0"+n:n)+(1==a.length?"0"+a:a)}function Kn([e,t,n]){e/=255,t/=255,n/=255;let a,s,r=Math.max(e,t,n),o=Math.min(e,t,n),i=r,l=r-o;if(s=0==r?0:l/r,r==o)a=0;else{switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;case n:a=(e-t)/l+4}a/=6}return[a,s,i]}function qn([e,t,n]){let a,s,r,o=Math.floor(6*e),i=6*e-o,l=n*(1-t),c=n*(1-i*t),d=n*(1-(1-i)*t);switch(o%6){case 0:a=n,s=d,r=l;break;case 1:a=c,s=n,r=l;break;case 2:a=l,s=n,r=d;break;case 3:a=l,s=c,r=n;break;case 4:a=d,s=l,r=n;break;case 5:a=n,s=l,r=c}return[Math.round(255*a),Math.round(255*s),Math.round(255*r)]}function Wn(e){let[t,n,a]=Kn(e);return n=Math.min(1,n+.05+.1*(1-n)),a=a>.5?Math.max(0,.65*a):Math.max(0,Math.min(1,1-.65*a)),`hsla(${360*t}, ${100*n}%, ${100*a}%, .4)`}var Qn=n(9524),ea=n(5866);const ta=(0,a.X$)((({wallpaper:e,theme:t,isSelected:n,onClick:s})=>{var r;const{slug:l,document:c}=e,d=`wallpaper${c.id}`,m=c.previewBlobUrl,u=(0,h.Z)(`${d}?size=m`),v=(0,ea.Z)(null===(r=c.thumbnail)||void 0===r?void 0:r.dataUri,Boolean(u),!0),{transitionClassNames:g}=(0,z.Z)(Boolean(u||m),void 0,void 0,"slow"),[p,E]=(0,a.eJ)(!1),{mediaData:C,loadProgress:f}=(0,Z.Z)(d,!p),b=!1===(0,P.Z)(p),{shouldRender:I,transitionClassNames:y}=(0,z.Z)(p&&!C||l===o.mp,void 0,b,"slow"),N=(0,a.sO)();N.current=t;const S=(0,a.I4)((()=>{(async()=>{const e=await(0,Hn.gm)(C);await Qn.save(i.fo,N.current,e),s(l)})()}),[C,s,l]);(0,a.d4)((()=>{C&&S()}),[C,S]);const w=(0,a.I4)((()=>{C?S():E((e=>!e))}),[C,S]),k=(0,X.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:k,onClick:w},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:v,className:"thumbnail"}),a.ZP.createElement("img",{src:u||m,className:(0,X.Z)("full-media",g),alt:""}),I&&a.ZP.createElement("div",{className:(0,X.Z)("spinner-container",y)},a.ZP.createElement($.Z,{progress:f,onClick:w}))))})),na=(0,G.P2)((e=>e()),6e4,!0),aa=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}))((({isActive:e,onScreenSelect:t,onReset:n,background:r,isBlurred:l,loadedWallpapers:c,theme:d})=>{const{loadWallpapers:h,uploadWallpaper:Z,setThemeSettings:P}=(0,s.uC)(),v=(0,a.sO)();v.current=d,(0,a.d4)((()=>{na((()=>{h()}))}),[h]);const g=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&Z(t[0])}),[Z]),p=(0,a.I4)((()=>{Yn("image/jpeg",g,!0)}),[g]),E=(0,a.I4)((()=>{t(o.MT.GeneralChatBackgroundColor)}),[t]),C=(0,a.I4)((()=>{P({theme:d,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===d?i.Vv:i.g})}),[P,d]),f=(0,a.I4)((e=>{P({theme:v.current,background:e});const t=c&&c.find((t=>t.slug===e));null!=t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let n,a,s,r,o=-4,i=[0,0,0],l=0;const c=document.createElement("canvas"),d=c.getContext&&c.getContext("2d");if(!d)return t;const m=await(0,Hn.pt)(e);s=m.naturalHeight||m.offsetHeight||m.height,a=m.naturalWidth||m.offsetWidth||m.width,c.height=s,c.width=a,d.drawImage(m,0,0);try{n=d.getImageData(0,0,a,s)}catch(e){return t}for(r=n.data.length;(o+=20)<r;)++l,i[0]+=n.data[o],i[1]+=n.data[o+1],i[2]+=n.data[o+2];return i[0]=Math.floor(i[0]/l),i[1]=Math.floor(i[1]/l),i[2]=Math.floor(i[2]/l),i}(t.document.thumbnail.dataUri).then((e=>{const t=Wn(e),n=`#${jn(e)}`;P({theme:v.current,backgroundColor:n,patternColor:t})}))}),[c,P]),b=(0,a.I4)((e=>{P({theme:v.current,isBlurred:e.target.checked})}),[P]),I=(0,u.Z)();(0,m.ZP)(e,n,t,o.MT.GeneralChatBackground);const y=(null==c?void 0:c[0])&&c[0].slug===o.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Le.Z,{icon:"camera-add",className:"mb-0",disabled:y,onClick:p},I("UploadImage")),a.ZP.createElement(Le.Z,{icon:"colorize",className:"mb-0",onClick:E},I("SetColor")),a.ZP.createElement(Le.Z,{icon:"favorite",onClick:C},I("ThemeResetToDefaults")),a.ZP.createElement(Cn.Z,{label:I("BackgroundBlurred"),checked:Boolean(l),onChange:b})),c?a.ZP.createElement("div",{className:"settings-wallpapers"},c.map((e=>a.ZP.createElement(ta,{wallpaper:e,theme:d,isSelected:r===e.slug,onClick:f})))):a.ZP.createElement(we.Z,null))}))),sa=Kn(Vn("e6ebee")),ra=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function oa(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 ia({colorPosition:e,huePosition:t},n){return[t/(n.hueRect.width-1),e[0]/(n.colorRect.width-1),1-e[1]/(n.colorRect.height-1)]}const la=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}))((({isActive:e,onScreenSelect:t,onReset:n,theme:r,backgroundColor:i})=>{const{setThemeSettings:l}=(0,s.uC)(),c=(0,a.sO)();c.current=r;const d=(0,a.sO)(null),u=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)(!0),[P,v]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?Kn(Vn(e.replace("#",""))):sa}(i)),g=(0,a.sO)(P);(0,a.d4)((()=>{g.current=P}),[P]);const[p,E,f]=(0,De.Z)(),[b,I]=(0,a.eJ)(""),[y,N]=(0,a.eJ)(""),S=(0,a.sO)(),w=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:u.current.offsetLeft,...(0,me.ei)(u.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:h.current.offsetLeft,...(0,me.ei)(h.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+d.current.scrollTop),e.height-1)],{huePosition:a}=oa(g.current,S.current);return v(ia({colorPosition:n,huePosition:a},S.current)),E(),!0}function a(e){const{colorPosition:n}=oa(g.current,S.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return v(ia({colorPosition:n,huePosition:a},S.current)),E(),!0}S.current={colorRect:e,hueRect:t},(0,C.s)(u.current,{onCapture:n,onDrag:n,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,C.s)(h.current,{onCapture:a,onDrag:a,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[E,f]);const{colorPosition:k=[0,0],huePosition:M=0}=S.current?oa(P,S.current):{},T=jn(qn(P)),L=P[0],A=jn(qn([L,1,1]));(0,a.d4)((()=>{const e=qn(P),t=`#${jn(e)}`;if(I(e.join(", ")),N(t),!Z.current){const n=Wn(e);l({theme:c.current,background:void 0,backgroundColor:t,patternColor:n})}Z.current=!1}),[P,l]),(0,a.d4)((()=>{!function(e,t,n,a){let s,r,o;n.current&&a.current?(s=a.current.colorRect.width,r=a.current.colorRect.height,o=n.current):(s=e.offsetWidth,r=e.offsetHeight,o=e.getContext("2d"),e.width=s,e.height=r,n.current=o);const i=o.createImageData(s,r),l=i.data,c=qn([t,1,1]);let d=0;for(let e=0;e<r;e++){const t=1-e/(r-1),n=[255*t,255*t,255*t],a=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);l[d++]=n[0]+(a[0]-n[0])*t,l[d++]=n[1]+(a[1]-n[1])*t,l[d++]=n[2]+(a[2]-n[2])*t,l[d++]=255}}o.putImageData(i,0,0)}(u.current.firstChild,L,w,S)}),[L]),(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 r=0;for(let e=0;e<t;e++){const n=qn([e/(t-1),1,1]);s[r++]=n[0],s[r++]=n[1],s[r++]=n[2],s[r++]=255}n.putImageData(a,0,0)}(h.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(Kn(e))}e.currentTarget.value=t}),[]),F=(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(Kn(Vn(t.replace("#","")))),e.currentTarget.value=t}),[]),B=(0,a.I4)((e=>{v(Kn(Vn(e.currentTarget.dataset.color.replace("#",""))))}),[]),$=(0,X.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",p&&"is-dragging");return(0,m.ZP)(e,n,t,o.MT.GeneralChatBackgroundColor),a.ZP.createElement("div",{ref:d,className:$},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:u,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${k[0]}px, ${k[1]}px); background-color: #${T};`})),a.ZP.createElement("div",{ref:h,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${M}px); background-color: #${A};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(Me.Z,{value:y,label:"HEX",onChange:F}),a.ZP.createElement(Me.Z,{value:b,label:"RGB",onChange:R}))),a.ZP.createElement("div",{className:"predefined-colors"},ra.map((e=>a.ZP.createElement("div",{className:e===`#${T}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:B})))))})));var ca=n(8406);const da=(0,a.X$)((0,s.c$)((e=>({hasPrivateChatsNotifications:Boolean(e.settings.byKey.hasPrivateChatsNotifications),hasPrivateChatsMessagePreview:Boolean(e.settings.byKey.hasPrivateChatsMessagePreview),hasGroupNotifications:Boolean(e.settings.byKey.hasGroupNotifications),hasGroupMessagePreview:Boolean(e.settings.byKey.hasGroupMessagePreview),hasBroadcastNotifications:Boolean(e.settings.byKey.hasBroadcastNotifications),hasBroadcastMessagePreview:Boolean(e.settings.byKey.hasBroadcastMessagePreview),hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})))((({isActive:e,onScreenSelect:t,onReset:n,hasPrivateChatsNotifications:r,hasPrivateChatsMessagePreview:i,hasGroupNotifications:l,hasGroupMessagePreview:c,hasBroadcastNotifications:d,hasBroadcastMessagePreview:h,hasContactJoinedNotifications:Z,hasPushNotifications:P,hasWebNotifications:v,notificationSoundVolume:g})=>{const{loadNotificationSettings:p,updateContactSignUpNotification:E,updateNotificationSettings:C,updateWebNotificationSettings:f}=(0,s.uC)();(0,a.d4)((()=>{p()}),[p]);const b=(0,x.Z)(500,!0),I=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!r:!("group"===t?l:d),s="contact"===t?i:"group"===t?c:h;C({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:s},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[h,d,c,l,i,r,C]),y=(0,a.I4)((e=>{E({isSilent:!e.target.checked})}),[E]),N=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.Notifications),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:N.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(Cn.Z,{label:"Web notifications",subLabel:N(v?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:v,onChange:e=>{f({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(Cn.Z,{label:"Offline notifications",disabled:!v,subLabel:N(P?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:P,onChange:e=>{f({hasPushNotifications:e.target.checked})}}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(fn.Z,{label:"Sound",min:0,max:10,value:g,onChange:e=>{f({notificationSoundVolume:e}),b((()=>(0,ca.q3)(void 0,e)))}}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("AutodownloadPrivateChats")),a.ZP.createElement(Cn.Z,{label:N("NotificationsForPrivateChats"),subLabel:N(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:e=>{I(e,"contact","silent")}}),a.ZP.createElement(Cn.Z,{label:N("MessagePreview"),disabled:!r,subLabel:N(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{I(e,"contact","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("FilterGroups")),a.ZP.createElement(Cn.Z,{label:N("NotificationsForGroups"),subLabel:N(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{I(e,"group","silent")}}),a.ZP.createElement(Cn.Z,{label:N("MessagePreview"),disabled:!l,subLabel:N(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{I(e,"group","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("FilterChannels")),a.ZP.createElement(Cn.Z,{label:N("NotificationsForChannels"),subLabel:N(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{I(e,"broadcast","silent")}}),a.ZP.createElement(Cn.Z,{label:N("MessagePreview"),disabled:!d,subLabel:N(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:e=>{I(e,"broadcast","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:N.isRtl?"rtl":void 0},N("PhoneOther")),a.ZP.createElement(Cn.Z,{label:N("ContactJoined"),checked:Z,onChange:y})))}))),ma=(0,a.X$)((0,s.c$)((e=>{var t,n,a,s,r;const{settings:{byKey:{hasPassword:o,isSensitiveEnabled:i,canChangeSensitive:l},privacy:c},blocked:d,activeSessions:m}=e;return{hasPassword:o,blockedCount:d.totalCount,sessionsCount:m.length,isSensitiveEnabled:i,canChangeSensitive:l,visibilityPrivacyPhoneNumber:null===(t=c.phoneNumber)||void 0===t?void 0:t.visibility,visibilityPrivacyLastSeen:null===(n=c.lastSeen)||void 0===n?void 0:n.visibility,visibilityPrivacyProfilePhoto:null===(a=c.profilePhoto)||void 0===a?void 0:a.visibility,visibilityPrivacyForwarding:null===(s=c.forwards)||void 0===s?void 0:s.visibility,visibilityPrivacyGroupChats:null===(r=c.chatInvite)||void 0===r?void 0:r.visibility}}))((({isActive:e,onScreenSelect:t,onReset:n,hasPassword:r,blockedCount:i,sessionsCount:l,isSensitiveEnabled:c,canChangeSensitive:d,visibilityPrivacyPhoneNumber:h,visibilityPrivacyLastSeen:Z,visibilityPrivacyProfilePhoto:P,visibilityPrivacyForwarding:v,visibilityPrivacyGroupChats:g})=>{const{loadPrivacySettings:p,loadBlockedContacts:E,loadAuthorizations:C,loadContentSettings:f,updateContentSettings:b}=(0,s.uC)();(0,a.d4)((()=>{E(),C(),p(),f()}),[E,C,p,f]);const I=(0,u.Z)();function y(e){switch(e){case"everybody":return I("P2PEverybody");case"contacts":return I("P2PContacts");case"nobody":return I("P2PNobody")}}return(0,m.ZP)(e,n,t,o.MT.Privacy),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Le.Z,{icon:"delete-user",narrow:!0,onClick:()=>t(o.MT.PrivacyBlockedUsers)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("BlockedUsers")),i>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I("Users",i)))),a.ZP.createElement(Le.Z,{icon:"lock",narrow:!0,onClick:()=>t(r?o.MT.TwoFaEnabled:o.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(r?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Le.Z,{icon:"active-sessions",narrow:!0,onClick:()=>t(o.MT.PrivacyActiveSessions)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("SessionsTitle")),l>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},1===l?"1 session":`${l} sessions`)))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:I.isRtl?"rtl":void 0},I("PrivacyTitle")),a.ZP.createElement(Le.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(h)))),a.ZP.createElement(Le.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(Z)))),a.ZP.createElement(Le.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(P)))),a.ZP.createElement(Le.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(v)))),a.ZP.createElement(Le.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},I("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},y(g))))),d&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:I.isRtl?"rtl":void 0},I("lng_settings_sensitive_title")),a.ZP.createElement(Cn.Z,{label:I("lng_settings_sensitive_disable_filtering"),subLabel:I("lng_settings_sensitive_about"),checked:Boolean(c),disabled:!d,onCheck:b})))}))),ua=(0,a.X$)((0,s.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})))((({isActive:e,onScreenSelect:t,onReset:n,languages:r,language:i})=>{const{loadLanguages:l,setSettingOption:c}=(0,s.uC)(),[d,u]=(0,a.eJ)(i),[h,Z,P]=(0,De.Z)();(0,a.d4)((()=>{l()}),[l]);const v=(0,a.I4)((e=>{u(e),Z(),(0,Fn.m0)(e,(()=>{P(),c({language:e})}))}),[Z,P,c]),g=(0,a.Ye)((()=>r?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((({langCode:e,nativeName:t,name:n})=>({value:e,label:t,subLabel:n}))).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(r):void 0),[r]);return(0,m.ZP)(e,n,t,o.MT.Language),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},g?a.ZP.createElement(at.Z,{name:"keyboard-send-settings",options:g,selected:d,loadingOption:h?d:void 0,onChange:v}):a.ZP.createElement(we.Z,null))})));function ha(e){switch(e){case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case o.MT.PrivacyLastSeen:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case o.MT.PrivacyForwarding:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return"forwards";case o.MT.PrivacyGroupChats:case o.MT.PrivacyGroupChatsAllowedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}const Za=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{let n;const{chats:{byId:a},settings:{privacy:s}}=e;switch(t){case o.MT.PrivacyPhoneNumber:n=s.phoneNumber;break;case o.MT.PrivacyLastSeen:n=s.lastSeen;break;case o.MT.PrivacyProfilePhoto:n=s.profilePhoto;break;case o.MT.PrivacyForwarding:n=s.forwards;break;case o.MT.PrivacyGroupChats:n=s.chatInvite}return n?{...n,chatsById:a}:{}}))((({screen:e,isActive:t,onScreenSelect:n,onReset:r,visibility:i,allowUserIds:l,allowChatIds:c,blockUserIds:d,blockChatIds:h,chatsById:Z})=>{const{setPrivacyVisibility:P}=(0,s.uC)(),v=(0,u.Z)(),g=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyGroupChats:return[{value:"everybody",label:v("P2PEverybody")},{value:"contacts",label:v("P2PContacts")}];default:return[{value:"everybody",label:v("P2PEverybody")},{value:"contacts",label:v("P2PContacts")},{value:"nobody",label:v("P2PNobody")}]}}),[v,e]),p={shouldShowDenied:"nobody"!==i,shouldShowAllowed:"everybody"!==i},E=ha(e),C=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyPhoneNumber:return v("PrivacyPhoneTitle");case o.MT.PrivacyLastSeen:return v("LastSeenTitle");case o.MT.PrivacyProfilePhoto:return v("PrivacyProfilePhotoTitle");case o.MT.PrivacyForwarding:return v("PrivacyForwardsTitle");case o.MT.PrivacyGroupChats:return v("WhoCanAddMe");default:return}}),[v,e]);(0,m.ZP)(t,r,n,e);const f=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyLastSeen:return v("CustomHelp");default:return}}),[v,e]),b=(()=>{switch(e){case o.MT.PrivacyPhoneNumber:return o.MT.PrivacyPhoneNumberAllowedContacts;case o.MT.PrivacyLastSeen:return o.MT.PrivacyLastSeenAllowedContacts;case o.MT.PrivacyProfilePhoto:return o.MT.PrivacyProfilePhotoAllowedContacts;case o.MT.PrivacyForwarding:return o.MT.PrivacyForwardingAllowedContacts;default:return o.MT.PrivacyGroupChatsAllowedContacts}})(),I=(()=>{switch(e){case o.MT.PrivacyPhoneNumber:return o.MT.PrivacyPhoneNumberDeniedContacts;case o.MT.PrivacyLastSeen:return o.MT.PrivacyLastSeenDeniedContacts;case o.MT.PrivacyProfilePhoto:return o.MT.PrivacyProfilePhotoDeniedContacts;case o.MT.PrivacyForwarding:return o.MT.PrivacyForwardingDeniedContacts;default:return o.MT.PrivacyGroupChatsDeniedContacts}})(),y=(0,a.Ye)((()=>l&&c&&Z?c.reduce(((e,t)=>e+(Z[t]?Z[t].membersCount:0)),l.length):0),[c,l,Z]),N=(0,a.Ye)((()=>d&&h&&Z?h.reduce(((e,t)=>e+(Z[t]?Z[t].membersCount:0)),d.length):0),[h,d,Z]),S=(0,a.I4)((e=>{P({privacyKey:E,visibility:e})}),[E,P]);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:v.isRtl?"rtl":void 0},C),a.ZP.createElement(at.Z,{name:`visibility-${E}`,options:g,onChange:S,selected:i}),f&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:v.isRtl?"rtl":void 0},f)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:v.isRtl?"rtl":void 0},v("PrivacyExceptions")),p.shouldShowAllowed&&a.ZP.createElement(Le.Z,{narrow:!0,icon:"add-user",onClick:()=>{n(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"},v("AlwaysShareWith")),a.ZP.createElement("span",{className:"subtitle"},v("EditAdminAddUsers")))),p.shouldShowDenied&&a.ZP.createElement(Le.Z,{narrow:!0,icon:"delete-user",onClick:()=>{n(I)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},N>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"",N),a.ZP.createElement("span",{className:"title"},v("NeverShareWith")),a.ZP.createElement("span",{className:"subtitle"},v("EditAdminAddUsers"))))))})));function Pa(e){return[e.region,e.country].filter(Boolean).join(", ")}function va(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const ga=(0,a.X$)((0,s.c$)((e=>({activeSessions:e.activeSessions})))((({isActive:e,onScreenSelect:t,onReset:n,activeSessions:r})=>{const{loadAuthorizations:i,terminateAuthorization:l,terminateAllAuthorizations:c}=(0,s.uC)(),[d,h,Z]=(0,De.Z)();(0,a.d4)((()=>{i()}),[i]);const P=(0,a.I4)((e=>{l({hash:e})}),[l]),v=(0,a.I4)((()=>{Z(),c()}),[Z,c]),g=(0,a.Ye)((()=>r.find((e=>e.isCurrent))),[r]),p=(0,a.Ye)((()=>r.filter((e=>!e.isCurrent))),[r]),E=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.PrivacyActiveSessions),a.ZP.createElement("div",{className:"settings-content custom-scroll"},g&&(f=g,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:E.isRtl?"rtl":void 0},E("AuthSessions.CurrentSession")),a.ZP.createElement(Le.Z,{narrow:!0,inactive:!0,className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},f.appName),a.ZP.createElement("span",{className:"subtitle black tight"},va(f)),a.ZP.createElement("span",{className:"subtitle"},f.ip," - ",Pa(f)))),a.ZP.createElement(Le.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:h},E("TerminateAllSessions")))),p&&(C=p,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:E.isRtl?"rtl":void 0},E("OtherSessions")),C.map((function(e){return a.ZP.createElement(Le.Z,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{P(e.hash)}}],className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,K.VX)(E,1e3*e.dateActive)),a.ZP.createElement("span",{className:"title"},e.appName),a.ZP.createElement("span",{className:"subtitle black tight"},va(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",Pa(e))))})))),p&&a.ZP.createElement(Xe.Z,{isOpen:d,onClose:Z,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:v,confirmIsDestructive:!0}));var C,f})));var pa=n(6272);const Ea=(0,a.X$)((0,s.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:null==a?void 0:a.userIds,localContactIds:e.userSearch.localUserIds,currentUserId:s}}))((({usersById:e,blockedIds:t,contactIds:n,localContactIds:r,currentUserId:o,isOpen:i,onClose:l})=>{const{loadContactList:c,setUserSearchQuery:d,blockContact:m}=(0,s.uC)(),h=(0,u.Z)(),[Z,P]=(0,a.eJ)(""),g=(0,a.sO)(null);(0,a.d4)((()=>{d({query:Z})}),[Z,d]);const p=(0,a.Ye)((()=>{const a=(0,me.Tw)([...n||[],...r||[]].filter((e=>e!==o&&!t.includes(e))));return(0,v.kK)(a,e,Z).sort(((t,n)=>{const a=(0,v.Js)(e[t])||"",s=(0,v.Js)(e[n])||"";return a.localeCompare(s)}))}),[t,n,o,Z,r,e]),E=(0,a.I4)((t=>{const{id:n,accessHash:a}=e[t]||{};n&&a&&(m({contactId:n,accessHash:a}),l())}),[m,l,e]);return a.ZP.createElement(Fe,{isOpen:i,chatOrUserIds:p,filterRef:g,filterPlaceholder:h("BlockedUsers.BlockUser"),filter:Z,onFilterChange:P,loadMore:c,onSelectChatOrUser:E,onClose:l})}))),Ca=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a,phoneCodeList:s}}))((({isActive:e,onScreenSelect:t,onReset:n,chatsByIds:r,usersByIds:l,blockedIds:c,phoneCodeList:d})=>{const{unblockContact:h}=(0,s.uC)(),Z=(0,u.Z)(),[P,g,p]=(0,De.Z)(),E=(0,a.I4)((e=>{h({contactId:e})}),[h]);return(0,m.ZP)(e,n,t,o.MT.PrivacyBlockedUsers),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:Z.isRtl?"rtl":void 0},Z("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=c&&c.length?a.ZP.createElement("div",{className:"scroll-container"},c.map(((e,t)=>function(e,t,n){const s=(0,v.YC)(e),o=s?l[e]:void 0,c=s?void 0:r[e],m=(0,X.Z)("Chat chat-item-clickable blocked-list-item small-icon",s?"private":"group");return a.ZP.createElement(Le.Z,{key:e,className:m,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{E(e)}}],style:`top: ${(0+t)*i.rS}px;`},a.ZP.createElement(ge.Z,{size:"medium",user:o,chat:c}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,ve.Z)((s?(0,v.Js)(o):(0,v.U)(Z,c))||"")),(null==o?void 0:o.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,pa.WZ)(d,o.phoneNumber)),o&&!o.phoneNumber&&o.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",o.username)))}(e,t)))):c&&!c.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},Z("NoBlocked")):a.ZP.createElement(we.Z,{key:"loading"}))),a.ZP.createElement(dn.Z,{isShown:!0,onClick:g,ariaLabel:Z("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(Ea,{isOpen:P,onClose:p}))})));var fa=n(7854);const ba=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"🔐")})))((({isActive:e,onReset:t,animatedEmoji:n,onScreenSelect:s})=>{const r=(0,u.Z)();return(0,m.ZP)(e,t,s,o.MT.TwoFaEnabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,ve.Z)(r("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Le.Z,{icon:"edit",onClick:()=>s(o.MT.TwoFaChangePasswordCurrent)},r("ChangePassword")),a.ZP.createElement(Le.Z,{icon:"password-off",onClick:()=>s(o.MT.TwoFaTurnOff)},r("TurnPasswordOff")),a.ZP.createElement(Le.Z,{icon:"email",onClick:()=>s(o.MT.TwoFaRecoveryEmailCurrentPassword)},r("SetRecoveryEmail"))))})));var Ia=n(3490),ya=n(9364);const Na=(0,a.X$)((({screen:e,isActive:t,onScreenSelect:n,onReset:s,error:r,isLoading:o,expectedPassword:i,placeholder:l="Current Password",hint:c,submitLabel:d,clearError:h,onSubmit:Z})=>{const[P,v]=(0,a.eJ)(""),[g,p]=(0,a.eJ)(!1),E=(0,a.I4)((e=>{i&&e!==i?v("Passwords Should Be Equal"):Z(e)}),[Z,i]),C=(0,a.I4)((()=>{h&&h(),v("")}),[h]),f=(0,u.Z)();return(0,m.ZP)(t,s,n,e),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(Ia.Z,{isBig:!0,isPasswordVisible:g})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(ya.Z,{error:P||r,hint:c,placeholder:l,submitLabel:d||f("Next"),clearError:C,isLoading:o,isPasswordVisible:g,onChangePasswordVisibility:p,onSubmit:E})))})),Sa=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"🔐")})))((({isActive:e,onScreenSelect:t,onReset:n,animatedEmoji:s,onStart:r})=>{const i=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.TwoFaDisabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:s,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},i("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(L.Z,{onClick:r},i("EditAdminTransferSetPassword"))))}))),wa=f.wB?550:400,ka=(0,a.X$)((0,s.c$)(((e,{icon:t})=>({animatedEmoji:(0,g.zB)(e,"email"===t?"💌":"💡")})))((({animatedEmoji:e,type:t="text",isLoading:n,error:s,placeholder:r,shouldConfirm:o,clearError:i,onSubmit:l,isActive:c,onScreenSelect:d,onReset:h,screen:Z})=>{const P=(0,a.sO)(null),[v,g]=(0,a.eJ)(""),[p,E,C]=(0,De.Z)(!1);(0,a.d4)((()=>{f.$b||setTimeout((()=>{P.current.focus()}),wa)}),[]);const b=(0,u.Z)();return(0,m.ZP)(c,h,d,Z),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),P.current&&l(v)}},a.ZP.createElement(Me.Z,{ref:P,value:v,inputMode:t,label:r,error:s,onChange:e=>{s&&i&&i(),g(e.target.value)}}),v?a.ZP.createElement(L.Z,{type:"submit",isLoading:n,ripple:!0},b("Continue")):a.ZP.createElement(L.Z,{isText:!0,isLoading:n,ripple:!0,onClick:o?E:()=>{l()}},b("YourEmailSkip"))),o&&a.ZP.createElement(ke.Z,{className:"narrow",isOpen:p,title:b("YourEmailSkipWarning"),onClose:C},(0,ve.Z)(b("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(L.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{C(),l()}},b("YourEmailSkip")),a.ZP.createElement(L.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:C},b("Cancel"))))))}))),Ma=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"🥳")})))((({isActive:e,onReset:t,animatedEmoji:n,onScreenSelect:s})=>{const r=(0,u.Z)();return(0,m.ZP)(e,t,s,o.MT.TwoFaCongratulations),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},r("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(L.Z,{onClick:()=>{s(o.MT.Privacy)}},r("TwoStepVerificationPasswordReturnSettings"))))}))),Ta=f.wB?550:400,La=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,g.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((({animatedEmoji:e,codeLength:t,isLoading:n,error:s,clearError:r,onSubmit:o,isActive:i,onScreenSelect:l,onReset:c,screen:d})=>{const h=(0,a.sO)(null),[Z,P]=(0,a.eJ)("");(0,a.d4)((()=>{f.$b||setTimeout((()=>{h.current.focus()}),Ta)}),[]);const v=(0,u.Z)();return(0,m.ZP)(i,c,l,d),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(fa.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Me.Z,{value:Z,ref:h,inputMode:"decimal",label:v("YourEmailCode"),error:s,onChange:e=>{s&&r&&r();const n=e.target.value.slice(0,t);n.length===t&&o(n),P(n),e.target.value=n}}),n&&a.ZP.createElement(we.Z,null)))}))),Aa=(0,a.X$)((0,s.c$)((e=>({...e.twoFaSettings})))((({currentScreen:e,shownScreen:t,state:n,hint:r,isLoading:i,error:l,waitingEmailCodeLength:c,dispatch:d,isActive:m,onScreenSelect:h,onReset:Z})=>{const{updatePassword:P,checkPassword:v,clearTwoFaError:g,updateRecoveryEmail:p,provideTwoFaEmailCode:E,clearPassword:C}=(0,s.uC)();(0,a.d4)((()=>{c&&(e===o.MT.TwoFaNewPasswordEmail?h(o.MT.TwoFaNewPasswordEmailCode):e===o.MT.TwoFaRecoveryEmail&&h(o.MT.TwoFaRecoveryEmailCode))}),[e,h,c]);const f=(0,a.I4)((()=>{d({type:"reset"}),h(o.MT.TwoFaNewPassword)}),[d,h]),b=(0,a.I4)((e=>{d({type:"setPassword",payload:e}),h(o.MT.TwoFaNewPasswordConfirm)}),[d,h]),I=(0,a.I4)((()=>{h(o.MT.TwoFaNewPasswordHint)}),[h]),y=(0,a.I4)((e=>{d({type:"setHint",payload:e}),h(o.MT.TwoFaNewPasswordEmail)}),[d,h]),N=(0,a.I4)((e=>{d({type:"setEmail",payload:e}),P({...n,email:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[d,h,n,P]),S=(0,a.I4)((e=>{d({type:"setCurrentPassword",payload:e}),v({currentPassword:e,onSuccess:()=>{h(o.MT.TwoFaChangePasswordNew)}})}),[v,d,h]),w=(0,a.I4)((e=>{d({type:"setPassword",payload:e}),h(o.MT.TwoFaChangePasswordConfirm)}),[d,h]),k=(0,a.I4)((()=>{h(o.MT.TwoFaChangePasswordHint)}),[h]),M=(0,a.I4)((e=>{d({type:"setHint",payload:e}),P({...n,hint:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[d,h,n,P]),T=(0,a.I4)((e=>{C({currentPassword:e,onSuccess:()=>{h(o.MT.Privacy)}})}),[C,h]),L=(0,a.I4)((e=>{d({type:"setCurrentPassword",payload:e}),v({currentPassword:e,onSuccess:()=>{h(o.MT.TwoFaRecoveryEmail)}})}),[v,d,h]),A=(0,a.I4)((e=>{d({type:"setEmail",payload:e}),p({...n,email:e,onSuccess:()=>{h(o.MT.TwoFaCongratulations)}})}),[d,h,n,p]),R=(0,a.I4)((e=>{E({code:e})}),[E]),F=(0,u.Z)();switch(e){case o.MT.TwoFaDisabled:return a.ZP.createElement(Sa,{onStart:f,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPassword:return a.ZP.createElement(Na,{screen:e,placeholder:F("PleaseEnterPassword"),submitLabel:F("Continue"),onSubmit:b,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(Na,{screen:e,expectedPassword:n.password,placeholder:F("PleaseReEnterPassword"),submitLabel:F("Continue"),onSubmit:I,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordHint:return a.ZP.createElement(ka,{icon:"hint",placeholder:F("PasswordHintPlaceholder"),onSubmit:y,screen:e,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(ka,{icon:"email",type:"email",isLoading:i,error:l,clearError:g,placeholder:F("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:N,screen:e,onScreenSelect:h,isActive:m||[o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(La,{isLoading:i,error:l,clearError:g,onSubmit:R,screen:e,onScreenSelect:h,isActive:m||t===o.MT.TwoFaCongratulations,onReset:Z});case o.MT.TwoFaCongratulations:return a.ZP.createElement(Ma,{onScreenSelect:h,isActive:m,onReset:Z});case o.MT.TwoFaEnabled:return a.ZP.createElement(ba,{onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordCurrent,o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaTurnOff,o.MT.TwoFaRecoveryEmailCurrentPassword,o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(Na,{screen:e,isLoading:i,error:l,clearError:g,hint:r,onSubmit:S,onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordNew:return a.ZP.createElement(Na,{screen:e,placeholder:F("PleaseEnterNewFirstPassword"),onSubmit:w,onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(Na,{screen:e,expectedPassword:n.password,placeholder:F("PleaseReEnterPassword"),onSubmit:k,onScreenSelect:h,isActive:m||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(ka,{isLoading:i,error:l,clearError:g,icon:"hint",placeholder:F("PasswordHintPlaceholder"),onSubmit:M,onScreenSelect:h,isActive:m||t===o.MT.TwoFaCongratulations,onReset:Z,screen:e});case o.MT.TwoFaTurnOff:return a.ZP.createElement(Na,{isLoading:i,error:l,clearError:g,hint:r,onSubmit:T,onScreenSelect:h,isActive:m,onReset:Z,screen:e});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(Na,{screen:e,isLoading:i,error:l,clearError:g,hint:r,onSubmit:L,onScreenSelect:h,isActive:m||[o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement(ka,{screen:e,icon:"email",type:"email",placeholder:F("RecoveryEmailTitle"),onSubmit:A,onScreenSelect:h,isActive:m||[o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:Z});case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(La,{screen:e,isLoading:i,error:l,clearError:g,onSubmit:R,onScreenSelect:h,isActive:m||t===o.MT.TwoFaCongratulations,onReset:Z});default:return}})));var Ra=n(1820);function Fa(e,t){const{privacy:n}=e.settings;switch(t){case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return n.forwards;case o.MT.PrivacyGroupChatsDeniedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const Ba=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=e;return{currentUserId:r,chatsById:n,listIds:a.active,orderedPinnedIds:s.active,archivedPinnedIds:s.archived,archivedListIds:a.archived,settings:Fa(e,t)}}))((({currentUserId:e,isAllowList:t,screen:n,settings:r,chatsById:i,listIds:l,orderedPinnedIds:c,archivedListIds:d,archivedPinnedIds:h,isActive:Z,onScreenSelect:P,onReset:g})=>{const{setPrivacySettings:p}=(0,s.uC)(),E=(0,u.Z)(),C=(0,a.Ye)((()=>r?t?[...r.allowUserIds,...r.allowChatIds]:[...r.blockUserIds,...r.blockChatIds]:[]),[t,r]),[f,b]=(0,a.eJ)(""),[I,y]=(0,a.eJ)(!1),[N,S]=(0,a.eJ)(C),w=(0,a.Ye)((()=>{const e=l?(0,v.O)(i,l,c,"all"):void 0,t=d?(0,v.O)(i,d,h,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]}),[i,l,c,d,h]),k=(0,a.Ye)((()=>{if(w)return w.filter((t=>((0,v.YC)(t.id)&&t.id!==e||(0,v.Bf)(t))&&(!f||(0,Tn.Z)((0,v.U)(E,t),f)||C.includes(t.id)))).map((({id:e})=>e))}),[w,e,E,f,C]),M=(0,a.I4)((e=>{S(e),y(!0)}),[]),T=(0,a.I4)((()=>{p({privacyKey:ha(n),isAllowList:Boolean(t),contactsIds:N}),P(o.MT.Privacy)}),[t,N,P,n,p]);return(0,m.ZP)(Z,g,P,n),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Ra.Z,{itemIds:k||[],selectedIds:N,filterValue:f,filterPlaceholder:E(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:M,onFilterChange:b}),a.ZP.createElement(dn.Z,{isShown:I,onClick:T,ariaLabel:E(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),$a=(0,a.X$)((0,s.c$)((e=>{const{availableReactions:t,appConfig:n}=e;return{availableReactions:t,selectedReaction:null==n?void 0:n.defaultReaction}}))((({isActive:e,onReset:t,onScreenSelect:n,availableReactions:r,selectedReaction:i})=>{const{setDefaultReaction:l}=(0,s.uC)();(0,m.ZP)(e,t,n,o.MT.General);const c=(null==r?void 0:r.filter((e=>!e.isInactive)).map((e=>({label:a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(lt.Z,{reaction:e.reaction}),e.title),value:e.reaction}))))||[],d=(0,a.I4)((e=>{l({reaction:e})}),[l]);return a.ZP.createElement("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction"},a.ZP.createElement(at.Z,{name:"quick-reaction-settings",options:c,selected:i,onChange:d}))}))),Da=Object.keys(o.MT).length/2,xa=[o.MT.TwoFaDisabled,o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations,o.MT.TwoFaEnabled,o.MT.TwoFaChangePasswordCurrent,o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaTurnOff,o.MT.TwoFaRecoveryEmailCurrentPassword,o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode],Ua=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],Oa=[o.MT.PrivacyBlockedUsers,o.MT.PrivacyActiveSessions],Ga=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],Ja=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],Xa=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],_a=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],za=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],Ya=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:s,onScreenSelect:r,onReset:i,shouldSkipTransition:l})=>{const[c,d]=(0,tn.Z)(an,nn),m=(0,a.I4)((()=>{t!==o.MT.FoldersCreateFolder&&t!==o.MT.FoldersEditFolder&&t!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),t!==o.MT.FoldersIncludedChats&&t!==o.MT.FoldersExcludedChats?i():"create"===n.mode?r(o.MT.FoldersCreateFolder):r(o.MT.FoldersEditFolder)}),[n.mode,s,t,i,r]),u=(0,a.I4)((()=>{s({type:"saveFilters"}),m()}),[s,m]);function h(i,l,h){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(sn,{currentScreen:t,onReset:m,onSaveFilter:u,onScreenSelect:r,editedFolderId:n.folderId}),function(i,l){const u={[o.MT.PrivacyPhoneNumber]:Ga.includes(l),[o.MT.PrivacyLastSeen]:Ja.includes(l),[o.MT.PrivacyProfilePhoto]:Xa.includes(l),[o.MT.PrivacyForwarding]:_a.includes(l),[o.MT.PrivacyGroupChats]:za.includes(l)},h=xa.includes(l),Z=Ua.includes(l),P=Oa.includes(l)||h||Object.keys(u).includes(l.toString())||Object.values(u).find((e=>!0===e));switch(t){case o.MT.Main:return a.ZP.createElement(ln,{onScreenSelect:r,isActive:e,onReset:m});case o.MT.EditProfile:return a.ZP.createElement(En,{onScreenSelect:r,isActive:e&&i,onReset:m});case o.MT.General:return a.ZP.createElement(_n,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor||l===o.MT.GeneralChatBackground||l===o.MT.QuickReaction||P||Z,onReset:m});case o.MT.QuickReaction:return a.ZP.createElement($a,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.Notifications:return a.ZP.createElement(da,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.DataStorage:return a.ZP.createElement(bn,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.Privacy:return a.ZP.createElement(ma,{onScreenSelect:r,isActive:i||P||h,onReset:m});case o.MT.Language:return a.ZP.createElement(ua,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.GeneralChatBackground:return a.ZP.createElement(aa,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor,onReset:m});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(la,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyActiveSessions:return a.ZP.createElement(ga,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(Ca,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyLastSeen:case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyForwarding:case o.MT.PrivacyGroupChats:return a.ZP.createElement(Za,{screen:t,onScreenSelect:r,isActive:i||u[t],onReset:m});case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(Ba,{isAllowList:!0,screen:t,onScreenSelect:r,isActive:i||u[t],onReset:m});case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(Ba,{screen:t,onScreenSelect:r,isActive:i,onReset:m});case o.MT.Folders:case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Rn,{currentScreen:t,shownScreen:l,state:n,dispatch:s,isActive:i,onScreenSelect:r,onReset:m});case o.MT.TwoFaDisabled:case o.MT.TwoFaNewPassword:case o.MT.TwoFaNewPasswordConfirm:case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaNewPasswordEmailCode:case o.MT.TwoFaCongratulations:case o.MT.TwoFaEnabled:case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:case o.MT.TwoFaChangePasswordHint:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:case o.MT.TwoFaRecoveryEmail:case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(Aa,{currentScreen:t,state:c,dispatch:d,shownScreen:l,isActive:i,onScreenSelect:r,onReset:m});default:return}}(i,h))}return a.ZP.createElement(R.Z,{id:"Settings",name:l?"none":f.s0,activeKey:t,renderCount:Da},h)})),Ha=(0,G.P2)((e=>e()),6e4,!0),Va=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n,statusesById:a}=e.users;return{usersById:n,userStatusesById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}}))((({isActive:e,filter:t,usersById:n,userStatusesById:r,contactIds:o,serverTimeOffset:i,onReset:l})=>{const{loadContactList:c,openChat:d}=(0,s.uC)();(0,a.d4)((()=>{Ha((()=>{c()}))})),(0,m.ZP)(e,l);const u=(0,a.I4)((e=>{d({id:e,shouldReplaceHistory:!0})}),[d]),h=(0,a.Ye)((()=>{if(!o)return;const e=(0,v.kK)(o,n,t);return(0,v.Z0)(e,n,r,void 0,i)}),[o,t,n,r,i]),[Z,P]=(0,ye.Z)(void 0,h,Boolean(t));return a.ZP.createElement(Te.Z,{items:Z,onLoadMore:P,className:"chat-list custom-scroll"},null!=Z&&Z.length?Z.map((e=>a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable",onClick:()=>u(e),ripple:!f.wB},a.ZP.createElement(Re.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):Z&&!Z.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},t.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(we.Z,{key:"loading"}))}))),ja=(0,G.P2)((e=>e()),6e4,!0),Ka=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.chats,{query:a,fetchingStatus:s,globalResults:r,localResults:o}=e.globalSearch,{userIds:i}=r||{},{userIds:l}=o||{};return{chatsById:n,localContactIds:t,searchQuery:a,isSearching:null==s?void 0:s.chats,globalUserIds:i,localUserIds:l}}))((({isChannel:e,isActive:t,selectedMemberIds:n,onSelectedMemberIdsChange:r,onNextStep:o,onReset:i,chatsById:l,localContactIds:c,searchQuery:d,isSearching:h,localUserIds:Z,globalUserIds:P})=>{const{loadContactList:g,setGlobalSearchQuery:p}=(0,s.uC)();(0,a.d4)((()=>{ja((()=>{g()}))}));const E=(0,u.Z)();(0,m.ZP)(t,i);const C=(0,a.I4)((e=>{p({query:e})}),[p]),f=(0,a.Ye)((()=>{const e=(0,s.Rd)().users.byId,t=c?(0,v.kK)(c,e,d):[];return(0,v.ih)((0,me.Tw)([...t,...Z||[],...P||[]]).filter((t=>{const n=e[t];return!n||!n.isSelf&&(n.canBeInvitedToGroup||!(0,v.cS)(n))})),l,!1,n)}),[c,l,d,Z,P,n]),b=(0,a.I4)((()=>{(n.length||e)&&(p({query:""}),o())}),[n.length,e,p,o]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:i,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,E("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Ra.Z,{itemIds:f,selectedIds:n,filterValue:d,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:r,onFilterChange:C}),a.ZP.createElement(dn.Z,{isShown:Boolean(n.length||e),onClick:b,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),qa=(0,a.X$)((0,s.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}))((({isChannel:e,isActive:t,memberIds:n,onReset:r,creationProgress:i,creationError:l})=>{const{createGroupChat:c,createChannel:d}=(0,s.uC)(),h=(0,u.Z)();(0,m.ZP)(t,r);const[Z,P]=(0,a.eJ)(""),[v,g]=(0,a.eJ)(""),[p,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(),b="Chat title can't be empty",I="Channel title can't be empty",y="Sorry, creating supergroups is not yet supported",N=i===o.Nh.InProgress,S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");P(n),n!==t&&(e.currentTarget.value=n)}),[]),w=(0,a.I4)((e=>{g(e.currentTarget.value)}),[]),k=(0,a.I4)((()=>{Z.length?n.length>199?f(y):c({title:Z,photo:p,memberIds:n}):f(b)}),[Z,n,c,p,b,y]),M=(0,a.I4)((()=>{Z.length?d({title:Z,about:v,photo:p,memberIds:n}):f(I)}),[Z,d,v,p,n,I]);(0,a.d4)((()=>{i===o.Nh.Complete&&r(!0)}),[i,r]);const T=l&&h(l)||(C!==b&&C!==I?C:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(L.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,h(e?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(cn.Z,{onChange:E,title:h("AddPhoto")}),a.ZP.createElement(Me.Z,{value:Z,onChange:S,label:h(e?"EnterChannelName":"GroupName"),error:C===b||C===I?C:void 0}),e&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Me.Z,{value:v,onChange:w,label:h("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},h("DescriptionInfo"))),T&&a.ZP.createElement("p",{className:"error"},T),n.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},h("GroupInfo.ParticipantCount",n.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},n.map((e=>a.ZP.createElement(Le.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Re.Z,{userId:e}))))))),a.ZP.createElement(dn.Z,{isShown:0!==Z.length,onClick:e?M:k,disabled:N,ariaLabel:e?h("ChannelIntro.CreateChannel"):"Create Group"},N?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Wa=Object.keys(o.du).length/2,Qa=(0,a.X$)((({isActive:e,isChannel:t=!1,content:n,onContentChange:s,onReset:r})=>{const[i,l]=(0,a.eJ)([]),c=(0,a.I4)((()=>{s(t?o.du.NewChannelStep2:o.du.NewGroupStep2)}),[t,s]);return a.ZP.createElement(R.Z,{id:"NewChat",name:f.s0,renderCount:Wa,activeKey:n},(s=>{switch(n){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(Ka,{isChannel:t,isActive:e,selectedMemberIds:i,onSelectedMemberIdsChange:l,onNextStep:c,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(qa,{isChannel:t,isActive:s&&e,memberIds:i,onReset:r});default:return}}))}));var es=n(1080);const ts=(0,a.X$)((({isActive:e,onReset:t,onContentChange:n})=>{const s=(0,u.Z)();return(0,m.ZP)(e,t,n,o.du.Archived),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:t,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,s("ArchivedChats"))),a.ZP.createElement(es.Z,{folderType:"archived",isActive:e}))}));var ns=n(1218);const as=(0,a.X$)((0,s.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}))((({isOpen:e,chatId:t,foldersById:n,folderOrderedIds:r,onClose:o,onCloseAnimationEnd:i})=>{const{editChatFolders:l}=(0,s.uC)(),c=(0,u.Z)(),d=(0,a.Ye)((()=>n?Object.keys(n).reduce(((e,a)=>{const{includedChatIds:s,pinnedChatIds:r}=n[Number(a)];return(s.includes(t)||null!=r&&r.includes(t))&&e.push(a),e}),[]):[]),[t,n]),[m,h]=(0,a.eJ)(d),Z=(0,a.Ye)((()=>(null==r?void 0:r.map((e=>({label:n?n[e].title:"",value:String(e)}))))||[]),[r,n]),P=(0,a.I4)((()=>{const e=d.filter((e=>!m.includes(e))).map(Number),n=m.filter((e=>!d.includes(e))).map(Number);l({chatId:t,idsToRemove:e,idsToAdd:n}),o()}),[t,l,d,o,m]);if(n&&r)return a.ZP.createElement(ke.Z,{isOpen:e,onClose:o,onCloseAnimationEnd:i,onEnter:P,className:"delete",title:c("FilterAddTo")},a.ZP.createElement(ns.Z,{options:Z,selected:m,onChange:h,round:!0}),a.ZP.createElement(L.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:P},c("FilterAddTo")),a.ZP.createElement(L.Z,{className:"confirm-dialog-button",isText:!0,onClick:o},c("Cancel")))})));var ss=n(4319),rs=n(647);function os(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let is,ls;const cs={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},ds=e=>"changedTouches"in e?e.changedTouches[0].clientY:0,ms=e=>{const t="deltaY"in e?e.deltaY:ds(e);if(!is||!is.contains(e.target)||is.scrollTop<=0&&t<=0||is.scrollTop>=is.scrollHeight-is.offsetHeight&&t>=0){if(ls&&e.target.closest(ls))return;e.preventDefault()}};function us(e){cs[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 hs(e,t){is=e,ls=t,document.addEventListener("wheel",ms,{passive:!1}),document.addEventListener("touchmove",ms,{passive:!1}),document.onkeydown=us}function Zs(){is=void 0,ls=void 0,document.removeEventListener("wheel",ms),document.removeEventListener("touchmove",ms),document.onkeydown=null}var Ps=n(3394),vs=n(2328);const gs=({reaction:e,onSendReaction:t,isReady:n})=>{var s;const o=(0,a.sO)(null),i=(0,h.Z)(`document${null===(s=e.selectAnimation)||void 0===s?void 0:s.id}`,!n,r.IU.Lottie),[l,c,d]=(0,De.Z)(),[m,u]=(0,De.Z)(),Z=Boolean(n&&i),{transitionClassNames:P}=(0,z.Z)(Z),{shouldRender:v,transitionClassNames:g}=(0,z.Z)(!n||!m,void 0,!0);return a.ZP.createElement("div",{className:"reaction",onClick:function(){if(!o.current)return;const{x:n,y:a}=o.current.getBoundingClientRect();t(e.reaction,n,a)},ref:o,onMouseEnter:n?c:void 0},v&&a.ZP.createElement(lt.Z,{className:n?g:void 0,reaction:e.reaction}),Z&&a.ZP.createElement(mt.Z,{id:`select_${e.reaction}`,className:P,animationData:i,play:l,noLoop:!0,size:32,onLoad:u,onEnded:d}))},ps=(0,a.X$)((({availableReactions:e,enabledReactions:t,onSendReaction:n,isPrivate:s,isReady:r})=>{const o=(0,a.sO)(null),[i,l]=(0,De.Z)(!1);(0,Ct.Z)(o.current,!i),(0,a.bt)((()=>{l()}),[l]);const c=e=>{o&&("deltaY"in e?e.deltaY:ds(e))&&e.preventDefault()};if((s||null!=t&&t.length)&&e)return a.ZP.createElement("div",{className:"ReactionSelector",onWheelCapture:c,onTouchMove:c},a.ZP.createElement("div",{className:"bubble-big"}),a.ZP.createElement("div",{className:"bubble-small"}),a.ZP.createElement("div",{className:"items-wrapper"},a.ZP.createElement("div",{className:"items no-scrollbar",ref:o},null==e?void 0:e.map((e=>{if(!e.isInactive&&(s||t&&t.includes(e.reaction)))return a.ZP.createElement(gs,{key:e.reaction,isReady:r,onSendReaction:n,reaction:e})})))))})),Es=(0,a.X$)((({availableReactions:e,isOpen:t,message:n,isPrivate:s,enabledReactions:o,anchor:i,canSendNow:l,canReschedule:c,canReply:d,canEdit:m,canPin:h,canUnpin:Z,canDelete:P,canReport:g,canForward:p,canFaveSticker:E,canUnfaveSticker:C,canCopy:b,canCopyLink:I,canSelect:y,canDownload:N,isDownloading:S,canShowSeenBy:w,canShowReactionsCount:k,canRemoveReaction:M,canShowReactionList:T,seenByRecentUsers:L,onReply:A,onEdit:R,onPin:F,onUnpin:$,onForward:D,onDelete:x,onReport:U,onFaveSticker:O,onUnfaveSticker:G,onSelect:J,onSend:_,onReschedule:z,onClose:Y,onCloseAnimationEnd:H,onCopyLink:V,onDownload:j,onShowSeenBy:K,onShowReactors:q,onSendReaction:W})=>{var Q,ee,te,ne;const ae=(0,a.sO)(null),se=(0,a.sO)(null),re=function(e,t,n){const a=[],s=(0,v.UD)(e),o=(0,v.O$)(e)||((0,v.Cg)(e)?void 0:(0,v.F$)(e)),i=(0,v.Ti)(e,"inline"),l=o&&(i||(0,v.BM)(e))&&ss.yl,c=window.getSelection();if(l&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(i?rs.he(i,r.IU.BlobUrl):o.blobUrl).then(ss.VP),t&&t()}}),s){var d;const e=Boolean((null==c||null===(d=c.anchorNode)||void 0===d?void 0:d.parentNode)&&c.anchorNode.parentNode.closest(".Message .content-inner")&&""!==c.toString().replace(/(?:\r\n|\r|\n)/g,""));a.push({label:os(e),handler:()=>{const n=e&&c?c.toString():s;(0,ss.TE)(n),t&&t()}})}return n&&a.push({label:"lng_context_copy_message_link",handler:()=>{n(),t&&t()}}),a}(n,Y,I?V:void 0),oe=!(s||null!=o&&o.length),ie=T&&!oe,[le,ce,de]=(0,De.Z)(),me=(0,a.I4)((()=>document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${n.id}"]`)),[n.id]),ue=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),he=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),Ze=(0,a.I4)((()=>{var e;const t=f.wB&&(null===(e=document.querySelector(".AudioPlayer-content"))||void 0===e?void 0:e.offsetHeight)||0,n=document.querySelector(".HeaderPinnedMessage-wrapper"),a=(f.wB&&!t||!f.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:ie?32:void 0,extraMarginTop:a+t}}),[ie]),Pe=(0,a.I4)((()=>{W(void 0,0,0)}),[W]);(0,a.d4)((()=>{t?setTimeout((()=>{ce()}),200):de()}),[t,ce,de]);const{positionX:ve,positionY:pe,style:Ee,menuStyle:Ce,withScroll:fe}=(0,Ps.Z)(i,me,ue,he,Ze);(0,a.d4)((()=>(hs(fe?se.current:void 0,".ReactionSelector"),Zs)),[fe]);const be=(0,u.Z)();return a.ZP.createElement(vs.Z,{ref:ae,isOpen:t,positionX:ve,positionY:pe,style:Ee,bubbleStyle:Ce,className:(0,X.Z)("MessageContextMenu","fluid",ie&&"with-reactions"),onClose:Y,onCloseAnimationEnd:H},T&&a.ZP.createElement(ps,{enabledReactions:o,onSendReaction:W,isPrivate:s,availableReactions:e,isReady:le}),a.ZP.createElement("div",{className:"scrollable-content custom-scroll",style:Ce,ref:se},M&&a.ZP.createElement(B.Z,{icon:"reactions",onClick:Pe},"Remove Reaction"),l&&a.ZP.createElement(B.Z,{icon:"send-outline",onClick:_},be("MessageScheduleSend")),c&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:z},be("MessageScheduleEditTime")),d&&a.ZP.createElement(B.Z,{icon:"reply",onClick:A},be("Reply")),m&&a.ZP.createElement(B.Z,{icon:"edit",onClick:R},be("Edit")),E&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:O},be("AddToFavorites")),C&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:G},be("Stickers.RemoveFromFavorites")),b&&re.map((e=>a.ZP.createElement(B.Z,{key:e.label,icon:"copy",onClick:e.handler},be(e.label)))),h&&a.ZP.createElement(B.Z,{icon:"pin",onClick:F},be("DialogPin")),Z&&a.ZP.createElement(B.Z,{icon:"unpin",onClick:$},be("DialogUnpin")),N&&a.ZP.createElement(B.Z,{icon:"download",onClick:j},be(S?"lng_context_cancel_download":"lng_media_download")),p&&a.ZP.createElement(B.Z,{icon:"forward",onClick:D},be("Forward")),y&&a.ZP.createElement(B.Z,{icon:"select",onClick:J},be("Common.Select")),g&&a.ZP.createElement(B.Z,{icon:"flag",onClick:U},be("lng_context_report_msg")),(w||k)&&a.ZP.createElement(B.Z,{icon:k?"reactions":"group",onClick:k?q:K,disabled:!(k||null!==(Q=n.seenByUserIds)&&void 0!==Q&&Q.length)},k&&null!==(ee=n.reactors)&&void 0!==ee&&ee.count?w&&null!==(te=n.seenByUserIds)&&void 0!==te&&te.length?be("Chat.OutgoingContextMixedReactionCount",[n.reactors.count,n.seenByUserIds.length]):be("Chat.ContextReactionCount",n.reactors.count,"i"):null!==(ne=n.seenByUserIds)&&void 0!==ne&&ne.length?be("Conversation.ContextMenuSeen",n.seenByUserIds.length,"i"):be("Conversation.ContextMenuNoViews"),a.ZP.createElement("div",{className:"avatars"},null==L?void 0:L.map((e=>a.ZP.createElement(ge.Z,{size:"micro",user:e}))))),P&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:x},be("Delete"))))})),Cs=2*I.Gw,fs=(0,a.X$)((0,s.c$)(((e,{message:t,messageListType:n})=>{var a,s,r;const{threadId:o}=(0,g.Bt)(e)||{},l=(0,g.xs)(e,t.chatId),c=(0,g.Z1)(e,t.chatId),{noOptions:d,canReply:m,canPin:u,canUnpin:h,canDelete:Z,canReport:P,canEdit:p,canForward:E,canFaveSticker:C,canUnfaveSticker:f,canCopy:b,canCopyLink:I,canSelect:y,canDownload:N}=o&&(0,g._k)(e,t,o)||{},S="pinned"===n,w="scheduled"===n,k=c&&(0,v.eA)(c),M=Boolean(c&&(0,v.Bf)(c)&&(0,v.B4)(t)&&!w&&c.membersCount&&c.membersCount<i.Hc&&t.date>Date.now()/1e3-i.EH),T=c&&(0,v.YC)(c.id),L=(0,v.Lo)(t),A=!k&&!w&&!L&&!T&&t.reactions&&!(0,v.JE)(t.reactions)&&t.reactions.canSeeList,R=T&&(null===(a=t.reactions)||void 0===a||null===(s=a.results)||void 0===s?void 0:s.some((e=>e.isChosen))),F=(0,g.EV)(e,t);return{availableReactions:e.availableReactions,noOptions:d,canSendNow:w,canReschedule:w,canReply:!S&&!w&&m,canPin:!w&&u,canUnpin:!w&&h,canDelete:Z,canReport:P,canEdit:!S&&p,canForward:!F&&!w&&E,canFaveSticker:!w&&C,canUnfaveSticker:!w&&f,canCopy:!F&&b,canCopyLink:!F&&!w&&I,canSelect:y,canDownload:!F&&N,activeDownloads:l,canShowSeenBy:M,enabledReactions:null==c||null===(r=c.fullInfo)||void 0===r?void 0:r.enabledReactions,isPrivate:T,hasFullInfo:Boolean(null==c?void 0:c.fullInfo),canShowReactionsCount:A,canShowReactionList:!L&&!w&&(null==c?void 0:c.id)!==i.aw,canRemoveReaction:R}}))((({availableReactions:e,isOpen:t,messageListType:n,chatUsername:r,message:o,album:i,anchor:l,onClose:c,onCloseAnimationEnd:d,noOptions:m,canSendNow:u,hasFullInfo:h,canReschedule:Z,canReply:P,canPin:v,canUnpin:g,canDelete:p,canReport:E,canShowReactionsCount:C,canShowReactionList:f,canRemoveReaction:b,canEdit:I,enabledReactions:y,isPrivate:N,canForward:S,canFaveSticker:w,canUnfaveSticker:k,canCopy:M,canCopyLink:T,canSelect:L,canDownload:A,activeDownloads:R,canShowSeenBy:F})=>{var B;const{setReplyingToId:$,setEditingId:D,pinMessage:x,openForwardMenu:U,faveSticker:O,unfaveSticker:G,toggleMessageSelection:J,sendScheduledMessages:X,rescheduleMessage:_,downloadMessageMedia:Y,cancelMessageMediaDownload:H,loadSeenBy:V,openSeenByModal:j,sendReaction:q,openReactorListModal:W,loadFullChat:Q,loadReactors:ee}=(0,s.uC)(),{transitionClassNames:te}=(0,z.Z)(t,d,void 0,!1),[ne,ae]=(0,a.eJ)(!0),[se,re]=(0,a.eJ)(!1),[oe,ie]=(0,a.eJ)(!1),[le,ce]=(0,a.eJ)(!1),[de,me,ue]=(0,De.Z)();(0,a.d4)((()=>{F&&t&&V({chatId:o.chatId,messageId:o.id})}),[V,t,o.chatId,o.id,F]),(0,a.d4)((()=>{C&&t&&ee({chatId:o.chatId,messageId:o.id})}),[C,t,ee,o.chatId,o.id]),(0,a.d4)((()=>{h||N||!t||Q({chatId:o.chatId})}),[h,t,N,Q,o.chatId]);const he=(0,a.Ye)((()=>{var e,t,n;if(null!==(e=o.reactions)&&void 0!==e&&null!==(t=e.recentReactions)&&void 0!==t&&t.length){var a,r;const e=(0,s.Rd)().users.byId;return null===(a=o.reactions)||void 0===a||null===(r=a.recentReactions)||void 0===r?void 0:r.slice(0,3).map((({userId:t})=>e[t])).filter(Boolean)}if(!o.seenByUserIds)return;const i=(0,s.Rd)().users.byId;return null===(n=o.seenByUserIds)||void 0===n?void 0:n.slice(0,3).map((e=>i[e])).filter(Boolean)}),[null===(B=o.reactions)||void 0===B?void 0:B.recentReactions,o.seenByUserIds]),Ze=i?i.messages.some((e=>R.includes(e.id))):R.includes(o.id),Pe=(0,a.I4)((()=>{ae(!1),re(!0)}),[]),ve=(0,a.I4)((()=>{ae(!1),ie(!0)}),[]),ge=(0,a.I4)((()=>{ae(!1),c()}),[c]),pe=(0,a.I4)((()=>{re(!1),c()}),[c]),Ee=(0,a.I4)((()=>{ie(!1),c()}),[c]),Ce=(0,a.I4)((()=>{ce(!1),c()}),[c]),fe=(0,a.I4)((()=>{ue(),c()}),[ue,c]),be=(0,a.I4)((()=>{$({messageId:o.id}),ge()}),[$,o.id,ge]),Ie=(0,a.I4)((()=>{D({messageId:o.id}),ge()}),[D,o.id,ge]),ye=(0,a.I4)((()=>{ae(!1),ce(!0)}),[]),Ne=(0,a.I4)((()=>{x({messageId:o.id,isUnpin:!0}),ge()}),[x,o.id,ge]),Se=(0,a.I4)((()=>{if(ge(),null!=i&&i.messages){const e=i.messages.map((({id:e})=>e));U({fromChatId:o.chatId,messageIds:e})}else U({fromChatId:o.chatId,messageIds:[o.id]})}),[U,o,ge,i]),we=(0,a.I4)((()=>{ge(),O({sticker:o.content.sticker})}),[ge,o.content.sticker,O]),ke=(0,a.I4)((()=>{ge(),G({sticker:o.content.sticker})}),[ge,o.content.sticker,G]),Me=(0,a.I4)((()=>{const e=null!=i&&i.messages?{messageId:o.id,childMessageIds:i.messages.map((({id:e})=>e)),withShift:!1}:{messageId:o.id,withShift:!1};J(e),ge()}),[ge,o.id,J,i]),Te=(0,a.I4)((()=>{X({chatId:o.chatId,id:o.id}),ge()}),[ge,o.chatId,o.id,X]),Le=(0,a.I4)((()=>{ae(!1),me()}),[me]),Ae=(0,a.I4)((()=>{ge(),j({chatId:o.chatId,messageId:o.id})}),[ge,o.chatId,o.id,j]),Re=(0,a.I4)((()=>{ge(),W({chatId:o.chatId,messageId:o.id})}),[ge,W,o.chatId,o.id]),Fe=(0,a.I4)((e=>{_({chatId:o.chatId,messageId:o.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[o.chatId,o.id,_]),Be=(0,a.I4)((()=>{(0,ss.TE)(`https://t.me/${r||`c/${o.chatId.replace("-","")}`}/${o.id}`),ge()}),[r,ge,o.chatId,o.id]),$e=(0,a.I4)((()=>{((null==i?void 0:i.messages)||[o]).forEach((e=>{Ze?H({message:e}):Y({message:e})})),ge()}),[i,o,ge,Ze,H,Y]),xe=(0,a.I4)(((e,t,n)=>{q({chatId:o.chatId,messageId:o.id,reaction:e,x:t,y:n,startSize:Cs}),ge()}),[ge,o.chatId,o.id,q]),Ue=(0,a.Ye)((()=>(i?i.messages:[o]).map((({id:e})=>e))),[i,o]);if(m)return void ge();const Oe=new Date;return Oe.setFullYear(Oe.getFullYear()+1),a.ZP.createElement("div",{className:["ContextMenuContainer",te].join(" ")},a.ZP.createElement(Es,{availableReactions:e,message:o,isPrivate:N,isOpen:ne,enabledReactions:y,anchor:l,canShowReactionsCount:C,canShowReactionList:f,canRemoveReaction:b,canSendNow:u,canReschedule:Z,canReply:P,canDelete:p,canReport:E,canPin:v,canUnpin:g,canEdit:I,canForward:S,canFaveSticker:w,canUnfaveSticker:k,canCopy:M,canCopyLink:T,canSelect:L,canDownload:A,canShowSeenBy:F,isDownloading:Ze,seenByRecentUsers:he,onReply:be,onEdit:Ie,onPin:ye,onUnpin:Ne,onForward:Se,onDelete:Pe,onReport:ve,onFaveSticker:we,onUnfaveSticker:ke,onSelect:Me,onSend:Te,onReschedule:Le,onClose:ge,onCopyLink:Be,onDownload:$e,onShowSeenBy:Ae,onSendReaction:xe,onShowReactors:Re}),a.ZP.createElement(We,{isOpen:se,isSchedule:"scheduled"===n,onClose:pe,album:i,message:o}),a.ZP.createElement(st,{isOpen:oe,onClose:Ee,messageIds:Ue}),a.ZP.createElement(Qe,{isOpen:le,messageId:o.id,chatId:o.chatId,onClose:Ce}),a.ZP.createElement(Ke,{isOpen:de,withTimePicker:!0,selectedAt:1e3*o.date,maxAt:(0,K._F)(Oe),isFutureMode:!0,onClose:fe,onSubmit:Fe}))}))),bs=(0,a.X$)((0,s.c$)(((e,{fromSticker:t,stickerSetShortName:n})=>{const a=(0,g.Bt)(e),{chatId:s,threadId:r}=a||{},o=s&&(0,g.Z1)(e,s),i=o?(0,v.H5)(o):void 0;return{canSendStickers:Boolean(o&&r&&(0,v.Qm)(o,r)&&(null==i?void 0:i.canSendStickers)),stickerSet:t?(0,g.Ny)(e,t.stickerSetId):n?(0,g.E_)(e,n):void 0}}))((({isOpen:e,fromSticker:t,stickerSetShortName:n,stickerSet:r,canSendStickers:o,onClose:l})=>{const{loadStickers:c,toggleStickerSet:d,sendMessage:m}=(0,s.uC)(),h=(0,a.sO)(null),Z=(0,u.Z)(),{observe:P}=(0,Bn.S1)({rootRef:h,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>{if(e)if(t){const{stickerSetId:e,stickerSetAccessHash:n}=t;c({stickerSetId:e,stickerSetAccessHash:n})}else n&&c({stickerSetShortName:n})}),[e,t,c,n]);const v=(0,a.I4)((e=>{e={...e,isPreloadedGlobally:!0},m({sticker:e}),l()}),[l,m]),g=(0,a.I4)((()=>{r&&(d({stickerSetId:r.id}),l())}),[l,r,d]);return a.ZP.createElement(ke.Z,{className:"StickerSetModal",isOpen:e,onClose:l,hasCloseButton:!0,title:r?(0,ve.Z)(r.title,["emoji","links"]):Z("AccDescrStickerSet")},null!=r&&r.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:h,className:"stickers custom-scroll"},r.stickers.map((e=>a.ZP.createElement(Un.Z,{sticker:e,size:i.yK,observeIntersection:P,onClick:o?v:void 0,clickArg:e})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(L.Z,{size:"smaller",fluid:!0,color:r.installedDate?"danger":"primary",onClick:g},Z(r.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",r.count,"i")))):a.ZP.createElement(we.Z,null))})));var Is=n(2898);const ys=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t);if(!a||a.isRestricted)return{};const s=(0,v.YC)(a.id),r=s?(0,g.dy)(e,t):void 0,o=r&&(0,v.kw)(r);return{chat:a,isMuted:(0,v.i4)(a,(0,g.dZ)(e),(0,g.NJ)(e)),isPrivate:s,canAddContact:o,canDeleteChat:(0,v.cc)(a),hasLinkedChat:Boolean(null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.linkedChatId)}}))((({chatId:e,isOpen:t,withExtraActions:n,anchor:r,isChannel:o,canStartBot:i,canRestartBot:l,canSubscribe:c,canSearch:d,canCall:m,canMute:h,canLeave:Z,canEnterVoiceChat:P,canCreateVoiceChat:v,chat:g,isPrivate:p,isMuted:E,canDeleteChat:C,hasLinkedChat:b,canAddContact:I,onSubscribeChannel:y,onSearchClick:N,onClose:S,onCloseAnimationEnd:w})=>{const{updateChatMutedState:k,enterMessageSelectMode:M,sendBotCommand:T,restartBot:L,joinGroupCall:A,createGroupCall:R,openLinkedChat:F,addContact:$,openCallFallbackConfirm:D}=(0,s.uC)(),[x,U]=(0,a.eJ)(!0),[O,G]=(0,a.eJ)(!1),{x:J,y:X}=r;(0,z.Z)(t,w,void 0,!1);const _=(0,a.I4)((()=>{U(!1),G(!0)}),[]),Y=(0,a.I4)((()=>{U(!1),S()}),[S]),H=(0,a.I4)((()=>{G(!1),S()}),[S]),V=(0,a.I4)((()=>{T({command:"/start"})}),[T]),j=(0,a.I4)((()=>{L({chatId:e})}),[e,L]),K=(0,a.I4)((()=>{k({chatId:e,isMuted:!E}),Y()}),[e,Y,E,k]),q=(0,a.I4)((()=>{v?R({chatId:e}):A({chatId:e}),Y()}),[Y,v,e,A,R]),W=(0,a.I4)((()=>{F({id:e}),Y()}),[e,Y,F]),Q=(0,a.I4)((()=>{$({userId:e}),Y()}),[$,e,Y]),ee=(0,a.I4)((()=>{y(),Y()}),[Y,y]),te=(0,a.I4)((()=>{D(),Y()}),[Y,D]),ne=(0,a.I4)((()=>{N(),Y()}),[Y,N]),ae=(0,a.I4)((()=>{M(),Y()}),[Y,M]);(0,a.d4)((()=>(hs(),Zs)),[]);const se=(0,u.Z)();return a.ZP.createElement(Is.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(vs.Z,{isOpen:x,positionX:"right",style:`left: ${J}px;top: ${X}px;`,onClose:Y},n&&i&&a.ZP.createElement(B.Z,{icon:"bots",onClick:V},se("BotStart")),n&&l&&a.ZP.createElement(B.Z,{icon:"bots",onClick:j},se("BotRestart")),n&&c&&a.ZP.createElement(B.Z,{icon:o?"channel":"group",onClick:ee},se(o?"ProfileJoinChannel":"ProfileJoinGroup")),I&&a.ZP.createElement(B.Z,{icon:"add-user",onClick:Q},se("AddContact")),f.wB&&m&&a.ZP.createElement(B.Z,{icon:"phone",onClick:te},se("Call")),f.wB&&d&&a.ZP.createElement(B.Z,{icon:"search",onClick:ne},se("Search")),h&&a.ZP.createElement(B.Z,{icon:E?"unmute":"mute",onClick:K},se(E?"ChatsUnmute":"ChatsMute")),(P||v)&&a.ZP.createElement(B.Z,{icon:"voice-chat",onClick:q},se(v?"StartVoipChat":"VoipGroupJoinCall")),b&&a.ZP.createElement(B.Z,{icon:o?"comments":"channel",onClick:W},se(o?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(B.Z,{icon:"select",onClick:ae},se("ReportSelectMessages")),Z&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:_},se(p?"DeleteChatUser":C?"GroupInfo.DeleteAndExit":o?"LeaveChannel":"Group.LeaveGroup"))),g&&a.ZP.createElement(gt.Z,{isOpen:O,onClose:H,chat:g})))})));var Ns=n(9589);const Ss=(0,G.Ds)((e=>e()),200,!1),ws=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.jr)(e);if(!t)return{};const{query:n,results:a}=(0,g.n5)(e)||{},{totalCount:s,foundIds:r}=a||{};return{chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}))((({isActive:e,chat:t,query:n,totalCount:r,foundIds:o,isHistoryCalendarOpen:i})=>{const{setLocalTextSearchQuery:l,searchTextMessagesLocal:c,focusMessage:d,closeLocalTextSearch:m,openHistoryCalendar:u}=(0,s.uC)(),h=(0,a.sO)(null),[Z,P]=(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===h.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)((()=>{t&&o&&o.length?(d({chatId:t.id,messageId:o[o.length-1]}),P(0)):P(-1)}),[t,d,o]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((t=>{t.disabled=Boolean(e&&t!==h.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((t=>{t.contentEditable=e?"false":"true"}))}),[e]),(0,a.d4)((()=>{e||h.current.blur()}),[e]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[i]);const v=(0,a.I4)((e=>{l({query:e}),e.length&&Ss(c)}),[c,l]),g=(0,a.I4)((()=>{if(t&&o){const e=Z+1;d({chatId:t.id,messageId:o[o.length-1-e]}),P(e)}}),[t,Z,d,o]),p=(0,a.I4)((()=>{if(t&&o){const e=Z-1;d({chatId:t.id,messageId:o[o.length-1-e]}),P(e)}}),[t,Z,d,o]);return a.ZP.createElement("div",{id:"MobileSearch",className:e?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(L.Z,{size:"smaller",round:!0,color:"translucent",onClick:m},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(Ns.Z,{ref:h,value:n,onChange:v})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},n?null!=o&&o.length?`${Z+1} of ${r}`:o&&!o.length?"No results":"":a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>u({selectedAt:(0,K._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:g,disabled:!o||!o.length||Z===o.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(L.Z,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!o||!o.length||0===Z},a.ZP.createElement("i",{className:"icon-down"}))))})));var ks=n(5376),Ms=n(9295),Ts=n(3575),Ls=n(971),As=n(7002),Rs=n(3616);function Fs(e,t,n=0,a=!1,s=!1,r=!1){const o=e[r?"scrollLeft":"scrollTop"],i=o+e[r?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let m=!1;for(let e=0;e<c;e++){const t=l[e],c=t[r?"offsetLeft":"offsetTop"],u=c+t[r?"offsetWidth":"offsetHeight"];if(s?u>=o-n&&u<=i+n:c<=i+n&&u>=o-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:l,visibleIndexes:d}}const Bs=function(e,t,n=!1){const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],r=t[n?"offsetLeft":"offsetTop"],o=r+t[n?"offsetWidth":"offsetHeight"];return r>a&&o<s};var $s=n(539);function Ds(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:r}=Fs(a,e,8,!0,!0);if(!r.length||!r[t])return;const o=s[0];if(!s.includes(t)||t===o&&!Bs(a,r[o])){const e=t>s[s.length-1]?"start":"end";(0,$s.Z)(a,r[t],e,10)}}var xs=n(3570);function Us({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:n,shouldRemoveSelectionOnReset:s,noArrowNavigation:r,items:o,shouldSelectOnTab:i,onSelect:l,onClose:c}){const[d,m]=(0,a.eJ)(-1),u=(0,a.I4)((e=>o?(0,xs.Z)(o.length,e):-1),[o]),h=(0,a.I4)(((e,t)=>{t.preventDefault(),m((t=>u(t+e)))}),[m,u]),Z=(0,a.I4)((e=>{if(o&&o.length&&d>-1){const t=o[d];t&&(e.preventDefault(),l(t))}}),[o,l,d]),P=!o||d>o.length-1;return(0,a.d4)((()=>{n&&!P||m(s?-1:0)}),[P,s,n]),(0,a.d4)((()=>e?(0,tt.Z)({onEsc:c,onUp:r||t?void 0:e=>h(-1,e),onDown:r||t?void 0:e=>h(1,e),onLeft:r||!t?void 0:e=>h(-1,e),onRight:r||!t?void 0:e=>h(1,e),onTab:i?Z:void 0,onEnter:Z}):void 0),[r,h,Z,e,t,c,i]),d}const Os=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,filteredUsers:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:l}=(0,z.Z)(e,void 0,void 0,!1),c=(0,a.I4)(((e,t=!1)=>{const a=(0,s.Rd)().users.byId[e];a&&n(a,t)}),[n]),d=(0,a.I4)((e=>{c(e.id,!0)}),[c]),m=Us({isActive:e,items:r,onSelect:d,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,a.d4)((()=>{Ds(".chat-item-clickable",m,o)}),[m]),(0,a.d4)((()=>{r&&!r.length&&t()}),[r,t]);const u=(0,P.Z)(null!=r&&r.length?r:void 0,i),h=r&&!r.length?u:r;if(!i||h&&!h.length)return;const Z=(0,X.Z)("MentionTooltip composer-tooltip custom-scroll",l);return a.ZP.createElement("div",{className:Z,ref:o},null==h?void 0:h.map((({id:e},t)=>a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>c(e),focus:m===t},a.ZP.createElement(Re.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var Gs=n(9830);const Js=(0,a.X$)((({chatId:e,threadId:t,attachments:n,caption:s,isReady:r,currentUserId:o,groupChatMembers:l,recentEmojis:c,baseEmojiKeywords:d,emojiKeywords:m,addRecentEmoji:h,onCaptionUpdate:Z,onSend:v,onFileAppend:g,onClear:p})=>{const C=(0,Ls.Y)(s),f=(0,a.sO)(),b=(0,P.Z)(n),I=n.length?n:b,y=Boolean(n.length),[N,S,w]=(0,De.Z)(),k=Boolean(I&&I.every((e=>e.quick))),M=(0,u.Z)(),{isMentionTooltipOpen:T,closeMentionTooltip:A,insertMention:R,mentionFilteredUsers:F}=(0,Ms.Z)(y,C,Z,i.nY,l,void 0,o),{isEmojiTooltipOpen:B,closeEmojiTooltip:$,filteredEmojis:D,insertEmoji:x}=(0,Ts.Z)(y,C,c,i.nY,Z,d,m,!r);(0,a.d4)((()=>y?(0,E.Z)(p):void 0),[y,p]);const U=(0,a.I4)((()=>{y&&v()}),[y,v]),O=(0,a.I4)((e=>{e.preventDefault(),w();const{dataTransfer:{files:t}}=e;if(null!=t&&t.length){const e=k?Array.from(t).filter((e=>e.type&&i.dI.has(e.type))):Array.from(t);g(e,k)}}),[k,g,w]);if(!I)return;const G=I.every((e=>i.oG.has(e.mimeType))),J=I.every((e=>i.wG.has(e.mimeType))),X=I.every((e=>e.mimeType.startsWith("audio/")));let _="";return _=M(G?"PreviewSender.SendPhoto":J?"PreviewSender.SendVideo":X?"PreviewSender.SendAudio":"PreviewSender.SendFile",I.length,"i"),a.ZP.createElement(ke.Z,{isOpen:y,onClose:p,header:function(){if(I)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:M.isRtl?"rtl":void 0},a.ZP.createElement(L.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:p},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},_),a.ZP.createElement(L.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:U},M("Send")))}(),className:"AttachmentModal "+(N?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:S,onDrop:O,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),f.current&&(window.clearTimeout(f.current),f.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(f.current=window.setTimeout(w,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),w())},"data-attach-description":M("Preview.Dragging.AddItems",10)},k?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},I.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})))):a.ZP.createElement("div",{className:"document-wrapper custom-scroll"},I.map((e=>a.ZP.createElement(As.Z,{name:e.filename,extension:(0,ks.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Os,{isOpen:T,onClose:A,onInsertUserName:R,filteredUsers:F}),a.ZP.createElement(Gs.Z,{isOpen:B,emojis:D,onClose:$,onEmojiSelect:x,addRecentEmoji:h}),a.ZP.createElement(Rs.Z,{id:"caption-input-text",chatId:e,threadId:t,isAttachmentModalInput:!0,html:s,editableInputId:i.nY,placeholder:M("Caption"),onUpdate:Z,onSend:v,canAutoFocus:Boolean(r&&n.length)}))))}));var Xs=n(3099);const _s=(0,a.X$)((({isOpen:e,onSend:t,onClear:n})=>{const s=(0,a.sO)(null),r=(0,a.sO)(null),o=(0,a.sO)(null),[i,l]=(0,a.eJ)(""),[c,d]=(0,a.eJ)([""]),[m,h]=(0,a.eJ)(!0),[Z,P]=(0,a.eJ)(!1),[v,g]=(0,a.eJ)(!1),[p,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(),[I,y]=(0,a.eJ)(!1),N=(0,u.Z)(),S=(0,a.I4)((t=>{e&&t.current&&t.current.focus()}),[e]);(0,a.d4)((()=>e?(0,E.Z)(n):void 0),[e,n]),(0,a.d4)((()=>{e||(l(""),d([""]),h(!0),P(!1),g(!1),C(""),b(""),y(!1))}),[e]),(0,a.d4)((()=>S(s)),[S,e]),(0,a.bt)((()=>{const e=o.current;e&&p!==e.innerHTML&&(e.innerHTML=p)}),[p]);const w=(0,a.I4)(((e=[])=>{d([...e,""]),requestAnimationFrame((()=>{const e=r.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),k=(0,a.I4)((()=>{if(y(!1),!e)return;const n=i.trim().substring(0,255),a=c.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!n||a.length<2)return l(n),a.length?a.length<2?w(a):d(a):w(),void y(!0);if(v&&(!f||!a[Number(f)]))return void y(!0);const s={summary:{question:n,answers:a.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===f&&{correct:!0}}))),...!m&&{isPublic:!0},...Z&&{multipleChoice:!0},...v&&{quiz:!0}}};if(v){const{text:e,entities:t}=p&&(0,Xs.Z)(p.substring(0,200))||{};s.quiz={correctAnswers:[f],...e&&{solution:e},...t&&{solutionEntities:t}}}t(s)}),[e,i,c,v,f,m,Z,t,w,p]),M=(0,a.I4)(((e,t)=>{const n=[...c];n[e]=t,n[n.length-1].trim().length&&n.length<10?w(n):d(n)}),[c,w]),T=(0,a.I4)((e=>{const t=[...c];t.splice(e,1),d(t),requestAnimationFrame((()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)}))}),[c]),A=(0,a.I4)((e=>{b(e)}),[b]),R=(0,a.I4)((e=>{h(e.target.checked)}),[]),F=(0,a.I4)((e=>{P(e.target.checked)}),[]),B=(0,a.I4)((e=>{g(e.target.checked)}),[]),$=(0,a.I4)((e=>{13===e.keyCode&&k()}),[k]),D=(0,a.I4)((()=>{if(I&&!i.trim().length)return N("lng_polls_choose_question")}),[I,N,i]),x=(0,a.I4)((e=>{const t=c.map((e=>e.trim())).filter((e=>e.length));if(I&&t.length<2&&!c[e].trim().length)return N("lng_polls_choose_answers")}),[I,N,c]);function U(){return c.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(Me.Z,{label:t!==c.length-1||10===c.length?N("OptionHint"):N("CreatePoll.AddOption"),error:x(t),value:e,onChange:e=>M(t,e.currentTarget.value),onKeyPress:$}),t!==c.length-1&&a.ZP.createElement(L.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:N("Delete"),onClick:()=>T(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement(ke.Z,{isOpen:e,onClose:n,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(L.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:n},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},N("NewPoll")),a.ZP.createElement(L.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:k},N("Create"))),className:"PollModal"},a.ZP.createElement(Me.Z,{ref:s,label:N("AskAQuestion"),value:i,error:D(),onChange:e=>l(e.currentTarget.value),onKeyPress:$}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:r},a.ZP.createElement("h3",{className:"options-header"},N("PollOptions")),I&&function(){const e=c.map((e=>e.trim())).filter((e=>e.length));return v&&(!f||!e[Number(f)])&&a.ZP.createElement("p",{className:"error"},N("lng_polls_choose_correct"))}(),v?a.ZP.createElement(at.Z,{name:"correctOption",options:U().map(((e,t)=>({value:String(t),label:e,hidden:t===c.length-1}))),onChange:A}):U()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},a.ZP.createElement(Cn.Z,{label:N("PollAnonymous"),checked:m,onChange:R}),a.ZP.createElement(Cn.Z,{label:N("PollMultiple"),checked:Z,disabled:v,onChange:F}),a.ZP.createElement(Cn.Z,{label:N("PollQuiz"),checked:v,disabled:Z,onChange:B}),v&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},N("lng_polls_solution_title")),a.ZP.createElement("div",{ref:o,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>C(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},N("CreatePoll.ExplanationInfo")))))}));var zs=n(6503),Ys=n(4284),Hs=n(1367);const Vs=(0,a.X$)((({emoji:e,focus:t,onClick:n})=>{const s=(0,a.I4)((t=>{t.preventDefault(),n(e.native,e.id)}),[e,n]);return a.ZP.createElement("div",{className:"EmojiButton "+(t?"focus":""),onMouseDown:s,title:`:${e.names[0]}:`},f.op?e.native:a.ZP.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))})),js=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:r,onEmojiSelect:o})=>{const i=(0,a.sO)(null);(0,Bn._N)(i,s);const l=(0,$n.Z)(r),c=(0,u.Z)(),d=f.wB?Math.floor((b.Z.get().width-8)/44):9,m=44*Math.ceil(e.emojis.length/d);return a.ZP.createElement("div",{ref:i,key:e.id,id:`emoji-category-${t}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},c("recent"===e.id?"RecentStickers":`Emoji${t}`)),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",l),style:`height: ${m}px;`,dir:c.isRtl?"rtl":void 0},r&&e.emojis.map((e=>{const t=n[e];if(!t)return;const s="id"in t?t:t[1];return a.ZP.createElement(Vs,{key:s.id,emoji:s,onClick:o})}))))})),Ks={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"},qs=[];let Ws,Qs,er;const tr=(0,a.X$)((0,s.c$)((e=>(0,me.ei)(e,["recentEmojis"])))((({className:e,onEmojiSelect:t,recentEmojis:s})=>{const r=(0,a.sO)(null),o=(0,a.sO)(null),[l,c]=(0,a.eJ)(),[d,m]=(0,a.eJ)(),[h,Z]=(0,a.eJ)(0),{observe:P}=(0,Bn.S1)({rootRef:r,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-",""));qs[n]=e.isIntersecting}));const t=qs.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,Ct.Z)(o.current,!f.wB),(0,a.d4)((()=>{if(!l)return;const e=o.current;if(!e)return;const t=42*h-e.offsetWidth/2+21;(0,Hs.Z)(e,t)}),[l,h]);const v=(0,u.Z)(),g=(0,a.Ye)((()=>{if(!l)return Zt.D;const e=[...l];return null!=s&&s.length&&e.unshift({id:"recent",name:v("RecentStickers"),emojis:s}),e}),[l,v,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c(er.categories),m(er.emojis)};er?e():async function(){return Ws||(Ws=n.e(501).then(n.t.bind(n,7501,19)),Qs=(await Ws).default,er=(0,Ys.NM)(Qs)),Ws}().then(e)}),200)}),[]);const p=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,$s.Z)(r.current,t,"start",50,800)}),[]),E=(0,a.I4)(((e,n)=>{t(e,n)}),[t]),C=(0,Ft.Z)([],i.kU),b=(0,X.Z)("EmojiPicker",e);return d&&C?a.ZP.createElement("div",{className:b},a.ZP.createElement("div",{ref:o,className:"EmojiPicker-header",dir:v.isRtl?"rtl":""},g.map((function(e,t){const n=Ks[e.id];return n&&a.ZP.createElement(L.Z,{className:"symbol-set-button "+(t===h?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>p(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:r,className:(0,X.Z)("EmojiPicker-main no-selection",f.$b?"no-scrollbar":"custom-scroll")},g.map(((e,t)=>a.ZP.createElement(js,{category:e,index:t,allEmojis:d,observeIntersection:P,shouldRender:h>=t-1&&h<=t+1,onEmojiSelect:E}))))):a.ZP.createElement("div",{className:b},a.ZP.createElement(we.Z,null))})));var nr=n(6389);const ar=f.wB?8:16,sr=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,observeIntersection:s,shouldRender:r,onStickerSelect:o,onStickerUnfave:l})=>{const c=(0,a.sO)(null);(0,Bn._N)(c,s);const d=(0,$n.Z)(r),m=f.wB?Math.floor((b.Z.get().width-8)/(i.Q+ar)):5,u=Math.ceil(e.count/m)*(i.Q+ar);return a.ZP.createElement("div",{ref:c,key:e.id,id:`sticker-set-${n}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name"},e.title),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",d),style:`height: ${u}px;`},r&&e.stickers&&e.stickers.map((n=>a.ZP.createElement(Un.Z,{key:n.id,sticker:n,size:i.Q,observeIntersection:s,noAnimate:!t,onClick:o,clickArg:n,onUnfaveClick:"favorite"===e.id?l:void 0})))))})),rr=[],or=(0,a.X$)((0,s.c$)((e=>{const{setsById:t,added:n,recent:a,favorite:s}=e.stickers;return{recentStickers:a.stickers,favoriteStickers:s.stickers,stickerSetsById:t,addedSetIds:n.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}}))((({chatId:e,threadId:t,className:n,loadAndPlay:r,canSendStickers:o,recentStickers:l,favoriteStickers:c,addedSetIds:d,stickerSetsById:m,shouldPlay:h,onStickerSelect:Z})=>{const{loadRecentStickers:P,addRecentSticker:v,unfaveSticker:g}=(0,s.uC)(),p=(0,a.sO)(null),E=(0,a.sO)(null),[C,b]=(0,a.eJ)(0),I=(0,nr.Z)(e,t),{observe:y}=(0,Bn.S1)({rootRef:p,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((({isIntersecting:e})=>e));t.length&&b(t[Math.floor(t.length/2)].index)})),{observe:N}=(0,Bn.S1)({rootRef:E}),S=(0,u.Z)(),w=Boolean(d),k=(0,a.Ye)((()=>d?[{id:"recent",title:S("RecentStickers"),stickers:l,count:l.length},{id:"favorite",title:S("FavoriteStickers"),stickers:c,count:c.length},...d.map((e=>m[e])).filter(Boolean)]:Zt.D),[d,S,l,c,m]),M=(0,a.Ye)((()=>w&&0===k.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[k,w]);(0,a.d4)((()=>{r&&(P(),I({type:"chooseSticker"}))}),[r,P,I]),(0,Ct.Z)(E.current),(0,a.d4)((()=>{if(!w)return;const e=E.current;if(!e)return;const t=52*C-(e.offsetWidth/2-26);(0,Hs.Z)(e,t)}),[w,C]);const T=(0,a.I4)((e=>{b(e);const t=document.getElementById(`sticker-set-${e}`);(0,$s.Z)(p.current,t,"start",void 0,500)}),[]),A=(0,a.I4)((e=>{Z(e),v({sticker:e})}),[v,Z]),R=(0,a.I4)((e=>{g({sticker:e})}),[g]),F=(0,a.I4)((()=>{I({type:"chooseSticker"})}),[I]),B=(0,Ft.Z)([],i.Y),$=(0,X.Z)("StickerPicker",n);return w&&B&&!M&&o?a.ZP.createElement("div",{className:$},a.ZP.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},k.map((function(e,t){var n;const s=null===(n=e.stickers)||void 0===n?void 0:n[0],r=(0,X.Z)("symbol-set-button sticker-set-button",t===C&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!s?a.ZP.createElement(L.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>T(t)},"recent"===e.id?a.ZP.createElement("i",{className:"icon-recent"}):"favorite"===e.id?a.ZP.createElement("i",{className:"icon-favorite"}):e.isAnimated?a.ZP.createElement(Dn,{stickerSet:e,observeIntersection:N}):a.ZP.createElement(xn,{stickerSet:e,observeIntersection:N})):a.ZP.createElement(Un.Z,{key:e.id,sticker:s,size:i.DC,title:e.title,className:r,observeIntersection:N,onClick:T,clickArg:t})}))),a.ZP.createElement("div",{ref:p,onMouseMove:F,className:(0,X.Z)("StickerPicker-main no-selection",f.$b?"no-scrollbar":"custom-scroll")},k.map(((e,t)=>a.ZP.createElement(sr,{key:e.id,stickerSet:e,loadAndPlay:Boolean(h&&r),index:t,observeIntersection:y,shouldRender:C>=t-1&&C<=t+1,onStickerSelect:A,onStickerUnfave:R}))))):a.ZP.createElement("div",{className:$},o?M?a.ZP.createElement("div",{className:"picker-disabled"},S("NoStickers")):a.ZP.createElement(we.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},S("ErrorSendRestrictedStickersAll")))})));var ir=n(386);function lr(){return(lr=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}).apply(this,arguments)}const cr=(0,a.X$)((({gif:e,observeIntersection:t,isDisabled:n,className:s,onClick:o})=>{var i,l;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=Boolean(null===(i=e.thumbnail)||void 0===i?void 0:i.dataUri),u=`gif${e.id}`,Z=(0,Bn.Op)(c,t)&&!n,P=(0,h.Z)(`${u}?size=m`,!Z,r.IU.BlobUrl),v=(0,ea.Z)(null===(l=e.thumbnail)||void 0===l?void 0:l.dataUri,Boolean(P)),g=(0,h.Z)(u,!Z,r.IU.BlobUrl),p=Boolean(Z&&g),{isBuffered:E,bufferingHandlers:C}=(0,Y.Z)(!0),f=Z&&!E,b=Z&&E;(0,V.Z)(d,[p]);const I=(0,a.I4)((()=>o({...e,blobUrl:g})),[o,e,g]),y=(0,X.Z)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",u,s);return a.ZP.createElement("div",{ref:c,className:y,onMouseDown:ir.b,onClick:I},m&&a.ZP.createElement("canvas",{ref:v,className:"thumbnail",style:b?"display: none;":void 0}),P&&!b&&a.ZP.createElement("img",{src:P,alt:"",className:"preview"}),p&&a.ZP.createElement("video",lr({ref:d,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},C),a.ZP.createElement("source",{src:g})),f&&a.ZP.createElement(J.Z,{color:P||m?"white":"black"}))})),dr=(0,a.X$)((0,s.c$)((e=>({savedGifs:e.gifs.saved.gifs})))((({className:e,loadAndPlay:t,canSendGifs:n,savedGifs:r,onGifSelect:o})=>{const{loadSavedGifs:l}=(0,s.uC)(),c=(0,a.sO)(null),{observe:d}=(0,Bn.S1)({rootRef:c,debounceMs:300});(0,a.d4)((()=>{t&&l()}),[t,l]);const m=(0,Ft.Z)([],i.Y);return a.ZP.createElement("div",{ref:c,className:(0,X.Z)("GifPicker",e,f.$b?"no-scrollbar":"custom-scroll")},n?m&&r&&r.length?r.map((e=>a.ZP.createElement(cr,{key:e.id,gif:e,observeIntersection:d,isDisabled:!t,onClick:o}))):m&&r?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(we.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let mr;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(mr||(mr={}));const ur=Object.values(mr).filter((e=>"string"==typeof e)),hr={[mr.Emoji]:"icon-smile",[mr.Stickers]:"icon-stickers",[mr.GIFs]:"icon-gifs"},Zr=(0,a.X$)((({activeTab:e,onSwitchTab:t,onRemoveSymbol:n,onSearchOpen:s})=>{const r=(0,u.Z)();function o(n){return a.ZP.createElement(L.Z,{className:"symbol-tab-button "+(e===n?"activated":""),onClick:()=>t(n),ariaLabel:ur[n],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:hr[n]}))}const i=(0,a.I4)((()=>{s(e===mr.Stickers?"stickers":"gifs")}),[e,s]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0},e!==mr.Emoji&&a.ZP.createElement(L.Z,{className:"symbol-search-button",ariaLabel:e===mr.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:i},a.ZP.createElement("i",{className:"icon-search"})),o(mr.Emoji),o(mr.Stickers),o(mr.GIFs),e===mr.Emoji&&a.ZP.createElement(L.Z,{className:"symbol-delete-button",onClick:n,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let Pr=!1;const vr=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((({chatId:e,threadId:t,isOpen:n,canSendStickers:s,canSendGifs:r,isLeftColumnShown:o,onLoad:i,onClose:l,onEmojiSelect:c,onStickerSelect:d,onGifSelect:m,onRemoveSymbol:h,onSearchOpen:Z,addRecentEmoji:P})=>{const[v,g]=(0,a.eJ)(0),[p,E]=(0,a.eJ)([]),[C,b]=(0,zs.Z)(n,l,void 0,f.wB),{shouldRender:I,transitionClassNames:y}=(0,z.Z)(n,l,!1,!1);!Pr&&n&&(Pr=!0),(0,a.d4)((()=>{i()}),[i]),(0,a.bt)((()=>{if(f.wB)return n&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{n&&(0,G.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[n]);const N=(0,a.sO)(p);N.current=p,(0,a.d4)((()=>{N.current.length&&(N.current.forEach((e=>{P({emoji:e})})),E([]))}),[n,v,P]);const S=(0,a.I4)(((e,t)=>{E((e=>[...e,t])),c(e)}),[c]),w=(0,a.I4)((e=>{l(),Z(e)}),[l,Z]),k=(0,a.I4)((e=>{d(e,!0)}),[d]),M=(0,u.Z)();function T(o,i){switch(v){case mr.Emoji:return a.ZP.createElement(tr,{className:"picker-tab",onEmojiSelect:S});case mr.Stickers:return a.ZP.createElement(or,{className:"picker-tab",loadAndPlay:!!s&&n&&(o||i),canSendStickers:s,onStickerSelect:k,chatId:e,threadId:t});case mr.GIFs:return a.ZP.createElement(dr,{className:"picker-tab",loadAndPlay:!!r&&n&&(o||i),canSendGifs:r,onGifSelect:m})}}const A=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Pr&&a.ZP.createElement(R.Z,{name:"slide",activeKey:v,renderCount:ur.length},T)),f.wB&&a.ZP.createElement(L.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:M("Close"),className:"symbol-close-button",size:"tiny",onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Zr,{activeTab:v,onSwitchTab:g,onRemoveSymbol:h,onSearchOpen:w}));if(f.wB){if(!I)return;const e=(0,X.Z)("SymbolMenu mobile-menu",y,!o&&"middle-column-open");return a.ZP.createElement(Is.Z,null,a.ZP.createElement("div",{className:e},A))}return a.ZP.createElement(vs.Z,{isOpen:n,positionX:"left",positionY:"bottom",onClose:l,className:"SymbolMenu",onCloseAnimationEnd:l,onMouseEnter:f.$b?void 0:C,onMouseLeave:f.$b?void 0:b,noCloseOnBackdrop:!f.$b},A)}))),gr=(0,a.X$)((({isOpen:e,canAttachMedia:t,canAttachPolls:n,onFileSelect:s,onPollCreate:r,onClose:o})=>{const[l,c]=(0,zs.Z)(e,o),d=(0,a.I4)(((e,t)=>{const{files:n}=e.target;n&&n.length>0&&s(Array.from(n),t)}),[s]),m=(0,a.I4)((()=>{Yn(Array.from(i.dI).join(","),(e=>d(e,!0)))}),[d]),h=(0,a.I4)((()=>{Yn("*",(e=>d(e,!1)))}),[d]),Z=(0,u.Z)();return a.ZP.createElement(vs.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:o,className:"AttachMenu fluid",onCloseAnimationEnd:o,onMouseEnter:f.$b?void 0:l,onMouseLeave:f.$b?void 0:c,noCloseOnBackdrop:!f.$b},!t&&a.ZP.createElement(B.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),t&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(B.Z,{icon:"photo",onClick:m},Z("AttachmentMenu.PhotoOrVideo")),a.ZP.createElement(B.Z,{icon:"document",onClick:h},Z("AttachDocument"))),n&&a.ZP.createElement(B.Z,{icon:"poll",onClick:r},Z("Poll")))})),pr=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:r})=>a.ZP.createElement(Le.Z,{key:n.command,className:(0,X.Z)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:()=>r(n),focus:t},e&&a.ZP.createElement(ge.Z,{size:"small",user:s}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",n.command),a.ZP.createElement("span",{className:"subtitle"},(0,ve.Z)(n.description)))))),Er=(0,a.X$)((0,s.c$)((e=>({usersById:e.users.byId})))((({usersById:e,isOpen:t,withUsername:n,botCommands:r,onClick:o,onClose:i})=>{const{sendBotCommand:l}=(0,s.uC)(),c=(0,a.sO)(null),{shouldRender:d,transitionClassNames:m}=(0,z.Z)(t,void 0,void 0,!1),u=(0,a.I4)((({botId:t,command:a})=>{const s=e[t];l({command:`/${a}${n&&s?`@${s.username}`:""}`,botId:t}),o()}),[o,l,e,n]),h=Us({isActive:t,items:r,onSelect:u,onClose:i});(0,a.d4)((()=>{r&&!r.length&&i()}),[r,i]),(0,a.d4)((()=>{Ds(".chat-item-clickable",h,c)}),[h]);const Z=(0,P.Z)(r&&r.length?r:void 0,d),v=r&&!r.length?Z:r;if(!d||v&&!v.length)return;const g=(0,X.Z)("BotCommandTooltip composer-tooltip custom-scroll",m);return a.ZP.createElement("div",{className:g,ref:c},v&&v.map(((t,n)=>a.ZP.createElement(pr,{key:`${t.botId}_${t.command}`,botCommand:t,bot:e[t.botId],withAvatar:!0,onClick:u,focus:h===n}))))}))),Cr=(0,a.X$)((({isOpen:e,botCommands:t,onClose:n})=>{const{sendBotCommand:r}=(0,s.uC)(),[o,i]=(0,zs.Z)(e,n,void 0,f.wB),l=(0,a.I4)((e=>{r({command:`/${e.command}`,botId:e.botId}),n()}),[n,r]);return a.ZP.createElement(vs.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:n,className:"BotCommandMenu",onCloseAnimationEnd:n,onMouseEnter:f.$b?void 0:o,onMouseLeave:f.$b?void 0:i,noCloseOnBackdrop:!f.$b},t.map((e=>a.ZP.createElement(pr,{key:e.command,botCommand:e,onClick:l}))))})),fr=(0,a.X$)((0,s.c$)((e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}}))((({chatId:e,threadId:t,isOpen:n,onStickerSelect:r,stickers:o})=>{const{clearStickersForEmoji:l}=(0,s.uC)(),c=(0,a.sO)(null),{shouldRender:d,transitionClassNames:m}=(0,z.Z)(n,void 0,void 0,!1),u=(0,P.Z)(o,!0),h=o||u,Z=(0,nr.Z)(e,t),{observe:v}=(0,Bn.S1)({rootRef:c,throttleMs:200});(0,a.d4)((()=>n?(0,E.Z)(l):void 0),[n,l]);const g=(0,X.Z)("StickerTooltip composer-tooltip custom-scroll",m,!(null!=h&&h.length)&&"hidden");return a.ZP.createElement("div",{ref:c,className:g,onMouseEnter:f.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:f.$b?void 0:()=>{document.body.classList.remove("no-select")},onMouseMove:()=>{Z({type:"chooseSticker"})}},d&&h?h.map((e=>a.ZP.createElement(Un.Z,{key:e.id,sticker:e,size:i.Q,observeIntersection:v,onClick:r,clickArg:e}))):d?a.ZP.createElement(we.Z,null):void 0)}))),br=(0,a.X$)((({isOpen:e,onSilentSend:t,onScheduleSend:n,onClose:s,onCloseAnimationEnd:r})=>{const[o,i]=(0,zs.Z)(e,s),l=(0,u.Z)();return a.ZP.createElement(vs.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:s,onCloseAnimationEnd:r,onMouseEnter:f.$b?void 0:o,onMouseLeave:f.$b?void 0:i,noCloseOnBackdrop:!f.$b},t&&a.ZP.createElement(B.Z,{icon:"mute",onClick:t},l("SendWithoutSound")),n&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:n},l("ScheduleMessage")))}));var Ir=n(2420),yr=n(3283),Nr=n(2678);const Sr=(0,a.X$)((({isOpen:e,emojis:t,onClose:n,onEmojiSelect:s,addRecentEmoji:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:l}=(0,z.Z)(e,void 0,void 0,!1),c=(0,Nr.Z)(t.length?t:void 0,350)||[],d=(0,a.I4)((e=>{s(e.native),r({emoji:e.id})}),[r,s]),m=(0,a.I4)(((e,t)=>{s(e),r({emoji:t})}),[r,s]),u=Us({isActive:e,isHorizontal:!0,items:t,onSelect:d,onClose:n});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=Fs(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!Bs(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,Hs.Z)(n,t)}}(u,o)}),[u]);const h=(0,X.Z)("EmojiTooltip composer-tooltip custom-scroll-x",l);return a.ZP.createElement("div",{ref:o,className:h,onMouseEnter:f.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:f.$b?void 0:()=>{document.body.classList.remove("no-select")}},i&&c?c.map(((e,t)=>a.ZP.createElement(Vs,{key:e.id,emoji:e,focus:u===t,onClick:m}))):i?a.ZP.createElement(we.Z,null):void 0)})),wr=(0,a.X$)((({title:e,description:t,thumbnail:n,thumbUrl:s,focus:r,transitionClassNames:o="",onClick:i})=>{let l="";const c=(0,h.Z)(n?`webDocument:${n.url}`:void 0);return(s=s||c)?l=a.ZP.createElement("img",{src:s,className:o,alt:"",decoding:"async",draggable:"false"}):e&&(l=(0,it.Xv)(e,1)),a.ZP.createElement(Le.Z,{focus:r,className:"BaseResult chat-item-clickable",onMouseDown:ir.b,onClick:i},a.ZP.createElement("span",{className:"thumb"},"string"==typeof l?(0,ve.Z)(l):l),a.ZP.createElement("div",{className:"content-inner"},e&&a.ZP.createElement("div",{className:"title"},e),t&&a.ZP.createElement("div",{className:"description"},t)))})),kr=(0,a.X$)((({focus:e,isForGallery:t,inlineResult:n,onClick:s})=>{var r;let o,i,l;"photo"in n&&(o=n.photo),"thumbnail"in n&&(i=n.thumbnail),"webThumbnail"in n&&t&&(l=n.webThumbnail);const c=(0,h.Z)(l?`webDocument:${l.url}`:void 0),d=(0,h.Z)(o&&`photo${o.id}?size=m`),m=(0,$n.Z)(d),u=(0,a.I4)((()=>{s(n)}),[n,s]);var Z,P;if(t)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:u},a.ZP.createElement("img",{src:(null===(Z=o)||void 0===Z||null===(P=Z.thumbnail)||void 0===P?void 0:P.dataUri)||c,alt:""}),a.ZP.createElement("img",{src:d,className:(0,X.Z)("full-media",m),alt:""}));const{title:v,description:g}=n;return a.ZP.createElement(wr,{focus:e,thumbUrl:d||(null===(r=i)||void 0===r?void 0:r.dataUri)||c,transitionClassNames:m,title:v,description:g,onClick:u})})),Mr=(0,a.X$)((({focus:e,inlineResult:t,onClick:n})=>{const{title:s,url:r,description:o,webThumbnail:i}=t,l=(0,a.I4)((()=>{n(t)}),[t,n]);return a.ZP.createElement(wr,{focus:e,thumbnail:i,title:s||r,description:o,onClick:l})})),Tr=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{gif:s}=e,r=(0,a.I4)((()=>{n(e)}),[e,n]);if(s)return a.ZP.createElement(cr,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:r})})),Lr=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{sticker:s}=e;if(s)return a.ZP.createElement(Un.Z,{sticker:s,size:i.zq,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:n,clickArg:e})})),Ar=(0,G.P2)((e=>e()),500,!0),Rr=(0,a.X$)((({isOpen:e,botId:t,isGallery:n,inlineBotResults:r,switchPm:i,loadMore:l,onClose:c,onSelectResult:d})=>{const{openChat:m,startBot:u}=(0,s.uC)(),h=(0,a.sO)(null),{shouldRender:Z,transitionClassNames:v}=(0,z.Z)(e,void 0,void 0,!1),{observe:g}=(0,Bn.S1)({rootRef:h,debounceMs:200,isDisabled:!e}),p=(0,a.I4)((({direction:e})=>{e===o.Uq.Backwards&&Ar(l)}),[l]),E=Us({isActive:e,shouldRemoveSelectionOnReset:n,noArrowNavigation:n,items:r,onSelect:d,onClose:c});(0,a.d4)((()=>{Ds(".chat-item-clickable",E,h)}),[E]);const C=(0,a.I4)((()=>{m({id:t}),u({botId:t,param:i.startParam})}),[t,m,u,i]),b=(0,P.Z)(null!=r&&r.length?r:void 0,Z),I=r&&!r.length?b:r;if(!Z||!(null!=I&&I.length||i))return;const y=(0,X.Z)("InlineBotTooltip composer-tooltip",f.$b?"no-scrollbar":"custom-scroll",n&&"gallery",v);return a.ZP.createElement(Te.Z,{ref:h,className:y,items:I,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:p,sensitiveArea:160},i&&a.ZP.createElement(Le.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:C},a.ZP.createElement("span",{className:"title"},i.text)),(null==I?void 0:I.length)&&I.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(Tr,{key:e.id,inlineResult:e,observeIntersection:g,onClick:d});case"photo":return a.ZP.createElement(kr,{key:e.id,isForGallery:n,inlineResult:e,onClick:d});case"sticker":return a.ZP.createElement(Lr,{key:e.id,inlineResult:e,observeIntersection:g,onClick:d});case"video":case"file":case"game":return a.ZP.createElement(kr,{key:e.id,focus:E===t,inlineResult:e,onClick:d});case"article":case"audio":return a.ZP.createElement(Mr,{key:e.id,focus:E===t,inlineResult:e,onClick:d});default:return}})))})),Fr=(0,a.X$)((({isOpen:e,onClose:t,chatId:n,selectedSendAsId:r,sendAsIds:o})=>{const{saveDefaultSendAs:i}=(0,s.uC)(),l=(0,s.Rd)().users.byId,c=(0,s.Rd)().chats.byId,d=(0,u.Z)(),m=(0,a.sO)(null),[h,Z,P]=(0,zs.Z)(e,t,void 0);(0,a.d4)((()=>{e&&P()}),[e,P]);const g=(0,a.I4)((e=>{t(),i({chatId:n,sendAsId:e})}),[n,t,i]),p=Us({isActive:e,items:o,onSelect:g,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});return(0,a.d4)((()=>{Ds(".chat-item-clickable",p,m)}),[p]),(0,a.d4)((()=>{o&&!o.length&&t()}),[o,t]),a.ZP.createElement(vs.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:t,className:"SendAsMenu",onCloseAnimationEnd:t,onMouseEnter:f.$b?void 0:h,onMouseLeave:f.$b?void 0:Z,noCloseOnBackdrop:!f.$b},a.ZP.createElement("div",{className:"send-as-title",dir:"auto"},d("SendMessageAsTitle")),l&&c&&(null==o?void 0:o.map(((e,t)=>{const n=(0,v.YC)(e)?l[e]:void 0,s=n?void 0:c[e],o=n?(0,v.Js)(n):null==s?void 0:s.title;return a.ZP.createElement(Le.Z,{key:e,className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>g(e),focus:p===t},a.ZP.createElement(ge.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"},o&&(0,ve.Z)(o))),a.ZP.createElement("span",{className:"subtitle"},n?d("VoipGroupPersonalAccount"):d("Subscribers",null==s?void 0:s.membersCount,"i"))))}))))}));var Br=n(6844);const $r=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),a=n&&(0,g.Zw)(e,n.id);if(!n||!a)return{};const{query:s,results:r}=(0,g.n5)(e)||{},{totalCount:o,foundIds:i}=r||{};return{chat:n,messagesById:a,query:s,totalCount:o,foundIds:i}}))((({chatId:e,threadId:t,onClose:n,isActive:r,chat:o,messagesById:i,query:l,totalCount:c,foundIds:d})=>{const{searchTextMessagesLocal:h,focusMessage:Z}=(0,s.uC)(),P=(0,u.Z)(),p=(0,a.Ye)((()=>{if(!(l&&d&&d.length&&i))return Zt.D;const n=d.map((n=>{const a=i[n];if(!a)return;const r=a.senderId?(0,g.dy)((0,s.Rd)(),a.senderId):void 0;let l;if(o&&(0,v.eA)(o))l=o;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;l=e&&t?(0,g.Z1)((0,s.Rd)(),t):void 0}else l=a.senderId?(0,g.Z1)((0,s.Rd)(),a.senderId):void 0;return{message:a,senderUser:r,senderChat:l,onClick:()=>Z({chatId:e,threadId:t,messageId:n})}})).filter(Boolean);return(0,me.Xo)(n,(({message:e})=>e.date),"desc")}),[e,t,Z,d,o,i,l]);(0,m.ZP)(r,n);const E=(0,a.sO)(null),C=(0,Ne.Z)(E,!0,(e=>{const t=null==p?void 0:p[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0);return a.ZP.createElement(Te.Z,{className:"RightSearch custom-scroll",items:p,preloadBackwards:0,onLoadMore:h,noFastList:!0,onKeyDown:C,ref:E},a.ZP.createElement("p",{className:"helper-text",dir:"auto"},l?0!==c&&p.length?1===c?"1 message found":`${p.length&&(c||p.length)} messages found`:P("lng_search_no_results"):P("lng_dlg_search_for_messages")),p.map((({message:e,senderUser:t,senderChat:n,onClick:s})=>{const r=n?(0,v.U)(P,n):(0,v.Js)(t),o=(0,v.MK)(P,e);return a.ZP.createElement(Le.Z,{className:"chat-item-clickable search-result-message m-0",onClick:s},a.ZP.createElement(ge.Z,{chat:n,user:t}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,ve.Z)(r)),a.ZP.createElement(Br.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,ve.Z)(o,["emoji","highlight"],{highlight:l}))))})))})));var Dr=n(9290);const xr=(0,a.X$)((0,s.c$)(((e,{stickerSetId:t})=>({set:(0,g.Ny)(e,t),shouldPlay:(0,g.yB)(e)})))((({stickerSetId:e,observeIntersection:t,set:n,shouldPlay:r,isSomeModalOpen:o,onModalToggle:l})=>{const{loadStickers:c,toggleStickerSet:d}=(0,s.uC)(),m=(0,u.Z)(),h=n&&Boolean(n.installedDate),Z=Boolean(null==n?void 0:n.stickers),[P,v,g]=(0,De.Z)();(0,Dr.Z)((()=>{l(P)}),[P,l]);const p=(0,a.Ye)((()=>{if(!n)return[];const e=(n.covers||[]).map((({id:e})=>e)),t=n.stickers?n.stickers.filter((({id:t})=>!e.includes(t))):[];return[...n.covers||[],...t].slice(0,5)}),[n]);(0,a.d4)((()=>{!Z&&p.length<5&&c({stickerSetId:e})}),[Z,p.length,c,e]);const E=(0,a.I4)((()=>{d({stickerSetId:e})}),[d,e]);if(!n)return;const C=p.length>0;return a.ZP.createElement("div",{key:n.id,className:"sticker-set",dir:m.isRtl?"rtl":void 0},a.ZP.createElement("div",{className:"sticker-set-header"},a.ZP.createElement("div",{className:"title-wrapper"},a.ZP.createElement("h3",{className:"title",dir:"auto"},n.title),a.ZP.createElement("p",{className:"count",dir:"auto"},m("Stickers",n.count,"i"))),a.ZP.createElement(L.Z,{className:h?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:E},m(h?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!C&&a.ZP.createElement(J.Z,null),C&&p.map((e=>a.ZP.createElement(Un.Z,{sticker:e,size:i.Y7,observeIntersection:t,noAnimate:!r||P||o,onClick:v})))),C&&a.ZP.createElement(Gn.Z,{isOpen:P,fromSticker:p[0],onClose:g}))}))),Ur=(0,G.P2)((e=>e()),6e4,!0),Or=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a}}))((({onClose:e,isActive:t,query:n,featuredIds:r,resultIds:o})=>{const{loadFeaturedStickers:i}=(0,s.uC)(),l=(0,a.sO)(null),c=(0,u.Z)(),[d,h]=(0,a.eJ)(!1),{observe:Z}=(0,Bn.S1)({rootRef:l,throttleMs:200});return(0,a.d4)((()=>{Ur((()=>{i()}))})),(0,m.ZP)(t,e),a.ZP.createElement("div",{ref:l,className:"StickerSearch custom-scroll",dir:c.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&r?r.map((e=>a.ZP.createElement(xr,{key:e,stickerSetId:e,observeIntersection:Z,isSomeModalOpen:d,onModalToggle:h}))):o?o.length?o.map((e=>a.ZP.createElement(xr,{key:e,stickerSetId:e,observeIntersection:Z,isSomeModalOpen:d,onModalToggle:h}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(we.Z,null)}())}))),Gr=(0,a.X$)((0,s.c$)((e=>{const t=(0,g.yN)(e),{query:n,results:a}=t||{},{chatId:s}=(0,g.Bt)(e)||{},r=s?(0,g.Z1)(e,s):void 0;return{query:n,results:a,chat:r,isChatWithBot:r?(0,g.xo)(e,r):void 0}}))((({onClose:e,isActive:t,query:n,results:r,chat:o,isChatWithBot:i})=>{const{searchMoreGifs:l,sendMessage:c,setGifSearchQuery:d}=(0,s.uC)(),h=(0,a.sO)(null),{observe:Z}=(0,Bn.S1)({rootRef:h,debounceMs:300}),{canSendGifs:P}=(0,v.H5)(o,i),g=(0,a.I4)((e=>{P&&c({gif:e}),f.$b&&d({query:void 0})}),[P,c,d]),p=(0,u.Z)();(0,m.ZP)(t,e);const E=Boolean(void 0!==n&&r&&r.length);return a.ZP.createElement("div",{className:"GifSearch",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(Te.Z,{ref:h,className:(0,X.Z)("gif-container custom-scroll",E&&"grid"),items:r,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:l},function(){if(void 0!==n)return r?r.length?r.map((e=>a.ZP.createElement(cr,{key:e.id,gif:e,observeIntersection:Z,onClick:g}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},p("NoGIFsFound")):a.ZP.createElement(we.Z,null)}()))}))),Jr=(0,a.X$)((0,s.c$)(((e,{answer:t})=>{const{voters:n,offsets:a}=e.pollResults;return{voters:null==n?void 0:n[t.option],offset:(null==a?void 0:a[t.option])||""}}))((({chat:e,message:t,answer:n,answerVote:r,totalVoters:o,voters:i,offset:l})=>{const{loadPollOptionResults:c,openChat:d,closePollResults:m}=(0,s.uC)(),h=(0,P.Z)(r.votersCount),[Z,v]=(0,a.eJ)(!0),g=Boolean(i),{option:p,text:E}=n,C=(0,u.Z)();(0,a.d4)((()=>{g&&h===r.votersCount||c({chat:e,messageId:t.id,option:p,offset:l,limit:4,shouldResetVoters:!0})}),[r.votersCount,g]);const f=(0,a.I4)((()=>{v(!0),c({chat:e,messageId:t.id,option:p,offset:l,limit:50})}),[e,c,t.id,l,p]);(0,a.d4)((()=>{v(!1)}),[i]);const b=(0,a.I4)((e=>{d({id:e}),m()}),[m,d]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},i?i.map((e=>a.ZP.createElement(Le.Z,{key:e,className:"chat-item-clickable",onClick:()=>b(e)},a.ZP.createElement(Re.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(we.Z,null),i&&function(){const e=r.votersCount-i.length;return r.votersCount>4&&e>0&&a.ZP.createElement(Sn,{count:e,itemName:"voter",isLoading:Z,onClick:f})}()),a.ZP.createElement("div",{className:"answer-head",dir:C.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},E),a.ZP.createElement("span",{className:"answer-percent",dir:C.isRtl?"auto":void 0},(I=r.votersCount,(y=o)>0?(I/y*100).toFixed():0),"%")));var I,y}))),Xr=(0,a.X$)((0,s.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,g.Z1)(e,t),message:(0,g.hj)(e,t,n),lastSyncTime:a}:{}}))((({onClose:e,isActive:t,chat:n,message:s,lastSyncTime:r})=>{const o=(0,u.Z)();if((0,m.ZP)(t,e),!s||!n)return a.ZP.createElement(we.Z,null);const{summary:i,results:l}=(0,v.t9)(s);if(!l.results)return;const c=(0,me.ee)(l.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,ve.Z)(i.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},r&&i.answers.map((e=>a.ZP.createElement(Jr,{key:`${s.id}-${e.option}`,chat:n,message:s,answer:e,answerVote:c[e.option],totalVoters:l.totalVoters}))),!r&&a.ZP.createElement(we.Z,null)))}))),_r="Please provide first name",zr=(0,a.X$)((0,s.c$)(((e,{userId:t})=>{const n=(0,g.dy)(e,t),a=(0,g.Z1)(e,t),{progress:s}=e.management;return{user:n,progress:s,isMuted:(0,v.i4)(a,(0,g.dZ)(e),(0,g.NJ)(e))}}))((({userId:e,user:t,progress:n,isMuted:r,onClose:i,isActive:l})=>{const{updateContact:c,deleteContact:d,closeManagement:h}=(0,s.uC)(),[Z,P,v]=(0,De.Z)(),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(),f=(0,u.Z)();(0,m.ZP)(l,i);const b=t&&t.firstName||"",I=t&&t.lastName||"",[y,N]=(0,a.eJ)(b),[S,w]=(0,a.eJ)(I),[k,M]=(0,a.eJ)(!r);(0,a.d4)((()=>{M(!r)}),[r]),(0,a.d4)((()=>{p(!1),v()}),[v,e]),(0,a.d4)((()=>{N(b),w(I)}),[b,I,t]),(0,a.d4)((()=>{n===o.wv.Complete&&(p(!1),C(void 0),v())}),[v,n]);const T=(0,a.I4)((e=>{N(e.target.value),p(!0)}),[]),L=(0,a.I4)((e=>{w(e.target.value),p(!0)}),[]),A=(0,a.I4)((e=>{M(e.target.checked),p(!0)}),[]),R=(0,a.I4)((()=>{const t=y.trim(),n=S.trim();t.length||C(_r),c({userId:e,isMuted:!k,firstName:t,lastName:n})}),[y,S,c,e,k]),F=(0,a.I4)((()=>{d({userId:e}),v(),h()}),[v,h,d,e]);if(!t)return;const B=n===o.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(Re.Z,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(Me.Z,{id:"user-first-name",label:f("UserInfo.FirstNamePlaceholder"),onChange:T,value:y,error:E===_r?E:void 0}),a.ZP.createElement(Me.Z,{id:"user-last-name",label:f("UserInfo.LastNamePlaceholder"),onChange:L,value:S}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(Cn.Z,{checked:k,label:f("Notifications"),subLabel:f(k?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:A}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:P},f("DeleteContact")))),a.ZP.createElement(dn.Z,{isShown:g,onClick:R,disabled:B,ariaLabel:f("Save")},B?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:Z,onClose:v,text:f("AreYouSureDeleteContact"),confirmLabel:f("DeleteContact"),confirmHandler:F,confirmIsDestructive:!0}))}))),Yr="Group title can't be empty",Hr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n,a;const s=(0,g.Z1)(e,t),{progress:r}=e.management,o=Boolean(null===(n=s.fullInfo)||void 0===n?void 0:n.linkedChatId),i=(0,v.G9)(s),{invites:l}=e.management.byChatId[t]||{};return{chat:s,progress:r,isBasicGroup:i,hasLinkedChannel:o,canChangeInfo:i?s.isCreator:(0,v.VE)(s,"changeInfo"),canBanUsers:i?s.isCreator:(0,v.VE)(s,"banUsers"),canInvite:i?s.isCreator:(0,v.VE)(s,"inviteUsers"),exportedInvites:l,lastSyncTime:e.lastSyncTime,availableReactionsCount:null===(a=e.availableReactions)||void 0===a?void 0:a.filter((e=>!e.isInactive)).length}}))((({chatId:e,chat:t,progress:n,isBasicGroup:i,hasLinkedChannel:l,canChangeInfo:c,canBanUsers:d,canInvite:Z,onScreenSelect:P,onClose:g,isActive:p,exportedInvites:E,lastSyncTime:C,availableReactionsCount:f})=>{var b,I,y,N,S;const{togglePreHistoryHidden:w,updateChat:k,deleteChat:M,leaveChannel:T,deleteChannel:L,closeManagement:A,openChat:R,loadExportedChatInvites:F}=(0,s.uC)(),[B,$,D]=(0,De.Z)(),x=t.title,U=t.fullInfo&&t.fullInfo.about||"",[O,G]=(0,a.eJ)(!1),[X,_]=(0,a.eJ)(x),[z,Y]=(0,a.eJ)(U),[H,V]=(0,a.eJ)(),[j,K]=(0,a.eJ)(),q=(0,v.RT)(t),W=(0,h.Z)(q,!1,r.IU.BlobUrl),Q=(0,u.Z)();(0,m.ZP)(p,g),(0,a.d4)((()=>{C&&Z&&F({chatId:e})}),[e,F,C,Z]),(0,a.d4)((()=>{n===o.wv.Complete&&(G(!1),K(void 0))}),[n]);const ee=(0,a.I4)((()=>{P(o.u1.ChatPrivacyType)}),[P]),te=(0,a.I4)((()=>{P(o.u1.Discussion)}),[P]),ne=(0,a.I4)((()=>{P(o.u1.Reactions)}),[P]),ae=(0,a.I4)((()=>{P(o.u1.GroupPermissions)}),[P]),se=(0,a.I4)((()=>{P(o.u1.ChatAdministrators)}),[P]),re=(0,a.I4)((()=>{P(o.u1.Invites)}),[P]),oe=(0,a.I4)((e=>{V(e),G(!0)}),[]),ie=(0,a.I4)((e=>{_(e.target.value),G(!0)}),[]),le=(0,a.I4)((e=>{Y(e.target.value),G(!0)}),[]),ce=(0,a.I4)((()=>{const t=X.trim(),n=z.trim();t.length?k({chatId:e,title:t,about:n,photo:H}):K(Yr)}),[z,e,H,X,k]),de=(0,a.I4)((()=>{P(o.u1.GroupMembers)}),[P]),me=(0,a.I4)((()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;w({chatId:t.id,isEnabled:!e})}),[t,w]),ue=(null===(b=t.fullInfo)||void 0===b||null===(I=b.enabledReactions)||void 0===I?void 0:I.length)||0,he=(0,a.Ye)((()=>{if(!t.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!t.defaultBannedRights[e])).length;const{sendStickers:n,sendGifs:a}=t.defaultBannedRights;return n||a||(e+=1),e}),[t]),Ze=(null===(y=t.fullInfo)||void 0===y||null===(N=y.adminMembers)||void 0===N?void 0:N.length)||0,Pe=(0,a.I4)((()=>{i?M({chatId:t.id}):t.isCreator?L({chatId:t.id}):T({chatId:t.id}),D(),A(),R({id:void 0})}),[i,t.isCreator,t.id,D,A,T,L,M,R]);if(t.isRestricted)return;const ge=n===o.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(cn.Z,{currentAvatarBlobUrl:W,onChange:oe,disabled:!c}),a.ZP.createElement(Me.Z,{id:"group-title",label:Q("GroupName"),onChange:ie,value:X,error:j===Yr?j:void 0,disabled:!c}),a.ZP.createElement(Me.Z,{id:"group-about",className:"mb-2",label:Q("DescriptionPlaceholder"),onChange:le,value:z,disabled:!c}),t.isCreator&&a.ZP.createElement(Le.Z,{icon:"lock",multiline:!0,onClick:ee},a.ZP.createElement("span",{className:"title"},Q("GroupType")),a.ZP.createElement("span",{className:"subtitle"},t.username?Q("TypePublic"):Q("TypePrivate"))),l&&a.ZP.createElement(Le.Z,{icon:"message",multiline:!0,onClick:te},a.ZP.createElement("span",{className:"title"},Q("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},Q("DiscussionUnlink"))),a.ZP.createElement(Le.Z,{icon:"permissions",multiline:!0,onClick:ae,disabled:!d},a.ZP.createElement("span",{className:"title"},Q("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},he,"/",8)),a.ZP.createElement(Le.Z,{icon:"reactions",multiline:!0,onClick:ne,disabled:!c},a.ZP.createElement("span",{className:"title"},Q("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ue,"/",f)),a.ZP.createElement(Le.Z,{icon:"admin",multiline:!0,onClick:se},a.ZP.createElement("span",{className:"title"},Q("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,it.kh)(Ze))),Z&&a.ZP.createElement(Le.Z,{icon:"link",onClick:re,multiline:!0,disabled:!E},a.ZP.createElement("span",{className:"title"},Q("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},E?(0,it.kh)(E.length):Q("Loading")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"group",multiline:!0,onClick:de},a.ZP.createElement("span",{className:"title"},Q("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,it.kh)(null!==(S=t.membersCount)&&void 0!==S?S:0))),t.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(Cn.Z,{checked:!t.fullInfo.isPreHistoryHidden,label:Q("ChatHistory"),onChange:me,disabled:!d}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:$},Q("DeleteMega")))),a.ZP.createElement(dn.Z,{isShown:O,onClick:ce,disabled:ge,ariaLabel:Q("Save")},ge?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:B,onClose:D,textParts:(0,ve.Z)(i||!t.isCreator?Q("AreYouSureDeleteAndExit"):Q("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:i||!t.isCreator?Q("DeleteMega"):Q("DeleteGroupForAll"),confirmHandler:Pe,confirmIsDestructive:!0}))}))),Vr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,g.Z1)(e,t),currentUserId:e.currentUserId})))((({onScreenSelect:e,onChatMemberSelect:t,chat:n,currentUserId:r,onClose:i,isActive:l})=>{const{updateChatDefaultBannedRights:c}=(0,s.uC)(),[d,h]=(0,a.eJ)({}),[Z,P]=(0,a.eJ)(!1),[v,g]=(0,a.eJ)(!1),p=(0,u.Z)();(0,m.ZP)(l,i);const E=(0,a.I4)((()=>{e(o.u1.GroupRemovedUsers)}),[e]),C=(0,a.I4)((()=>{e(o.u1.GroupUserPermissionsCreate)}),[e]),f=(0,a.I4)((n=>{t(n.userId,n.promotedByUserId===r),e(o.u1.GroupUserPermissions)}),[r,t,e]);(0,a.d4)((()=>{h((null==n?void 0:n.defaultBannedRights)||{}),P(!1),setTimeout((()=>{g(!1)}),250)}),[n]);const b=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}h((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),P(!0)}),[]),I=(0,a.I4)((()=>{n&&(g(!0),c({chatId:n.id,bannedRights:d}))}),[n,d,c]),y=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.kickedMembers?n.fullInfo.kickedMembers.length:0),[n]),N=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.members?n.fullInfo.members.filter((({bannedRights:e})=>!!e)):[]),[n]),S=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!n)return;const{defaultBannedRights:a}=n;return Object.keys(t).reduce(((e,n)=>{if(!t[n]||null!=a&&a[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)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}}(n);if(!s)return e;const r=p(s);return`${e}${e.length?`, ${r}`:r}`}),"")}),[n,p]);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"},p("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMessages",checked:!d.sendMessages,label:p("UserRestrictionsSend"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMedia",checked:!d.sendMedia,label:p("UserRestrictionsSendMedia"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendStickers",checked:!d.sendStickers&&!d.sendGifs,label:p("UserRestrictionsSendStickers"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendPolls",checked:!d.sendPolls,label:p("UserRestrictionsSendPolls"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"embedLinks",checked:!d.embedLinks,label:p("UserRestrictionsEmbedLinks"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"inviteUsers",checked:!d.inviteUsers,label:p("UserRestrictionsInviteUsers"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"pinMessages",checked:!d.pinMessages,label:p("UserRestrictionsPinMessages"),blocking:!0,onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!d.changeInfo,label:p("UserRestrictionsChangeInfo"),blocking:!0,onChange:b}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:E},a.ZP.createElement("span",{className:"title"},p("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},y))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},p("PrivacyExceptions")),a.ZP.createElement(Le.Z,{icon:"add-user",onClick:C},p("ChannelAddException")),N.map((e=>a.ZP.createElement(Le.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>f(e)},a.ZP.createElement(Re.Z,{userId:e.userId,status:S(e)})))))),a.ZP.createElement(dn.Z,{isShown:Z,onClick:I,ariaLabel:p("Save"),disabled:v},v?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),jr=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}))((({chat:e,currentUserId:t,isOpen:n,onClose:r})=>{var o;const{loadMoreMembers:i,deleteChatMember:l}=(0,s.uC)(),c=(0,u.Z)(),[d,m]=(0,a.eJ)(""),h=(0,a.sO)(null),Z=(0,a.Ye)((()=>{var n;const a=((null===(n=e.fullInfo)||void 0===n?void 0:n.members)||[]).reduce(((e,n)=>(n.isAdmin||n.isOwner||n.userId===t||e.push(n.userId),e)),[]),r=(0,s.Rd)().users.byId;return(0,v.kK)(a,r,d)}),[null===(o=e.fullInfo)||void 0===o?void 0:o.members,t,d]),P=(0,a.I4)((t=>{l({chatId:e.id,userId:t}),r()}),[e.id,l,r]);return a.ZP.createElement(Fe,{isOpen:n,chatOrUserIds:Z,filterRef:h,filterPlaceholder:c("ChannelBlockUser"),filter:d,onFilterChange:m,loadMore:i,onSelectChatOrUser:P,onClose:r})}))),Kr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),{byId:a}=e.users;return{chat:n,usersById:a,canDeleteMembers:n&&((0,v.VE)(n,"banUsers")||n.isCreator)}}))((({chat:e,usersById:t,canDeleteMembers:n,onClose:r,isActive:o})=>{const{updateChatMemberBannedRights:i}=(0,s.uC)(),l=(0,u.Z)(),[c,d,h]=(0,De.Z)();(0,m.ZP)(o,r);const Z=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[]),[e]),P=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const n=t[e.kickedByUserId];return n?l("UserRemovedBy",(0,v.Js)(n)):void 0}),[l,t]),g=(0,a.I4)((t=>{if(e)return[{title:l("Unblock"),icon:"delete",destructive:!0,handler:()=>i({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[l,e,i]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:l.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},l("NoBlockedGroup2")),Z.map((e=>a.ZP.createElement(Le.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:g(e)},a.ZP.createElement(Re.Z,{userId:e.userId,status:P(e)})))),n&&a.ZP.createElement(dn.Z,{isShown:!0,onClick:d,ariaLabel:l("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),e&&n&&a.ZP.createElement(jr,{chat:e,isOpen:c,onClose:h}))))}))),qr="Channel title can't be empty",Wr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t),{progress:s}=e.management,r=Boolean(null==a?void 0:a.isSignaturesShown),{invites:o}=e.management.byChatId[t]||{};return{chat:a,progress:s,isSignaturesShown:r,canChangeInfo:(0,v.VE)(a,"changeInfo"),canInvite:(0,v.VE)(a,"inviteUsers"),lastSyncTime:e.lastSyncTime,exportedInvites:o,availableReactionsCount:null===(n=e.availableReactions)||void 0===n?void 0:n.filter((e=>!e.isInactive)).length}}))((({chatId:e,chat:t,progress:n,isSignaturesShown:i,canChangeInfo:l,canInvite:c,exportedInvites:d,lastSyncTime:Z,availableReactionsCount:P,onScreenSelect:g,onClose:p,isActive:E})=>{var C,f,b,I,y,N;const{updateChat:S,toggleSignatures:w,closeManagement:k,leaveChannel:M,deleteChannel:T,openChat:L,loadExportedChatInvites:A}=(0,s.uC)(),R=t&&t.title||"",F=null!=t&&t.fullInfo&&t.fullInfo.about||"",B=null==t||null===(C=t.fullInfo)||void 0===C?void 0:C.linkedChatId,[$,D,x]=(0,De.Z)(),[U,O]=(0,a.eJ)(!1),[G,X]=(0,a.eJ)(R),[_,z]=(0,a.eJ)(F),[Y,H]=(0,a.eJ)(),[V,j]=(0,a.eJ)(),K=t&&(0,v.RT)(t),q=(0,h.Z)(K,!1,r.IU.BlobUrl),W=(0,u.Z)();(0,m.ZP)(E,p),(0,a.d4)((()=>{Z&&A({chatId:e})}),[e,A,Z]),(0,a.d4)((()=>{n===o.wv.Complete&&(O(!1),j(void 0))}),[n]);const Q=(null==t||null===(f=t.fullInfo)||void 0===f||null===(b=f.adminMembers)||void 0===b?void 0:b.length)||0,ee=(0,a.I4)((()=>{g(o.u1.ChatPrivacyType)}),[g]),te=(0,a.I4)((()=>{g(o.u1.Discussion)}),[g]),ne=(0,a.I4)((()=>{g(o.u1.Reactions)}),[g]),ae=(0,a.I4)((()=>{g(o.u1.ChatAdministrators)}),[g]),se=(0,a.I4)((()=>{g(o.u1.Invites)}),[g]),re=(0,a.I4)((e=>{H(e),O(!0)}),[]),oe=(0,a.I4)((e=>{X(e.target.value),O(!0)}),[]),ie=(0,a.I4)((e=>{z(e.target.value),O(!0)}),[]),le=(0,a.I4)((()=>{const t=G.trim(),n=_.trim();t.length?S({chatId:e,title:t,about:n,photo:Y}):j(qr)}),[_,e,Y,G,S]),ce=(0,a.I4)((()=>{w({chatId:e,isEnabled:!i})}),[e,i,w]),de=(0,a.I4)((()=>{g(o.u1.ChannelSubscribers)}),[g]),me=(0,a.I4)((()=>{t.isCreator?T({chatId:t.id}):M({chatId:t.id}),x(),k(),L({id:void 0})}),[t.isCreator,t.id,x,k,M,T,L]),ue=(null===(I=t.fullInfo)||void 0===I||null===(y=I.enabledReactions)||void 0===y?void 0:y.length)||0;if(t.isRestricted)return;const he=n===o.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(cn.Z,{currentAvatarBlobUrl:q,onChange:re,disabled:!l}),a.ZP.createElement(Me.Z,{id:"channel-title",label:W("EnterChannelName"),onChange:oe,value:G,error:V===qr?V:void 0,disabled:!l}),a.ZP.createElement(Me.Z,{id:"channel-about",className:"mb-2",label:W("DescriptionPlaceholder"),onChange:ie,value:_,disabled:!l}),t.isCreator&&a.ZP.createElement(Le.Z,{icon:"lock",multiline:!0,onClick:ee},a.ZP.createElement("span",{className:"title"},W("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},t.username?W("TypePublic"):W("TypePrivate"))),a.ZP.createElement(Le.Z,{icon:"message",multiline:!0,onClick:te,disabled:!l},a.ZP.createElement("span",{className:"title"},W("Discussion")),a.ZP.createElement("span",{className:"subtitle"},W(B?"DiscussionUnlink":"Add"))),a.ZP.createElement(Le.Z,{icon:"admin",multiline:!0,onClick:ae},a.ZP.createElement("span",{className:"title"},W("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},Q)),c&&a.ZP.createElement(Le.Z,{icon:"link",onClick:se,multiline:!0,disabled:!d},a.ZP.createElement("span",{className:"title"},W("GroupInfo.InviteLinks")),a.ZP.createElement("span",{className:"subtitle"},d?(0,it.kh)(d.length):W("Loading"))),a.ZP.createElement(Le.Z,{icon:"reactions",multiline:!0,onClick:ne,disabled:!l},a.ZP.createElement("span",{className:"title"},W("Reactions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ue,"/",P)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(Cn.Z,{checked:i,label:W("ChannelSignMessages"),onChange:ce}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"group",multiline:!0,onClick:de},a.ZP.createElement("span",{className:"title",dir:"auto"},W("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},W("Subscribers",null!==(N=t.membersCount)&&void 0!==N?N:0,"i")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:D},t.isCreator?W("ChannelDelete"):W("LeaveChannel")))),a.ZP.createElement(dn.Z,{isShown:U,onClick:le,disabled:he,ariaLabel:W("Save")},he?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:$,onClose:x,text:t.isCreator?W("ChannelDeleteAlert"):W("ChannelLeaveAlert"),confirmLabel:t.isCreator?W("ChannelDelete"):W("LeaveChannel"),confirmHandler:me,confirmIsDestructive:!0}))})));var Qr=n(88);const eo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t),{isUsernameAvailable:a}=(0,g.aW)(e,t);return{chat:n,isChannel:(0,v.eA)(n),progress:e.management.progress,isUsernameAvailable:a,isProtected:null==n?void 0:n.isProtected}}))((({chat:e,onClose:t,isActive:n,isChannel:r,progress:i,isUsernameAvailable:l,isProtected:c})=>{var d;const{checkPublicLink:h,updatePublicLink:Z,updatePrivateLink:P,toggleIsProtected:v}=(0,s.uC)(),g=Boolean(e.username),p=null===(d=e.fullInfo)||void 0===d?void 0:d.inviteLink,[E,C]=(0,a.eJ)(g?"public":"private"),[f,b]=(0,a.eJ)(),[I,y,N]=(0,De.Z)(),S=Boolean("public"===E&&f&&l||"private"===E&&g);(0,m.ZP)(n,t),(0,a.d4)((()=>{E&&!p&&P()}),[E,p,P]);const w=(0,a.I4)((e=>{C(e)}),[]),k=(0,a.I4)((t=>{v({chatId:e.id,isProtected:"protected"===t})}),[e.id,v]),M=(0,a.I4)((()=>{Z({username:"public"===E?f:""})}),[E,Z,f]),T=(0,a.I4)((()=>{N(),P()}),[N,P]),L=(0,u.Z)(),A=r?"Channel":"Mega",R=r?"Channel":"Group",F=[{value:"private",label:L(`${A}Private`),subLabel:L(`${A}PrivateInfo`)},{value:"public",label:L(`${A}Public`),subLabel:L(`${A}PublicInfo`)}],B=[{value:"allowed",label:L("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:L("ChannelVisibility.Forwarding.Disabled")}],$=i===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:L.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},L(`${R}Type`)),a.ZP.createElement(at.Z,{selected:E,name:"channel-type",options:F,onChange:w})),"private"===E?a.ZP.createElement("div",{className:"section",dir:L.isRtl?"rtl":void 0},p?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Qr.Z,{url:p,className:"group-link",text:p}),a.ZP.createElement("p",{className:"section-info",dir:L.isRtl?"rtl":void 0},L(`${A}PrivateLinkHelp`)),a.ZP.createElement(Le.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:y},L("RevokeLink")),a.ZP.createElement(Xe.Z,{isOpen:I,onClose:N,text:L("RevokeAlert"),confirmLabel:L("RevokeButton"),confirmHandler:T,confirmIsDestructive:!0})):a.ZP.createElement(we.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(Pn,{asLink:!0,currentUsername:e.username,isLoading:$,isUsernameAvailable:l,checkUsername:h,onChange:b}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},L(`${R}.Username.CreatePublicLinkHelp`))),a.ZP.createElement("div",{className:"section",dir:L.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},L(r?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")),a.ZP.createElement(at.Z,{selected:c?"protected":"allowed",name:"channel-type",options:B,onChange:k}),a.ZP.createElement("p",{className:"section-info"},L(r?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")))),a.ZP.createElement(dn.Z,{isShown:S,disabled:$,ariaLabel:L("Save"),onClick:M},$?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),to=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t),{forDiscussionIds:s,byId:r}=e.chats;return{chat:a,chatsByIds:r,forDiscussionIds:s,linkedChat:null!=a&&null!==(n=a.fullInfo)&&void 0!==n&&n.linkedChatId?(0,g.Z1)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&(0,v.eA)(a)}}))((({chat:e,onClose:t,isActive:n,chatId:r,chatsByIds:l,linkedChat:c,forDiscussionIds:d,isChannel:h,onScreenSelect:Z})=>{const{loadGroupsForDiscussion:P,linkDiscussionGroup:v,unlinkDiscussionGroup:g}=(0,s.uC)(),[p,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(!1),y=(0,a.I4)((()=>I(!0)),[]),[N,S,w]=(0,De.Z)(),[k,M,T]=(0,De.Z)(),L=(0,u.Z)(),A=null==c?void 0:c.id;(0,m.ZP)(n,t),(0,a.d4)((()=>{P()}),[P]),(0,a.d4)((()=>{C||(0,dt.Z)("DiscussionGroups").then(f)}),[C]);const R=(0,a.I4)((()=>{w(),g({channelId:h?r:A}),h||Z(o.u1.Initial)}),[w,g,h,r,A,Z]),F=(0,a.I4)((()=>{T(),v({channelId:r,chatId:p})}),[T,v,r,p]);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:"section-icon"},C&&a.ZP.createElement(mt.Z,{id:"discussionGroupsDucks",size:i.bM,animationData:C,play:b,noLoop:!0,onLoad:y})),c&&a.ZP.createElement("div",null,a.ZP.createElement(Le.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Ae.Z,{chatId:c.id})),a.ZP.createElement(Le.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:S},L(h?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Xe.Z,{isOpen:N,onClose:w,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:c}),a.ZP.createElement("div",{className:"modal-title"},L(h?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,ve.Z)(L(h?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:L(h?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:R,confirmIsDestructive:!0})),!c&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},L("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Le.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},L("DiscussionCreateGroup")),d?d.map(((e,t)=>a.ZP.createElement(Le.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{E(e),M()}},a.ZP.createElement(Ae.Z,{chatId:e})))):a.ZP.createElement(wt.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},L("DiscussionChannelHelp2")),a.ZP.createElement(Xe.Z,{isOpen:k,onClose:T,header:function(){const e=l[p];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},L("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const t=l[p];if(t)return t.hasPrivateLink?(0,ve.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):(0,ve.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:L("DiscussionLinkGroup"),confirmHandler:F,isButtonsInOneRow:!0})))))}))),no=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,g.Z1)(e,t);return{chat:a,isFormFullyDisabled:!(a.isCreator||n)}}))((({chat:e,selectedChatMemberId:t,onScreenSelect:n,isFormFullyDisabled:r,onClose:i,isActive:l})=>{const{updateChatMemberBannedRights:c}=(0,s.uC)(),[d,h]=(0,a.eJ)({}),[Z,P]=(0,a.eJ)(!1),[v,g]=(0,a.eJ)(!1),[p,E,C]=(0,De.Z)(),f=(0,u.Z)();(0,m.ZP)(l,i);const b=(0,a.Ye)((()=>{if(e&&e.fullInfo&&e.fullInfo.members)return e.fullInfo.members.find((({userId:e})=>e===t))}),[e,t]);(0,a.d4)((()=>{null!=e&&e.fullInfo&&t&&!b&&n(o.u1.GroupPermissions)}),[e,n,b,t]),(0,a.d4)((()=>{h((null==b?void 0:b.bannedRights)||(null==e?void 0:e.defaultBannedRights)||{}),P(!1),g(!1)}),[e,b]);const I=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}h((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),P(!0)}),[]),y=(0,a.I4)((()=>{e&&t&&(g(!0),c({chatId:e.id,userId:t,bannedRights:d}))}),[e,t,d,c]),N=(0,a.I4)((()=>{e&&t&&c({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})}),[e,t,c]),S=(0,a.I4)((t=>!!r||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t]),[e,r]);if(b)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Re.Z,{userId:b.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},f("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMessages",checked:!d.sendMessages,label:f("UserRestrictionsSend"),blocking:!0,disabled:S("sendMessages"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendMedia",checked:!d.sendMedia,label:f("UserRestrictionsSendMedia"),blocking:!0,disabled:S("sendMedia"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendStickers",checked:!d.sendStickers&&!d.sendGifs,label:f("UserRestrictionsSendStickers"),blocking:!0,disabled:S("sendStickers"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"sendPolls",checked:!d.sendPolls,label:f("UserRestrictionsSendPolls"),blocking:!0,disabled:S("sendPolls"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"embedLinks",checked:!d.embedLinks,label:f("UserRestrictionsEmbedLinks"),blocking:!0,disabled:S("embedLinks"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"inviteUsers",checked:!d.inviteUsers,label:f("UserRestrictionsInviteUsers"),blocking:!0,disabled:S("inviteUsers"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"pinMessages",checked:!d.pinMessages,label:f("UserRestrictionsPinMessages"),blocking:!0,disabled:S("pinMessages"),onChange:I})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!d.changeInfo,label:f("UserRestrictionsChangeInfo"),blocking:!0,disabled:S("changeInfo"),onChange:I}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:E},f("UserRestrictionsBlock")))),a.ZP.createElement(dn.Z,{isShown:Z,onClick:y,ariaLabel:f("Save"),disabled:v},v?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Xe.Z,{isOpen:p,onClose:C,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:N,confirmIsDestructive:!0}))}))),ao=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.Z1)(e,t);return{chat:n,currentUserId:e.currentUserId,isChannel:(0,v.eA)(n)}}))((({chat:e,isChannel:t,currentUserId:n,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c})=>{const d=(0,u.Z)();(0,m.ZP)(c,l);const h=(0,a.Ye)((()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[e]),Z=(0,a.I4)((e=>{i(e.userId,e.promotedByUserId===n),r(o.u1.ChatAdminRights)}),[n,i,r]),P=(0,a.I4)((()=>{r(o.u1.GroupAddAdmins)}),[r]),g=(0,a.I4)((e=>{if(e.isOwner)return d("ChannelCreator");const t=(0,s.Rd)().users.byId,n=e.promotedByUserId?t[e.promotedByUserId]:void 0;return n?d("EditAdminPromotedBy",(0,v.Js)(n)):d("ChannelAdmin")}),[d]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{icon:"recent",multiline:!0,onClick:function(){r(o.u1.GroupRecentActions)}},a.ZP.createElement("span",{className:"title"},d("EventLog")),a.ZP.createElement("span",{className:"subtitle"},d(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:d.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),h.map((e=>a.ZP.createElement(Le.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>Z(e)},a.ZP.createElement(Re.Z,{userId:e.userId,status:g(e),forceShowSelf:!0})))),a.ZP.createElement(dn.Z,{isShown:!0,onClick:P,ariaLabel:d("Channel.Management.AddModerator")},a.ZP.createElement("i",{className:"icon-add-user-filled"})))))}))),so=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,g.Z1)(e,t)})))((({chat:e,onClose:t,isActive:n})=>{const s=(0,u.Z)();(0,m.ZP)(n,t);const r=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[e]),o=(0,a.I4)((e=>e.isOwner?s("ChannelCreator"):s("ChannelAdmin")),[s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:s.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(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:s.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},s("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllAdmins"),onChange:void 0})),r.map((e=>a.ZP.createElement(Le.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(Cn.Z,{label:"",checked:!0}),a.ZP.createElement(Re.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),ro=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,g.Z1)(e,t),{byId:s}=e.users,{currentUserId:r}=e;return{chat:a,usersById:s,currentUserId:r,isChannel:(0,v.eA)(a),isFormFullyDisabled:!(a.isCreator||n),defaultRights:a.adminRights}}))((({isNewAdmin:e,selectedChatMemberId:t,defaultRights:n,onScreenSelect:r,chat:i,usersById:l,currentUserId:c,isChannel:d,isFormFullyDisabled:h,onClose:Z,isActive:P})=>{const{updateChatAdmin:g}=(0,s.uC)(),[p,E]=(0,a.eJ)({}),[C,f]=(0,a.eJ)(e),[b,I]=(0,a.eJ)(!1),[y,N,S]=(0,De.Z)(),[w,k]=(0,a.eJ)(""),M=(0,u.Z)();(0,m.ZP)(P,Z);const T=(0,a.Ye)((()=>{var n,a;const s=null===(n=i.fullInfo)||void 0===n||null===(a=n.adminMembers)||void 0===a?void 0:a.find((({userId:e})=>e===t));var r,o;return e?s||null===(r=i.fullInfo)||void 0===r||null===(o=r.members)||void 0===o?void 0:o.find((({userId:e})=>e===t)):s}),[i.fullInfo,e,t]);(0,a.d4)((()=>{null!=i&&i.fullInfo&&t&&!T&&r(o.u1.ChatAdministrators)}),[i,r,T,t]),(0,a.d4)((()=>{E((e?n:null==T?void 0:T.adminRights)||{}),k(((e?"admin":null==T?void 0:T.customTitle)||"").substr(0,16)),f(Boolean(e)),I(!1)}),[n,e,T]);const L=(0,a.I4)((e=>{const{name:t}=e.target;E((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),f(!0)}),[]),A=(0,a.I4)((()=>{t&&(I(!0),g({chatId:i.id,userId:t,adminRights:p,customTitle:w}))}),[t,g,i.id,p,w]),R=(0,a.I4)((()=>{t&&(g({chatId:i.id,userId:t,adminRights:{}}),S())}),[i.id,S,t,g]),F=(0,a.I4)((e=>!((0,v.G9)(i)||!h&&i.adminRights&&i.adminRights[e])),[i,h]),B=(0,a.Ye)((()=>{if(e||!T)return;if(T.isOwner)return M("ChannelCreator");const t=T.promotedByUserId?l[T.promotedByUserId]:void 0;return t?M("EditAdminPromotedBy",(0,v.Js)(t)):M("ChannelAdmin")}),[e,T,l,M]),$=(0,a.I4)((e=>{const{value:t}=e.target;k(t),f(!0)}),[]);if(T)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Le.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Re.Z,{userId:T.userId,status:B,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},M("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"changeInfo",checked:!!p.changeInfo,label:M(d?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:F("changeInfo"),onChange:L})),d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"postMessages",checked:!!p.postMessages,label:M("EditAdminPostMessages"),blocking:!0,disabled:F("postMessages"),onChange:L})),d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"editMessages",checked:!!p.editMessages,label:M("EditAdminEditMessages"),blocking:!0,disabled:F("editMessages"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"deleteMessages",checked:!!p.deleteMessages,label:M(d?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:F("deleteMessages"),onChange:L})),!d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"banUsers",checked:!!p.banUsers,label:M("EditAdminBanUsers"),blocking:!0,disabled:F("banUsers"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"inviteUsers",checked:!!p.inviteUsers,label:M("EditAdminAddUsers"),blocking:!0,disabled:F("inviteUsers"),onChange:L})),!d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"pinMessages",checked:!!p.pinMessages,label:M("EditAdminPinMessages"),blocking:!0,disabled:F("pinMessages"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"addAdmins",checked:!!p.addAdmins,label:M("EditAdminAddAdmins"),blocking:!0,disabled:F("addAdmins"),onChange:L})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"manageCall",checked:!!p.manageCall,label:M("StartVoipChatPermission"),blocking:!0,disabled:F("manageCall"),onChange:L})),!d&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:"anonymous",checked:!!p.anonymous,label:M("EditAdminSendAnonymously"),blocking:!0,disabled:F("anonymous"),onChange:L})),h&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},M("Channel.EditAdmin.CannotEdit")),!d&&a.ZP.createElement(Me.Z,{id:"admin-title",label:M("EditAdminRank"),onChange:$,value:w,disabled:h,maxLength:16}),c!==t&&!h&&!e&&a.ZP.createElement(Le.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:N},M("EditAdminRemoveAdmin")))),a.ZP.createElement(dn.Z,{isShown:C,onClick:A,ariaLabel:M("Save"),disabled:b},b?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),!e&&a.ZP.createElement(Xe.Z,{isOpen:y,onClose:S,text:"Are you sure you want to dismiss this admin?",confirmLabel:M("Channel.Admin.Dismiss"),confirmHandler:R,confirmIsDestructive:!0}))}))),oo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n,a;const s=(0,g.Z1)(e,t),{statusesById:r}=e.users;return{members:null==s||null===(n=s.fullInfo)||void 0===n?void 0:n.members,adminMembers:null==s||null===(a=s.fullInfo)||void 0===a?void 0:a.adminMembers,userStatusesById:r,isChannel:s&&(0,v.eA)(s),serverTimeOffset:e.serverTimeOffset}}))((({noAdmins:e,members:t,adminMembers:n,userStatusesById:r,isChannel:i,isActive:l,serverTimeOffset:c,onClose:d,onScreenSelect:u,onChatMemberSelect:h})=>{const{openUserInfo:Z}=(0,s.uC)(),P=(0,a.Ye)((()=>{const a=(0,s.Rd)().users.byId;if(!t||!a)return;const o=e&&(null==n?void 0:n.map((({userId:e})=>e)))||[],i=(0,v.Z0)(t.map((({userId:e})=>e)),a,r,void 0,c);return e?i.filter((e=>!o.includes(e))):i}),[t,e,n,r,c]),g=(0,a.I4)((t=>{e?(h(t,!1),u(o.u1.ChatNewAdminRights)):Z({id:t})}),[e,h,u,Z]);return(0,m.ZP)(l,d),a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},P?P.map(((e,t)=>a.ZP.createElement(Le.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>g(e)},a.ZP.createElement(Re.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(wt.Z,{teactOrderKey:0,key:"nothing-found",text:i?"No subscribers found":"No members found"}))))}))),io=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t),{byId:s,statusesById:r}=e.users;return{members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,usersById:s,userStatusesById:r,isChannel:a&&(0,v.eA)(a),serverTimeOffset:e.serverTimeOffset}}))((({usersById:e,userStatusesById:t,members:n,isChannel:s,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c,serverTimeOffset:d})=>{(0,m.ZP)(c,l);const u=(0,a.Ye)((()=>{if(n&&e)return(0,v.Z0)(n.filter((e=>!e.isOwner)).map((({userId:e})=>e)),e,t,void 0,d)}),[n,d,e,t]),h=(0,a.I4)((e=>{i(e),r(o.u1.GroupUserPermissions)}),[i,r]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},u?u.map(((e,t)=>a.ZP.createElement(Le.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>h(e)},a.ZP.createElement(Re.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(wt.Z,{teactOrderKey:0,key:"nothing-found",text:s?"No subscribers found":"No members found"}))))})));var lo=n(2357),co=n(2267);function mo(e,t){const{isPermanent:n,usage:a=0,date:s}=e,{isPermanent:r,usage:o=0,date:i}=t;return n||r?Number(n)-Number(r):a||o?o-a:i-s}const uo=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{invites:n}=e.management.byChatId[t];return{exportedInvites:n,chat:(0,g.Z1)(e,t),serverTimeOffset:e.serverTimeOffset}}))((({chatId:e,chat:t,exportedInvites:n,isActive:r,serverTimeOffset:i,onClose:l,onScreenSelect:d})=>{const{setEditingExportedInvite:h,showNotification:Z,editExportedChatInvite:P}=(0,s.uC)();(0,m.ZP)(r,l);const v=(0,u.Z)(),g=(0,a.Ye)((()=>{if(n)return n.some((({expireDate:e})=>e&&e-(0,co.b)(i)<K.xR/1e3))}),[n,i]),p=(0,c.Z)();(0,lo.Z)((()=>{p()}),g?1e3:void 0);const E=null==n?void 0:n.find((({isPermanent:e})=>e)),C=null!=t&&t.username?`t.me/${t.username}`:null==E?void 0:E.link,b=(0,a.Ye)((()=>{const e=null!=t&&t.username?n:null==n?void 0:n.filter((({isPermanent:e})=>!e));return null==e?void 0:e.filter((({isRevoked:e})=>!e)).sort(mo)}),[null==t?void 0:t.username,n]),I=(0,a.I4)((t=>{const{link:n,title:a,isRequestNeeded:s,expireDate:r,usageLimit:o}=t;P({chatId:e,link:n,title:a,isRequestNeeded:s,expireDate:r,usageLimit:o,isRevoked:!0})}),[e,P]),y=(0,a.I4)((()=>{d(o.u1.EditInvite)}),[d]),N=(0,a.I4)((()=>{E&&I(E)}),[E,I]),S=(0,a.I4)((e=>{(0,ss.TE)(e),Z({message:v("LinkCopied")})}),[v,Z]),w=(0,a.I4)((()=>{S(C)}),[S,C]),k=t=>{const n=[];return n.push({title:v("Copy"),icon:"copy",handler:()=>S(t.link)}),t.isPermanent||n.push({title:v("Edit"),icon:v("edit"),handler:()=>(t=>{h({chatId:e,invite:t}),d(o.u1.EditInvite)})(t)}),n.push({title:v("RevokeButton"),icon:v("delete"),handler:()=>I(t),destructive:!0}),n},M=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(L.Z,{round:!0,ripple:!f.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"Actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]);return a.ZP.createElement("div",{className:"Management ManageInvites"},a.ZP.createElement("div",{className:"custom-scroll"},C&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("p",{className:"text-muted"},null!=t&&t.username?v("PublicLink"):v("lng_create_permanent_link_title")),a.ZP.createElement("div",{className:"primary-link"},a.ZP.createElement("input",{className:"form-control primary-link-input",value:C,readOnly:!0,onClick:w}),a.ZP.createElement(F.Z,{className:"primary-link-more-menu",trigger:M,positionX:"right"},a.ZP.createElement(B.Z,{icon:"copy",onClick:w},v("Copy")),!(null!=t&&t.username)&&a.ZP.createElement(B.Z,{icon:"delete",onClick:N,destructive:!0},v("RevokeButton")))),a.ZP.createElement(L.Z,{onClick:w},v("CopyLink"))),a.ZP.createElement("div",{className:"section",teactFastList:!0},a.ZP.createElement(L.Z,{isText:!0,key:"create",className:"create-link",onClick:y},v("CreateNewLink")),!b&&a.ZP.createElement(wt.Z,{text:"No links found",key:"nothing"}),null==b?void 0:b.map((e=>a.ZP.createElement(Le.Z,{icon:"link",secondaryIcon:"more",multiline:!0,onClick:()=>S(e.link),contextActions:k(e),key:e.link},a.ZP.createElement("span",{className:"title"},e.title||e.link),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},(e=>{const{usage:t=0,usageLimit:n,expireDate:a,isPermanent:s,requested:r}=e;let o="";if(o=n&&t<n?v("CanJoin",n-t):t?v("PeopleJoined",t):v("NoOneJoined"),r&&(o+=`${v("JoinRequests",r)}`),void 0!==n&&t===n)o+=`${v("LinkLimitReached")}`;else if(a){const e=1e3*(a-(0,co.b)(i));o+=" • ",o+=e>0?v("InviteLink.ExpiresIn",(0,K.D)(v,e)):v("InviteLink.Expired")}else s&&(o+=`${v("Permanent")}`);return o})(e))))),a.ZP.createElement("p",{className:"text-muted hint",key:"links-hint"},v("ManageLinksInfoHelp")))))})));var ho=n(2531);const Zo=[1,10,100],Po={hour:36e5,day:864e5,week:6048e5},vo=Po.hour,go=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const{editingInvite:n}=e.management.byChatId[t];return{editingInvite:n,serverTimeOffset:e.serverTimeOffset}}))((({chatId:e,editingInvite:t,isActive:n,serverTimeOffset:r,onClose:i,onScreenSelect:l})=>{const{editExportedChatInvite:c,exportChatInvite:d}=(0,s.uC)(),h=(0,u.Z)(),[Z,P,v]=(0,De.Z)(),[g,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(Date.now()+vo),[I,y]=(0,a.eJ)("unlimited"),[N,S]=(0,a.eJ)(10),[w,k]=(0,a.eJ)("0");(0,m.ZP)(n,i),(0,a.d4)((()=>{if(t){const{title:e,usageLimit:n,expireDate:a,isRequestNeeded:s}=t;e&&C(e),n&&(k(Zo.includes(n)?n.toString():"custom"),S(n)),a&&(y("custom"),b(1e3*a)),s&&p(!0)}else C(""),y("unlimited"),k("0"),b(1e3*(0,co.b)(r)+vo),S(10),p(!1)}),[t,r]);const M=(0,a.I4)((e=>{p(e.target.checked)}),[]),T=(0,a.I4)((e=>{C(e.target.value)}),[]),A=(0,a.I4)((e=>{S(Number.parseInt(e.target.value,10))}),[]),R=(0,a.I4)((e=>{b(e.getTime()),v()}),[v]),F=(0,a.I4)((()=>{const n="custom"===w?N:w;let a;switch(I){case"custom":a=(0,co.b)(r)+(f-Date.now())/1e3;break;case"hour":case"day":case"week":a=(0,co.b)(r)+Po[I]/1e3;break;case"unlimited":default:a=void 0}t?c({link:t.link,chatId:e,title:E,isRequestNeeded:g,expireDate:a,usageLimit:n}):d({chatId:e,title:E,isRequestNeeded:g,expireDate:a,usageLimit:n}),l(o.u1.Invites)}),[e,f,N,c,t,d,g,I,w,E,l,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(Cn.Z,{label:h("ApproveNewMembers"),subLabel:h("ApproveNewMembersDescription"),checked:g,onChange:M})),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Me.Z,{className:"link-name",placeholder:h("LinkNameHint"),value:E,onChange:T}),a.ZP.createElement("p",{className:"text-muted hint"},h("LinkNameHelp"))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},h("LimitByPeriod")),a.ZP.createElement(at.Z,{name:"expireOptions",options:[{value:"hour",label:h("Hours",1)},{value:"day",label:h("Days",1)},{value:"week",label:h("Weeks",1)},{value:"unlimited",label:h("NoLimit")},{value:"custom",label:h("lng_group_invite_expire_custom")}],onChange:y,selected:I}),"custom"===I&&a.ZP.createElement(L.Z,{className:"expire-limit",isText:!0,onClick:P},(0,K.Tu)(h,f)," ",(0,K.mr)(h,f)),a.ZP.createElement("p",{className:"text-muted hint"},h("TimeLimitHelp"))),!g&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-header"},h("LimitNumberOfUses")),a.ZP.createElement(at.Z,{name:"usageOptions",options:[...Zo.map((e=>({value:e.toString(),label:e}))),{value:"0",label:h("NoLimit")},{value:"custom",label:h("lng_group_invite_usage_custom")}],onChange:k,selected:w}),"custom"===w&&a.ZP.createElement("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:N,onChange:A}),a.ZP.createElement("p",{className:"text-muted hint"},h("UsesLimitHelp"))),a.ZP.createElement(dn.Z,{isShown:!0,onClick:F,ariaLabel:h(t?"SaveLink":"CreateLink")},a.ZP.createElement("i",{className:"icon-check"}))),a.ZP.createElement(ho.Z,{isOpen:Z,isFutureMode:!0,withTimePicker:!0,onClose:v,onSubmit:R,selectedAt:f,submitButtonLabel:h("Save")}))}))),po=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,g.Z1)(e,t);return{enabledReactions:null===(n=a.fullInfo)||void 0===n?void 0:n.enabledReactions,availableReactions:e.availableReactions,chat:a}}))((({availableReactions:e,enabledReactions:t,chat:n,isActive:r,onClose:o})=>{const{setChatEnabledReactions:i}=(0,s.uC)(),l=(0,u.Z)(),[c,d]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),[P,v]=(0,a.eJ)(t);(0,m.ZP)(r,o);const g=(0,a.I4)((()=>{n&&(Z(!0),i({chatId:n.id,enabledReactions:P}))}),[n,P,i]);(0,a.d4)((()=>{Z(!1),d(!1),v(t||[])}),[t]);const p=(0,a.I4)((t=>{if(!n||!e)return;const{name:a,checked:s}=t.currentTarget,r="all"===a?s?e.map((e=>e.reaction)):[]:s?[...P,a]:P.filter((e=>e!==a));v(r),d(!0)}),[e,n,P]);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(Cn.Z,{name:"all",checked:!P||P.length>0,label:l("EnableReactions"),onChange:p})),null==e?void 0:e.filter((e=>!e.isInactive)).map((({reaction:e,title:t})=>a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Cn.Z,{name:e,checked:!P||(null==P?void 0:P.includes(e)),disabled:0===(null==P?void 0:P.length),label:a.ZP.createElement("div",{className:"Reaction"},a.ZP.createElement(lt.Z,{reaction:e}),t),onChange:p})))))),a.ZP.createElement(dn.Z,{isShown:c,onClick:g,ariaLabel:l("Save"),disabled:h},h?a.ZP.createElement(J.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Eo=(0,a.X$)((0,s.c$)((e=>({managementType:(0,g.pP)(e)})))((({chatId:e,currentScreen:t,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c,managementType:d})=>{switch(t){case o.u1.Initial:switch(d){case"user":return a.ZP.createElement(zr,{key:e,userId:e,onClose:l,isActive:c});case"group":return a.ZP.createElement(Hr,{key:e,chatId:e,onScreenSelect:r,onClose:l,isActive:c||[o.u1.ChatPrivacyType,o.u1.Discussion,o.u1.GroupPermissions,o.u1.ChatAdministrators,o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions,o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(t)});case"channel":return a.ZP.createElement(Wr,{key:e,chatId:e,onScreenSelect:r,onClose:l,isActive:c||[o.u1.ChannelSubscribers,o.u1.ChatAdministrators,o.u1.Discussion,o.u1.ChatPrivacyType,o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(t)})}break;case o.u1.ChatPrivacyType:return a.ZP.createElement(eo,{chatId:e,isActive:c,onClose:l});case o.u1.Discussion:return a.ZP.createElement(to,{chatId:e,onScreenSelect:r,isActive:c,onClose:l});case o.u1.GroupPermissions:return a.ZP.createElement(Vr,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupRemovedUsers:return a.ZP.createElement(Kr,{chatId:e,isActive:c,onClose:l});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(io,{chatId:e,onChatMemberSelect:i,onScreenSelect:r,isActive:c||[o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupUserPermissions:return a.ZP.createElement(no,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChatAdministrators:return a.ZP.createElement(ao,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.ChatAdminRights,o.u1.ChatNewAdminRights,o.u1.GroupRecentActions].includes(t),onClose:l});case o.u1.GroupRecentActions:return a.ZP.createElement(so,{chatId:e,isActive:c,onClose:l});case o.u1.ChatAdminRights:return a.ZP.createElement(ro,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChatNewAdminRights:return a.ZP.createElement(ro,{chatId:e,isNewAdmin:!0,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(oo,{chatId:e,isActive:c,onClose:l});case o.u1.Invites:return a.ZP.createElement(uo,{chatId:e,isActive:c,onClose:l,onScreenSelect:r});case o.u1.EditInvite:return a.ZP.createElement(go,{chatId:e,isActive:c,onClose:l,onScreenSelect:r});case o.u1.GroupAddAdmins:return a.ZP.createElement(oo,{chatId:e,noAdmins:!0,isActive:c,onClose:l,onScreenSelect:r,onChatMemberSelect:i});case o.u1.Reactions:return a.ZP.createElement(po,{chatId:e,isActive:c,onClose:l})}})));var Co=n(9937);const fo=/^4[0-9]{12}(?:[0-9]{1,3})?$/,bo=/^5[1-5][0-9]{11,14}$/,Io=/^2[2-7][0-9]{11,14}$/;let yo;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(yo||(yo={}));const No={[yo.Default]:"",[yo.Visa]:"visa",[yo.Mastercard]:"mastercard"};function So(e){return e=e.replace(/\s/g,""),fo.test(e)?yo.Visa:bo.test(e)||Io.test(e)?yo.Mastercard:yo.Default}const wo={},ko=/(\d{1,3})(\d{1,3})?(\d{1,3})?(\d{1,3})?(\d{1,3})?/,Mo="AF🇦🇫93Afghanistan333\nAO🇦🇴244Angola333\nAL🇦🇱355Albania234\nAD🇦🇩376Andorra222\nAE🇦🇪971United Arab Emirates234\nAI🇦🇮1264Anguilla34\nAR🇦🇷54Argentina\nAM🇦🇲374Armenia233\nAG🇦🇬1268Antigua and Barbuda34\nAU🇦🇺61Australia333\nAS🇦🇸1684American Samoa34\nAT🇦🇹43Austria\nAW🇦🇼297Aruba34\nAZ🇦🇿994Azerbaijan2322\nBI🇧🇮257Burundi224\nBE🇧🇪32Belgium3222\nBJ🇧🇯229Benin233\nBF🇧🇫226Burkina Faso2222\nBD🇧🇩880Bangladesh\nBG🇧🇬359Bulgaria\nBH🇧🇭973Bahrain44\nBS🇧🇸1242Bahamas34\nBA🇧🇦387Bosnia and Herzegovina\nBY🇧🇾375Belarus2322\nBZ🇧🇿501Belize\nBO🇧🇴591Bolivia134\nBR🇧🇷55Brazil254\nBB🇧🇧1246Barbados34\nBM🇧🇲1441Bermuda34\nBN🇧🇳673Brunei34\nBQ🇧🇶599Bonaire, Sint Eustatius and Saba\nBT🇧🇹975Bhutan\nBW🇧🇼267Botswana233\nCF🇨🇫236Central African Republic2222\nCA🇨🇦1Canada334\nCH🇨🇭41Switzerland234\nCK🇨🇰682Cook Islands\nCL🇨🇱56Chile144\nCN🇨🇳86China344\nCI🇨🇮225Côte d`Ivoire233\nCM🇨🇲237Cameroon44\nCD🇨🇩243DR Congo234\nCG🇨🇬242Republic of the Congo234\nCO🇨🇴57Colombia334\nKM🇰🇲269Comoros34\nCV🇨🇻238Cape Verde34\nCR🇨🇷506Costa Rica\nCU🇨🇺53Cuba44\nCY🇨🇾357Cyprus44\nCW🇨🇼599Curaçao\nCZ🇨🇿420Czech Republic\nDE🇩🇪49Germany38\nDJ🇩🇯253Djibouti2222\nDM🇩🇲1767Dominica34\nDK🇩🇰45Denmark44\nDO🇩🇴1Dominican Republic334\nDZ🇩🇿213Algeria3222\nEC🇪🇨593Ecuador\nEG🇪🇬20Egypt234\nER🇪🇷291Eritrea133\nES🇪🇸34Spain333\nEE🇪🇪372Estonia\nET🇪🇹251Ethiopia234\nFI🇫🇮358Finland\nFJ🇫🇯679Fiji\nFK🇫🇰500Falkland Islands\nFM🇫🇲691Micronesia\nFO🇫🇴298Faroe Islands33\nFR🇫🇷33France12222\nGA🇬🇦241Gabon1222\nGB🇬🇧44United Kingdom46\nGE🇬🇪995Georgia\nGF🇬🇫594French Guiana\nGH🇬🇭233Ghana\nGI🇬🇮350Gibraltar44\nGL🇬🇱299Greenland33\nGN🇬🇳224Guinea333\nGM🇬🇲220Gambia34\nGP🇬🇵590Guadeloupe\nGU🇬🇺1671Guam34\nGW🇬🇼245Guinea-Bissau34\nGQ🇬🇶240Equatorial Guinea333\nGR🇬🇷30Greece244\nGD🇬🇩1473Grenada34\nGT🇬🇹502Guatemala134\nGY🇬🇾592Guyana\nHK🇭🇰852Hong Kong\nHN🇭🇳504Honduras44\nHR🇭🇷385Croatia\nHT🇭🇹509Haiti\nHU🇭🇺36Hungary234\nID🇮🇩62Indonesia\nIN🇮🇳91India55\nIO🇩🇬246Diego Garcia34\nIE🇮🇪353Ireland234\nIR🇮🇷98Iran334\nIQ🇮🇶964Iraq334\nIS🇮🇸354Iceland34\nIL🇮🇱972Israel234\nIT🇮🇹39Italy334\nJM🇯🇲1876Jamaica34\nJO🇯🇴962Jordan144\nJP🇯🇵81Japan244\nKZ🇰🇿7Kazakhstan3322\nKE🇰🇪254Kenya333\nKG🇰🇬996Kyrgyzstan\nKH🇰🇭855Cambodia\nKI🇰🇮686Kiribati\nKN🇰🇳1869Saint Kitts and Nevis34\nKR🇰🇷82South Korea\nKW🇰🇼965Kuwait44\nKY🇰🇾1345Cayman Islands34\nLA🇱🇦856Laos\nLB🇱🇧961Lebanon\nLR🇱🇷231Liberia\nLY🇱🇾218Libya234\nLC🇱🇨1758Saint Lucia34\nLI🇱🇮423Liechtenstein\nLK🇱🇰94Sri Lanka234\nLS🇱🇸266Lesotho233\nLT🇱🇹370Lithuania35\nLU🇱🇺352Luxembourg\nLV🇱🇻371Latvia35\nMA🇲🇦212Morocco234\nMC🇲🇨377Monaco44\nMD🇲🇩373Moldova233\nMG🇲🇬261Madagascar2232\nMP🇲🇵1670Northern Mariana Islands34\nMO🇲🇴853Macau\nMS🇲🇸1664Montserrat34\nMV🇲🇻960Maldives\nMX🇲🇽52Mexico\nMH🇲🇭692Marshall Islands\nMK🇲🇰389Macedonia\nML🇲🇱223Mali44\nMT🇲🇹356Malta2222\nMM🇲🇲95Myanmar\nME🇲🇪382Montenegro\nMN🇲🇳976Mongolia\nMZ🇲🇿258Mozambique234\nMQ🇲🇶596Martinique\nMR🇲🇷222Mauritania44\nMU🇲🇺230Mauritius\nMW🇲🇼265Malawi\nMY🇲🇾60Malaysia\nNA🇳🇦264Namibia234\nNC🇳🇨687New Caledonia6\nNE🇳🇪227Niger2222\nNF🇳🇫672Norfolk Island\nNG🇳🇬234Nigeria\nNI🇳🇮505Nicaragua44\nNL🇳🇱31Netherlands12222\nNO🇳🇴47Norway44\nNP🇳🇵977Nepal\nNU🇳🇺683Niue\nNR🇳🇷674Nauru\nNZ🇳🇿64New Zealand\nOM🇴🇲968Oman44\nPK🇵🇰92Pakistan334\nPA🇵🇦507Panama44\nPE🇵🇪51Peru333\nPF🇵🇫689French Polynesia\nPH🇵🇭63Philippines334\nPM🇵🇲508Saint Pierre and Miquelon\nPR🇵🇷1Puerto Rico334\nPS🇵🇸970Palestine324\nPW🇵🇼680Palau\nPG🇵🇬675Papua New Guinea\nPL🇵🇱48Poland333\nKP🇰🇵850North Korea\nPT🇵🇹351Portugal144\nPY🇵🇾595Paraguay333\nQA🇶🇦974Qatar\nRE🇷🇪262Réunion333\nRO🇷🇴40Romania333\nRU🇷🇺7Russia3322\nRW🇷🇼250Rwanda333\nSA🇸🇦966Saudi Arabia\nSD🇸🇩249Sudan234\nSN🇸🇳221Senegal234\nSG🇸🇬65Singapore44\nSH🇸🇭290Saint Helena23\nSH🇸🇭247Saint Helena4\nSB🇸🇧677Solomon Islands\nSL🇸🇱232Sierra Leone233\nSV🇸🇻503El Salvador44\nSM🇸🇲378San Marino334\nSO🇸🇴252Somalia233\nRS🇷🇸381Serbia234\nSS🇸🇸211South Sudan234\nST🇸🇹239São Tomé and Príncipe25\nSR🇸🇷597Suriname34\nSK🇸🇰421Slovakia\nSI🇸🇮386Slovenia\nSE🇸🇪46Sweden234\nSZ🇸🇿268Swaziland44\nSC🇸🇨248Seychelles1222\nSX🇸🇽1721Sint Maarten34\nSY🇸🇾963Syria\nTC🇹🇨1649Turks and Caicos Islands34\nTD🇹🇩235Chad2222\nTG🇹🇬228Togo233\nTH🇹🇭66Thailand144\nTJ🇹🇯992Tajikistan\nTK🇹🇰690Tokelau\nTM🇹🇲993Turkmenistan26\nTL🇹🇱670Timor-Leste\nTO🇹🇴676Tonga\nTT🇹🇹1868Trinidad and Tobago34\nTN🇹🇳216Tunisia233\nTR🇹🇷90Turkey334\nTV🇹🇻688Tuvalu\nTW🇹🇼886Taiwan\nTZ🇹🇿255Tanzania234\nUG🇺🇬256Uganda234\nUA🇺🇦380Ukraine2322\nUY🇺🇾598Uruguay44\nUS🇺🇸1United States334\nUZ🇺🇿998Uzbekistan27\nVA🇻🇦3Vatican City\nVC🇻🇨1784Saint Vincent and the Grenadines34\nVE🇻🇪58Venezuela334\nVG🇻🇬1284British Virgin Islands34\nVI🇻🇮1340US Virgin Islands34\nVN🇻🇳84Vietnam\nVU🇻🇺678Vanuatu\nWF🇼🇫681Wallis and Futuna\nWS🇼🇸685Samoa\nXK🇽🇰383Kosovo44\nYE🇾🇪967Yemen333\nZA🇿🇦27South Africa234\nZM🇿🇲260Zambia234\nZW🇿🇼263Zimbabwe234".split("\n").map((e=>({id:e.substr(0,2),flag:e.substr(2,4),code:`+${e.match(/\d+/)[0]}`,name:e.split(/\d+/)[1],phoneFormat:function(e){if(!e)return ko;const t=e[0];let n;if(!wo[t]){const e=t.split("").map(Number);n=e.reduce(((e,t,n)=>`${e}(\\d{1,${t}})${n>0?"?":""}`),""),wo[t]=new RegExp(`${n}${"()?".repeat(5-e.length)}`)}return wo[t]}(e.match(/\d+$/))}))),To={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Lo=(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,billingCountry:Ao(t.payload),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.countryIso2?{...e,...t.payload,billingCountry:Ao(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Ao(e){const t=Mo.find((({id:t})=>t===e));return t?t.name:""}function Ro(e,t=400){(0,a.d4)((()=>{f.$b||setTimeout((()=>{(0,G.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const Fo=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:r,error:o,ref:i,placeholder:l,onChange:c,children:d}=e,m=o||s,u=(0,X.Z)("input-group",n&&"touched",o&&"error",m&&"with-label",r&&"with-arrow","input-group");return a.ZP.createElement("div",{className:u},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:c,placeholder:l||s,ref:i},d),m&&t&&a.ZP.createElement("label",{htmlFor:t},m))})),Bo=(0,a.X$)((({state:e,needEmail:t,needPhone:n,needName:s,needAddress:r,dispatch:o})=>{const i=(0,a.sO)(null),l=(0,a.sO)(null),c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==e.countryIso2&&(c.current.value=e.countryIso2)}),[e.countryIso2]);const d=(0,u.Z)();Ro(i);const m=(0,a.I4)((e=>{o({type:"changeAddress1",payload:e.target.value})}),[o]),h=(0,a.I4)((e=>{o({type:"changeAddress2",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeCity",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeState",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeCountry",payload:e.target.value})}),[o]),g=(0,a.I4)((e=>{o({type:"changePostCode",payload:e.target.value})}),[o]),p=(0,a.I4)((e=>{o({type:"changeFullName",payload:e.target.value})}),[o]),E=(0,a.I4)((e=>{o({type:"changeEmail",payload:e.target.value})}),[o]),C=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,l.current&&(l.current.value=t),o({type:"changePhone",payload:t})}),[o]),f=(0,a.I4)((e=>{o({type:"changeSaveInfo",payload:e.target.value})}),[o]),{formErrors:b}=e;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,r?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,d("PaymentShippingAddress")),a.ZP.createElement(Me.Z,{ref:i,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:b.streetLine1}),a.ZP.createElement(Me.Z,{label:"Address2 (Street)",onChange:h,value:e.streetLine2,inputMode:"text",error:b.streetLine2}),a.ZP.createElement(Me.Z,{label:"City",onChange:Z,value:e.city,inputMode:"text",error:b.city}),a.ZP.createElement(Me.Z,{label:"State",onChange:P,value:e.state,inputMode:"text",error:b.state}),a.ZP.createElement(Fo,{label:"Country",placeholder:"Country",onChange:v,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:b.countryIso2,ref:c},Mo.map((({name:e,id:t})=>a.ZP.createElement("option",{value:t,className:"county-item"},e)))),a.ZP.createElement(Me.Z,{label:"Post Code",onChange:g,value:e.postCode,inputMode:"text",error:b.postCode})):void 0,s||t||n?a.ZP.createElement("h5",null,d("PaymentShippingReceiver")):void 0,s&&a.ZP.createElement(Me.Z,{label:"Full name",onChange:p,value:e.fullName,inputMode:"text",error:b.fullName}),t&&a.ZP.createElement(Me.Z,{label:"Email",onChange:E,value:e.email,inputMode:"email",error:b.email}),n&&a.ZP.createElement(Me.Z,{label:"Phone number",onChange:C,value:e.phone,inputMode:"tel",error:b.phone,ref:l}),a.ZP.createElement(Cn.Z,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:f})))})),$o=(0,a.X$)((({state:e,shippingOptions:t,currency:n,dispatch:s})=>{const r=(0,u.Z)();(0,a.d4)((()=>{t&&!e.shipping&&s({type:"changeShipping",payload:t[0].id})}),[t,e.shipping,s]);const o=(0,a.I4)((e=>{s({type:"changeShipping",payload:e})}),[s]),i=(0,a.Ye)((()=>t.map((({id:e,title:t,amount:a})=>({label:t,subLabel:(0,Co.x)(a,n,r.code),value:e})))),[t,n,r.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,"Select shipping method"),a.ZP.createElement(at.Z,{name:"shipping-options",options:i,onChange:o,selected:e.shipping})))}));function Do(e,t,n,s,r=!1){return a.ZP.createElement("div",{className:"price-info-item "+(r?"price-info-item-main":"")},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("div",{className:"value"},(0,Co.x)(n,s,e)))}function xo(e,t,n){return a.ZP.createElement("div",{className:"checkout-info-item"},a.ZP.createElement("i",{className:e}," "),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("p",{className:"data"},n)))}const Uo=(0,a.X$)((({invoiceContent:e,prices:t,shippingPrices:n,checkoutInfo:s,currency:r,totalPrice:o})=>{const i=(0,u.Z)(),{photoUrl:l,title:c,text:d}=e||{},{paymentMethod:m,paymentProvider:h,shippingAddress:Z,name:P,phone:v,shippingMethod:g}=s||{};return a.ZP.createElement("div",{className:"Checkout"},a.ZP.createElement("div",{className:"description has-image"},l&&a.ZP.createElement("img",{src:l,alt:""}),a.ZP.createElement("div",{className:"text"},a.ZP.createElement("h5",null,c),a.ZP.createElement("p",null,d))),a.ZP.createElement("div",{className:"price-info"},t&&t.map((e=>Do(i.code,e.label,e.amount,r))),n&&n.map((e=>Do(i.code,e.label,e.amount,r))),void 0!==o&&Do(i.code,i("Checkout.TotalAmount"),o,r,!0)),a.ZP.createElement("div",{className:"invoice-info"},m&&xo("icon-card",m,"Payment method"),h&&xo("stripe-provider",h,"Payment provider"),Z&&xo("icon-location",Z,"Shipping address"),P&&xo("icon-user",P,"Name"),v&&xo("icon-phone",v,"Phone number"),g&&xo("icon-truck",g,"Shipping method")))})),Oo=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null),r=(0,a.I4)((t=>{if("Backspace"===t.key&&"/"===e.charAt(e.length-1)){const t=e.slice(0,e.length-1);s.current&&(s.current.value=t)}}),[e]),o=(0,a.I4)((e=>{n(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))}),[n]);return a.ZP.createElement(Me.Z,{label:"Expiry date",ref:s,onChange:o,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}));var Go=n(6352),Jo=n(5753);const Xo=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null);Ro(s);const[r,o]=(0,a.eJ)(yo.Default);(0,a.d4)((()=>{const t=So(e);o(t)}),[]);const i=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),a=So(e.target.value);o(a),n(t),s.current&&(s.current.value=t)}),[n,s]),l=function(e){switch(e){case yo.Mastercard:return a.ZP.createElement("img",{src:Go,alt:""});case yo.Visa:return a.ZP.createElement("img",{src:Jo,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},l),a.ZP.createElement(Me.Z,{ref:s,label:"Card number",onChange:i,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))})),_o=(0,a.X$)((({state:e,canSaveCredentials:t,needCardholderName:n,needCountry:s,needZip:r,dispatch:o})=>{const i=(0,a.sO)(null);(0,a.d4)((()=>{i.current&&i.current.value!==e.billingCountry&&(i.current.value=e.billingCountry)}),[e.billingCountry]);const l=(0,a.I4)((e=>{o({type:"changeCardNumber",payload:e})}),[o]),c=(0,a.I4)((e=>{o({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[o]),d=(0,a.I4)((e=>{o({type:"changeExpiryDate",payload:e})}),[o]),m=(0,a.I4)((e=>{o({type:"changeCvvCode",payload:e.target.value})}),[o]),h=(0,a.I4)((e=>{o({type:"changeBillingCountry",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeBillingZip",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeSaveCredentials",payload:e.target.value})}),[o]),v=(0,u.Z)(),{formErrors:g={}}=e;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,v("PaymentCardTitle")),a.ZP.createElement(Xo,{onChange:l,value:e.cardNumber,error:g.cardNumber}),n&&a.ZP.createElement(Me.Z,{label:"Name on card",onChange:c,value:e.cardholder,inputMode:"text",error:g.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(Oo,{value:e.expiry,onChange:d,error:g.expiry}),a.ZP.createElement(Me.Z,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:g.cvv})),s||r?a.ZP.createElement("h5",null,v("PaymentBillingAddress")):void 0,s&&a.ZP.createElement(Fo,{label:"Country",placeholder:"Country",onChange:h,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,ref:i},Mo.map((({name:e})=>a.ZP.createElement("option",{value:e,className:"county-item"},e)))),r&&a.ZP.createElement(Me.Z,{label:"Post Code",onChange:Z,value:e.billingZip,inputMode:"text",error:g.billingZip}),t&&a.ZP.createElement(Cn.Z,{label:v("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:P})))})),zo=(0,a.X$)((0,s.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:r,invoiceContent:o,nativeProvider:i,nativeParams:l,passwordMissing:c,error:d}=e.payment,m=Boolean(r&&(!i||"stripe"!==i)),{needCardholderName:u,needCountry:h,needZip:Z}=l||{},{nameRequested:P,phoneRequested:v,emailRequested:g,shippingAddressRequested:p,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I}=r||{};return{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:i,passwordMissing:c,nameRequested:P,shippingAddressRequested:p,phoneRequested:v,emailRequested:g,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I,isProviderError:m,invoiceContent:o,needCardholderName:u,needCountry:h,needZip:Z,error:d}}))((({isOpen:e,onClose:t,step:n,shippingOptions:r,savedInfo:i,canSaveCredentials:l,nameRequested:c,shippingAddressRequested:d,phoneRequested:m,emailRequested:h,phoneToProvider:Z,emailToProvider:P,currency:v,passwordMissing:g,isProviderError:p,invoiceContent:E,nativeProvider:C,prices:f,needCardholderName:b,needCountry:I,needZip:y,error:N})=>{const{validateRequestedInfo:S,sendPaymentForm:w,setPaymentStep:k,sendCredentialsInfo:M,clearPaymentError:T}=(0,s.uC)(),[A,F]=(0,tn.Z)(Lo,To),[B,$]=(0,a.eJ)(!1),D=(0,u.Z)();(0,a.d4)((()=>{(n||N)&&$(!1)}),[n,N]),(0,a.d4)((()=>{null!=N&&N.field&&F({type:"setFormErrors",payload:{[N.field]:N.message}})}),[N,F]),(0,a.d4)((()=>{if(i){const{name:e,phone:t,email:n,shippingAddress:a}=i;F({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...a||{}}})}}),[i,F]);const x=(0,a.I4)((()=>{T()}),[T]),U=(0,a.Ye)((()=>n!==o.KB.Checkout?0:function(e=[],t,n){const a=t?Ho(t,n):[];let s=0;return s=e.concat(a||[]).reduce(((e,t)=>e+t.amount),s),s}(f,r,A.shipping)),[n,A.shipping,f,r]),O=(0,a.Ye)((()=>{if(n===o.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=So(e);return No[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:o}=e,i=t?Yo(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:o,phone:r,shippingMethod:null==i?void 0:i.title}}(A,r,C||"")}),[n,A,r,C]),G=(0,a.I4)((()=>{const{saveInfo:e}=A,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o,fullName:i,phone:l,email:c}=e;return{name:i,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o}}}(A);S({requestInfo:t,saveInfo:e})}),[S,A]),X=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:r,billingZip:o}=e,[i,l]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:i,expiryYear:l,cvv:s,country:r,zip:o}}}(A);M({credentials:e})}),[M,A]),_=(0,a.I4)((()=>{w({shippingOptionId:A.shipping,saveCredentials:A.saveCredentials})}),[w,A]),z=(0,a.I4)((e=>{k({step:e})}),[k]),Y=(0,a.I4)((()=>{switch($(!0),n){case o.KB.ShippingInfo:return G();case o.KB.Shipping:return z(o.KB.PaymentInfo);case o.KB.PaymentInfo:return X();case o.KB.Checkout:return _();default:return()=>{}}}),[n,G,z,X,_]),H=(0,a.Ye)((()=>{switch(n){case o.KB.ShippingInfo:return D("PaymentShippingInfo");case o.KB.Shipping:return D("PaymentShippingMethod");case o.KB.PaymentInfo:return D("PaymentCardInfo");case o.KB.Checkout:return D("PaymentCheckout");default:return""}}),[n,D]),V=(0,a.Ye)((()=>{switch(n){case o.KB.Checkout:return D("Checkout.PayPrice",(0,Co.x)(U,v,D.code));default:return D("Next")}}),[n,D,v,U]);return p?a.ZP.createElement(ke.Z,{className:"error",isOpen:e,onClose:t},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(L.Z,{isText:!0,onClick:t},D("OK"))):a.ZP.createElement(ke.Z,{className:"PaymentModal",isOpen:e,onClose:t},a.ZP.createElement("div",{className:"header",dir:D.isRtl?"rtl":void 0},a.ZP.createElement(L.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null,H)),void 0!==n?a.ZP.createElement(R.Z,{name:"slide",activeKey:n},(()=>a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case o.KB.ShippingInfo:return a.ZP.createElement(Bo,{state:A,dispatch:F,needAddress:Boolean(d),needEmail:Boolean(h||P),needPhone:Boolean(m||Z),needName:Boolean(c)});case o.KB.Shipping:return a.ZP.createElement($o,{state:A,dispatch:F,shippingOptions:r||[],currency:v});case o.KB.PaymentInfo:return a.ZP.createElement(_o,{state:A,dispatch:F,canSaveCredentials:Boolean(!g&&l),needCardholderName:b,needCountry:I,needZip:y});case o.KB.Checkout:return a.ZP.createElement(Uo,{prices:f,shippingPrices:A.shipping&&r?Ho(r,A.shipping):void 0,totalPrice:U,invoiceContent:E,checkoutInfo:O,currency:v});default:return}}(n)))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(J.Z,{color:"gray"})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(L.Z,{type:"submit",onClick:Y,disabled:B,isLoading:B},V)),N&&!N.field&&function(){if(N)return a.ZP.createElement(ke.Z,{className:"error",isOpen:Boolean(N),onClose:x},a.ZP.createElement("h4",null,N.description||"Error"),a.ZP.createElement("p",null,N.description||"Error"),a.ZP.createElement(L.Z,{isText:!0,onClick:T},D("OK")))}())})));function Yo(e,t){return e.find((({id:e})=>e===t))}function Ho(e,t){const n=Yo(e,t);return null==n?void 0:n.prices}const Vo=(0,a.X$)((0,s.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:i,shippingMethod:l,photoUrl:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:i,shippingMethod:l,photoUrl:c,text:d,title:m}}))((({isOpen:e,onClose:t,prices:n,shippingPrices:s,totalAmount:r,currency:o,info:i,photoUrl:l,text:c,title:d,credentialsTitle:m,shippingMethod:h})=>{const Z=(0,u.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:r,name:o}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:o,phone:r,shippingMethod:n}}(m,i,h)),[i,h,m]);return a.ZP.createElement(ke.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:e,onClose:t},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:Z.isRtl?"rtl":void 0},a.ZP.createElement(L.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null," ",Z("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(Uo,{prices:n,shippingPrices:s,totalPrice:r,invoiceContent:{photoUrl:l,text:c,title:d},checkoutInfo:P,currency:o}))))})))},9364:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(4050),s=n(3716),r=n(7361),o=n(6752),i=n(9107),l=n(231);const c=r.wB?550:400,d=(0,a.X$)((({isLoading:e=!1,isPasswordVisible:t,error:n,hint:d,placeholder:m="Password",submitLabel:u="Next",clearError:h,onChangePasswordVisibility:Z,onInputChange:P,onSubmit:v})=>{const g=(0,a.sO)(null),p=(0,i.Z)(),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(!1);return(0,a.d4)((()=>{r.$b||setTimeout((()=>{g.current.focus()}),c)}),[]),(0,a.d4)((()=>{n&&requestAnimationFrame((()=>{g.current.focus(),g.current.select()}))}),[n]),a.ZP.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||f&&v(E)},autoComplete:"off"},a.ZP.createElement("div",{className:(0,o.Z)("input-group password-input",E&&"touched",n&&"error"),dir:p.isRtl?"rtl":void 0},a.ZP.createElement("input",{ref:g,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:E||"",autoComplete:"current-password",onChange:function(e){n&&h();const{target:t}=e;C(t.value),b(t.value.length>=s.lo),P&&P(t.value)},dir:"auto"}),a.ZP.createElement("label",null,n||d||m),a.ZP.createElement("div",{className:"toggle-password",onClick:function(){Z(!t)},role:"button",tabIndex:0,title:"Toggle password visibility"},a.ZP.createElement("i",{className:t?"icon-eye":"icon-eye-closed"}))),f&&a.ZP.createElement(l.Z,{type:"submit",ripple:!0,isLoading:e},u))}))},3490:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(4050),s=n(3716),r=n(7361),o=n(7324),i=n(7799);const l=[0,50],c=[0,20],d=[20,0],m=r.wB?s.qp:s.z7,u=(0,a.X$)((({isPasswordVisible:e,isBig:t})=>{const[n,r]=(0,a.eJ)(),[u,h]=(0,a.eJ)(),[Z,P]=(0,a.eJ)(!1),[v,g]=(0,a.eJ)(!1);(0,a.d4)((()=>{n?setTimeout((()=>g(!0)),2e3):(0,o.Z)("MonkeyClose").then(r)}),[n]),(0,a.d4)((()=>{u||(0,o.Z)("MonkeyPeek").then(h)}),[u]);const p=(0,a.I4)((()=>P(!0)),[]);return a.ZP.createElement("div",{id:"monkey",className:t?"big":""},!Z&&a.ZP.createElement("div",{className:"monkey-preview"}),n&&a.ZP.createElement(i.Z,{id:"closeMonkey",size:t?s.K2:m,className:v?"hidden":"shown",animationData:n,playSegment:l,noLoop:!0,onLoad:p}),u&&a.ZP.createElement(i.Z,{id:"peekMonkey",size:t?s.K2:m,className:v?"shown":"hidden",animationData:u,playSegment:e?c:d,noLoop:!0}))}))},710:(e,t,n)=>{n.d(t,{Z:()=>v});var a=n(4050),s=n(6752),r=n(3716),o=n(1394),i=n(9107),l=n(231),c=n(3103),d=n(4288);const m={type:"blob",quality:1,format:"jpeg",circle:!1,size:{width:1024,height:1024}};let u,h,Z;const P=(0,a.X$)((({file:e,onChange:t,onClose:s})=>{const[P,v]=(0,a.eJ)(!1);(0,a.d4)((()=>{e&&(P?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;Z=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,o.YJ)(e);await Z.bind({url:s})}catch(e){r.eM&&console.error(e)}}(e):async function(){return h||(h=Promise.all([n.e(99),n.e(472)]).then(n.bind(n,3472)),u=(await h).default),h}().then((()=>v(!0))))}),[e,P]);const g=(0,i.Z)();return a.ZP.createElement(c.Z,{isOpen:Boolean(e),onClose:s,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},P?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(l.Z,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!Z)return;const e=await Z.result(m),n="string"==typeof e?e:(0,o.hl)(e,"avatar.jpg");t(n)},ariaLabel:g("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),v=(0,a.X$)((({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:n,onChange:r})=>{const[o,i]=(0,a.eJ)(),[l,c]=(0,a.eJ)(n);(0,a.d4)((()=>{c(n)}),[n]);const d=(0,s.Z)(l&&"filled",t&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:d,role:"button",tabIndex:0,title:e},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(i(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),l&&a.ZP.createElement("img",{src:l,alt:"Avatar"})),a.ZP.createElement(P,{file:o,onClose:function(){i(void 0)},onChange:function(e){i(void 0),r(e),l&&URL.revokeObjectURL(l),c(URL.createObjectURL(e))}}))}))},6352:(e,t,n)=>{e.exports=n.p+"mastercard.4216118edafe23cc2dec..svg"},5753:(e,t,n)=>{e.exports=n.p+"visa.e5a7c336e1deb4b92a63..svg"}}]);
//# sourceMappingURL=442.f81b4eb30975dff27660.js.map