"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[477],{9477:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>ja,AttachMenu:()=>sr,AttachmentModal:()=>Ts,BotCommandMenu:()=>ir,BotCommandTooltip:()=>or,CalendarModal:()=>Ye,ChatFolderModal:()=>qa,ContactList:()=>za,ContextMenuContainer:()=>ds,CustomSendMenu:()=>cr,DeleteMessageModal:()=>Ke,Dialogs:()=>De,DropArea:()=>dr.Z,EmojiTooltip:()=>hr,ForwardPicker:()=>Re,GifSearch:()=>kr,HeaderMenuContainer:()=>hs,HistoryCalendar:()=>je,InlineBotTooltip:()=>Cr,LeftSearch:()=>Vt,Management:()=>Yr,MediaViewer:()=>fe,MentionTooltip:()=>Ns,MessageSelectToolbar:()=>at,MobileSearch:()=>gs,NewChat:()=>Ha,NewChatStep1:()=>Ja,NewChatStep2:()=>_a,Notifications:()=>Ue,PaymentModal:()=>fo,PinMessageModal:()=>qe,PollModal:()=>As,PollResults:()=>Mr,ReceiptModal:()=>yo,RightSearch:()=>br,SafeLinkModal:()=>ze,SeenByModal:()=>st,Settings:()=>Oa,StickerSearch:()=>wr,StickerSetModal:()=>ms,StickerTooltip:()=>lr,SymbolMenu:()=>ar,TextFormatter:()=>mr.Z,UnpinAllMessagesModal:()=>We});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),g=n(2858),v=n(1638),p=n(396),E=n(3989),C=n(1174),f=n(7361),b=n(782),I=n(3858),y=n(4399),S=n(935);function w(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if("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 k(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 .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 F=n(231),A=n(126),L=n(2255),R=n(3106),B=n(8964),$=n(9196);const D=(0,a.X$)((0,s.c$)(((e,{message:t})=>({isDownloading:!!t&&(0,v.te)(e,t)})),((e,t)=>(0,b.ei)(t,["downloadMessageMedia","cancelMessageMediaDownload"])))((({mediaData:e,isVideo:t,isZoomed:n,message:s,fileName:r,isAvatar:o,isDownloading:i,onCloseMediaViewer:l,onForward:c,onZoomToggle:d,downloadMessageMedia:m,cancelMessageMediaDownload:h})=>{const{loadProgress:P}=(0,Z.Z)(s&&(0,g.Ti)(s,"download"),!i),v=(0,a.I4)((()=>{i?h({message:s}):m({message:s})}),[h,m,i,s]),p=(0,u.Z)(),E=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]);return f.wB?a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(R.Z,{trigger:E,positionX:"right"},!o&&a.ZP.createElement(B.Z,{icon:"forward",onClick:c},p("Forward")),t?a.ZP.createElement(B.Z,{icon:i?"close":"download",onClick:v},i?`${Math.round(100*P)}% Downloading...`:"Download"):a.ZP.createElement(B.Z,{icon:"download",href:e,download:r},p("AccActionDownload"))),i&&a.ZP.createElement($.Z,{progress:P,size:"s",noCross:!0})):a.ZP.createElement("div",{className:"MediaViewerActions"},!o&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("Forward"),onClick:c},a.ZP.createElement("i",{className:"icon-forward"}))),t?a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("AccActionDownload"),onClick:v},i?a.ZP.createElement($.Z,{progress:P,size:"s",onClick:v}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(F.Z,{href:e,download:r,round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"})),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:n?"Zoom Out":"Zoom In",onClick:d},a.ZP.createElement("i",{className:n?"icon-zoom-out":"icon-zoom-in"})),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})))})));var x=n(2202),U=n(9933),O=n(275),G=n(9118),z=n(9204),X=n(6752);const J=({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*y.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 _=n(1212),V=n(2019);const H=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var Y=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),g=(0,a.sO)(null),v=(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(v.current&&g.current){const{width:t,left:a}=g.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=>{v.current=!0,E(e)}),[E]),I=(0,a.I4)((()=>{v.current=!1}),[]);var y,S;if((0,a.d4)((()=>{if(g.current&&Z)return(0,C.s)(g.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,g),a.ZP.createElement(F.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,S=s,a.ZP.createElement("div",{className:"player-file-size"},`${W(S*y)} / ${W(S)}`)),l&&a.ZP.createElement(F.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{const d=(0,a.sO)(null),[m,u]=(0,a.eJ)(!f.$b||!f.cj),[h,Z]=(0,a.eJ)(0),[P,g]=(0,a.eJ)(!0),[v,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,V.Z)(),{shouldRender:y,transitionClassNames:S}=(0,_.Z)(!C,void 0,void 0,"slow"),{shouldRender:w,transitionClassNames:k}=(0,_.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 N=(0,a.I4)((e=>{e.stopPropagation(),m?(d.current.pause(),u(!1)):((0,j.Z)(d.current),u(!0),f.wB&&g(!1))}),[m]);(0,Y.Z)(d,[]);const M=(0,a.I4)((()=>{g(!0)}),[]),T=(0,a.I4)((()=>{g(!1)}),[]),A=(0,a.I4)((e=>{Z(e.currentTarget.currentTime)}),[]),L=(0,a.I4)((()=>{Z(0),u(!1),g(!0)}),[]),R=(0,a.I4)((()=>{v&&E?E():!v&&p&&p()}),[E,v,p]),B=(0,a.I4)((e=>{d.current.currentTime=e}),[]),D=(0,a.I4)((e=>{e.stopPropagation(),g(!P),P||(d.current.pause(),u(!1))}),[P]);(0,a.d4)((()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),N(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[N]);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:L,onClick:f.wB?void 0:N,onDoubleClick:R},I,{onTimeUpdate:A}),e&&a.ZP.createElement("source",{src:e}))),w&&a.ZP.createElement(F.Z,{round:!0,className:`play-button ${k}`,onClick:N},a.ZP.createElement("i",{className:"icon-play"})),y&&a.ZP.createElement("div",{className:["spinner-container",S].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:v,fileSize:o,duration:d.current?d.current.duration:0,isForceVisible:P,isForceMobileVersion:s&&s.width<400,onSeek:B,onChangeFullscreen:R,onPlayPause:N}))})),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,v.hj)(e,n,s);return t?{chatId:n,messageId:s,senderId:t.senderId,origin:l,message:t}:{}}if(r)return{messageId:-1,senderId:r,avatarOwner:(0,v.dy)(e,r)||(0,v.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,v.Tm)(e,n,s):(0,v.hj)(e,n,s),c?{chatId:n,threadId:a,messageId:s,senderId:c.senderId,origin:l,message:c}:{}}))((e=>{const{messageId:t,isActive:n,avatarOwner:s,chatId:i,message:c,profilePhotoIndex:d,origin:m,animationLevel:u,onClose:P,onFooterClick:v,isFooterHidden:p}=e,E=c?(0,g.O$)(c):void 0,C=c?(0,g.b7)(c):void 0,f=c?(0,g.F$)(c):void 0,b=c?(0,g.Cg)(c):void 0,I=!!c&&(0,g.rl)(c),w=!!c&&(0,g.hC)(c),k=Boolean(C||b||w),N=Boolean(!k&&(E||f||I)),{isGif:M}=C||b||{},T=Boolean(s||t),F=Boolean(s),A=m===o.bZ.SharedMedia,L=m===o.bZ.SearchResult,R=2===u;function B(e){if(F&&void 0!==d){const{photos:t}=s;return t&&t[d]?`photo${t[d].id}?size=c`:(0,g.RT)(s,e?"big":"normal")}return c&&(0,g.Ti)(c,e?"viewerFull":"viewerPreview")}const $=(0,h.Z)(c&&(A||L)&&(0,g.Ti)(c,"pictogram"),void 0,r.IU.BlobUrl,void 0,R&&350),D=B(),x=(0,h.Z)(D,void 0,r.IU.BlobUrl,void 0,R&&350),{mediaData:U,loadProgress:O}=(0,Z.Z)(B(!0),void 0,c&&(0,g.kG)(c,"viewerFull"),void 0,R&&350),G=E||C?(E||C).blobUrl:void 0;let X=!k&&(G||U)||x||$;const _=(0,l.Z)(!X&&c&&(0,g.DH)(c));X||m===o.bZ.SearchResult||(X=_);const V=c?(0,g.c0)(c):void 0;let H;if(c?I||w?H=(0,g.aE)(c).mediaSize:E||f?H=(0,g.bV)(E||f):(C||b)&&(H=(0,g.jC)(C||b)):H=y.vY,F)return a.ZP.createElement("div",{key:i,className:"MediaViewerContent"},se(U||x,(0,y.PA)(y.vY,!1),!1));if(!c)return;const Y=(0,S.X)(c),j=Boolean(Y);return a.ZP.createElement("div",{className:"MediaViewerContent "+(j?"has-footer":"")},N&&se(G||U||x||$,c&&(0,y.PA)(H,j),!1),k&&(n?a.ZP.createElement(ne,{key:t,url:G||U,isGif:M,posterData:X,posterSize:c&&(0,y.PA)(H,j,!0),loadProgress:O,fileSize:V,isMediaViewerOpen:T,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(!1)}))):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(z.Z,{color:"white"}))}(X,c&&(0,y.PA)(H,j,!0))),Y&&a.ZP.createElement(J,{text:Y,onClick:v,isHidden:p&&(!k||M),isForVideo:k&&!M}))})));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(z.Z,{color:"white"}))}function re(){return(re=Object.assign||function(e){for(var t=1;t{const u=(0,a.sO)(null),h=(0,a.sO)(null),Z=(0,a.sO)(le),P=(0,a.sO)(!1),g=(0,a.sO)(!0),[v,p]=(0,a.eJ)(e),E=(0,c.Z)(),[b,I]=(0,a.eJ)(!1),{isZoomed:y,onClose:S}=m,w=(0,a.I4)((e=>{Z.current=e,E()}),[E]),k=(0,a.I4)((e=>{P.current=e,E()}),[E]),N=(0,a.I4)((e=>{g.current=e,E()}),[E]),M=(0,x.Z)(350,!1),T=(0,x.Z)(500,!1),F=(0,x.Z)(800,!1),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||!v)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{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&&lh||l>h&&i{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;w({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=>w({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=>w({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=>w({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:u,y:h,scale:m},d>=50)return S();if(d>0)return(0,U.vr)({from:h,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>w({x:0,y:e,scale:m})});const P=u<0?1:-1,g=t(v,u<0?1:-1),E=r.x<0?-1:1;if(g&&c>=50&&P===E){const e=(window.innerWidth+40)*P;Z.current.x+=e,p(g),M((()=>n(g)))}T((()=>k(!1))),F((()=>N(!0))),ie=(0,U.vr)({from:Z.current.x,to:0,duration:oe,timing:U.M8.easeOutCubic,onUpdate:e=>w({y:0,x:e,scale:Z.current.scale})})}})}),[y,S,w,t,v,k,N]),!v)return;const L=t(v,1),R=t(v,-1),B=Z.current.x,$=Z.current.y,{scale:D}=Z.current;return a.ZP.createElement("div",{className:"MediaViewerSlides",ref:u},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}))),v&&a.ZP.createElement("div",{className:"MediaViewerSlide "+(l?"MediaViewerSlide--active":""),onClick:A,ref:h,style:de(B,$,D)},a.ZP.createElement(ae,re({},m,{messageId:v,isActive:g.current,isFooterHidden:b||y||1!==D}))),L&&1===D&&a.ZP.createElement("div",{className:"MediaViewerSlide",style:de(window.innerWidth+B+40)},a.ZP.createElement(ae,re({},m,{messageId:L,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)});`}const me=[1,0,0,1,0,0],ue={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5},he=150,Ze=(0,a.X$)((({children:e,className:t,noWrap:n,canPan:s,zoomLevel:r,panDeltaX:o,panDeltaY:i,onPan:l})=>{const c=ue[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)(me),g=(0,a.sO)(null),v=(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,b.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-he{s||P(me)}),[s]),(0,a.d4)((()=>{v.current&&(v.current.style.transform=`matrix(${Z.toString()})`)}),[n,Z]),n?e:a.ZP.createElement("div",{ref:g,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),g.current&&g.current.classList.add("move")},onMouseUp:()=>{m(!1),g.current&&g.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),v.current&&(v.current.style.transform=`matrix(${Z.toString()})`)}}},a.ZP.createElement("div",{ref:v,className:"pan-container"},e))}));var Pe=n(2340),ge=n(172);const ve=(0,s.c$)(((e,{chatId:t,messageId:n,isAvatar:a})=>{if(a&&t)return{sender:(0,g.YC)(t)?(0,v.dy)(e,t):(0,v.Z1)(e,t)};if(!n||!t)return{};const s=(0,v.hj)(e,t,n);return{message:s,sender:s&&(0,v.Ur)(e,s)}}),((e,t)=>(0,b.ei)(t,["closeMediaViewer","focusMessage"])))((({chatId:e,messageId:t,sender:n,isAvatar:s,message:r,closeMediaViewer:o,focusMessage:i})=>{const l=(0,a.I4)((()=>{o(),i({chatId:e,messageId:t})}),[e,i,t,o]),c=(0,u.Z)();if(!n||!r&&!s)return;const d=(0,g.OU)(c,n);return a.ZP.createElement("div",{className:"SenderInfo",onClick:l},(0,g.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"},d&&(0,Pe.Z)(d)),a.ZP.createElement("div",{className:"date",dir:"auto"},s?c("lng_mediaview_profile_photo"):(0,K.ZK)(c,1e3*r.date,!0))))})),pe=({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(L.Z,t,e),Ee=(0,a.X$)((({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:n}=(0,_.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(F.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(F.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}))))})),Ce=350,fe=(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,v.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,v.dy)(e,s)||(0,v.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,v.Tm)(e,t,a):(0,v.hj)(e,t,a),!c)return{animationLevel:l};if(d=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,v.Fn)(e,t):(0,v.Zw)(e,t),i===o.bZ.Inline||i===o.bZ.Album)m=(0,v.qC)(e,t,n)||(0,v.gb)(e,t,n);else if(i===o.bZ.SharedMedia){const t=(0,v.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}}),((e,t)=>(0,b.ei)(t,["openMediaViewer","closeMediaViewer","openForwardMenu","focusMessage"])))((({chatId:e,threadId:t,messageId:n,senderId:s,origin:v,avatarOwner:b,profilePhotoIndex:R,message:B,chatMessages:$,collectionIds:x,openMediaViewer:U,closeMediaViewer:O,openForwardMenu:G,focusMessage:z,animationLevel:X})=>{const J=Boolean(b||n),_=v===o.bZ.SharedMedia,V=v===o.bZ.SearchResult,H=B?(0,g.O$)(B):void 0,Y=B?(0,g.b7)(B):void 0,j=B?(0,g.F$)(B):void 0,K=B?(0,g.Cg)(B):void 0,q=!!B&&(0,g.rl)(B),W=!!B&&(0,g.hC)(B),Q=Boolean(Y||K||W),{isGif:ee}=Y||K||{},te=Boolean(!Q&&(H||j||q)),ne=Boolean(b),ae=Boolean(j||K),se=(0,a.Ye)((()=>ae&&n?[n]:(0,g.N0)($||{},x||[],_)),[ae,n,$,x,_]),re=n?se.indexOf(n):-1,oe=0===re||-1===re,ie=re===se.length-1||-1===re,le=(0,a.sO)(),de=(0,P.Z)(s);!J||de&&de===s&&le.current||(le.current=re);const me=X>=1&&!f.$b?"mv-slide":"none",ue=2===X?"slide-fade":"none",he=2===X,[Pe,ge]=(0,a.eJ)(!1),[fe,be]=(0,a.eJ)(!1),[Ie,ye]=(0,a.eJ)(1),[Se,we]=(0,a.eJ)({x:0,y:0});function ke(e){if(ne&&void 0!==R){const{photos:t}=b;return t&&t[R]?`photo${t[R].id}?size=c`:(0,g.RT)(b,e?"big":"normal")}return B&&(0,g.Ti)(B,e?"viewerFull":"viewerPreview")}const Ne=(0,h.Z)(B&&(_||V)&&(0,g.Ti)(B,"pictogram"),void 0,r.IU.BlobUrl,void 0,he&&Ce),Me=ke(),Te=(0,h.Z)(Me,void 0,r.IU.BlobUrl,void 0,he&&Ce),{mediaData:Fe}=(0,Z.Z)(ke(!0),void 0,B&&(0,g.kG)(B,"viewerFull"),void 0,he&&Ce),Ae=H||Y?(H||Y).blobUrl:void 0;let Le=!Q&&(Ae||Fe)||Te||Ne;const Re=(0,l.Z)(!Le&&B&&(0,g.DH)(B));Le||v===o.bZ.SearchResult||(Le=Re);const Be=B?(0,g.ep)(B):ne?`avatar${b.id}-${R}.jpg`:void 0;let $e;B?q||W?$e=(0,g.aE)(B).mediaSize:H||j?$e=(0,g.bV)(H||j):(Y||K)&&($e=(0,g.jC)(Y||K)):$e=y.vY,(0,a.d4)((()=>{f.wB&&document.body.classList.toggle("is-media-viewer-open",J)}),[J]);const De=(0,c.Z)();(0,a.d4)((()=>{const e=window.matchMedia(y.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",De):"function"==typeof e.addListener&&e.addListener(De),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",De):"function"==typeof e.removeListener&&e.removeListener(De)}}),[De]);const xe=(0,P.Z)(B),Ue=(0,P.Z)(v),Oe=(0,P.Z)(b),Ge=(0,P.Z)(Le),ze=B?(0,S.X)(B):void 0,Xe=Boolean(ze);(0,a.d4)((()=>{he&&J&&!xe&&!Oe&&((0,d.YW)(Ce+i.fK),function(e,t,n,a,s,r){const{mediaEl:l}=M(t,r);if(!l)return;const{width:c}=I.Z.get(),{width:d,height:m}=(0,y.fM)(e,s),{width:u,height:h}=(0,y.jg)(d,m,a.width,a.height),Z=(c-u)/2,P=function(e){const t=window.matchMedia(y.L6);let n=4.125;return e&&(n+=t.matches?.875:3.375),n*y.Gw}(e)+(m-h)/2;let{top:g,left:v,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,g,v,p,E);g=e.top,v=e.left,p=e.width,E=e.height}const C=v+p/2-(Z+u/2),f=g+E/2-(P+h/2),b=p/u,S=E/h,k=w(n||l);N(k,{top:`${P}px`,left:`${Z}px`,width:`${u}px`,height:`${h}px`,transform:`translate3d(${C}px, ${f}px, 0) scale(${b}, ${S})`}),T(k,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(k),requestAnimationFrame((()=>{k.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(k),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(k)&&document.body.removeChild(k),document.body.classList.remove("ghost-animating")}))}),200+i.fK)}))}))}(Xe,v,Le,$e,Q,B)),he&&!J&&(xe||Oe)&&((0,d.YW)(Ce+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 g=u;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:n}=I.Z.get();return t.top<=n&&t.top+t.height>=0}(a)){const{height:e}=I.Z.get();g=uC?E=C:C>E&&(C=E));const b=document.getElementsByClassName("ghost")[0],y=b||w(t||s,e);b||N(y,{top:`${g}px`,left:`${h}px`,width:`${Z}px`,height:`${P}px`,transform:`translate3d(${v}px, ${p}px, 0) scale(${E}, ${C})`}),requestAnimationFrame((()=>{if(b){const{top:e,left:t,width:n,height:a}=b.getBoundingClientRect();N(y,{transition:"none",top:`${g}px`,left:`${h}px`,transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-g}px, 0) scale(${n/Z}, ${a/P})`,width:`${Z}px`,height:`${P}px`})}document.body.classList.add("ghost-animating"),b||document.body.appendChild(y),requestAnimationFrame((()=>{b&&(b.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)}))}))}(Ue,Ge,xe||void 0))}),[he,J,v,Ue,B,xe,Oe,Le,Ge,$e,Q,Xe]),(0,a.d4)((()=>{let e;return fe?ge(!0):e=window.setTimeout((()=>{ge(!1)}),Ce),()=>{e&&window.clearTimeout(e)}}),[fe]);const Je=()=>{be(!1),ye(1),we({x:0,y:0})},_e=(0,a.I4)((()=>{be(!fe),ye(fe?1:1.5),fe&&we({x:0,y:0})}),[fe]),Ve=(0,a.I4)(((e,t=!1)=>{ye(e),1===e&&t&&Je()}),[]),He=(0,a.I4)((()=>{O(),Je()}),[O]),Ye=(0,a.I4)((()=>{He(),z({chatId:e,threadId:t,messageId:n})}),[He,e,t,z,n]),je=(0,a.I4)((()=>{G({fromChatId:e,messageIds:[n]}),Je()}),[G,e,n]),Ke=(0,a.I4)((n=>U({chatId:e,threadId:t,messageId:n,origin:v},{forceOnHeavyAnimation:!0})),[e,U,v,t]);(0,a.d4)((()=>J?(0,E.Z)((()=>{fe?Je():He()})):void 0),[He,J,fe]),(0,a.d4)((()=>{Q&&!ee&&(0,p.Es)()}),[ee,Q]),(0,a.d4)((()=>{if(J)return I.Z.disableRefresh(),()=>{I.Z.enableRefresh()}}),[J]);const qe=(0,a.I4)(((e,t)=>{if(!e)return;const n=se.indexOf(e);return-1===t&&n>0||1===t&&n{we({x:e,y:t})}),[]),tt=(0,u.Z)();function nt(){return ne?a.ZP.createElement(ve,{key:b.id,chatId:b.id,isAvatar:!0}):a.ZP.createElement(ve,{key:n,chatId:e,messageId:n})}return(0,m.ZP)(J,O,U,{chatId:e,threadId:t,messageId:n,origin:v,avatarOwnerId:b&&b.id}),(0,a.d4)((()=>{if(J)return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)};function e(e){switch(e.key){case"Left":case"ArrowLeft":Ke(Qe);break;case"Right":case"ArrowRight":Ke(We)}}}),[J,We,Qe,Ke]),(0,a.d4)((()=>{if(fe||f.$b)return;const e=document.querySelector(".MediaViewerSlide--active");if(!e)return;const t=ee&&!f.cj;return(0,C.s)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:He})}),[He,ee,fe,n]),a.ZP.createElement(A.Z,{id:"MediaViewer",className:fe?"zoomed":"",isOpen:J},(()=>a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"media-viewer-head",dir:tt.isRtl?"rtl":void 0},f.wB&&a.ZP.createElement(F.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:tt("Close"),onClick:He},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(L.Z,{activeKey:le.current,name:ue},nt),a.ZP.createElement(D,{mediaData:Fe||Te,isVideo:Q,isZoomed:fe,message:B,fileName:Be,onCloseMediaViewer:He,onForward:je,onZoomToggle:_e,isAvatar:ne})),a.ZP.createElement(Ze,{noWrap:!Pe,canPan:fe,panDeltaX:Se.x,panDeltaY:Se.y,zoomLevel:Ie,onPan:et},a.ZP.createElement(pe,{activeKey:re,name:me},(s=>a.ZP.createElement(ce,{messageId:n,getMessageId:qe,chatId:e,isPhoto:te,isGif:ee,threadId:t,avatarOwnerId:b&&b.id,profilePhotoIndex:R,origin:v,isOpen:J,hasFooter:Xe,isZoomed:fe,isActive:s,animationLevel:X,onClose:He,selectMessage:Ke,onFooterClick:Ye})))),!oe&&!f.$b&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${Q&&!ee&&"inline"}`,"aria-label":tt("AccDescrPrevious"),dir:tt.isRtl?"rtl":void 0,onClick:()=>Ke(Qe)}),!ie&&!f.$b&&a.ZP.createElement("button",{type:"button",className:`navigation next ${Q&&!ee&&"inline"}`,"aria-label":tt("Next"),dir:tt.isRtl?"rtl":void 0,onClick:()=>Ke(We)}),a.ZP.createElement(Ee,{isShown:fe,onChangeZoom:Ve}))))})));var be=n(8360),Ie=n(7407),ye=n(2313),Se=n(2515),we=n(4288),ke=n(3103),Ne=n(7687),Me=n(1273),Te=n(1876),Fe=n(8799),Ae=n(6058);const Le=(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,Ie.Z)(c,n,Boolean(r)),P=(0,a.I4)((()=>{i("")}),[i]);(0,Se.Z)(s,e,P);const v=(0,a.sO)(null),p=(0,a.I4)((e=>{i(e.currentTarget.value)}),[i]),E=(0,ye.Z)(v,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(F.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Ne.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(Me.Z,{className:"picker-list custom-scroll",items:h,onLoadMore:Z,noScrollRestore:Boolean(r),ref:v,onKeyDown:E},h.map((e=>a.ZP.createElement(Te.Z,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>d(e)},(0,g.YC)(e)?a.ZP.createElement(Ae.Z,{status:e===t?m("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Fe.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))})),Re=(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}}),((e,t)=>(0,b.ei)(t,["setForwardChatId","exitForwardMode","loadMoreChats"])))((({chatsById:e,activeListIds:t,archivedListIds:n,pinnedIds:o,contactIds:i,currentUserId:l,isOpen:c,setForwardChatId:d,exitForwardMode:m,loadMoreChats:h})=>{const Z=(0,u.Z)(),[P,v]=(0,a.eJ)(""),p=(0,a.sO)(null),E=(0,a.Ye)((()=>{if(!c)return;let a=o||[];l&&(a=(0,b.Tw)([l,...a]));const d=[...t||[],...n||[]].filter((t=>{const n=e[t];return n&&(0,g.Qm)(n,r._f)})),m=(0,s.Rd)().users.byId;return(0,g.ih)((0,b.Tw)([...(0,g.$l)(Z,d,e,P,l),...i?(0,g.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,be.Z)(E);return a.ZP.createElement(Le,{currentUserId:l,isOpen:c,chatOrUserIds:f,filterRef:p,filterPlaceholder:Z("ForwardTo"),filter:P,onFilterChange:v,loadMore:h,onSelectChatOrUser:C,onClose:m})})));var Be=n(1947);function $e(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const De=(0,a.X$)((0,s.c$)((e=>(0,b.ei)(e,["dialogs"])),((e,t)=>(0,b.ei)(t,["dismissDialog","acceptInviteConfirmation"])))((({dialogs:e,dismissDialog:t,acceptInviteConfirmation:n})=>{const s=(0,u.Z)();if(e.length)return a.ZP.createElement("div",{id:"Dialogs"},e.map((e=>{return"hash"in e?(e=>{const{hash:r,title:o,participantsCount:i,isChannel:l}=e,c=s(l?"Subscribers":"Members",i,"i"),d=s(l?"ChannelJoin":"JoinGroup");return a.ZP.createElement(ke.Z,{isOpen:!0,onClose:t,className:"error",title:o},void 0!==i&&a.ZP.createElement("p",null,c),a.ZP.createElement(F.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{n({hash:r}),t()}},d),a.ZP.createElement(F.Z,{isText:!0,className:"confirm-dialog-button",onClick:t},s("Cancel")))})(e):(r=e,a.ZP.createElement(ke.Z,{isOpen:!0,onClose:t,className:"error",title:$e(r)},r.hasErrorKey?(0,Be.ZP)(r):(0,Pe.Z)(r.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(F.Z,{isText:!0,onClick:t},s("OK")))));var r})))})));var xe=n(6937);const Ue=(0,a.X$)((0,s.c$)((e=>(0,b.ei)(e,["notifications"])),((e,t)=>(0,b.ei)(t,["dismissNotification"])))((({notifications:e,dismissNotification:t})=>{if(e.length)return a.ZP.createElement("div",{id:"Notifications"},e.map((({message:e,localId:n})=>a.ZP.createElement(xe.Z,{message:(0,Pe.Z)(e,["emoji","br","links","simple_markdown"]),onDismiss:()=>t({localId:n})}))))})));var Oe=n(1396),Ge=n(7551);const ze=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,b.ei)(t,["toggleSafeLinkModal"])))((({url:e,toggleSafeLinkModal:t})=>{const n=(0,u.Z)(),s=(0,a.I4)((()=>{window.open((0,Oe.X)(e)),t({url:void 0})}),[t,e]),r=(0,a.I4)((()=>{t({url:void 0})}),[t]),o=(0,be.Z)(e);return a.ZP.createElement(Ge.Z,{isOpen:Boolean(e),onClose:r,title:n("OpenUrlTitle"),textParts:(0,Pe.Z)(n("OpenUrlAlert2",o),["links"]),confirmLabel:n("OpenUrlTitle"),confirmHandler:s})})));var Xe=n(706);const Je=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function _e(e,t,n,a,s){const r=new Date(e,t,n,0,0,0,0),o=a&&new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0),i=s&&new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0);return!!(i&&r>i)||!!(o&&r{const h=(0,u.Z)(),Z=new Date,g=(0,a.Ye)((()=>e?new Date(e):new Date),[e]),v=t?new Date(t):void 0,p=(0,P.Z)(r),[E,C,f]=(0,Xe.Z)(!1),[b,I]=(0,a.eJ)(g),[y,S]=(0,a.eJ)(new Date(b.getFullYear(),b.getMonth(),1)),[w,k]=(0,a.eJ)(Ve(g.getHours())),[N,M]=(0,a.eJ)(Ve(g.getMinutes())),T=He(b.getFullYear(),b.getMonth(),b.getDate()),A=y.getFullYear(),L=y.getMonth();(0,a.d4)((()=>{!p&&r&&(I(g),S(new Date(g.getFullYear(),g.getMonth(),1)))}),[g,r,p]),(0,a.d4)((()=>{n&&!E&&b.getTime()=Z.getFullYear()&&L>=Z.getMonth()||v&&A>=v.getFullYear()&&L>=v.getMonth(),B=n&&A<=Z.getFullYear()&&L<=Z.getMonth(),{prevMonthGrid:$,currentMonthGrid:D,nextMonthGrid:x}=(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;e0)for(let e=1;e<=7-l;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(A,L)),[L,A]),U=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return k(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(b.getTime());a.setHours(n),I(a);const s=Ve(n);k(s),e.target.value=s}),[b]),O=(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),59)),a=new Date(b.getTime());a.setMinutes(n),I(a);const s=Ve(n);M(s),e.target.value=s}),[b]);return a.ZP.createElement(ke.Z,{isOpen:r,onClose:c,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",onClick:c},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,h(`lng_month${L+1}`)," ",A),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",disabled:B,onClick:B?void 0:function(){S((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",disabled:R,onClick:R?void 0:function(){S((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"},Je.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,h(e))))),$.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),D.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void I((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(L),n.setFullYear(A),n}));var t},className:(0,X.Z)("day-button",_e(A,L,e,n?Z:void 0,s?Z:v)?"disabled":e?"clickable":"",T===He(A,L,e)&&"selected")},!!e&&a.ZP.createElement("span",null,e)))),x.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),o&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:w,onChange:U,onFocus:C,onBlur:f}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:N,onChange:O,onFocus:C,onBlur:f})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(F.Z,{onClick:function(){d(b)}},o?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)(t,e)):e("Conversation.ScheduleMessage.SendOn",[n,(0,K.mr)(t,e)])}(h,b):i),l&&a.ZP.createElement(F.Z,{onClick:m,isText:!0},l)))})),je=(0,a.X$)((0,s.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})),((e,t)=>(0,b.ei)(t,["searchMessagesByDate","closeHistoryCalendar"])))((({isOpen:e,selectedAt:t,searchMessagesByDate:n,closeHistoryCalendar:s})=>{const r=(0,a.I4)((e=>{n({timestamp:e.valueOf()/1e3}),s()}),[s,n]),o=(0,u.Z)();return a.ZP.createElement(Ye,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:o("JumpToDate"),onClose:s,onSubmit:r})}))),Ke=(0,a.X$)((0,s.c$)(((e,{message:t,isSchedule:n})=>{const{threadId:a}=(0,v.Bt)(e)||{},{canDeleteForAll:s}=a&&(0,v._k)(e,t,a)||{},r=(0,v.Z1)(e,t.chatId);return{canDeleteForAll:!n&&s,contactName:r&&(0,g.YC)(r.id)?(0,g.Vl)((0,v.dy)(e,(0,g.zX)(r))):void 0,willDeleteForCurrentUserOnly:r&&(0,g.G9)(r)&&!s,willDeleteForAll:r&&(0,g.ZV)(r)}}),((e,t)=>(0,b.ei)(t,["deleteMessages","deleteScheduledMessages"])))((({isOpen:e,isSchedule:t,message:n,album:s,canDeleteForAll:r,contactName:o,willDeleteForCurrentUserOnly:i,willDeleteForAll:l,onClose:c,deleteMessages:d,deleteScheduledMessages:m})=>{const h=(0,a.I4)((()=>{const e=null!=s&&s.messages?s.messages.map((({id:e})=>e)):[n.id];d({messageIds:e,shouldDeleteForAll:!0}),c()}),[d,n.id,c,s]),Z=(0,a.I4)((()=>{const e=null!=s&&s.messages?s.messages.map((({id:e})=>e)):[n.id];t?m({messageIds:e}):d({messageIds:e,shouldDeleteForAll:!1}),c()}),[s,n.id,t,c,m,d]),P=(0,u.Z)();return a.ZP.createElement(ke.Z,{isOpen:e,onClose:c,onEnter:e&&!r?Z:void 0,className:"delete",title:P("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,P("AreYouSureDeleteSingleMessage")),i&&a.ZP.createElement("p",null,P("lng_delete_for_me_chat_hint",1,"i")),l&&a.ZP.createElement("p",null,P("lng_delete_for_everyone_hint",1,"i")),r&&a.ZP.createElement(F.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},o&&(0,Pe.Z)(P("Conversation.DeleteMessagesFor",o)),!o&&P("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(F.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},P(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},P("Cancel")))}))),qe=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,g.YC)(t),a=(0,v.FM)(e,t),s=(0,v.Z1)(e,t),r=!!s&&(0,g.eA)(s),o=!!s&&(0,g.G9)(s),i=!!s&&(0,g.ZV)(s);return{isPrivateChat:n,isChatWithSelf:a,isChannel:r,isGroup:o,isSuperGroup:i,canPinForAll:n&&!a||i||o,contactName:s&&(0,g.YC)(s.id)?(0,g.Vl)((0,v.dy)(e,(0,g.zX)(s))):void 0}}),((e,t)=>(0,b.ei)(t,["pinMessage"])))((({isOpen:e,messageId:t,chatId:n,isChannel:s,isGroup:r,isSuperGroup:o,canPinForAll:i,contactName:l,onClose:c,pinMessage:d})=>{const m=(0,a.I4)((()=>{d({chatId:n,messageId:t,isUnpin:!1}),c()}),[d,n,t,c]),h=(0,a.I4)((()=>{d({chatId:n,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),c()}),[n,t,c,d]),Z=(0,u.Z)();return a.ZP.createElement(ke.Z,{isOpen:e,onClose:c,className:"pin",title:Z("PinMessageAlertTitle")},a.ZP.createElement("p",null,Z(s?"PinMessageAlertChannel":r||o?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:h},Z("DialogPin")),i&&a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},l?(0,Pe.Z)(Z("Conversation.PinMessagesFor",l)):Z("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},Z("Cancel")))}))),We=(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(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},r("DialogUnpin")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},r("Cancel")))}));var Qe=n(517);const et=(0,a.X$)((0,s.c$)(((e,{isSchedule:t})=>{const{messageIds:n}=e.selectedMessages||{},{canDeleteForAll:a}=(0,v.xl)(e),s=(0,v.jr)(e);return{selectedMessageIds:n,canDeleteForAll:!t&&a,contactName:s&&(0,g.YC)(s.id)?(0,g.Vl)((0,v.dy)(e,(0,g.zX)(s))):void 0,willDeleteForCurrentUserOnly:s&&(0,g.G9)(s)&&!a,willDeleteForAll:s&&(0,g.ZV)(s)}}),((e,t)=>(0,b.ei)(t,["deleteMessages","deleteScheduledMessages","exitMessageSelectMode"])))((({isOpen:e,isSchedule:t,selectedMessageIds:n,canDeleteForAll:s,contactName:r,willDeleteForCurrentUserOnly:o,willDeleteForAll:i,onClose:l,deleteMessages:c,deleteScheduledMessages:d,exitMessageSelectMode:m})=>{const h=(0,P.Z)(e),Z=(0,a.I4)((()=>{l(),c({messageIds:n,shouldDeleteForAll:!0})}),[c,n,l]),g=(0,a.I4)((()=>{t?d({messageIds:n}):c({messageIds:n,shouldDeleteForAll:!1}),l()}),[t,l,d,n,c]),v=(0,u.Z)();if((0,a.d4)((()=>{!e&&h&&m()}),[m,e,h]),n)return a.ZP.createElement(ke.Z,{isOpen:e,onClose:l,onEnter:s?void 0:g,className:"delete",title:v("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,v("AreYouSureDeleteFewMessages")),o&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),i&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),s&&a.ZP.createElement(F.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},r?(0,Pe.Z)(v("ChatList.DeleteForEveryone",r)):v("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(F.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:g},v(s?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:l},v("Cancel")))})));var tt=n(4434);const nt=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,b.ei)(t,["reportMessages","exitMessageSelectMode"])))((({isOpen:e,messageIds:t,reportMessages:n,exitMessageSelectMode:s,onClose:r})=>{const[o,i]=(0,a.eJ)("spam"),[l,c]=(0,a.eJ)(""),d=()=>{n({messageIds:t,reason:o,description:l}),s(),r()},m=(0,a.I4)((e=>{i(e)}),[]),h=(0,a.I4)((e=>{c(e.target.value)}),[]),Z=(0,u.Z)(),P=[{value:"spam",label:Z("lng_report_reason_spam")},{value:"violence",label:Z("lng_report_reason_violence")},{value:"pornography",label:Z("lng_report_reason_pornography")},{value:"childAbuse",label:Z("lng_report_reason_child_abuse")},{value:"copyright",label:Z("ReportPeer.ReasonCopyright")},{value:"other",label:Z("lng_report_reason_other")}];if(t)return a.ZP.createElement(ke.Z,{isOpen:e,onClose:r,onEnter:e?d:void 0,className:"report",title:Z("lng_report_message_title")},a.ZP.createElement(tt.Z,{name:"report-message",options:P,onChange:m,selected:o}),a.ZP.createElement(Ne.Z,{label:Z("lng_report_reason_description"),value:l,onChange:h}),a.ZP.createElement(F.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d},Z("lng_report_button")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},Z("Cancel")))}))),at=(0,a.X$)((0,s.c$)((e=>{const{type:t}=(0,v.Bt)(e)||{},{canDelete:n}=(0,v.xl)(e),a=(0,v.nB)(e),s=(0,v.Nu)(e),{messageIds:r}=e.selectedMessages||{};return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,v.D7)(e),canDeleteMessages:n,canReportMessages:a,canDownloadMessages:s,selectedMessageIds:r}}),((e,t)=>(0,b.ei)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages","downloadSelectedMessages"])))((({canPost:e,isActive:t,messageListType:n,isSchedule:s,selectedMessagesCount:r,canDeleteMessages:o,canReportMessages:i,canDownloadMessages:l,selectedMessageIds:c,exitMessageSelectMode:d,openForwardMenuForSelectedMessages:m,downloadSelectedMessages:h})=>{const[Z,g,v]=(0,Xe.Z)(),[p,E,C]=(0,Xe.Z)();(0,a.d4)((()=>!t||Z||p?void 0:(0,Qe.Z)({onBackspace:g,onDelete:g,onEsc:d})),[t,Z,p,g,d]);const f=(0,a.I4)((()=>{h(),d()}),[h,d]),b=(0,P.Z)(r||void 0,!0),I=t?r:b,y=(0,u.Z)(),S=y("VoiceOver.Chat.MessagesSelected",I,"i"),w=(0,X.Z)("MessageSelectToolbar",e&&"with-composer",t&&"shown"),k=(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:w},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(F.Z,{color:"translucent",round:!0,onClick:d,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:S},S),!!r&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==n&&k("forward",y("Chat.ForwardActionHeader"),m),i&&k("flag",y("Conversation.ReportMessages"),E),l&&k("download",y("lng_media_download"),f),k("delete",y("EditAdminGroupDeleteMessages"),g,!o,!0))),a.ZP.createElement(et,{isOpen:Z,isSchedule:s,onClose:v}),a.ZP.createElement(nt,{isOpen:p,onClose:C,messageIds:c}))}))),st=(0,a.X$)((0,s.c$)((e=>{var t;const{chatId:n,messageId:a}=e.seenByModal||{};return n&&a?{memberIds:null===(t=(0,v.hj)(e,n,a))||void 0===t?void 0:t.seenByUserIds}:{}}),((e,t)=>(0,b.ei)(t,["openChat","closeSeenByModal"])))((({isOpen:e,memberIds:t,openChat:n,closeSeenByModal:s})=>{const r=(0,u.Z)(),o=(0,a.I4)((e=>{s(),setTimeout((()=>{n({id:e})}),100)}),[s,n]),i=(0,be.Z)(t,!0);return a.ZP.createElement(ke.Z,{isOpen:e,onClose:s,className:"narrow",title:"Which users read the message"},a.ZP.createElement("div",{dir:r.isRtl?"rtl":void 0},i&&i.map((e=>a.ZP.createElement(Te.Z,{key:e,className:"chat-item-clickable scroll-item small-icon",onClick:()=>o(e)},a.ZP.createElement(Ae.Z,{userId:e,noStatusOrTyping:!0}))))),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},r("Close")))})));var rt=n(3133),ot=n(735),it=n(1470);const lt=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 ct=n(329),dt=n(742);const mt=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t),a=n&&(0,g.zX)(n);return{chat:n,user:a?(0,v.dy)(e,a):void 0,isPinned:(0,v.ep)(e,t),isMuted:n?(0,g.i4)(n,(0,v.dZ)(e),(0,v.NJ)(e)):void 0}}))((({chatId:e,chat:t,user:n,isPinned:s,isMuted:r,withUsername:o,onClick:i})=>{const[l,c,d]=(0,Xe.Z)(),[m,u,h]=(0,Xe.Z)(),Z=(0,it.Z)({chat:t,user:n,isPinned:s,isMuted:r,handleDelete:c,handleChatFolderChange:u},!0),P=()=>{i(e)},v=lt(P);if(t)return a.ZP.createElement(Te.Z,{className:"chat-item-clickable search-result",onClick:P,contextActions:Z,buttonRef:v},(0,g.YC)(e)?a.ZP.createElement(Ae.Z,{userId:e,withUsername:o,avatarSize:"large"}):a.ZP.createElement(Fe.Z,{chatId:e,withUsername:o,avatarSize:"large"}),a.ZP.createElement(ct.Z,{isOpen:l,onClose:d,chat:t}),a.ZP.createElement(dt.Z,{isOpen:m,onClose:h,chatId:e}))})));var ut=n(8781);const ht=(0,G.P2)((e=>e()),6e4,!0),Zt=(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}}),((e,t)=>(0,b.ei)(t,["loadTopUsers","loadContactList","openChat","addRecentlyFoundChatId","clearRecentlyFoundChats"])))((({topUserIds:e,usersById:t,recentlyFoundChatIds:n,onReset:s,loadTopUsers:r,loadContactList:o,openChat:i,addRecentlyFoundChatId:l,clearRecentlyFoundChats:c})=>{const d=(0,a.sO)(null);(0,a.d4)((()=>{ht((()=>{r(),o()}))}),[r,o]),(0,ut.Z)(d.current,!e);const m=(0,a.I4)((e=>{i({id:e,shouldReplaceHistory:!0}),s(),setTimeout((()=>{l({id:e})}),250)}),[i,l,s]),h=(0,u.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},e&&a.ZP.createElement("div",{className:"top-peers-section",dir:h.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:d,className:"top-peers no-selection"},e.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>m(e),dir:h.isRtl?"rtl":void 0},a.ZP.createElement(ge.Z,{user:t[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,Pe.Z)((0,g.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:h.isRtl?"rtl":void 0},h("Recent"),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:c,isRtl:h.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),n.map((e=>a.ZP.createElement(mt,{chatId:e,onClick:m})))))})));var Pt=n(9411),gt=n(8033);const vt=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t);if(!n)return{};const a=(0,g.zX)(n);return{chat:n,lastSyncTime:e.lastSyncTime,...a&&{privateChatUser:(0,v.dy)(e,a)}}}),((e,t)=>(0,b.ei)(t,["focusMessage"])))((({message:e,searchQuery:t,chatId:n,chat:s,privateChatUser:r,focusMessage:o,lastSyncTime:i})=>{const l=(0,g.DH)(e),c=(0,h.Z)((0,g.Ti)(e,"micro")),d=Boolean((0,g.Y5)(e)),m=(0,a.I4)((()=>{o({chatId:n,messageId:e.id})}),[n,o,e.id]),Z=(0,u.Z)(),P=lt(m);if(s)return a.ZP.createElement(Te.Z,{className:"ChatMessage chat-item-clickable",ripple:!f.wB,onClick:m,buttonRef:P},a.ZP.createElement(ge.Z,{chat:s,user:r,isSavedMessages:null==r?void 0:r.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,Pe.Z)((0,g.U)(Z,s,r))),s.isVerified&&a.ZP.createElement(Pt.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(gt.Z,{className:"date"},(0,K.VX)(Z,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,g.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,Pe.Z)((0,g.MK)(e,t,!0),["emoji","highlight"],{highlight:s})):(0,Pe.Z)((0,g.MK)(e,t))}(Z,e,c||l,t,d)))))}))),pt=(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 Et=n(7262),Ct=n(9187);const ft=(0,G.P2)((e=>e()),500,!0),bt=(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}}),((e,t)=>(0,b.ei)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"])))((({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:v,lastSyncTime:p,onReset:E,onSearchDateSelect:C,openChat:I,addRecentlyFoundChatId:y,searchMessagesGlobal:S,setGlobalSearchChatId:w})=>{const k=(0,u.Z)(),[N,M]=(0,a.eJ)(!1),[T,F]=(0,a.eJ)(!1),A=(0,a.I4)((({direction:t})=>{p&&t===o.Uq.Backwards&&ft((()=>{S({type:"text",query:e})}))}),[p,S,e]),L=(0,a.I4)((e=>{I({id:e,shouldReplaceHistory:!0}),e!==r&&y({id:e}),f.wB||E()}),[r,I,y,E]),R=(0,a.I4)((e=>{w({id:e})}),[w]),B=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return ot.D;const t=[...r?[r]:[],...i||[]],n=(0,s.Rd)().users.byId,a=(0,g.kK)(t,n,e);return[...(0,g.ih)((0,b.Tw)([...a||[],...l||[],...c||[]]),P,void 0,r?[r]:void 0)]}),[e,i,r,l,c,P]),$=(0,a.Ye)((()=>!e||e.length<4||!d||!m?ot.D:(0,g.ih)((0,b.Tw)([...d,...m]),P,!0)),[P,d,m,e]),D=(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)):ot.D),[h,Z,e,t]),x=(0,a.I4)((()=>{M(!N)}),[N]),U=(0,a.I4)((()=>{F(!T)}),[T]),O=v&&!v.chats&&!v.messages&&!B.length&&!$.length&&!D.length;return e||t?a.ZP.createElement(Me.Z,{className:"LeftSearch custom-scroll",items:D,onLoadMore:A,noScrollRestoreOnTop:!0,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(pt,{searchDate:n,onSelect:C})),O&&a.ZP.createElement(Et.Z,{text:k("ChatList.Search.NoResults"),description:k("ChatList.Search.NoResultsDescription")}),!!B.length&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:k.isRtl?"rtl":void 0},B.map((e=>a.ZP.createElement(Ct.Z,{chatOrUserId:e,onClick:R,clickArg:e})))),!!B.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:k.isRtl?"auto":void 0},B.length>5&&a.ZP.createElement(gt.Z,{onClick:x},k(N?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),k("DialogList.SearchSectionDialogs")),B.map(((e,t)=>{if(N||!(t>=5))return a.ZP.createElement(mt,{chatId:e,onClick:L})}))),!!$.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:k.isRtl?"auto":void 0},$.length>5&&a.ZP.createElement(gt.Z,{onClick:U},k(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),k("DialogList.SearchSectionGlobal")),$.map(((e,t)=>{if(T||!(t>=5))return a.ZP.createElement(mt,{chatId:e,withUsername:!0,onClick:L})}))),!!D.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:k.isRtl?"auto":void 0},k("SearchMessages")),D.map((function(t){const n=(0,g.MK)(k,t),s=P[t.chatId];if(n&&s)return a.ZP.createElement(vt,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(Zt,{onReset:E})}))),It=(0,G.P2)((e=>e()),500,!0),yt=(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}}),((e,t)=>(0,b.ei)(t,["searchMessagesGlobal"])))((({searchQuery:e,currentUserId:t,dateSearchQuery:n,foundIds:s,globalMessagesByChatId:r,chatsById:i,fetchingStatus:l,lastSyncTime:c,searchMessagesGlobal:d,onSearchDateSelect:m})=>{const h=(0,u.Z)(),Z=(0,a.I4)((({direction:n})=>{c&&n===o.Uq.Backwards&&It((()=>{d({type:"text",query:e,chatId:t})}))}),[t,c,d,e]),P=(0,a.Ye)((()=>s&&0!==s.length?s.map((e=>{var t;const[n,a]=e.split("_");return null==r||null===(t=r[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):ot.D),[s,r]),v=l&&!l.chats&&!l.messages&&!P.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Me.Z,{className:"search-content custom-scroll chat-list",items:P,onLoadMore:Z,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(pt,{searchDate:n,onSelect:m})),v&&a.ZP.createElement(Et.Z,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),!!P.length&&P.map((function(t){const n=(0,g.MK)(h,t),s=i[t.chatId];if(n&&s)return a.ZP.createElement(vt,{chatId:t.chatId,message:t,searchQuery:e})}))))})));function St(e){return(t,n)=>{var a;const{byId:s}=t.chats,{byId:r}=t.users,{fetchingStatus:o,resultsByType:i,chatId:l}=t.globalSearch,c="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:d}=t.messages,m=null==i||null===(a=i[c])||void 0===a?void 0:a.foundIds,u=t.activeDownloads.byChatId;return{theme:(0,v.Pu)(t),isLoading:void 0===m||!!o&&Boolean(o.chats||o.messages),chatsById:s,usersById:r,globalMessagesByChatId:d,foundIds:m,searchChatId:l,activeDownloads:u,lastSyncTime:t.lastSyncTime}}}var wt=n(7891),kt=n(3709);const Nt="media",Mt=(0,G.P2)((e=>e()),500,!0),Tt=(0,a.X$)((0,s.c$)(St(Nt),((e,t)=>(0,b.ei)(t,["searchMessagesGlobal","openMediaViewer"])))((({searchQuery:e,searchChatId:t,isLoading:n,globalMessagesByChatId:s,foundIds:r,lastSyncTime:l,searchMessagesGlobal:c,openMediaViewer:d})=>{const m=(0,u.Z)(),h=(0,a.I4)((({direction:n})=>{l&&n===o.Uq.Backwards&&Mt((()=>{c({type:Nt,query:e,chatId:t})}))}),[l,c,e,t]),Z=(0,a.Ye)((()=>r&&s?r.map((e=>{var t;const[n,a]=e.split("_");return null===(t=s[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):ot.D),[s,r]),P=(0,a.I4)(((e,t)=>{d({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[d]),g=(0,wt.Z)([e],i.Y)&&!n,v=g&&r&&r.length>0&&!e,p=g&&r&&r.length>0&&e,E=(0,X.Z)("search-content custom-scroll",p&&"chat-list");return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Me.Z,{className:E,items:Z,itemSelector:e?".ListItem":".Media",onLoadMore:h,noFastList:!0},!g&&a.ZP.createElement(we.Z,null),g&&(!r||0===r.length)&&a.ZP.createElement(Et.Z,{text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),v&&a.ZP.createElement("div",{className:"media-list",dir:m.isRtl?"rtl":void 0},Z.map((e=>a.ZP.createElement(kt.Z,{key:e.id,idPrefix:"search-media",message:e,onClick:P})))),p&&Z.map((e=>a.ZP.createElement(vt,{key:e.id,chatId:e.chatId,message:e})))))})));var Ft=n(91),At=n(5418);const Lt="links",Rt=(0,G.P2)((e=>e()),500,!0),Bt=(0,a.X$)((0,s.c$)(St(Lt),((e,t)=>(0,b.ei)(t,["searchMessagesGlobal","focusMessage"])))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:s,usersById:r,globalMessagesByChatId:l,foundIds:c,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:h})=>{const Z=(0,u.Z)(),P=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&Rt((()=>{m({type:Lt,query:e,chatId:t})}))}),[d,m,e,t]),g=(0,a.Ye)((()=>c&&l?c.map((e=>{var t;const[n,a]=e.split("_");return null===(t=l[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):ot.D),[l,c]),v=(0,a.I4)(((e,t)=>{h({chatId:t,messageId:e})}),[h]),p=(0,wt.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Me.Z,{className:"search-content documents-list custom-scroll",items:g,onLoadMore:P,noFastList:!0},!p&&a.ZP.createElement(we.Z,null),p&&(!c||0===c.length)&&a.ZP.createElement(Et.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),p&&c&&c.length>0&&g.map(((e,t)=>{const n=0===t||(0,K.kj)(e.date)!==(0,K.kj)(g[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:Z.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:Z.isRtl?"rtl":void 0},(0,K.np)(Z,new Date(1e3*e.date))),a.ZP.createElement(At.Z,{key:e.id,message:e,senderTitle:(0,Ft.F)(Z,e,s,r),onMessageClick:v}))}))))})));var $t=n(2535);const Dt="documents",xt=(0,G.P2)((e=>e()),500,!0),Ut=(0,a.X$)((0,s.c$)(St(Dt),((e,t)=>(0,b.ei)(t,["searchMessagesGlobal","focusMessage"])))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:s,usersById:r,globalMessagesByChatId:l,foundIds:c,activeDownloads:d,lastSyncTime:m,searchMessagesGlobal:h,focusMessage:Z})=>{const P=(0,u.Z)(),v=(0,a.I4)((({direction:n})=>{m&&n===o.Uq.Backwards&&xt((()=>{h({type:Dt,query:e,chatId:t})}))}),[m,h,e,t]),p=(0,a.Ye)((()=>c&&l?c.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=l[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,g.aE)(s)?s:void 0})).filter(Boolean):ot.D),[l,c]),E=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),C=(0,wt.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Me.Z,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:v,noFastList:!0},!C&&a.ZP.createElement(we.Z,null),C&&(!c||0===c.length)&&a.ZP.createElement(Et.Z,{text:P("ChatList.Search.NoResults"),description:P("ChatList.Search.NoResultsDescription")}),C&&c&&c.length>0&&p.map(((e,t)=>{var n;const o=0===t||(0,K.kj)(e.date)!==(0,K.kj)(p[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},o&&a.ZP.createElement("p",{className:"section-heading"},(0,K.np)(P,new Date(1e3*e.date))),a.ZP.createElement($t.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,Ft.F)(P,e,s,r),className:"scroll-item",onDateClick:E,isDownloading:null===(n=d[e.chatId])||void 0===n?void 0:n.includes(e.id)}))}))))})));var Ot=n(4752);const Gt=(0,G.P2)((e=>e()),500,!0),zt=(0,a.X$)((0,s.c$)(St("audio"),((e,t)=>(0,b.ei)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"])))((({theme:e,isVoice:t,searchQuery:n,searchChatId:s,isLoading:r,chatsById:l,usersById:c,globalMessagesByChatId:d,foundIds:m,lastSyncTime:h,activeDownloads:Z,searchMessagesGlobal:P,focusMessage:g,openAudioPlayer:v})=>{const p=(0,u.Z)(),E=t?"voice":"audio",C=(0,a.I4)((({direction:e})=>{h&&e===o.Uq.Backwards&&Gt((()=>{P({type:E,query:n,chatId:s})}))}),[E,h,P,n,s]),f=(0,a.Ye)((()=>m&&d?m.map((e=>{var t;const[n,a]=e.split("_");return null===(t=d[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):ot.D),[d,m]),b=(0,a.I4)(((e,t)=>{g({chatId:t,messageId:e})}),[g]),I=(0,a.I4)(((e,t)=>{v({chatId:t,messageId:e})}),[v]),y=(0,wt.Z)([n],i.Y)&&!r;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(Me.Z,{className:"search-content documents-list custom-scroll",items:f,onLoadMore:C,noFastList:!0},!y&&a.ZP.createElement(we.Z,null),y&&(!m||0===m.length)&&a.ZP.createElement(Et.Z,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),y&&m&&m.length>0&&f.map(((t,n)=>{var s;const r=0===n||(0,K.kj)(t.date)!==(0,K.kj)(f[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:t.id},r&&a.ZP.createElement("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0},(0,K.np)(p,new Date(1e3*t.date))),a.ZP.createElement(Ot.Z,{key:t.id,theme:e,message:t,origin:o.Cr.Search,senderTitle:(0,Ft.F)(p,t,l,c),date:t.date,lastSyncTime:h,className:"scroll-item",onPlay:I,onDateClick:b,isDownloading:null===(s=Z[t.chatId])||void 0===s?void 0:s.includes(t.id)}))}))))}))),Xt=[{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"}],Jt=[{type:o.nJ.ChatList,title:"All Messages"},...Xt.slice(1)],_t=Object.keys(o.nJ).length/2,Vt=(0,a.X$)((0,s.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}),((e,t)=>(0,b.ei)(t,["setGlobalSearchContent","setGlobalSearchDate"])))((({searchQuery:e,searchDate:t,isActive:n,currentContent:s=o.nJ.ChatList,chatId:r,setGlobalSearchContent:i,setGlobalSearchDate:l,onReset:c})=>{const d=(0,u.Z)(),[h,Z]=(0,a.eJ)(s),P=(0,a.Ye)((()=>(0,K.xk)(e)),[e]),g=(0,a.I4)((e=>{const t=Xt[e];i({content:t.type}),Z(e)}),[i]),v=(0,a.I4)((e=>{l({date:e.getTime()/1e3})}),[l]);(0,m.ZP)(n,c,void 0,void 0,!0);const p=(0,a.sO)(null),E=(0,ye.Z)(p,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:p,onKeyDown:E},a.ZP.createElement(rt.Z,{activeTab:h,tabs:r?Jt:Xt,onSwitchTab:g}),a.ZP.createElement(L.Z,{name:d.isRtl?"slide-optimized-rtl":"slide-optimized",renderCount:_t,activeKey:s},(()=>{switch(s){case o.nJ.ChatList:return r?a.ZP.createElement(yt,{searchQuery:e,dateSearchQuery:P,onReset:c,onSearchDateSelect:v}):a.ZP.createElement(bt,{searchQuery:e,searchDate:t,dateSearchQuery:P,onReset:c,onSearchDateSelect:v});case o.nJ.Media:return a.ZP.createElement(Tt,{searchQuery:e});case o.nJ.Links:return a.ZP.createElement(Bt,{searchQuery:e});case o.nJ.Files:return a.ZP.createElement(Ut,{searchQuery:e});case o.nJ.Music:return a.ZP.createElement(zt,{key:"audio",searchQuery:e});case o.nJ.Voice:return a.ZP.createElement(zt,{key:"voice",isVoice:!0,searchQuery:e});default:return}})))})));var Ht=n(1090);const Yt={currentPassword:"",password:"",hint:"",email:""},jt=(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 Yt;default:return e}},Kt=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,b.ei)(t,["signOut","deleteChatFolder"])))((({currentScreen:e,editedFolderId:t,onReset:n,onSaveFilter:s,signOut:r,deleteChatFolder:i,onScreenSelect:l})=>{const[c,d]=(0,a.eJ)(!1),[m,h]=(0,a.eJ)(!1),Z=(0,a.I4)((()=>{d(!0)}),[]),P=(0,a.I4)((()=>{d(!1)}),[]),g=(0,a.I4)((()=>{h(!0)}),[]),v=(0,a.I4)((()=>{h(!1)}),[]),p=(0,a.I4)((()=>{P(),r()}),[P,r]),E=(0,a.I4)((()=>{v(),i({id:t}),n()}),[t,v,i,n]),C=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(F.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"}))),[]),b=(0,u.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:b("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case o.MT.EditProfile:return a.ZP.createElement("h3",null,b("lng_settings_information"));case o.MT.General:return a.ZP.createElement("h3",null,b("General"));case o.MT.Notifications:return a.ZP.createElement("h3",null,b("Notifications"));case o.MT.DataStorage:return a.ZP.createElement("h3",null,b("DataSettings"));case o.MT.Privacy:return a.ZP.createElement("h3",null,b("PrivacySettings"));case o.MT.Language:return a.ZP.createElement("h3",null,b("Language"));case o.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,b("ChatBackground"));case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,b("SetColor"));case o.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,b("PrivacyPhone"));case o.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,b("PrivacyLastSeen"));case o.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,b("Privacy.ProfilePhoto"));case o.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,b("PrivacyForwards"));case o.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,b("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,b("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,b("NeverShareWith"));case o.MT.PrivacyActiveSessions:return a.ZP.createElement("h3",null,b("SessionsTitle"));case o.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,b("BlockedUsers"));case o.MT.TwoFaDisabled:case o.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,b("TwoStepVerification"));case o.MT.TwoFaNewPassword:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,b("PleaseEnterCurrentPassword"));case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,b("PleaseReEnterPassword"));case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,b("PasswordHint"));case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,b("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,b("TwoStepVerificationPasswordSet"));case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,b("PleaseEnterCurrentPassword"));case o.MT.Folders:return a.ZP.createElement("h3",null,b("Filters"));case o.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,b("FilterNew"));case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,b("FilterEdit")),t&&a.ZP.createElement(R.Z,{className:"settings-more-menu",trigger:C,positionX:"right"},a.ZP.createElement(B.Z,{icon:"delete",destructive:!0,onClick:g},b("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,b("FilterInclude")):a.ZP.createElement("h3",null,b("FilterExclude")),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:s,ariaLabel:b("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,b("SETTINGS")),a.ZP.createElement(F.Z,{round:!0,ripple:!f.wB,size:"smaller",color:"translucent",onClick:()=>l(o.MT.EditProfile),ariaLabel:b("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(R.Z,{className:"settings-more-menu",trigger:C,positionX:"right"},a.ZP.createElement(B.Z,{icon:"logout",onClick:Z},b("LogOutTitle"))))}}(),a.ZP.createElement(Ge.Z,{isOpen:c,onClose:P,text:b("lng_sure_logout"),confirmLabel:b("AccountSettings.Logout"),confirmHandler:p,confirmIsDestructive:!0}),a.ZP.createElement(Ge.Z,{isOpen:m,onClose:v,text:b("FilterDeleteAlert"),confirmLabel:b("Delete"),confirmHandler:E,confirmIsDestructive:!0}))})));var qt=n(787),Wt=n(180);const Qt=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{currentUser:t?(0,v.dy)(e,t):void 0,lastSyncTime:n}}),((e,t)=>(0,b.ei)(t,["loadProfilePhotos"])))((({isActive:e,onScreenSelect:t,onReset:n,loadProfilePhotos:s,currentUser:r,lastSyncTime:i})=>{const l=(0,u.Z)(),c=null==r?void 0:r.id;return(0,a.d4)((()=>{c&&i&&s({profileId:c})}),[i,c,s]),(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(qt.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement(Wt.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Te.Z,{icon:"settings",onClick:()=>t(o.MT.General)},l("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Te.Z,{icon:"unmute",onClick:()=>t(o.MT.Notifications)},l("Notifications")),a.ZP.createElement(Te.Z,{icon:"lock",onClick:()=>t(o.MT.Privacy)},l("PrivacySettings")),a.ZP.createElement(Te.Z,{icon:"data",onClick:()=>t(o.MT.DataStorage)},l("DataSettings")),a.ZP.createElement(Te.Z,{icon:"folder",onClick:()=>t(o.MT.Folders)},l("Filters")),a.ZP.createElement(Te.Z,{icon:"language",onClick:()=>t(o.MT.Language)},l("Language"))))})));var en=n(710),tn=n(1151);const nn="https://t.me/",an=/https:\/\/t\.me\/?/i,sn=/^([a-zA-Z0-9_]+)$/,rn=(0,G.Ds)((e=>e()),250,!1),on=(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`]:sn.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(an,"");l(n),e.target.value=`${t?nn:""}${n}`;const a=function(e){return e.length>=5&&e.length<=32&&sn.test(e)}(n);a&&rn((()=>{r({username:n})})),o&&o(!!a&&n)}),[t,r,o]);return a.ZP.createElement(Ne.Z,{value:`${t?nn:""}${i}`,onChange:P,label:m,error:Z,success:h,readOnly:n})})),ln=(0,G.P2)((e=>e()),6e4,!0),cn="Please provide your first name",dn="Bio can' be longer than 70 characters",mn=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,v.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,g.RT)(s),currentFirstName:r,currentLastName:o,currentBio:c,currentUsername:i,progress:n,isUsernameAvailable:a}}),((e,t)=>(0,b.ei)(t,["loadCurrentUser","updateProfile","checkUsername"])))((({isActive:e,onScreenSelect:t,onReset:n,currentAvatarHash:s,currentFirstName:i,currentLastName:l,currentBio:c,currentUsername:d,progress:Z,isUsernameAvailable:P,loadCurrentUser:g,updateProfile:v,checkUsername:p})=>{const E=(0,u.Z)(),[C,f]=(0,a.eJ)(!1),[b,I]=(0,a.eJ)(!1),[y,S]=(0,a.eJ)(),[w,k]=(0,a.eJ)(),[N,M]=(0,a.eJ)(i||""),[T,F]=(0,a.eJ)(l||""),[A,L]=(0,a.eJ)(c||""),[R,B]=(0,a.eJ)(d||""),$=(0,h.Z)(s,!1,r.IU.BlobUrl),D=Z===o.rN.InProgress,x=!1===R,U=(0,a.Ye)((()=>!x&&(Boolean(w)||b||!0===P)),[w,b,x,P]);(0,m.ZP)(e,n,t,o.MT.EditProfile),(0,a.d4)((()=>{ln((()=>{g()}))}),[g]),(0,a.d4)((()=>{k(void 0)}),[$]),(0,a.d4)((()=>{M(i||""),F(l||""),L(c||"")}),[i,l,c]),(0,a.d4)((()=>{B(d||"")}),[d]),(0,a.d4)((()=>{Z===o.rN.Complete&&(I(!1),f(!1),S(void 0))}),[Z]);const O=(0,a.I4)((e=>{k(e)}),[]),G=(0,a.I4)((e=>{M(e.target.value),I(!0)}),[]),X=(0,a.I4)((e=>{F(e.target.value),I(!0)}),[]),J=(0,a.I4)((e=>{L(e.target.value),I(!0)}),[]),_=(0,a.I4)((e=>{B(e),f(!0)}),[]),V=(0,a.I4)((()=>{const e=N.trim(),t=T.trim(),n=A.trim();e.length?n.length>70?S(dn):v({photo:w,...b&&{firstName:e,lastName:t,bio:n},...C&&{username:R}}):S(cn)}),[w,N,T,A,b,R,C,v]);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(en.Z,{currentAvatarBlobUrl:$,onChange:O,title:"Edit your profile photo",disabled:D}),a.ZP.createElement(Ne.Z,{value:N,onChange:G,label:E("FirstName"),disabled:D,error:y===cn?y:void 0}),a.ZP.createElement(Ne.Z,{value:T,onChange:X,label:E("LastName"),disabled:D}),a.ZP.createElement(Ne.Z,{value:A,onChange:J,label:E("UserBio"),disabled:D,error:y===dn?y:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},(0,Pe.Z)(E("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("Username")),a.ZP.createElement(on,{currentUsername:R||"",isLoading:D,isUsernameAvailable:P,checkUsername:p,onChange:_}),a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},(0,Pe.Z)(E("UsernameHelp"),["br","simple_markdown"])),R&&a.ZP.createElement("p",{className:"settings-item-description",dir:E.isRtl?"rtl":void 0},E("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},"https://t.me/",R)))),a.ZP.createElement(tn.Z,{isShown:U,onClick:V,disabled:D,ariaLabel:"Save changes"},D?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var un=n(4605),hn=n(8051);const Zn=(0,a.X$)((0,s.c$)((e=>(0,b.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])),((e,t)=>(0,b.ei)(t,["setSettingOption"])))((({isActive:e,onScreenSelect:t,onReset:n,canAutoLoadPhotoFromContacts:s,canAutoLoadPhotoInPrivateChats:r,canAutoLoadPhotoInGroups:l,canAutoLoadPhotoInChannels:c,canAutoLoadVideoFromContacts:d,canAutoLoadVideoInPrivateChats:h,canAutoLoadVideoInGroups:Z,canAutoLoadVideoInChannels:P,canAutoLoadFileFromContacts:g,canAutoLoadFileInPrivateChats:v,canAutoLoadFileInGroups:p,canAutoLoadFileInChannels:E,canAutoPlayGifs:C,canAutoPlayVideos:f,autoLoadFileMaxSizeMb:b,setSettingOption:I})=>{const y=(0,u.Z)();(0,m.ZP)(e,n,t,o.MT.General);const S=(0,a.I4)((e=>y("AutodownloadSizeLimitUpTo",y("FileSize.MB",String(i.by[e]),"i"))),[y]),w=(0,a.I4)((e=>{I({autoLoadFileMaxSizeMb:i.by[e]})}),[I]);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:y.isRtl?"rtl":void 0},e),a.ZP.createElement(un.Z,{label:y("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>I({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(un.Z,{label:y("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>I({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(un.Z,{label:y("AutoDownloadSettings.GroupChats"),checked:r,onCheck:e=>I({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(un.Z,{label:y("AutoDownloadSettings.Channels"),checked:o,onCheck:e=>I({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=i.by.indexOf(b);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(hn.Z,{label:y("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(y("AutoDownloadPhotosTitle"),"Photo",s,r,l,c),k(y("AutoDownloadVideosTitle"),"Video",d,h,Z,P),k("Auto-download files","File",g,v,p,E),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("AutoplayMedia")),a.ZP.createElement(un.Z,{label:y("GifsTab2"),checked:C,onCheck:e=>I({canAutoPlayGifs:e})}),a.ZP.createElement(un.Z,{label:y("DataAndStorage.Autoplay.Videos"),checked:f,onCheck:e=>I({canAutoPlayVideos:e})})))})));var Pn=n(7324),gn=n(7799);const vn=(0,G.P2)((e=>e()),6e4,!0),pn=(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,v.dZ)(e),notifyExceptions:(0,v.NJ)(e)}}),((e,t)=>(0,b.ei)(t,["loadRecommendedChatFolders","addChatFolder","showDialog"])))((({isActive:e,allListIds:t,chatsById:n,usersById:s,orderedFolderIds:r,foldersById:l,recommendedChatFolders:c,notifySettings:d,notifyExceptions:h,onCreateFolder:Z,onEditFolder:P,onScreenSelect:v,onReset:p,loadRecommendedChatFolders:E,addChatFolder:C,showDialog:f})=>{const[b,I]=(0,a.eJ)(),[y,S]=(0,a.eJ)(!1),w=(0,a.I4)((()=>S(!0)),[]);(0,a.d4)((()=>{b||(0,Pn.Z)("FoldersAll").then(I)}),[b]),(0,a.d4)((()=>{vn((()=>{E()}))}),[E]);const k=(0,a.I4)((()=>{Object.keys(l).length>=10?f({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):Z()}),[l,f,Z]),N=(0,u.Z)();(0,m.ZP)(e,p,v,o.MT.Folders);const M=(0,a.Ye)((()=>{if(r)return r.map((e=>{const a=l[e];return{id:a.id,title:a.title,subtitle:(0,g.SB)(N,t,n,s,a,d,h)}}))}),[N,t,l,n,s,r,d,h]),T=(0,a.I4)((e=>{Object.keys(l).length>=10?f({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):C({folder:e})}),[l,C,f]);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"},b&&a.ZP.createElement(gn.Z,{id:"settingsFoldersMain",size:i.ku,animationData:b,play:y,noLoop:!0,onLoad:w})),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},N("CreateNewFilterInfo")),a.ZP.createElement(F.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:k,isRtl:N.isRtl},a.ZP.createElement("i",{className:"icon-add"}),N("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("Filters")),null!=M&&M.length?M.map((e=>a.ZP.createElement(Te.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>P(l[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):M&&!M.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(we.Z,null)),c&&!!c.length&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterRecommended")),c.map((e=>a.ZP.createElement(Te.Z,{className:"mb-2",narrow:!0,onClick:()=>T(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(F.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:N.isRtl},N("Add"))))))))})));var En=n(3455);const Cn=({count:e,itemName:t,itemPluralName:n,isLoading:s,onClick:r})=>{const o=(0,u.Z)();return a.ZP.createElement(F.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)},fn="Please provide a title for this folder.",bn="ChatList.Filter.Error.Empty",In=(0,a.X$)((0,s.c$)((e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}}),((e,t)=>(0,b.ei)(t,["editChatFolder","addChatFolder","loadMoreChats"])))((({state:e,dispatch:t,onAddIncludedChats:n,onAddExcludedChats:s,isActive:r,onScreenSelect:l,onReset:c,onBack:d,loadedActiveChatIds:h,loadedArchivedChatIds:Z,editChatFolder:P,addChatFolder:v,loadMoreChats:p})=>{const[E,C]=(0,a.eJ)(),[f,I]=(0,a.eJ)(!1),y=(0,a.I4)((()=>I(!0)),[]),[S,w]=(0,a.eJ)(!1),[k,N]=(0,a.eJ)(!1),{selectedChatIds:M,selectedChatTypes:T}=(0,En.vb)(e,"included"),{selectedChatIds:F,selectedChatTypes:A}=(0,En.vb)(e,"excluded");(0,a.d4)((()=>{E||(0,Pn.Z)("FoldersNew").then(C)}),[E]),(0,a.d4)((()=>{w(!1),N(!1)}),[e.folderId]);const[L,R]=(0,a.Ye)((()=>{const e=new Set([...h||[],...Z||[]]),t=(0,b.eL)(M,e),n=(0,b.eL)(F,e);return[S?t:t.slice(0,5-T.length),k?n:n.slice(0,5-A.length)]}),[F,M,T,A,k,S,h,Z]);(0,a.d4)((()=>{(L.lengthw(!0):()=>N(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?En.fi.find((({key:t})=>t===e)):En.Yy.find((({key:t})=>t===e));if(n)return a.ZP.createElement(Te.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(Te.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,g.YC)(e)?a.ZP.createElement(Ae.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Fe.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(Cn,{count:r,itemName:"chat",onClick:o}))}return(0,m.ZP)(r,d,l,"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"},E&&a.ZP.createElement(gn.Z,{id:"settingsFoldersEdit",size:i.ku,animationData:E,play:f&&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(Ne.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===fn?fn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===bn&&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(Te.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(Te.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},B("FilterAddChats")),$("excluded"))),a.ZP.createElement(tn.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?P({id:e.folderId,folderUpdate:e.folder}):v({folder:e.folder}),setTimeout((()=>{c()}),500)):t({type:"setError",payload:bn}):t({type:"setError",payload:fn})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var yn=n(5765);const Sn=(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?En.fi:En.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]),v=(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,Ie.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(Ct.Z,{icon:t.icon,title:E(t.title),isMinimized:h,canClose:!0,onClick:v,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(Ct.Z,{chatOrUserId:e,isMinimized:h&&tv(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(un.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(Te.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>P(e),ripple:!0,disabled:!t&&Z},(0,g.YC)(e)?a.ZP.createElement(Ae.Z,{userId:e}):a.ZP.createElement(Fe.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(un.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"})))})),wn=(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}}),((e,t)=>(0,b.ei)(t,["loadMoreChats"])))((({isActive:e,onScreenSelect:t,onReset:n,mode:s,state:r,dispatch:i,chatsById:l,listIds:c,orderedPinnedIds:d,archivedListIds:h,archivedPinnedIds:Z,loadMoreChats:P})=>{const{chatFilter:v}=r,{selectedChatIds:p,selectedChatTypes:E}=(0,En.vb)(r,s,!0),C=(0,u.Z)(),f=(0,a.Ye)((()=>{const e=c?(0,g.O)(l,c,d,"all"):void 0,t=h?(0,g.O)(l,h,Z,"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)||[]]}),[l,c,d,h,Z]),b=(0,a.Ye)((()=>{if(f)return f.filter((e=>!v||(0,yn.Z)((0,g.U)(C,e),v)||p.includes(e.id))).map((({id:e})=>e))}),[f,v,C,p]),I=(0,a.I4)((e=>{i({type:"setChatFilter",payload:e})}),[i]),y=(0,a.I4)((e=>{i("included"===s?{type:"setIncludeFilters",payload:{...r.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...r.excludeFilters,excludedChatIds:e}})}),[s,r,i]),S=(0,a.I4)((e=>{const t={};e.forEach((e=>{t[e]=!0})),i("included"===s?{type:"setIncludeFilters",payload:{includedChatIds:p,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:p,...t}})}),[s,p,i]);return(0,m.ZP)(e,n,t,"included"===s?o.MT.FoldersIncludedChats:o.MT.FoldersExcludedChats),b?a.ZP.createElement(Sn,{mode:s,chatIds:b,selectedIds:p,selectedChatTypes:E,filterValue:v,onSelectedIdsChange:y,onSelectedChatTypesChange:S,onFilterChange:I,onLoadMore:P}):a.ZP.createElement(we.Z,null)}))),kn=(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(pn,{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(In,{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(wn,{mode:"included",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(wn,{mode:"excluded",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});default:return}}));var Nn=n(663),Mn=n(3657),Tn=n(692),Fn=n(2155);const An=(0,a.X$)((({size:e=i.DC,stickerSet:t,observeIntersection:n})=>{const s=(0,a.sO)(null),o=(0,Mn.Op)(s,n),l=`stickerSet${t.id}`,c=(0,h.Z)(l,!o,r.IU.Lottie),d=(0,Tn.Z)(c),m=(0,a.Ye)((()=>{if(!c)return(0,Fn.Xv)(t.title,2)}),[c,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},m,c&&a.ZP.createElement(gn.Z,{id:l,size:e,animationData:c,className:d}))})),Ln=(0,a.X$)((({stickerSet:e,observeIntersection:t})=>{const n=(0,a.sO)(null),s=(0,Mn.Op)(n,t),r=(0,h.Z)(e.hasThumbnail&&`stickerSet${e.id}`,!s),o=(0,Tn.Z)(r),i=(0,a.Ye)((()=>{if(!r)return(0,Fn.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 Rn=n(3547);const Bn=(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(Te.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!o,onClick:()=>o&&n(o)},a.ZP.createElement(F.Z,{ariaLabel:e.title,color:"translucent",isRtl:r.isRtl},e.isAnimated?a.ZP.createElement(An,{size:i.Mw,stickerSet:e,observeIntersection:t}):a.ZP.createElement(Ln,{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(Te.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>n(o)},a.ZP.createElement(Rn.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 $n=n(4851);const Dn=["Solid and Steady","Nice and Fast","Lots of Stuff"],xn=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],Un=(0,a.X$)((0,s.c$)((e=>({...(0,b.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive","timeFormat"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById})),((e,t)=>(0,b.ei)(t,["setSettingOption","loadStickerSets","loadAddedStickers"])))((({isActive:e,onScreenSelect:t,onReset:n,stickerSetIds:s,stickerSetsById:r,messageTextSize:i,animationLevel:l,messageSendKeyCombo:c,shouldSuggestStickers:d,shouldLoopStickers:h,timeFormat:Z,setSettingOption:P,loadStickerSets:g,loadAddedStickers:v})=>{const p=(0,a.sO)(null),{observe:E}=(0,Mn.S1)({rootRef:p}),[C,b,I]=(0,Xe.Z)(),[y,S]=(0,a.eJ)(),w=(0,u.Z)(),k=f.$b?void 0:[{value:"enter",label:w("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:w(f.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];(0,a.d4)((()=>{g()}),[g]),(0,a.d4)((()=>{null!=s&&s.length&&v()}),[s,v]);const N=(0,a.I4)((e=>{Dn.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),P({animationLevel:e})}),[P]),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()),P({messageTextSize:e})}),[P]),T=(0,a.I4)((e=>{P({timeFormat:e}),P({wasTimeFormatSetManually:!0}),(0,Nn.qf)(e)}),[P]),F=(0,a.I4)((e=>{S(e),b()}),[b]),A=s&&s.map((e=>{var t;return!(null==r||null===(t=r[e])||void 0===t||!t.installedDate)&&r[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:w.isRtl?"rtl":void 0},w("SETTINGS")),a.ZP.createElement(hn.Z,{label:w("TextSize"),min:12,max:20,value:i,onChange:M}),a.ZP.createElement(Te.Z,{icon:"photo",onClick:()=>t(o.MT.GeneralChatBackground)},w("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(tt.Z,{name:"timeformat",options:xn,selected:Z,onChange:T})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:w.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(hn.Z,{options:Dn,value:l,onChange:N})),k&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},w("VoiceOver.Keyboard")),a.ZP.createElement(tt.Z,{name:"keyboard-send-settings",options:k,onChange:e=>P({messageSendKeyCombo:e}),selected:c})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:w.isRtl?"rtl":void 0},w("AccDescrStickers")),a.ZP.createElement(un.Z,{label:w("SuggestStickers"),checked:d,onCheck:e=>P({shouldSuggestStickers:e})}),a.ZP.createElement(un.Z,{label:w("LoopAnimatedStickers"),checked:h,onCheck:e=>P({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:p},A&&A.map((e=>a.ZP.createElement(Bn,{key:e.id,stickerSet:e,observeIntersection:E,onClick:F})))),y&&a.ZP.createElement($n.Z,{isOpen:C,fromSticker:y,onClose:I})))})));let On;function Gn(e="*",t,n=!1){On||(On=document.createElement("input"),On.setAttribute("type","file")),On.setAttribute("accept",e),n?On.removeAttribute("multiple"):On.setAttribute("multiple","multiple"),On.onchange=null,On.value="",On.onchange=t,On.click()}var zn=n(1394);function Xn(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 _n([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.5?Math.max(0,.65*a):Math.max(0,Math.min(1,1-.65*a)),`hsla(${360*t}, ${100*n}%, ${100*a}%, .4)`}var Yn=n(9524),jn=n(5866);const Kn=(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`),g=(0,jn.Z)(null===(r=c.thumbnail)||void 0===r?void 0:r.dataUri,Boolean(u),!0),{transitionClassNames:v}=(0,_.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)(p&&!C||l===o.mp,void 0,b,"slow"),S=(0,a.sO)();S.current=t;const w=(0,a.I4)((()=>{(async()=>{const e=await(0,zn.gm)(C);await Yn.save(i.fo,S.current,e),s(l)})()}),[C,s,l]);(0,a.d4)((()=>{C&&w()}),[C,w]);const k=(0,a.I4)((()=>{C?w():E((e=>!e))}),[C,w]),N=(0,X.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:N,onClick:k},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:g,className:"thumbnail"}),a.ZP.createElement("img",{src:u||m,className:(0,X.Z)("full-media",v),alt:""}),I&&a.ZP.createElement("div",{className:(0,X.Z)("spinner-container",y)},a.ZP.createElement($.Z,{progress:f,onClick:k}))))})),qn=(0,G.P2)((e=>e()),6e4,!0),Wn=(0,a.X$)((0,s.c$)((e=>{const t=(0,v.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}),((e,t)=>(0,b.ei)(t,["loadWallpapers","uploadWallpaper","setThemeSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,background:s,isBlurred:r,loadedWallpapers:l,theme:c,loadWallpapers:d,uploadWallpaper:h,setThemeSettings:Z})=>{const P=(0,a.sO)();P.current=c,(0,a.d4)((()=>{qn((()=>{d()}))}),[d]);const g=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&h(t[0])}),[h]),v=(0,a.I4)((()=>{Gn("image/jpeg",g,!0)}),[g]),p=(0,a.I4)((()=>{t(o.MT.GeneralChatBackgroundColor)}),[t]),E=(0,a.I4)((()=>{Z({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?i.Vv:i.g})}),[Z,c]),C=(0,a.I4)((e=>{Z({theme:P.current,background:e});const t=l&&l.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,zn.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){const t=Hn(e),n=`#${Jn(e)}`;Z({theme:P.current,backgroundColor:n,patternColor:t})}))}),[l,Z]),f=(0,a.I4)((e=>{Z({theme:P.current,isBlurred:e.target.checked})}),[Z]),b=(0,u.Z)();(0,m.ZP)(e,n,t,o.MT.GeneralChatBackground);const I=(null==l?void 0:l[0])&&l[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(Te.Z,{icon:"camera-add",className:"mb-0",disabled:I,onClick:v},b("UploadImage")),a.ZP.createElement(Te.Z,{icon:"colorize",className:"mb-0",onClick:p},b("SetColor")),a.ZP.createElement(Te.Z,{icon:"favorite",onClick:E},b("ThemeResetToDefaults")),a.ZP.createElement(un.Z,{label:b("BackgroundBlurred"),checked:Boolean(r),onChange:f})),l?a.ZP.createElement("div",{className:"settings-wallpapers"},l.map((e=>a.ZP.createElement(Kn,{wallpaper:e,theme:c,isSelected:s===e.slug,onClick:C})))):a.ZP.createElement(we.Z,null))}))),Qn=_n(Xn("e6ebee")),ea=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function ta(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 na({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 aa=(0,a.X$)((0,s.c$)((e=>{const t=(0,v.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}),((e,t)=>(0,b.ei)(t,["setThemeSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,theme:s,backgroundColor:r,setThemeSettings:i})=>{const l=(0,a.sO)();l.current=s;const c=(0,a.sO)(null),d=(0,a.sO)(null),u=(0,a.sO)(null),h=(0,a.sO)(!0),[Z,P]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?_n(Xn(e.replace("#",""))):Qn}(r)),g=(0,a.sO)(Z);(0,a.d4)((()=>{g.current=Z}),[Z]);const[v,p,E]=(0,Xe.Z)(),[f,I]=(0,a.eJ)(""),[y,S]=(0,a.eJ)(""),w=(0,a.sO)(),k=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:d.current.offsetLeft,...(0,b.ei)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:u.current.offsetLeft,...(0,b.ei)(u.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+c.current.scrollTop),e.height-1)],{huePosition:a}=ta(g.current,w.current);return P(na({colorPosition:n,huePosition:a},w.current)),p(),!0}function a(e){const{colorPosition:n}=ta(g.current,w.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return P(na({colorPosition:n,huePosition:a},w.current)),p(),!0}w.current={colorRect:e,hueRect:t},(0,C.s)(d.current,{onCapture:n,onDrag:n,onRelease:E,onClick:E,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,C.s)(u.current,{onCapture:a,onDrag:a,onRelease:E,onClick:E,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[p,E]);const{colorPosition:N=[0,0],huePosition:M=0}=w.current?ta(Z,w.current):{},T=Jn(Vn(Z)),F=Z[0],A=Jn(Vn([F,1,1]));(0,a.d4)((()=>{const e=Vn(Z),t=`#${Jn(e)}`;if(I(e.join(", ")),S(t),!h.current){const n=Hn(e);i({theme:l.current,background:void 0,backgroundColor:t,patternColor:n})}h.current=!1}),[Z,i]),(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=Vn([t,1,1]);let d=0;for(let e=0;e{!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{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())));P(_n(e))}e.currentTarget.value=t}),[]),R=(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}$/)&&P(_n(Xn(t.replace("#","")))),e.currentTarget.value=t}),[]),B=(0,a.I4)((e=>{P(_n(Xn(e.currentTarget.dataset.color.replace("#",""))))}),[]),$=(0,X.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",v&&"is-dragging");return(0,m.ZP)(e,n,t,o.MT.GeneralChatBackgroundColor),a.ZP.createElement("div",{ref:c,className:$},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:d,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${N[0]}px, ${N[1]}px); background-color: #${T};`})),a.ZP.createElement("div",{ref:u,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(Ne.Z,{value:y,label:"HEX",onChange:R}),a.ZP.createElement(Ne.Z,{value:f,label:"RGB",onChange:L}))),a.ZP.createElement("div",{className:"predefined-colors"},ea.map((e=>a.ZP.createElement("div",{className:e===`#${T}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:B})))))})));var sa=n(8406);const ra=(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})),((e,t)=>(0,b.ei)(t,["loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings","updateWebNotificationSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,hasPrivateChatsNotifications:s,hasPrivateChatsMessagePreview:r,hasGroupNotifications:i,hasGroupMessagePreview:l,hasBroadcastNotifications:c,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:h,hasPushNotifications:Z,hasWebNotifications:P,notificationSoundVolume:g,loadNotificationSettings:v,updateContactSignUpNotification:p,updateNotificationSettings:E,updateWebNotificationSettings:C})=>{(0,a.d4)((()=>{v()}),[v]);const f=(0,x.Z)(500,!1,!0),b=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!s:!("group"===t?i:c),o="contact"===t?r:"group"===t?l:d;E({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:o},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[d,c,l,i,r,s,E]),I=(0,a.I4)((e=>{p({isSilent:!e.target.checked})}),[p]),y=(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:y.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(un.Z,{label:"Web notifications",subLabel:y(P?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:P,onChange:e=>{C({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(un.Z,{label:"Offline notifications",disabled:!P,subLabel:y(Z?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:Z,onChange:e=>{C({hasPushNotifications:e.target.checked})}}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(hn.Z,{label:"Sound",min:0,max:10,value:g,onChange:e=>{C({notificationSoundVolume:e}),f((()=>(0,sa.q3)(void 0,e)))}}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("AutodownloadPrivateChats")),a.ZP.createElement(un.Z,{label:y("NotificationsForPrivateChats"),subLabel:y(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{b(e,"contact","silent")}}),a.ZP.createElement(un.Z,{label:y("MessagePreview"),disabled:!s,subLabel:y(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:e=>{b(e,"contact","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("FilterGroups")),a.ZP.createElement(un.Z,{label:y("NotificationsForGroups"),subLabel:y(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{b(e,"group","silent")}}),a.ZP.createElement(un.Z,{label:y("MessagePreview"),disabled:!i,subLabel:y(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{b(e,"group","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("FilterChannels")),a.ZP.createElement(un.Z,{label:y("NotificationsForChannels"),subLabel:y(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{b(e,"broadcast","silent")}}),a.ZP.createElement(un.Z,{label:y("MessagePreview"),disabled:!c,subLabel:y(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{b(e,"broadcast","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("PhoneOther")),a.ZP.createElement(un.Z,{label:y("ContactJoined"),checked:h,onChange:I})))}))),oa=(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}}),((e,t)=>(0,b.ei)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings","loadContentSettings","updateContentSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,hasPassword:s,blockedCount:r,sessionsCount:i,isSensitiveEnabled:l,canChangeSensitive:c,visibilityPrivacyPhoneNumber:d,visibilityPrivacyLastSeen:h,visibilityPrivacyProfilePhoto:Z,visibilityPrivacyForwarding:P,visibilityPrivacyGroupChats:g,loadPrivacySettings:v,loadBlockedContacts:p,loadAuthorizations:E,loadContentSettings:C,updateContentSettings:f})=>{(0,a.d4)((()=>{p(),E(),v(),C()}),[p,E,v,C]);const b=(0,u.Z)();function I(e){switch(e){case"everybody":return b("P2PEverybody");case"contacts":return b("P2PContacts");case"nobody":return b("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(Te.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"},b("BlockedUsers")),r>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},b("Users",r)))),a.ZP.createElement(Te.Z,{icon:"lock",narrow:!0,onClick:()=>t(s?o.MT.TwoFaEnabled:o.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},b("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},b(s?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Te.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"},b("SessionsTitle")),i>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},1===i?"1 session":`${i} sessions`)))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:b.isRtl?"rtl":void 0},b("PrivacyTitle")),a.ZP.createElement(Te.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"},b("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(d)))),a.ZP.createElement(Te.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"},b("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(h)))),a.ZP.createElement(Te.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"},b("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(Z)))),a.ZP.createElement(Te.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"},b("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(P)))),a.ZP.createElement(Te.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"},b("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},I(g))))),c&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},b("lng_settings_sensitive_title")),a.ZP.createElement(un.Z,{label:b("lng_settings_sensitive_disable_filtering"),subLabel:b("lng_settings_sensitive_about"),checked:Boolean(l),disabled:!c,onCheck:f})))}))),ia=(0,a.X$)((0,s.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})),((e,t)=>(0,b.ei)(t,["loadLanguages","setSettingOption"])))((({isActive:e,onScreenSelect:t,onReset:n,languages:s,language:r,loadLanguages:i,setSettingOption:l})=>{const[c,d]=(0,a.eJ)(r),[u,h,Z]=(0,Xe.Z)();(0,a.d4)((()=>{i()}),[i]);const P=(0,a.I4)((e=>{d(e),h(),(0,Nn.m0)(e,(()=>{Z(),l({language:e})}))}),[h,Z,l]),g=(0,a.Ye)((()=>s?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))}(s):void 0),[s]);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(tt.Z,{name:"keyboard-send-settings",options:g,selected:c,loadingOption:u?c:void 0,onChange:P}):a.ZP.createElement(we.Z,null))})));function la(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 ca=(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}:{}}),((e,t)=>(0,b.ei)(t,["setPrivacyVisibility"])))((({screen:e,isActive:t,onScreenSelect:n,onReset:s,visibility:r,allowUserIds:i,allowChatIds:l,blockUserIds:c,blockChatIds:d,chatsById:h,setPrivacyVisibility:Z})=>{const P=(0,u.Z)(),g=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyGroupChats:return[{value:"everybody",label:P("P2PEverybody")},{value:"contacts",label:P("P2PContacts")}];default:return[{value:"everybody",label:P("P2PEverybody")},{value:"contacts",label:P("P2PContacts")},{value:"nobody",label:P("P2PNobody")}]}}),[P,e]),v={shouldShowDenied:"nobody"!==r,shouldShowAllowed:"everybody"!==r},p=la(e),E=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyPhoneNumber:return P("PrivacyPhoneTitle");case o.MT.PrivacyLastSeen:return P("LastSeenTitle");case o.MT.PrivacyProfilePhoto:return P("PrivacyProfilePhotoTitle");case o.MT.PrivacyForwarding:return P("PrivacyForwardsTitle");case o.MT.PrivacyGroupChats:return P("WhoCanAddMe");default:return}}),[P,e]);(0,m.ZP)(t,s,n,e);const C=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyLastSeen:return P("CustomHelp");default:return}}),[P,e]),f=(()=>{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}})(),b=(()=>{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}})(),I=(0,a.Ye)((()=>i&&l&&h?l.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),i.length):0),[l,i,h]),y=(0,a.Ye)((()=>c&&d&&h?d.reduce(((e,t)=>e+(h[t]?h[t].membersCount:0)),c.length):0),[d,c,h]),S=(0,a.I4)((e=>{Z({privacyKey:p,visibility:e})}),[p,Z]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},E),a.ZP.createElement(tt.Z,{name:`visibility-${p}`,options:g,onChange:S,selected:r}),C&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:P.isRtl?"rtl":void 0},C)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:P.isRtl?"rtl":void 0},P("PrivacyExceptions")),v.shouldShowAllowed&&a.ZP.createElement(Te.Z,{narrow:!0,icon:"add-user",onClick:()=>{n(f)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},I>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",I),a.ZP.createElement("span",{className:"title"},P("AlwaysShareWith")),a.ZP.createElement("span",{className:"subtitle"},P("EditAdminAddUsers")))),v.shouldShowDenied&&a.ZP.createElement(Te.Z,{narrow:!0,icon:"delete-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"},P("NeverShareWith")),a.ZP.createElement("span",{className:"subtitle"},P("EditAdminAddUsers"))))))})));function da(e){return[e.region,e.country].filter(Boolean).join(", ")}function ma(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const ua=(0,a.X$)((0,s.c$)((e=>({activeSessions:e.activeSessions})),((e,t)=>(0,b.ei)(t,["loadAuthorizations","terminateAuthorization","terminateAllAuthorizations"])))((({isActive:e,onScreenSelect:t,onReset:n,activeSessions:s,loadAuthorizations:r,terminateAuthorization:i,terminateAllAuthorizations:l})=>{const[c,d,h]=(0,Xe.Z)();(0,a.d4)((()=>{r()}),[r]);const Z=(0,a.I4)((e=>{i({hash:e})}),[i]),P=(0,a.I4)((()=>{h(),l()}),[h,l]),g=(0,a.Ye)((()=>s.find((e=>e.isCurrent))),[s]),v=(0,a.Ye)((()=>s.filter((e=>!e.isCurrent))),[s]),p=(0,u.Z)();return(0,m.ZP)(e,n,t,o.MT.PrivacyActiveSessions),a.ZP.createElement("div",{className:"settings-content custom-scroll"},g&&(C=g,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:p.isRtl?"rtl":void 0},p("AuthSessions.CurrentSession")),a.ZP.createElement(Te.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"},C.appName),a.ZP.createElement("span",{className:"subtitle black tight"},ma(C)),a.ZP.createElement("span",{className:"subtitle"},C.ip," - ",da(C)))),a.ZP.createElement(Te.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d},p("TerminateAllSessions")))),v&&(E=v,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:p.isRtl?"rtl":void 0},p("OtherSessions")),E.map((function(e){return a.ZP.createElement(Te.Z,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{Z(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)(p,1e3*e.dateActive)),a.ZP.createElement("span",{className:"title"},e.appName),a.ZP.createElement("span",{className:"subtitle black tight"},ma(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",da(e))))})))),v&&a.ZP.createElement(Ge.Z,{isOpen:c,onClose:h,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:P,confirmIsDestructive:!0}));var E,C})));var ha=n(6272);const Za=(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}}),((e,t)=>(0,b.ei)(t,["loadContactList","setUserSearchQuery","blockContact"])))((({usersById:e,blockedIds:t,contactIds:n,localContactIds:s,currentUserId:r,isOpen:o,onClose:i,loadContactList:l,setUserSearchQuery:c,blockContact:d})=>{const m=(0,u.Z)(),[h,Z]=(0,a.eJ)(""),P=(0,a.sO)(null);(0,a.d4)((()=>{c({query:h})}),[h,c]);const v=(0,a.Ye)((()=>{const a=(0,b.Tw)([...n||[],...s||[]].filter((e=>e!==r&&!t.includes(e))));return(0,g.kK)(a,e,h).sort(((t,n)=>{const a=(0,g.Js)(e[t])||"",s=(0,g.Js)(e[n])||"";return a.localeCompare(s)}))}),[t,n,r,h,s,e]),p=(0,a.I4)((t=>{const{id:n,accessHash:a}=e[t]||{};n&&a&&(d({contactId:n,accessHash:a}),i())}),[d,i,e]);return a.ZP.createElement(Le,{isOpen:o,chatOrUserIds:v,filterRef:P,filterPlaceholder:m("BlockedUsers.BlockUser"),filter:h,onFilterChange:Z,loadMore:l,onSelectChatOrUser:p,onClose:i})}))),Pa=(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}}),((e,t)=>(0,b.ei)(t,["unblockContact"])))((({isActive:e,onScreenSelect:t,onReset:n,chatsByIds:s,usersByIds:r,blockedIds:l,phoneCodeList:c,unblockContact:d})=>{const h=(0,u.Z)(),[Z,P,v]=(0,Xe.Z)(),p=(0,a.I4)((e=>{d({contactId:e})}),[d]);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:h.isRtl?"rtl":void 0},h("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=l&&l.length?a.ZP.createElement("div",{className:"scroll-container"},l.map(((e,t)=>function(e,t,n){const o=(0,g.YC)(e),l=o?r[e]:void 0,d=o?void 0:s[e],m=(0,X.Z)("Chat chat-item-clickable blocked-list-item small-icon",o?"private":"group");return a.ZP.createElement(Te.Z,{key:e,className:m,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{p(e)}}],style:`top: ${(0+t)*i.rS}px;`},a.ZP.createElement(ge.Z,{size:"medium",user:l,chat:d}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,Pe.Z)((o?(0,g.Js)(l):(0,g.U)(h,d))||"")),(null==l?void 0:l.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,ha.WZ)(c,l.phoneNumber)),l&&!l.phoneNumber&&l.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",l.username)))}(e,t)))):l&&!l.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},h("NoBlocked")):a.ZP.createElement(we.Z,{key:"loading"}))),a.ZP.createElement(tn.Z,{isShown:!0,onClick:P,ariaLabel:h("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(Za,{isOpen:Z,onClose:v}))})));var ga=n(7854);const va=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,v.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(ga.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,Pe.Z)(r("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Te.Z,{icon:"edit",onClick:()=>s(o.MT.TwoFaChangePasswordCurrent)},r("ChangePassword")),a.ZP.createElement(Te.Z,{icon:"password-off",onClick:()=>s(o.MT.TwoFaTurnOff)},r("TurnPasswordOff")),a.ZP.createElement(Te.Z,{icon:"email",onClick:()=>s(o.MT.TwoFaRecoveryEmailCurrentPassword)},r("SetRecoveryEmail"))))})));var pa=n(3490),Ea=n(9364);const Ca=(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,g]=(0,a.eJ)(""),[v,p]=(0,a.eJ)(!1),E=(0,a.I4)((e=>{i&&e!==i?g("Passwords Should Be Equal"):Z(e)}),[Z,i]),C=(0,a.I4)((()=>{h&&h(),g("")}),[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(pa.Z,{isBig:!0,isPasswordVisible:v})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Ea.Z,{error:P||r,hint:c,placeholder:l,submitLabel:d||f("Next"),clearError:C,isLoading:o,isPasswordVisible:v,onChangePasswordVisibility:p,onSubmit:E})))})),fa=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,v.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(ga.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(F.Z,{onClick:r},i("EditAdminTransferSetPassword"))))}))),ba=f.wB?550:400,Ia=(0,a.X$)((0,s.c$)(((e,{icon:t})=>({animatedEmoji:(0,v.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),[g,v]=(0,a.eJ)(""),[p,E,C]=(0,Xe.Z)(!1);(0,a.d4)((()=>{f.$b||setTimeout((()=>{P.current.focus()}),ba)}),[]);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(ga.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(g)}},a.ZP.createElement(Ne.Z,{ref:P,value:g,inputMode:t,label:r,error:s,onChange:e=>{s&&i&&i(),v(e.target.value)}}),g?a.ZP.createElement(F.Z,{type:"submit",isLoading:n,ripple:!0},b("Continue")):a.ZP.createElement(F.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,Pe.Z)(b("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(F.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{C(),l()}},b("YourEmailSkip")),a.ZP.createElement(F.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:C},b("Cancel"))))))}))),ya=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,v.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(ga.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(F.Z,{onClick:()=>{s(o.MT.Privacy)}},r("TwoStepVerificationPasswordReturnSettings"))))}))),Sa=f.wB?550:400,wa=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,v.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()}),Sa)}),[]);const g=(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(ga.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Ne.Z,{value:Z,ref:h,inputMode:"decimal",label:g("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)))}))),ka=(0,a.X$)((0,s.c$)((e=>({...e.twoFaSettings})),((e,t)=>(0,b.ei)(t,["updatePassword","updateRecoveryEmail","clearPassword","provideTwoFaEmailCode","checkPassword","clearTwoFaError"])))((({currentScreen:e,shownScreen:t,state:n,hint:s,isLoading:r,error:i,waitingEmailCodeLength:l,dispatch:c,isActive:d,onScreenSelect:m,onReset:h,updatePassword:Z,checkPassword:P,clearTwoFaError:g,updateRecoveryEmail:v,provideTwoFaEmailCode:p,clearPassword:E})=>{(0,a.d4)((()=>{l&&(e===o.MT.TwoFaNewPasswordEmail?m(o.MT.TwoFaNewPasswordEmailCode):e===o.MT.TwoFaRecoveryEmail&&m(o.MT.TwoFaRecoveryEmailCode))}),[e,m,l]);const C=(0,a.I4)((()=>{c({type:"reset"}),m(o.MT.TwoFaNewPassword)}),[c,m]),f=(0,a.I4)((e=>{c({type:"setPassword",payload:e}),m(o.MT.TwoFaNewPasswordConfirm)}),[c,m]),b=(0,a.I4)((()=>{m(o.MT.TwoFaNewPasswordHint)}),[m]),I=(0,a.I4)((e=>{c({type:"setHint",payload:e}),m(o.MT.TwoFaNewPasswordEmail)}),[c,m]),y=(0,a.I4)((e=>{c({type:"setEmail",payload:e}),Z({...n,email:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,Z]),S=(0,a.I4)((e=>{c({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{m(o.MT.TwoFaChangePasswordNew)}})}),[P,c,m]),w=(0,a.I4)((e=>{c({type:"setPassword",payload:e}),m(o.MT.TwoFaChangePasswordConfirm)}),[c,m]),k=(0,a.I4)((()=>{m(o.MT.TwoFaChangePasswordHint)}),[m]),N=(0,a.I4)((e=>{c({type:"setHint",payload:e}),Z({...n,hint:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,Z]),M=(0,a.I4)((e=>{E({currentPassword:e,onSuccess:()=>{m(o.MT.Privacy)}})}),[E,m]),T=(0,a.I4)((e=>{c({type:"setCurrentPassword",payload:e}),P({currentPassword:e,onSuccess:()=>{m(o.MT.TwoFaRecoveryEmail)}})}),[P,c,m]),F=(0,a.I4)((e=>{c({type:"setEmail",payload:e}),v({...n,email:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,v]),A=(0,a.I4)((e=>{p({code:e})}),[p]),L=(0,u.Z)();switch(e){case o.MT.TwoFaDisabled:return a.ZP.createElement(fa,{onStart:C,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaNewPassword:return a.ZP.createElement(Ca,{screen:e,placeholder:L("PleaseEnterPassword"),submitLabel:L("Continue"),onSubmit:f,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(Ca,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),submitLabel:L("Continue"),onSubmit:b,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaNewPasswordHint:return a.ZP.createElement(Ia,{icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:I,screen:e,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(Ia,{icon:"email",type:"email",isLoading:r,error:i,clearError:g,placeholder:L("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:y,screen:e,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(wa,{isLoading:r,error:i,clearError:g,onSubmit:A,screen:e,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:h});case o.MT.TwoFaCongratulations:return a.ZP.createElement(ya,{onScreenSelect:m,isActive:d,onReset:h});case o.MT.TwoFaEnabled:return a.ZP.createElement(va,{onScreenSelect:m,isActive:d||[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:h});case o.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(Ca,{screen:e,isLoading:r,error:i,clearError:g,hint:s,onSubmit:S,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaChangePasswordNew:return a.ZP.createElement(Ca,{screen:e,placeholder:L("PleaseEnterNewFirstPassword"),onSubmit:w,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(Ca,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),onSubmit:k,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(Ia,{isLoading:r,error:i,clearError:g,icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:N,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:h,screen:e});case o.MT.TwoFaTurnOff:return a.ZP.createElement(Ca,{isLoading:r,error:i,clearError:g,hint:s,onSubmit:M,onScreenSelect:m,isActive:d,onReset:h,screen:e});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(Ca,{screen:e,isLoading:r,error:i,clearError:g,hint:s,onSubmit:T,onScreenSelect:m,isActive:d||[o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement(Ia,{screen:e,icon:"email",type:"email",placeholder:L("RecoveryEmailTitle"),onSubmit:F,onScreenSelect:m,isActive:d||[o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:h});case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(wa,{screen:e,isLoading:r,error:i,clearError:g,onSubmit:A,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:h});default:return}})));var Na=n(1820);function Ma(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 Ta=(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:Ma(e,t)}}),((e,t)=>(0,b.ei)(t,["setPrivacySettings"])))((({currentUserId:e,isAllowList:t,screen:n,settings:s,chatsById:r,listIds:i,orderedPinnedIds:l,archivedListIds:c,archivedPinnedIds:d,setPrivacySettings:h,isActive:Z,onScreenSelect:P,onReset:v})=>{const p=(0,u.Z)(),E=(0,a.Ye)((()=>s?t?[...s.allowUserIds,...s.allowChatIds]:[...s.blockUserIds,...s.blockChatIds]:[]),[t,s]),[C,f]=(0,a.eJ)(""),[b,I]=(0,a.eJ)(!1),[y,S]=(0,a.eJ)(E),w=(0,a.Ye)((()=>{const e=i?(0,g.O)(r,i,l,"all"):void 0,t=c?(0,g.O)(r,c,d,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]}),[r,i,l,c,d]),k=(0,a.Ye)((()=>{if(w)return w.filter((t=>((0,g.YC)(t.id)&&t.id!==e||(0,g.Bf)(t))&&(!C||(0,yn.Z)((0,g.U)(p,t),C)||E.includes(t.id)))).map((({id:e})=>e))}),[w,e,p,C,E]),N=(0,a.I4)((e=>{S(e),I(!0)}),[]),M=(0,a.I4)((()=>{h({privacyKey:la(n),isAllowList:Boolean(t),contactsIds:y}),P(o.MT.Privacy)}),[t,y,P,n,h]);return(0,m.ZP)(Z,v,P,n),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Na.Z,{itemIds:k||[],selectedIds:y,filterValue:C,filterPlaceholder:p(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:N,onFilterChange:f}),a.ZP.createElement(tn.Z,{isShown:b,onClick:M,ariaLabel:p(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Fa=Object.keys(o.MT).length/2,Aa=[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],La=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],Ra=[o.MT.PrivacyBlockedUsers,o.MT.PrivacyActiveSessions],Ba=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],$a=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],Da=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],xa=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],Ua=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],Oa=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:s,onScreenSelect:r,onReset:i,shouldSkipTransition:l})=>{const[c,d]=(0,Ht.Z)(jt,Yt),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(Kt,{currentScreen:t,onReset:m,onSaveFilter:u,onScreenSelect:r,editedFolderId:n.folderId}),function(i,l){const u={[o.MT.PrivacyPhoneNumber]:Ba.includes(l),[o.MT.PrivacyLastSeen]:$a.includes(l),[o.MT.PrivacyProfilePhoto]:Da.includes(l),[o.MT.PrivacyForwarding]:xa.includes(l),[o.MT.PrivacyGroupChats]:Ua.includes(l)},h=Aa.includes(l),Z=La.includes(l),P=Ra.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(Qt,{onScreenSelect:r,isActive:e,onReset:m});case o.MT.EditProfile:return a.ZP.createElement(mn,{onScreenSelect:r,isActive:e&&i,onReset:m});case o.MT.General:return a.ZP.createElement(Un,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor||l===o.MT.GeneralChatBackground||P||Z,onReset:m});case o.MT.Notifications:return a.ZP.createElement(ra,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.DataStorage:return a.ZP.createElement(Zn,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.Privacy:return a.ZP.createElement(oa,{onScreenSelect:r,isActive:i||P||h,onReset:m});case o.MT.Language:return a.ZP.createElement(ia,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.GeneralChatBackground:return a.ZP.createElement(Wn,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor,onReset:m});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(aa,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyActiveSessions:return a.ZP.createElement(ua,{onScreenSelect:r,isActive:i,onReset:m});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(Pa,{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(ca,{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(Ta,{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(Ta,{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(kn,{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(ka,{currentScreen:t,state:c,dispatch:d,shownScreen:l,isActive:i,onScreenSelect:r,onReset:m});default:return}}(i,h))}return a.ZP.createElement(L.Z,{id:"Settings",name:l?"none":f.s0,activeKey:t,renderCount:Fa},h)})),Ga=(0,G.P2)((e=>e()),6e4,!0),za=(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}}),((e,t)=>(0,b.ei)(t,["loadContactList","openChat"])))((({isActive:e,filter:t,usersById:n,userStatusesById:s,contactIds:r,serverTimeOffset:o,onReset:i,loadContactList:l,openChat:c})=>{(0,a.d4)((()=>{Ga((()=>{l()}))})),(0,m.ZP)(e,i);const d=(0,a.I4)((e=>{c({id:e,shouldReplaceHistory:!0})}),[c]),u=(0,a.Ye)((()=>{if(!r)return;const e=(0,g.kK)(r,n,t);return(0,g.Z0)(e,n,s,void 0,o)}),[r,t,n,s,o]),[h,Z]=(0,Ie.Z)(void 0,u,Boolean(t));return a.ZP.createElement(Me.Z,{items:h,onLoadMore:Z,className:"chat-list custom-scroll"},null!=h&&h.length?h.map((e=>a.ZP.createElement(Te.Z,{key:e,className:"chat-item-clickable",onClick:()=>d(e),ripple:!f.wB},a.ZP.createElement(Ae.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):h&&!h.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"}))}))),Xa=(0,G.P2)((e=>e()),6e4,!0),Ja=(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}}),((e,t)=>(0,b.ei)(t,["loadContactList","setGlobalSearchQuery"])))((({isChannel:e,isActive:t,selectedMemberIds:n,onSelectedMemberIdsChange:r,onNextStep:o,onReset:i,chatsById:l,localContactIds:c,searchQuery:d,isSearching:h,localUserIds:Z,globalUserIds:P,loadContactList:v,setGlobalSearchQuery:p})=>{(0,a.d4)((()=>{Xa((()=>{v()}))}));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,g.kK)(c,e,d):[];return(0,g.ih)((0,b.Tw)([...t,...Z||[],...P||[]]).filter((t=>{const n=e[t];return!n||n.canBeInvitedToGroup&&!n.isSelf&&!(0,g.cS)(n)})),l,!1,n)}),[c,l,d,Z,P,n]),I=(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(F.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(Na.Z,{itemIds:f,selectedIds:n,filterValue:d,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:r,onFilterChange:C}),a.ZP.createElement(tn.Z,{isShown:Boolean(n.length||e),onClick:I,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),_a=(0,a.X$)((0,s.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}),((e,t)=>(0,b.ei)(t,["createGroupChat","createChannel"])))((({isChannel:e,isActive:t,memberIds:n,onReset:s,creationProgress:r,creationError:i,createGroupChat:l,createChannel:c})=>{const d=(0,u.Z)();(0,m.ZP)(t,s);const[h,Z]=(0,a.eJ)(""),[P,g]=(0,a.eJ)(""),[v,p]=(0,a.eJ)(),[E,C]=(0,a.eJ)(),f="Chat title can't be empty",b="Channel title can't be empty",I="Sorry, creating supergroups is not yet supported",y=r===o.Nh.InProgress,S=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");Z(n),n!==t&&(e.currentTarget.value=n)}),[]),w=(0,a.I4)((e=>{g(e.currentTarget.value)}),[]),k=(0,a.I4)((()=>{h.length?n.length>199?C(I):l({title:h,photo:v,memberIds:n}):C(f)}),[h,n,l,v,f,I]),N=(0,a.I4)((()=>{h.length?c({title:h,about:P,photo:v,memberIds:n}):C(b)}),[h,c,P,v,n,b]);(0,a.d4)((()=>{r===o.Nh.Complete&&s(!0)}),[r,s]);const M=i&&d(i)||(E!==f&&E!==b?E:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>s(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,d(e?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(en.Z,{onChange:p,title:d("AddPhoto")}),a.ZP.createElement(Ne.Z,{value:h,onChange:S,label:d(e?"EnterChannelName":"GroupName"),error:E===f||E===b?E:void 0}),e&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Ne.Z,{value:P,onChange:w,label:d("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},d("DescriptionInfo"))),M&&a.ZP.createElement("p",{className:"error"},M),n.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},d("GroupInfo.ParticipantCount",n.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},n.map((e=>a.ZP.createElement(Te.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ae.Z,{userId:e}))))))),a.ZP.createElement(tn.Z,{isShown:0!==h.length,onClick:e?N:k,disabled:y,ariaLabel:e?d("ChannelIntro.CreateChannel"):"Create Group"},y?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Va=Object.keys(o.du).length/2,Ha=(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(L.Z,{id:"NewChat",name:f.s0,renderCount:Va,activeKey:n},(s=>{switch(n){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(Ja,{isChannel:t,isActive:e,selectedMemberIds:i,onSelectedMemberIdsChange:l,onNextStep:c,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(_a,{isChannel:t,isActive:s&&e,memberIds:i,onReset:r});default:return}}))}));var Ya=n(1080);const ja=(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(F.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(Ya.Z,{folderType:"archived",isActive:e}))}));var Ka=n(1218);const qa=(0,a.X$)((0,s.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}),((e,t)=>(0,b.ei)(t,["editChatFolders"])))((({isOpen:e,chatId:t,foldersById:n,folderOrderedIds:s,onClose:r,onCloseAnimationEnd:o,editChatFolders:i})=>{const l=(0,u.Z)(),c=(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]),[d,m]=(0,a.eJ)(c),h=(0,a.Ye)((()=>(null==s?void 0:s.map((e=>({label:n?n[e].title:"",value:String(e)}))))||[]),[s,n]),Z=(0,a.I4)((()=>{const e=c.filter((e=>!d.includes(e))).map(Number),n=d.filter((e=>!c.includes(e))).map(Number);i({chatId:t,idsToRemove:e,idsToAdd:n}),r()}),[t,i,c,r,d]);if(n&&s)return a.ZP.createElement(ke.Z,{isOpen:e,onClose:r,onCloseAnimationEnd:o,onEnter:Z,className:"delete",title:l("FilterAddTo")},a.ZP.createElement(Ka.Z,{options:h,selected:d,onChange:m,round:!0}),a.ZP.createElement(F.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:Z},l("FilterAddTo")),a.ZP.createElement(F.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},l("Cancel")))})));var Wa=n(4319),Qa=n(647);function es(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let ts;const ns={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},as=e=>{const t="deltaY"in e?e.deltaY:(e=>"changedTouches"in e?e.changedTouches[0].clientY:0)(e);(!ts||!ts.contains(e.target)||ts.scrollTop<=0&&t<=0||ts.scrollTop>=ts.scrollHeight-ts.offsetHeight&&t>=0)&&e.preventDefault()};function ss(e){ns[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 rs(e){ts=e,document.addEventListener("wheel",as,{passive:!1}),document.addEventListener("touchmove",as,{passive:!1}),document.onkeydown=ss}function os(){ts=void 0,document.removeEventListener("wheel",as),document.removeEventListener("touchmove",as),document.onkeydown=null}var is=n(3394),ls=n(2328);const cs=(0,a.X$)((({isOpen:e,message:t,anchor:n,canSendNow:s,canReschedule:o,canReply:i,canEdit:l,canPin:c,canUnpin:d,canDelete:m,canReport:h,canForward:Z,canFaveSticker:P,canUnfaveSticker:v,canCopy:p,canCopyLink:E,canSelect:C,canDownload:f,isDownloading:b,canShowSeenBy:I,seenByRecentUsers:y,onReply:S,onEdit:w,onPin:k,onUnpin:N,onForward:M,onDelete:T,onReport:F,onFaveSticker:A,onUnfaveSticker:L,onSelect:R,onSend:$,onReschedule:D,onClose:x,onCloseAnimationEnd:U,onCopyLink:O,onDownload:G,onShowSeenBy:z})=>{var X,J;const _=(0,a.sO)(null),V=function(e,t,n){const a=[],s=(0,g.UD)(e),o=(0,g.O$)(e)||((0,g.Cg)(e)?void 0:(0,g.F$)(e)),i=(0,g.Ti)(e,"inline"),l=o&&(i||(0,g.BM)(e))&&Wa.yl,c=window.getSelection();if(l&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(i?Qa.he(i,r.IU.BlobUrl):o.blobUrl).then(Wa.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:es(e),handler:()=>{const n=e&&c?c.toString():s;(0,Wa.TE)(n),t&&t()}})}return n&&a.push({label:"lng_context_copy_message_link",handler:()=>{n(),t&&t()}}),a}(t,x,E?O:void 0),H=(0,a.I4)((()=>document.querySelector(`.Transition__slide--active > .MessageList div[data-message-id="${t.id}"]`)),[t.id]),Y=(0,a.I4)((()=>document.querySelector(".Transition__slide--active > .MessageList")),[]),j=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),{positionX:K,positionY:q,style:W,menuStyle:Q,withScroll:ee}=(0,is.Z)(n,H,Y,j,10,document.querySelector(".MiddleHeader").offsetHeight);(0,a.d4)((()=>(rs(ee?_.current:void 0),os)),[ee]);const te=(0,u.Z)();return a.ZP.createElement(ls.Z,{ref:_,isOpen:e,positionX:K,positionY:q,style:W,menuStyle:Q,className:"MessageContextMenu fluid",onClose:x,onCloseAnimationEnd:U},s&&a.ZP.createElement(B.Z,{icon:"send-outline",onClick:$},te("MessageScheduleSend")),o&&a.ZP.createElement(B.Z,{icon:"schedule",onClick:D},te("MessageScheduleEditTime")),i&&a.ZP.createElement(B.Z,{icon:"reply",onClick:S},te("Reply")),l&&a.ZP.createElement(B.Z,{icon:"edit",onClick:w},te("Edit")),P&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:A},te("AddToFavorites")),v&&a.ZP.createElement(B.Z,{icon:"favorite",onClick:L},te("Stickers.RemoveFromFavorites")),p&&V.map((e=>a.ZP.createElement(B.Z,{key:e.label,icon:"copy",onClick:e.handler},te(e.label)))),c&&a.ZP.createElement(B.Z,{icon:"pin",onClick:k},te("DialogPin")),d&&a.ZP.createElement(B.Z,{icon:"unpin",onClick:N},te("DialogUnpin")),f&&a.ZP.createElement(B.Z,{icon:"download",onClick:G},te(b?"lng_context_cancel_download":"lng_media_download")),Z&&a.ZP.createElement(B.Z,{icon:"forward",onClick:M},te("Forward")),C&&a.ZP.createElement(B.Z,{icon:"select",onClick:R},te("Common.Select")),h&&a.ZP.createElement(B.Z,{icon:"flag",onClick:F},te("lng_context_report_msg")),I&&a.ZP.createElement(B.Z,{icon:"group",onClick:z,disabled:!(null!==(X=t.seenByUserIds)&&void 0!==X&&X.length)},null!==(J=t.seenByUserIds)&&void 0!==J&&J.length?te("Conversation.ContextMenuSeen",t.seenByUserIds.length,"i"):te("Conversation.ContextMenuNoViews"),a.ZP.createElement("div",{className:"avatars"},null==y?void 0:y.map((e=>a.ZP.createElement(ge.Z,{size:"micro",user:e}))))),m&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:T},te("Delete")))})),ds=(0,a.X$)((0,s.c$)(((e,{message:t,messageListType:n})=>{const{threadId:a}=(0,v.Bt)(e)||{},s=(0,v.xs)(e,t.chatId),r=(0,v.Z1)(e,t.chatId),{noOptions:o,canReply:l,canPin:c,canUnpin:d,canDelete:m,canReport:u,canEdit:h,canForward:Z,canFaveSticker:P,canUnfaveSticker:p,canCopy:E,canCopyLink:C,canSelect:f,canDownload:b}=a&&(0,v._k)(e,t,a)||{},I="pinned"===n,y="scheduled"===n;return{noOptions:o,canSendNow:y,canReschedule:y,canReply:!I&&!y&&l,canPin:!y&&c,canUnpin:!y&&d,canDelete:m,canReport:u,canEdit:!I&&h,canForward:!y&&Z,canFaveSticker:!y&&P,canUnfaveSticker:!y&&p,canCopy:E,canCopyLink:!y&&C,canSelect:f,canDownload:b,activeDownloads:s,canShowSeenBy:Boolean(r&&(0,g.Bf)(r)&&(0,g.B4)(t)&&r.membersCount&&r.membersCountDate.now()/1e3-i.EH)}}),((e,t)=>(0,b.ei)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","downloadMessageMedia","cancelMessageMediaDownload","loadSeenBy","openSeenByModal"])))((({isOpen:e,messageListType:t,chatUsername:n,message:r,album:o,anchor:i,onClose:l,onCloseAnimationEnd:c,noOptions:d,canSendNow:m,canReschedule:u,canReply:h,canPin:Z,canUnpin:P,canDelete:g,canReport:v,canEdit:p,canForward:E,canFaveSticker:C,canUnfaveSticker:f,canCopy:b,canCopyLink:I,canSelect:y,canDownload:S,activeDownloads:w,canShowSeenBy:k,setReplyingToId:N,setEditingId:M,pinMessage:T,openForwardMenu:F,faveSticker:A,unfaveSticker:L,toggleMessageSelection:R,sendScheduledMessages:B,rescheduleMessage:$,downloadMessageMedia:D,cancelMessageMediaDownload:x,loadSeenBy:U,openSeenByModal:O})=>{const{transitionClassNames:G}=(0,_.Z)(e,c,void 0,!1),[z,X]=(0,a.eJ)(!0),[J,V]=(0,a.eJ)(!1),[H,Y]=(0,a.eJ)(!1),[j,q]=(0,a.eJ)(!1),[W,Q,ee]=(0,Xe.Z)();(0,a.d4)((()=>{k&&e&&U({chatId:r.chatId,messageId:r.id})}),[U,e,r.chatId,r.id,k]);const te=(0,a.Ye)((()=>{var e;if(!r.seenByUserIds)return;const t=(0,s.Rd)().users.byId;return null===(e=r.seenByUserIds)||void 0===e?void 0:e.slice(0,3).map((e=>t[e])).filter(Boolean)}),[r.seenByUserIds]),ne=o?o.messages.some((e=>w.includes(e.id))):w.includes(r.id),ae=(0,a.I4)((()=>{X(!1),V(!0)}),[]),se=(0,a.I4)((()=>{X(!1),Y(!0)}),[]),re=(0,a.I4)((()=>{X(!1),l()}),[l]),oe=(0,a.I4)((()=>{V(!1),l()}),[l]),ie=(0,a.I4)((()=>{Y(!1),l()}),[l]),le=(0,a.I4)((()=>{q(!1),l()}),[l]),ce=(0,a.I4)((()=>{ee(),l()}),[ee,l]),de=(0,a.I4)((()=>{N({messageId:r.id}),re()}),[N,r.id,re]),me=(0,a.I4)((()=>{M({messageId:r.id}),re()}),[M,r.id,re]),ue=(0,a.I4)((()=>{X(!1),q(!0)}),[]),he=(0,a.I4)((()=>{T({messageId:r.id,isUnpin:!0}),re()}),[T,r.id,re]),Ze=(0,a.I4)((()=>{if(re(),null!=o&&o.messages){const e=o.messages.map((({id:e})=>e));F({fromChatId:r.chatId,messageIds:e})}else F({fromChatId:r.chatId,messageIds:[r.id]})}),[F,r,re,o]),Pe=(0,a.I4)((()=>{re(),A({sticker:r.content.sticker})}),[re,r.content.sticker,A]),ge=(0,a.I4)((()=>{re(),L({sticker:r.content.sticker})}),[re,r.content.sticker,L]),ve=(0,a.I4)((()=>{const e=null!=o&&o.messages?{messageId:r.id,childMessageIds:o.messages.map((({id:e})=>e)),withShift:!1}:{messageId:r.id,withShift:!1};R(e),re()}),[re,r.id,R,o]),pe=(0,a.I4)((()=>{B({chatId:r.chatId,id:r.id}),re()}),[re,r.chatId,r.id,B]),Ee=(0,a.I4)((()=>{X(!1),Q()}),[Q]),Ce=(0,a.I4)((()=>{re(),O({chatId:r.chatId,messageId:r.id})}),[re,r.chatId,r.id,O]),fe=(0,a.I4)((e=>{$({chatId:r.chatId,messageId:r.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[r.chatId,r.id,$]),be=(0,a.I4)((()=>{(0,Wa.TE)(`https://t.me/${n||`c/${r.chatId.replace("-","")}`}/${r.id}`),re()}),[n,re,r.chatId,r.id]),Ie=(0,a.I4)((()=>{((null==o?void 0:o.messages)||[r]).forEach((e=>{ne?x({message:e}):D({message:e})})),re()}),[o,r,re,ne,x,D]),ye=(0,a.Ye)((()=>(o?o.messages:[r]).map((({id:e})=>e))),[o,r]);if(d)return void re();const Se=new Date;return Se.setFullYear(Se.getFullYear()+1),a.ZP.createElement("div",{className:["ContextMenuContainer",G].join(" ")},a.ZP.createElement(cs,{message:r,isOpen:z,anchor:i,canSendNow:m,canReschedule:u,canReply:h,canDelete:g,canReport:v,canPin:Z,canUnpin:P,canEdit:p,canForward:E,canFaveSticker:C,canUnfaveSticker:f,canCopy:b,canCopyLink:I,canSelect:y,canDownload:S,canShowSeenBy:k,isDownloading:ne,seenByRecentUsers:te,onReply:de,onEdit:me,onPin:ue,onUnpin:he,onForward:Ze,onDelete:ae,onReport:se,onFaveSticker:Pe,onUnfaveSticker:ge,onSelect:ve,onSend:pe,onReschedule:Ee,onClose:re,onCopyLink:be,onDownload:Ie,onShowSeenBy:Ce}),a.ZP.createElement(Ke,{isOpen:J,isSchedule:"scheduled"===t,onClose:oe,album:o,message:r}),a.ZP.createElement(nt,{isOpen:H,onClose:ie,messageIds:ye}),a.ZP.createElement(qe,{isOpen:j,messageId:r.id,chatId:r.chatId,onClose:le}),a.ZP.createElement(Ye,{isOpen:W,withTimePicker:!0,selectedAt:1e3*r.date,maxAt:(0,K._F)(Se),isFutureMode:!0,onClose:ce,onSubmit:fe}))}))),ms=(0,a.X$)((0,s.c$)(((e,{fromSticker:t,stickerSetShortName:n})=>{const a=(0,v.Bt)(e),{chatId:s,threadId:r}=a||{},o=s&&(0,v.Z1)(e,s),i=o?(0,g.H5)(o):void 0;return{canSendStickers:Boolean(o&&r&&(0,g.Qm)(o,r)&&(null==i?void 0:i.canSendStickers)),stickerSet:t?(0,v.Ny)(e,t.stickerSetId):n?(0,v.E_)(e,n):void 0}}),((e,t)=>(0,b.ei)(t,["loadStickers","toggleStickerSet","sendMessage"])))((({isOpen:e,fromSticker:t,stickerSetShortName:n,stickerSet:s,canSendStickers:r,onClose:o,loadStickers:l,toggleStickerSet:c,sendMessage:d})=>{const m=(0,a.sO)(null),h=(0,u.Z)(),{observe:Z}=(0,Mn.S1)({rootRef:m,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>{if(e)if(t){const{stickerSetId:e,stickerSetAccessHash:n}=t;l({stickerSetId:e,stickerSetAccessHash:n})}else n&&l({stickerSetShortName:n})}),[e,t,l,n]);const P=(0,a.I4)((e=>{e={...e,isPreloadedGlobally:!0},d({sticker:e}),o()}),[o,d]),g=(0,a.I4)((()=>{s&&(c({stickerSetId:s.id}),o())}),[o,s,c]);return a.ZP.createElement(ke.Z,{className:"StickerSetModal",isOpen:e,onClose:o,hasCloseButton:!0,title:s?(0,Pe.Z)(s.title,["emoji","links"]):h("AccDescrStickerSet")},null!=s&&s.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:m,className:"stickers custom-scroll"},s.stickers.map((e=>a.ZP.createElement(Rn.Z,{sticker:e,size:i.yK,observeIntersection:Z,onClick:r?P:void 0,clickArg:e})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(F.Z,{size:"smaller",fluid:!0,color:s.installedDate?"danger":"primary",onClick:g},h(s.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",s.count,"i")))):a.ZP.createElement(we.Z,null))})));var us=n(2898);const hs=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,v.Z1)(e,t);if(!a||a.isRestricted)return{};const s=(0,g.YC)(a.id),r=s?(0,v.dy)(e,t):void 0,o=r&&(0,g.kw)(r);return{chat:a,isMuted:(0,g.i4)(a,(0,v.dZ)(e),(0,v.NJ)(e)),isPrivate:s,canAddContact:o,canDeleteChat:(0,g.cc)(a),hasLinkedChat:Boolean(null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.linkedChatId)}}),((e,t)=>(0,b.ei)(t,["updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot","joinGroupCall","createGroupCall","openLinkedChat","addContact","openCallFallbackConfirm"])))((({chatId:e,isOpen:t,withExtraActions:n,anchor:s,isChannel:r,canStartBot:o,canRestartBot:i,canSubscribe:l,canSearch:c,canCall:d,canMute:m,canLeave:h,canEnterVoiceChat:Z,canCreateVoiceChat:P,chat:g,isPrivate:v,isMuted:p,canDeleteChat:E,hasLinkedChat:C,canAddContact:b,onSubscribeChannel:I,onSearchClick:y,onClose:S,onCloseAnimationEnd:w,updateChatMutedState:k,enterMessageSelectMode:N,sendBotCommand:M,restartBot:T,joinGroupCall:F,createGroupCall:A,openLinkedChat:L,addContact:R,openCallFallbackConfirm:$})=>{const[D,x]=(0,a.eJ)(!0),[U,O]=(0,a.eJ)(!1),{x:G,y:z}=s;(0,_.Z)(t,w,void 0,!1);const X=(0,a.I4)((()=>{x(!1),O(!0)}),[]),J=(0,a.I4)((()=>{x(!1),S()}),[S]),V=(0,a.I4)((()=>{O(!1),S()}),[S]),H=(0,a.I4)((()=>{M({command:"/start"})}),[M]),Y=(0,a.I4)((()=>{T({chatId:e})}),[e,T]),j=(0,a.I4)((()=>{k({chatId:e,isMuted:!p}),J()}),[e,J,p,k]),K=(0,a.I4)((()=>{P?A({chatId:e}):F({chatId:e}),J()}),[J,P,e,F,A]),q=(0,a.I4)((()=>{L({id:e}),J()}),[e,J,L]),W=(0,a.I4)((()=>{R({userId:e}),J()}),[R,e,J]),Q=(0,a.I4)((()=>{I(),J()}),[J,I]),ee=(0,a.I4)((()=>{$(),J()}),[J,$]),te=(0,a.I4)((()=>{y(),J()}),[J,y]),ne=(0,a.I4)((()=>{N(),J()}),[J,N]);(0,a.d4)((()=>(rs(),os)),[]);const ae=(0,u.Z)();return a.ZP.createElement(us.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(ls.Z,{isOpen:D,positionX:"right",style:`left: ${G}px;top: ${z}px;`,onClose:J},n&&o&&a.ZP.createElement(B.Z,{icon:"bots",onClick:H},ae("BotStart")),n&&i&&a.ZP.createElement(B.Z,{icon:"bots",onClick:Y},ae("BotRestart")),n&&l&&a.ZP.createElement(B.Z,{icon:r?"channel":"group",onClick:Q},ae(r?"ProfileJoinChannel":"ProfileJoinGroup")),b&&a.ZP.createElement(B.Z,{icon:"add-user",onClick:W},ae("AddContact")),f.wB&&d&&a.ZP.createElement(B.Z,{icon:"phone",onClick:ee},ae("Call")),f.wB&&c&&a.ZP.createElement(B.Z,{icon:"search",onClick:te},ae("Search")),m&&a.ZP.createElement(B.Z,{icon:p?"unmute":"mute",onClick:j},ae(p?"ChatsUnmute":"ChatsMute")),(Z||P)&&a.ZP.createElement(B.Z,{icon:"voice-chat",onClick:K},ae(P?"StartVoipChat":"VoipGroupJoinCall")),C&&a.ZP.createElement(B.Z,{icon:r?"comments":"channel",onClick:q},ae(r?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(B.Z,{icon:"select",onClick:ne},ae("ReportSelectMessages")),h&&a.ZP.createElement(B.Z,{destructive:!0,icon:"delete",onClick:X},ae(v?"DeleteChatUser":E?"GroupInfo.DeleteAndExit":r?"LeaveChannel":"Group.LeaveGroup"))),g&&a.ZP.createElement(ct.Z,{isOpen:U,onClose:V,chat:g})))})));var Zs=n(9589);const Ps=(0,G.Ds)((e=>e()),200,!1),gs=(0,a.X$)((0,s.c$)((e=>{const t=(0,v.jr)(e);if(!t)return{};const{query:n,results:a}=(0,v.n5)(e)||{},{totalCount:s,foundIds:r}=a||{};return{chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}),((e,t)=>(0,b.ei)(t,["setLocalTextSearchQuery","searchTextMessagesLocal","focusMessage","closeLocalTextSearch","openHistoryCalendar"])))((({isActive:e,chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:o,setLocalTextSearchQuery:i,searchTextMessagesLocal:l,focusMessage:c,closeLocalTextSearch:d,openHistoryCalendar:m})=>{const u=(0,a.sO)(null),[h,Z]=(0,a.eJ)(0);(0,a.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),n=()=>{const{activeElement:n}=document;if(n&&n===u.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&&r&&r.length?(c({chatId:t.id,messageId:r[r.length-1]}),Z(0)):Z(-1)}),[t,c,r]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((t=>{t.disabled=Boolean(e&&t!==u.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((t=>{t.contentEditable=e?"false":"true"}))}),[e]),(0,a.d4)((()=>{e||u.current.blur()}),[e]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[o]);const P=(0,a.I4)((e=>{i({query:e}),e.length&&Ps(l)}),[l,i]),g=(0,a.I4)((()=>{if(t&&r){const e=h+1;c({chatId:t.id,messageId:r[r.length-1-e]}),Z(e)}}),[t,h,c,r]),v=(0,a.I4)((()=>{if(t&&r){const e=h-1;c({chatId:t.id,messageId:r[r.length-1-e]}),Z(e)}}),[t,h,c,r]);return a.ZP.createElement("div",{id:"MobileSearch",className:e?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(F.Z,{size:"smaller",round:!0,color:"translucent",onClick:d},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(Zs.Z,{ref:u,value:n,onChange:P})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},n?null!=r&&r.length?`${h+1} of ${s}`:r&&!r.length?"No results":"":a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>m({selectedAt:(0,K._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",onClick:g,disabled:!r||!r.length||h===r.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(F.Z,{round:!0,size:"smaller",color:"translucent",onClick:v,disabled:!r||!r.length||0===h},a.ZP.createElement("i",{className:"icon-down"}))))})));var vs=n(5376),ps=n(9295),Es=n(3575),Cs=n(7002),fs=n(3616);function bs(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=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 Is=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&&os[s.length-1]?"start":"end";(0,ys.Z)(a,r[t],e,10)}}var ws=n(3570);function ks({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,ws.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,Qe.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 Ns=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,usersById:s,filteredUsers:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:l}=(0,_.Z)(e,void 0,void 0,!1),c=(0,a.I4)(((e,t=!1)=>{const a=null==s?void 0:s[e];a&&n(a,t)}),[s,n]),d=(0,a.I4)((e=>{c(e.id,!0)}),[c]),m=ks({isActive:e,items:r,onSelect:d,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,a.d4)((()=>{Ss(".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(Te.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>c(e),focus:m===t},a.ZP.createElement(Ae.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var Ms=n(9830);const Ts=(0,a.X$)((({chatId:e,threadId:t,attachments:n,caption:s,isReady:r,currentUserId:o,groupChatMembers:l,usersById:c,recentEmojis:d,baseEmojiKeywords:m,emojiKeywords:h,addRecentEmoji:Z,onCaptionUpdate:g,onSend:v,onFileAppend:p,onClear:C})=>{const f=(0,a.sO)(null),b=(0,P.Z)(n),I=n.length?n:b,y=Boolean(n.length),[S,w,k]=(0,Xe.Z)(),N=Boolean(I&&I.every((e=>e.quick))),M=(0,u.Z)(),{isMentionTooltipOpen:T,closeMentionTooltip:A,insertMention:L,mentionFilteredUsers:R}=(0,ps.Z)(y,s,g,i.nY,l,void 0,o),{isEmojiTooltipOpen:B,closeEmojiTooltip:$,filteredEmojis:D,insertEmoji:x}=(0,Es.Z)(y,s,d,i.nY,g,m,h,!r);(0,a.d4)((()=>y?(0,E.Z)(C):void 0),[y,C]);const U=(0,a.I4)((()=>{y&&v()}),[y,v]),O=(0,a.I4)((e=>{e.preventDefault(),k();const{dataTransfer:{files:t}}=e;if(null!=t&&t.length){const e=N?Array.from(t).filter((e=>e.type&&i.dI.has(e.type))):Array.from(t);p(e,N)}}),[N,p,k]);if(!I)return;const G=I.every((e=>i.oG.has(e.mimeType))),z=I.every((e=>i.wG.has(e.mimeType))),X=I.every((e=>e.mimeType.startsWith("audio/")));let J="";return J=M(G?"PreviewSender.SendPhoto":z?"PreviewSender.SendVideo":X?"PreviewSender.SendAudio":"PreviewSender.SendFile",I.length,"i"),a.ZP.createElement(ke.Z,{isOpen:y,onClose:C,header:function(){if(I)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:M.isRtl?"rtl":void 0},a.ZP.createElement(F.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:C},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},J),a.ZP.createElement(F.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:U},M("Send")))}(),className:"AttachmentModal "+(S?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:w,onDrop:O,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),f.current&&window.clearTimeout(f.current)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(f.current=window.setTimeout(k,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),k())},"data-attach-description":M("Preview.Dragging.AddItems",10)},N?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(Cs.Z,{name:e.filename,extension:(0,vs.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Ns,{isOpen:T,onClose:A,onInsertUserName:L,filteredUsers:R,usersById:c}),a.ZP.createElement(Ms.Z,{isOpen:B,emojis:D,onClose:$,onEmojiSelect:x,addRecentEmoji:Z}),a.ZP.createElement(fs.Z,{id:"caption-input-text",chatId:e,threadId:t,isAttachmentModalInput:!0,html:s,editableInputId:i.nY,placeholder:M("Caption"),onUpdate:g,onSend:v,canAutoFocus:Boolean(r&&n.length)}))))}));var Fs=n(3099);const As=(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),[g,v]=(0,a.eJ)(!1),[p,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(),[I,y]=(0,a.eJ)(!1),S=(0,u.Z)(),w=(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),v(!1),C(""),b(""),y(!1))}),[e]),(0,a.d4)((()=>w(s)),[w,e]),(0,a.bt)((()=>{const e=o.current;e&&p!==e.innerHTML&&(e.innerHTML=p)}),[p]);const k=(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"}))}))}),[]),N=(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?k(a):d(a):k(),void y(!0);if(g&&(!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},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=p&&(0,Fs.Z)(p.substring(0,200))||{};s.quiz={correctAnswers:[f],...e&&{solution:e},...t&&{solutionEntities:t}}}t(s)}),[e,i,c,g,f,m,Z,t,k,p]),M=(0,a.I4)(((e,t)=>{const n=[...c];n[e]=t,n[n.length-1].trim().length&&n.length<10?k(n):d(n)}),[c,k]),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]),L=(0,a.I4)((e=>{h(e.target.checked)}),[]),R=(0,a.I4)((e=>{P(e.target.checked)}),[]),B=(0,a.I4)((e=>{v(e.target.checked)}),[]),$=(0,a.I4)((e=>{13===e.keyCode&&N()}),[N]),D=(0,a.I4)((()=>{if(I&&!i.trim().length)return S("lng_polls_choose_question")}),[I,S,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 S("lng_polls_choose_answers")}),[I,S,c]);function U(){return c.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(Ne.Z,{label:t!==c.length-1||10===c.length?S("OptionHint"):S("CreatePoll.AddOption"),error:x(t),value:e,onChange:e=>M(t,e.currentTarget.value),onKeyPress:$}),t!==c.length-1&&a.ZP.createElement(F.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:S("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(F.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"},S("NewPoll")),a.ZP.createElement(F.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:N},S("Create"))),className:"PollModal"},a.ZP.createElement(Ne.Z,{ref:s,label:S("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"},S("PollOptions")),I&&function(){const e=c.map((e=>e.trim())).filter((e=>e.length));return g&&(!f||!e[Number(f)])&&a.ZP.createElement("p",{className:"error"},S("lng_polls_choose_correct"))}(),g?a.ZP.createElement(tt.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(un.Z,{label:S("PollAnonymous"),checked:m,onChange:L}),a.ZP.createElement(un.Z,{label:S("PollMultiple"),checked:Z,disabled:g,onChange:R}),a.ZP.createElement(un.Z,{label:S("PollQuiz"),checked:g,disabled:Z,onChange:B}),g&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},S("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"},S("CreatePoll.ExplanationInfo")))))}));var Ls=n(6503),Rs=n(4284),Bs=n(1367);const $s=(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"}))})),Ds=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:r,onEmojiSelect:o})=>{const i=(0,a.sO)(null);(0,Mn._N)(i,s);const l=(0,Tn.Z)(r),c=(0,u.Z)(),d=f.wB?Math.floor((I.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($s,{key:s.id,emoji:s,onClick:o})}))))})),xs={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"},Us=[];let Os,Gs,zs;const Xs=(0,a.X$)((0,s.c$)((e=>(0,b.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,Mn.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-",""));Us[n]=e.isIntersecting}));const t=Us.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,ut.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,Bs.Z)(e,t)}),[l,h]);const g=(0,u.Z)(),v=(0,a.Ye)((()=>{if(!l)return ot.D;const e=[...l];return null!=s&&s.length&&e.unshift({id:"recent",name:g("RecentStickers"),emojis:s}),e}),[l,g,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{c(zs.categories),m(zs.emojis)};zs?e():async function(){return Os||(Os=n.e(501).then(n.t.bind(n,7501,19)),Gs=(await Os).default,zs=(0,Rs.NM)(Gs)),Os}().then(e)}),200)}),[]);const p=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,ys.Z)(r.current,t,"start",50,800)}),[]),E=(0,a.I4)(((e,n)=>{t(e,n)}),[t]),C=(0,wt.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:g.isRtl?"rtl":""},v.map((function(e,t){const n=xs[e.id];return n&&a.ZP.createElement(F.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")},v.map(((e,t)=>a.ZP.createElement(Ds,{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))}))),Js=f.wB?8:16,_s=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,observeIntersection:s,shouldRender:r,onStickerSelect:o,onStickerUnfave:l})=>{const c=(0,a.sO)(null);(0,Mn._N)(c,s);const d=(0,Tn.Z)(r),m=f.wB?Math.floor((I.Z.get().width-8)/(i.Q+Js)):5,u=Math.ceil(e.count/m)*(i.Q+Js);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(Rn.Z,{key:n.id,sticker:n,size:i.Q,observeIntersection:s,noAnimate:!t,onClick:o,clickArg:n,onUnfaveClick:"favorite"===e.id?l:void 0})))))})),Vs=[],Hs=(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}}),((e,t)=>(0,b.ei)(t,["loadStickerSets","loadRecentStickers","loadFavoriteStickers","loadAddedStickers","addRecentSticker","unfaveSticker"])))((({className:e,loadAndPlay:t,canSendStickers:n,recentStickers:s,favoriteStickers:r,addedSetIds:o,stickerSetsById:l,shouldPlay:c,onStickerSelect:d,loadStickerSets:m,loadRecentStickers:h,loadFavoriteStickers:Z,loadAddedStickers:P,addRecentSticker:g,unfaveSticker:v})=>{const p=(0,a.sO)(null),E=(0,a.sO)(null),[C,b]=(0,a.eJ)(0),{observe:I}=(0,Mn.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-",""));Vs[n]=e.isIntersecting}));const t=Vs.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&b(t[Math.floor(t.length/2)].index)})),{observe:y}=(0,Mn.S1)({rootRef:E}),S=(0,u.Z)(),w=Boolean(o),k=(0,a.Ye)((()=>o?[{id:"recent",title:S("RecentStickers"),stickers:s,count:s.length},{id:"favorite",title:S("FavoriteStickers"),stickers:r,count:r.length},...o.map((e=>l[e])).filter(Boolean)]:ot.D),[o,S,s,r,l]),N=(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)((()=>{t&&(m(),h(),Z())}),[t,Z,h,m]),(0,a.d4)((()=>{null!=o&&o.length&&P()}),[o,P]),(0,ut.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,Bs.Z)(e,t)}),[w,C]);const M=(0,a.I4)((e=>{b(e);const t=document.getElementById(`sticker-set-${e}`);(0,ys.Z)(p.current,t,"start",void 0,500)}),[]),T=(0,a.I4)((e=>{d(e),g({sticker:e})}),[g,d]),A=(0,a.I4)((e=>{v({sticker:e})}),[v]),L=(0,wt.Z)([],i.Y),R=(0,X.Z)("StickerPicker",e);return w&&L&&!N&&n?a.ZP.createElement("div",{className:R},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(F.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>M(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(An,{stickerSet:e,observeIntersection:y}):a.ZP.createElement(Ln,{stickerSet:e,observeIntersection:y})):a.ZP.createElement(Rn.Z,{key:e.id,sticker:s,size:i.DC,title:e.title,className:r,observeIntersection:y,onClick:M,clickArg:t})}))),a.ZP.createElement("div",{ref:p,className:(0,X.Z)("StickerPicker-main no-selection",f.$b?"no-scrollbar":"custom-scroll")},k.map(((e,n)=>a.ZP.createElement(_s,{key:e.id,stickerSet:e,loadAndPlay:Boolean(c&&t),index:n,observeIntersection:I,shouldRender:C>=n-1&&C<=n+1,onStickerSelect:T,onStickerUnfave:A}))))):a.ZP.createElement("div",{className:R},n?N?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 Ys=n(386);function js(){return(js=Object.assign||function(e){for(var t=1;t{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,Mn.Op)(c,t)&&!n,P=(0,h.Z)(`${u}?size=m`,!Z,r.IU.BlobUrl),g=(0,jn.Z)(null===(l=e.thumbnail)||void 0===l?void 0:l.dataUri,Boolean(P)),v=(0,h.Z)(u,!Z,r.IU.BlobUrl),p=Boolean(Z&&v),{isBuffered:E,bufferingHandlers:C}=(0,V.Z)(!0),f=Z&&!E,b=Z&&E;(0,Y.Z)(d,[p]);const I=(0,a.I4)((()=>o({...e,blobUrl:v})),[o,e,v]),y=(0,X.Z)("GifButton",e.width&&e.height&&e.width({savedGifs:e.gifs.saved.gifs})),((e,t)=>(0,b.ei)(t,["loadSavedGifs"])))((({className:e,loadAndPlay:t,canSendGifs:n,savedGifs:s,onGifSelect:r,loadSavedGifs:o})=>{const l=(0,a.sO)(null),{observe:c}=(0,Mn.S1)({rootRef:l,debounceMs:300});(0,a.d4)((()=>{t&&o()}),[t,o]);const d=(0,wt.Z)([],i.Y);return a.ZP.createElement("div",{ref:l,className:(0,X.Z)("GifPicker",e,f.$b?"no-scrollbar":"custom-scroll")},n?d&&s&&s.length?s.map((e=>a.ZP.createElement(Ks,{key:e.id,gif:e,observeIntersection:c,isDisabled:!t,onClick:r}))):d&&s?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 Ws;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(Ws||(Ws={}));const Qs=Object.values(Ws).filter((e=>"string"==typeof e)),er={[Ws.Emoji]:"icon-smile",[Ws.Stickers]:"icon-stickers",[Ws.GIFs]:"icon-gifs"},tr=(0,a.X$)((({activeTab:e,onSwitchTab:t,onRemoveSymbol:n,onSearchOpen:s})=>{const r=(0,u.Z)();function o(n){return a.ZP.createElement(F.Z,{className:"symbol-tab-button "+(e===n?"activated":""),onClick:()=>t(n),ariaLabel:Qs[n],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:er[n]}))}const i=(0,a.I4)((()=>{s(e===Ws.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!==Ws.Emoji&&a.ZP.createElement(F.Z,{className:"symbol-search-button",ariaLabel:e===Ws.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:i},a.ZP.createElement("i",{className:"icon-search"})),o(Ws.Emoji),o(Ws.Stickers),o(Ws.GIFs),e===Ws.Emoji&&a.ZP.createElement(F.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 nr=!1;const ar=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((({isOpen:e,allowedAttachmentOptions:t,isLeftColumnShown:n,onLoad:s,onClose:r,onEmojiSelect:o,onStickerSelect:i,onGifSelect:l,onRemoveSymbol:c,onSearchOpen:d,addRecentEmoji:m})=>{const[h,Z]=(0,a.eJ)(0),[P,g]=(0,a.eJ)([]),[v,p]=(0,Ls.Z)(e,r,void 0,f.wB),{shouldRender:E,transitionClassNames:C}=(0,_.Z)(e,r,!1,!1);!nr&&e&&(nr=!0),(0,a.d4)((()=>{s()}),[s]),(0,a.bt)((()=>{if(f.wB)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&(0,G.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[e]);const b=(0,a.sO)(P);b.current=P,(0,a.d4)((()=>{b.current.length&&(b.current.forEach((e=>{m({emoji:e})})),g([]))}),[e,h,m]);const I=(0,a.I4)(((e,t)=>{g((e=>[...e,t])),o(e)}),[o]),y=(0,a.I4)((e=>{r(),d(e)}),[r,d]),S=(0,a.I4)((e=>{i(e,!0)}),[i]),w=(0,u.Z)(),{canSendStickers:k,canSendGifs:N}=t;function M(t,n){switch(h){case Ws.Emoji:return a.ZP.createElement(Xs,{className:"picker-tab",onEmojiSelect:I});case Ws.Stickers:return a.ZP.createElement(Hs,{className:"picker-tab",loadAndPlay:!!k&&e&&(t||n),canSendStickers:k,onStickerSelect:S});case Ws.GIFs:return a.ZP.createElement(qs,{className:"picker-tab",loadAndPlay:!!N&&e&&(t||n),canSendGifs:N,onGifSelect:l})}}const T=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},nr&&a.ZP.createElement(L.Z,{name:"slide",activeKey:h,renderCount:Qs.length},M)),f.wB&&a.ZP.createElement(F.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:w("Close"),className:"symbol-close-button",size:"tiny",onClick:r},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(tr,{activeTab:h,onSwitchTab:Z,onRemoveSymbol:c,onSearchOpen:y}));if(f.wB){if(!E)return;const e=(0,X.Z)("SymbolMenu mobile-menu",C,!n&&"middle-column-open");return a.ZP.createElement(us.Z,null,a.ZP.createElement("div",{className:e},T))}return a.ZP.createElement(ls.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SymbolMenu",onCloseAnimationEnd:r,onMouseEnter:f.$b?void 0:v,onMouseLeave:f.$b?void 0:p,noCloseOnBackdrop:!f.$b},T)}))),sr=(0,a.X$)((({isOpen:e,allowedAttachmentOptions:t,onFileSelect:n,onPollCreate:s,onClose:r})=>{const[o,l]=(0,Ls.Z)(e,r),c=(0,a.I4)(((e,t)=>{const{files:a}=e.target;a&&a.length>0&&n(Array.from(a),t)}),[n]),d=(0,a.I4)((()=>{Gn(Array.from(i.dI).join(","),(e=>c(e,!0)))}),[c]),m=(0,a.I4)((()=>{Gn("*",(e=>c(e,!1)))}),[c]),h=(0,u.Z)(),{canAttachMedia:Z,canAttachPolls:P}=t;return a.ZP.createElement(ls.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:r,className:"AttachMenu fluid",onCloseAnimationEnd:r,onMouseEnter:f.$b?void 0:o,onMouseLeave:f.$b?void 0:l,noCloseOnBackdrop:!f.$b},!Z&&a.ZP.createElement(B.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),Z&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(B.Z,{icon:"photo",onClick:d},h("AttachmentMenu.PhotoOrVideo")),a.ZP.createElement(B.Z,{icon:"document",onClick:m},h("AttachDocument"))),P&&a.ZP.createElement(B.Z,{icon:"poll",onClick:s},h("Poll")))})),rr=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:r})=>a.ZP.createElement(Te.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,Pe.Z)(n.description)))))),or=(0,a.X$)((0,s.c$)((e=>({usersById:e.users.byId})),((e,t)=>(0,b.ei)(t,["sendBotCommand"])))((({usersById:e,isOpen:t,withUsername:n,botCommands:s,onClick:r,onClose:o,sendBotCommand:i})=>{const l=(0,a.sO)(null),{shouldRender:c,transitionClassNames:d}=(0,_.Z)(t,void 0,void 0,!1),m=(0,a.I4)((({botId:t,command:a})=>{const s=e[t];i({command:`/${a}${n&&s?`@${s.username}`:""}`,botId:t}),r()}),[r,i,e,n]),u=ks({isActive:t,items:s,onSelect:m,onClose:o});(0,a.d4)((()=>{s&&!s.length&&o()}),[s,o]),(0,a.d4)((()=>{Ss(".chat-item-clickable",u,l)}),[u]);const h=(0,P.Z)(s&&s.length?s:void 0,c),Z=s&&!s.length?h:s;if(!c||Z&&!Z.length)return;const g=(0,X.Z)("BotCommandTooltip composer-tooltip custom-scroll",d);return a.ZP.createElement("div",{className:g,ref:l},Z&&Z.map(((t,n)=>a.ZP.createElement(rr,{key:`${t.botId}_${t.command}`,botCommand:t,bot:e[t.botId],withAvatar:!0,onClick:m,focus:u===n}))))}))),ir=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,b.ei)(t,["sendBotCommand"])))((({isOpen:e,botCommands:t,onClose:n,sendBotCommand:s})=>{const[r,o]=(0,Ls.Z)(e,n,void 0,f.wB),i=(0,a.I4)((e=>{s({command:`/${e.command}`,botId:e.botId}),n()}),[n,s]);return a.ZP.createElement(ls.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:n,className:"BotCommandMenu",onCloseAnimationEnd:n,onMouseEnter:f.$b?void 0:r,onMouseLeave:f.$b?void 0:o,noCloseOnBackdrop:!f.$b},t.map((e=>a.ZP.createElement(rr,{key:e.command,botCommand:e,onClick:i}))))}))),lr=(0,a.X$)((0,s.c$)((e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}}),((e,t)=>(0,b.ei)(t,["clearStickersForEmoji"])))((({isOpen:e,onStickerSelect:t,stickers:n,clearStickersForEmoji:s})=>{const r=(0,a.sO)(null),{shouldRender:o,transitionClassNames:l}=(0,_.Z)(e,void 0,void 0,!1),c=(0,P.Z)(n,!0),d=n||c,{observe:m}=(0,Mn.S1)({rootRef:r,throttleMs:200});(0,a.d4)((()=>e?(0,E.Z)(s):void 0),[e,s]);const u=(0,X.Z)("StickerTooltip composer-tooltip custom-scroll",l,!(null!=d&&d.length)&&"hidden");return a.ZP.createElement("div",{ref:r,className:u,onMouseEnter:f.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:f.$b?void 0:()=>{document.body.classList.remove("no-select")}},o&&d?d.map((e=>a.ZP.createElement(Rn.Z,{key:e.id,sticker:e,size:i.Q,observeIntersection:m,onClick:t,clickArg:e}))):o?a.ZP.createElement(we.Z,null):void 0)}))),cr=(0,a.X$)((({isOpen:e,onSilentSend:t,onScheduleSend:n,onClose:s,onCloseAnimationEnd:r})=>{const[o,i]=(0,Ls.Z)(e,s),l=(0,u.Z)();return a.ZP.createElement(ls.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 dr=n(2420),mr=n(3283),ur=n(2678);const hr=(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)(e,void 0,void 0,!1),c=(0,ur.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=ks({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}=bs(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!Is(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,Bs.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($s,{key:e.id,emoji:e,focus:u===t,onClick:m}))):i?a.ZP.createElement(we.Z,null):void 0)})),Zr=(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,Fn.Xv)(e,1)),a.ZP.createElement(Te.Z,{focus:r,className:"BaseResult chat-item-clickable",onMouseDown:Ys.b,onClick:i},a.ZP.createElement("span",{className:"thumb"},"string"==typeof l?(0,Pe.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)))})),Pr=(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,Tn.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:g,description:v}=n;return a.ZP.createElement(Zr,{focus:e,thumbUrl:d||(null===(r=i)||void 0===r?void 0:r.dataUri)||c,transitionClassNames:m,title:g,description:v,onClick:u})})),gr=(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(Zr,{focus:e,thumbnail:i,title:s||r,description:o,onClick:l})})),vr=(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(Ks,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:r})})),pr=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{sticker:s}=e;if(s)return a.ZP.createElement(Rn.Z,{sticker:s,size:i.zq,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:n,clickArg:e})})),Er=(0,G.P2)((e=>e()),500,!0),Cr=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,b.ei)(t,["startBot","openChat","sendInlineBotResult"])))((({isOpen:e,botId:t,isGallery:n,inlineBotResults:s,switchPm:r,loadMore:i,onClose:l,openChat:c,startBot:d,onSelectResult:m})=>{const u=(0,a.sO)(null),{shouldRender:h,transitionClassNames:Z}=(0,_.Z)(e,void 0,void 0,!1),{observe:g}=(0,Mn.S1)({rootRef:u,debounceMs:200,isDisabled:!e}),v=(0,a.I4)((({direction:e})=>{e===o.Uq.Backwards&&Er(i)}),[i]),p=ks({isActive:e,shouldRemoveSelectionOnReset:n,noArrowNavigation:n,items:s,onSelect:m,onClose:l});(0,a.d4)((()=>{Ss(".chat-item-clickable",p,u)}),[p]);const E=(0,a.I4)((()=>{c({id:t}),d({botId:t,param:r.startParam})}),[t,c,d,r]),C=(0,P.Z)(null!=s&&s.length?s:void 0,h),b=s&&!s.length?C:s;if(!h||!b||!b.length&&!r)return;const I=(0,X.Z)("InlineBotTooltip composer-tooltip",f.$b?"no-scrollbar":"custom-scroll",n&&"gallery",Z);return a.ZP.createElement(Me.Z,{ref:u,className:I,items:b,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:v,sensitiveArea:160},r&&a.ZP.createElement(Te.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:E},a.ZP.createElement("span",{className:"title"},r.text)),b.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(vr,{key:e.id,inlineResult:e,observeIntersection:g,onClick:m});case"photo":return a.ZP.createElement(Pr,{key:e.id,isForGallery:n,inlineResult:e,onClick:m});case"sticker":return a.ZP.createElement(pr,{key:e.id,inlineResult:e,observeIntersection:g,onClick:m});case"video":case"game":return a.ZP.createElement(Pr,{key:e.id,focus:p===t,inlineResult:e,onClick:m});case"article":case"audio":return a.ZP.createElement(gr,{key:e.id,focus:p===t,inlineResult:e,onClick:m});default:return}})))})));var fr=n(6844);const br=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t),a=n&&(0,v.Zw)(e,n.id);if(!n||!a)return{};const{query:s,results:r}=(0,v.n5)(e)||{},{totalCount:o,foundIds:i}=r||{};return{chat:n,messagesById:a,query:s,totalCount:o,foundIds:i}}),((e,t)=>(0,b.ei)(t,["searchTextMessagesLocal","focusMessage"])))((({chatId:e,threadId:t,onClose:n,isActive:r,chat:o,messagesById:i,query:l,totalCount:c,foundIds:d,searchTextMessagesLocal:h,focusMessage:Z})=>{const P=(0,u.Z)(),p=(0,a.Ye)((()=>{if(!(l&&d&&d.length&&i))return ot.D;const n=d.map((n=>{const a=i[n];if(!a)return;const r=a.senderId?(0,v.dy)((0,s.Rd)(),a.senderId):void 0;let l;if(o&&(0,g.eA)(o))l=o;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;l=e&&t?(0,v.Z1)((0,s.Rd)(),t):void 0}else l=a.senderId?(0,v.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,b.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,ye.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(Me.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,g.U)(P,n):(0,g.Js)(t),o=(0,g.MK)(P,e);return a.ZP.createElement(Te.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,Pe.Z)(r)),a.ZP.createElement(fr.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,Pe.Z)(o,["emoji","highlight"],{highlight:l}))))})))})));var Ir=n(9290);const yr=(0,a.X$)((0,s.c$)(((e,{stickerSetId:t})=>({set:(0,v.Ny)(e,t),shouldPlay:(0,v.yB)(e)})),((e,t)=>(0,b.ei)(t,["loadStickers","toggleStickerSet"])))((({stickerSetId:e,observeIntersection:t,set:n,shouldPlay:s,loadStickers:r,toggleStickerSet:o,isSomeModalOpen:l,onModalToggle:c})=>{const d=(0,u.Z)(),m=n&&Boolean(n.installedDate),h=Boolean(null==n?void 0:n.stickers),[Z,P,g]=(0,Xe.Z)();(0,Ir.Z)((()=>{c(Z)}),[Z,c]);const v=(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)((()=>{!h&&v.length<5&&r({stickerSetId:e})}),[h,v.length,r,e]);const p=(0,a.I4)((()=>{o({stickerSetId:e})}),[o,e]);if(!n)return;const E=v.length>0;return a.ZP.createElement("div",{key:n.id,className:"sticker-set",dir:d.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"},d("Stickers",n.count,"i"))),a.ZP.createElement(F.Z,{className:m?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:p},d(m?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!E&&a.ZP.createElement(z.Z,null),E&&v.map((e=>a.ZP.createElement(Rn.Z,{sticker:e,size:i.Y7,observeIntersection:t,noAnimate:!s||Z||l,onClick:P})))),E&&a.ZP.createElement($n.Z,{isOpen:Z,fromSticker:v[0],onClose:g}))}))),Sr=(0,G.P2)((e=>e()),6e4,!0),wr=(0,a.X$)((0,s.c$)((e=>{const t=(0,v.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a}}),((e,t)=>(0,b.ei)(t,["loadFeaturedStickers"])))((({onClose:e,isActive:t,query:n,featuredIds:s,resultIds:r,loadFeaturedStickers:o})=>{const i=(0,a.sO)(null),l=(0,u.Z)(),[c,d]=(0,a.eJ)(!1),{observe:h}=(0,Mn.S1)({rootRef:i,throttleMs:200});return(0,a.d4)((()=>{Sr((()=>{o()}))})),(0,m.ZP)(t,e),a.ZP.createElement("div",{ref:i,className:"StickerSearch custom-scroll",dir:l.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&s?s.map((e=>a.ZP.createElement(yr,{key:e,stickerSetId:e,observeIntersection:h,isSomeModalOpen:c,onModalToggle:d}))):r?r.length?r.map((e=>a.ZP.createElement(yr,{key:e,stickerSetId:e,observeIntersection:h,isSomeModalOpen:c,onModalToggle:d}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(we.Z,null)}())}))),kr=(0,a.X$)((0,s.c$)((e=>{const t=(0,v.yN)(e),{query:n,results:a}=t||{},{chatId:s}=(0,v.Bt)(e)||{},r=s?(0,v.Z1)(e,s):void 0;return{query:n,results:a,chat:r,isChatWithBot:r?(0,v.xo)(e,r):void 0}}),((e,t)=>(0,b.ei)(t,["searchMoreGifs","sendMessage","setGifSearchQuery"])))((({onClose:e,isActive:t,query:n,results:s,chat:r,isChatWithBot:o,searchMoreGifs:i,sendMessage:l,setGifSearchQuery:c})=>{const d=(0,a.sO)(null),{observe:h}=(0,Mn.S1)({rootRef:d,debounceMs:300}),{canSendGifs:Z}=(0,g.H5)(r,o),P=(0,a.I4)((e=>{Z&&l({gif:e}),f.$b&&c({query:void 0})}),[Z,l,c]),v=(0,u.Z)();(0,m.ZP)(t,e);const p=Boolean(void 0!==n&&s&&s.length);return a.ZP.createElement("div",{className:"GifSearch",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(Me.Z,{ref:d,className:(0,X.Z)("gif-container custom-scroll",p&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:i},function(){if(void 0!==n)return s?s.length?s.map((e=>a.ZP.createElement(Ks,{key:e.id,gif:e,observeIntersection:h,onClick:P}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},v("NoGIFsFound")):a.ZP.createElement(we.Z,null)}()))}))),Nr=(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])||""}}),((e,t)=>(0,b.ei)(t,["loadPollOptionResults","openChat","closePollResults"])))((({chat:e,message:t,answer:n,answerVote:s,totalVoters:r,voters:o,offset:i,loadPollOptionResults:l,openChat:c,closePollResults:d})=>{const m=(0,P.Z)(s.votersCount),[h,Z]=(0,a.eJ)(!0),g=Boolean(o),{option:v,text:p}=n,E=(0,u.Z)();(0,a.d4)((()=>{g&&m===s.votersCount||l({chat:e,messageId:t.id,option:v,offset:i,limit:4,shouldResetVoters:!0})}),[s.votersCount,g]);const C=(0,a.I4)((()=>{Z(!0),l({chat:e,messageId:t.id,option:v,offset:i,limit:50})}),[e,l,t.id,i,v]);(0,a.d4)((()=>{Z(!1)}),[o]);const f=(0,a.I4)((e=>{c({id:e}),d()}),[d,c]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},o?o.map((e=>a.ZP.createElement(Te.Z,{key:e,className:"chat-item-clickable",onClick:()=>f(e)},a.ZP.createElement(Ae.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(we.Z,null),o&&function(){const e=s.votersCount-o.length;return s.votersCount>4&&e>0&&a.ZP.createElement(Cn,{count:e,itemName:"voter",isLoading:h,onClick:C})}()),a.ZP.createElement("div",{className:"answer-head",dir:E.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},p),a.ZP.createElement("span",{className:"answer-percent",dir:E.isRtl?"auto":void 0},(b=s.votersCount,(I=r)>0?(b/I*100).toFixed():0),"%")));var b,I}))),Mr=(0,a.X$)((0,s.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,v.Z1)(e,t),message:(0,v.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,g.t9)(s);if(!l.results)return;const c=(0,b.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,Pe.Z)(i.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},r&&i.answers.map((e=>a.ZP.createElement(Nr,{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)))}))),Tr="Please provide first name",Fr=(0,a.X$)((0,s.c$)(((e,{userId:t})=>{const n=(0,v.dy)(e,t),a=(0,v.Z1)(e,t),{progress:s}=e.management;return{user:n,chat:a,progress:s,isMuted:(0,g.i4)(a,(0,v.dZ)(e),(0,v.NJ)(e))}}),((e,t)=>(0,b.ei)(t,["updateContact","deleteUser","closeManagement","openChat","deleteHistory"])))((({userId:e,user:t,chat:n,progress:s,isMuted:r,updateContact:i,deleteUser:l,deleteHistory:c,closeManagement:d,openChat:h,onClose:Z,isActive:P})=>{const[g,v,p]=(0,Xe.Z)(),[E,C]=(0,a.eJ)(!1),[f,b]=(0,a.eJ)(),I=(0,u.Z)();(0,m.ZP)(P,Z);const y=t&&t.firstName||"",S=t&&t.lastName||"",[w,k]=(0,a.eJ)(y),[N,M]=(0,a.eJ)(S),[T,F]=(0,a.eJ)(!r);(0,a.d4)((()=>{F(!r)}),[r]),(0,a.d4)((()=>{C(!1),p()}),[p,e]),(0,a.d4)((()=>{k(y),M(S)}),[y,S,t]),(0,a.d4)((()=>{s===o.wv.Complete&&(C(!1),b(void 0),p())}),[p,s]);const A=(0,a.I4)((e=>{k(e.target.value),C(!0)}),[]),L=(0,a.I4)((e=>{M(e.target.value),C(!0)}),[]),R=(0,a.I4)((e=>{F(e.target.checked),C(!0)}),[]),B=(0,a.I4)((()=>{const t=w.trim(),n=N.trim();t.length||b(Tr),i({userId:e,isMuted:!T,firstName:t,lastName:n})}),[w,N,i,e,T]),$=(0,a.I4)((()=>{c({chatId:n.id,shouldDeleteForAll:!1}),l({userId:e}),p(),d(),h({id:void 0})}),[n.id,p,d,c,l,h,e]);if(!t)return;const D=s===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(Ae.Z,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(Ne.Z,{id:"user-first-name",label:I("UserInfo.FirstNamePlaceholder"),onChange:A,value:w,error:f===Tr?f:void 0}),a.ZP.createElement(Ne.Z,{id:"user-last-name",label:I("UserInfo.LastNamePlaceholder"),onChange:L,value:N}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(un.Z,{checked:T,label:I("Notifications"),subLabel:I(T?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:R}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:v},I("DeleteContact")))),a.ZP.createElement(tn.Z,{isShown:E,onClick:B,disabled:D,ariaLabel:I("Save")},D?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Ge.Z,{isOpen:g,onClose:p,text:I("AreYouSureDeleteContact"),confirmLabel:I("DeleteContact"),confirmHandler:$,confirmIsDestructive:!0}))}))),Ar="Group title can't be empty",Lr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,v.Z1)(e,t),{progress:s}=e.management,r=Boolean(null===(n=a.fullInfo)||void 0===n?void 0:n.linkedChatId),o=(0,g.G9)(a);return{chat:a,progress:s,isBasicGroup:o,hasLinkedChannel:r,canChangeInfo:o?a.isCreator:(0,g.VE)(a,"changeInfo"),canBanUsers:o?a.isCreator:(0,g.VE)(a,"banUsers")}}),((e,t)=>(0,b.ei)(t,["togglePreHistoryHidden","updateChat","closeManagement","leaveChannel","deleteChannel","deleteChat","openChat"])))((({chatId:e,chat:t,progress:n,isBasicGroup:s,hasLinkedChannel:i,canChangeInfo:l,canBanUsers:c,onScreenSelect:d,togglePreHistoryHidden:Z,updateChat:P,deleteChat:v,leaveChannel:p,deleteChannel:E,closeManagement:C,openChat:f,onClose:b,isActive:I})=>{var y,S,w;const[k,N,M]=(0,Xe.Z)(),T=t.title,F=t.fullInfo&&t.fullInfo.about||"",[A,L]=(0,a.eJ)(!1),[R,B]=(0,a.eJ)(T),[$,D]=(0,a.eJ)(F),[x,U]=(0,a.eJ)(),[O,G]=(0,a.eJ)(),X=(0,g.RT)(t),J=(0,h.Z)(X,!1,r.IU.BlobUrl),_=(0,u.Z)();(0,m.ZP)(I,b),(0,a.d4)((()=>{n===o.wv.Complete&&(L(!1),G(void 0))}),[n]);const V=(0,a.I4)((()=>{d(o.u1.ChatPrivacyType)}),[d]),H=(0,a.I4)((()=>{d(o.u1.Discussion)}),[d]),Y=(0,a.I4)((()=>{d(o.u1.GroupPermissions)}),[d]),j=(0,a.I4)((()=>{d(o.u1.ChatAdministrators)}),[d]),K=(0,a.I4)((e=>{U(e),L(!0)}),[]),q=(0,a.I4)((e=>{B(e.target.value),L(!0)}),[]),W=(0,a.I4)((e=>{D(e.target.value),L(!0)}),[]),Q=(0,a.I4)((()=>{const t=R.trim(),n=$.trim();t.length?P({chatId:e,title:t,about:n,photo:x}):G(Ar)}),[$,e,x,R,P]),ee=(0,a.I4)((()=>{d(o.u1.GroupMembers)}),[d]),te=(0,a.I4)((()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;Z({chatId:t.id,isEnabled:!e})}),[t,Z]),ne=(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]),ae=(null===(y=t.fullInfo)||void 0===y||null===(S=y.adminMembers)||void 0===S?void 0:S.length)||0,se=(0,a.I4)((()=>{s?v({chatId:t.id}):t.isCreator?E({chatId:t.id}):p({chatId:t.id}),M(),C(),f({id:void 0})}),[s,t.isCreator,t.id,M,C,p,E,v,f]);if(t.isRestricted)return;const re=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(en.Z,{currentAvatarBlobUrl:J,onChange:K,disabled:!l}),a.ZP.createElement(Ne.Z,{id:"group-title",label:_("GroupName"),onChange:q,value:R,error:O===Ar?O:void 0,disabled:!l}),a.ZP.createElement(Ne.Z,{id:"group-about",className:"mb-2",label:_("DescriptionPlaceholder"),onChange:W,value:$,disabled:!l}),t.isCreator&&a.ZP.createElement(Te.Z,{icon:"lock",multiline:!0,onClick:V},a.ZP.createElement("span",{className:"title"},_("GroupType")),a.ZP.createElement("span",{className:"subtitle"},t.username?_("TypePublic"):_("TypePrivate"))),i&&a.ZP.createElement(Te.Z,{icon:"message",multiline:!0,onClick:H},a.ZP.createElement("span",{className:"title"},_("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},_("DiscussionUnlink"))),a.ZP.createElement(Te.Z,{icon:"permissions",multiline:!0,onClick:Y,disabled:!c},a.ZP.createElement("span",{className:"title"},_("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ne,"/",8)),a.ZP.createElement(Te.Z,{icon:"admin",multiline:!0,onClick:j},a.ZP.createElement("span",{className:"title"},_("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,Fn.kh)(ae)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"group",multiline:!0,onClick:ee},a.ZP.createElement("span",{className:"title"},_("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,Fn.kh)(null!==(w=t.membersCount)&&void 0!==w?w:0))),t.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(un.Z,{checked:!t.fullInfo.isPreHistoryHidden,label:_("ChatHistory"),onChange:te,disabled:!c}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:N},_("DeleteMega")))),a.ZP.createElement(tn.Z,{isShown:A,onClick:Q,disabled:re,ariaLabel:_("Save")},re?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Ge.Z,{isOpen:k,onClose:M,textParts:(0,Pe.Z)(s||!t.isCreator?_("AreYouSureDeleteAndExit"):_("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:s||!t.isCreator?_("DeleteMega"):_("DeleteGroupForAll"),confirmHandler:se,confirmIsDestructive:!0}))}))),Rr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,v.Z1)(e,t),currentUserId:e.currentUserId})),((e,t)=>(0,b.ei)(t,["updateChatDefaultBannedRights"])))((({onScreenSelect:e,onChatMemberSelect:t,chat:n,currentUserId:s,updateChatDefaultBannedRights:r,onClose:i,isActive:l})=>{const[c,d]=(0,a.eJ)({}),[h,Z]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(!1),v=(0,u.Z)();(0,m.ZP)(l,i);const p=(0,a.I4)((()=>{e(o.u1.GroupRemovedUsers)}),[e]),E=(0,a.I4)((()=>{e(o.u1.GroupUserPermissionsCreate)}),[e]),C=(0,a.I4)((n=>{t(n.userId,n.promotedByUserId===s),e(o.u1.GroupUserPermissions)}),[s,t,e]);(0,a.d4)((()=>{d((null==n?void 0:n.defaultBannedRights)||{}),Z(!1),setTimeout((()=>{g(!1)}),250)}),[n]);const f=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}d((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),Z(!0)}),[]),b=(0,a.I4)((()=>{n&&(g(!0),r({chatId:n.id,bannedRights:c}))}),[n,c,r]),I=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.kickedMembers?n.fullInfo.kickedMembers.length:0),[n]),y=(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=v(s);return`${e}${e.length?`, ${r}`:r}`}),"")}),[n,v]);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"},v("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendMessages",checked:!c.sendMessages,label:v("UserRestrictionsSend"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendMedia",checked:!c.sendMedia,label:v("UserRestrictionsSendMedia"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendStickers",checked:!c.sendStickers&&!c.sendGifs,label:v("UserRestrictionsSendStickers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendPolls",checked:!c.sendPolls,label:v("UserRestrictionsSendPolls"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"embedLinks",checked:!c.embedLinks,label:v("UserRestrictionsEmbedLinks"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:v("UserRestrictionsInviteUsers"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"pinMessages",checked:!c.pinMessages,label:v("UserRestrictionsPinMessages"),blocking:!0,onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!c.changeInfo,label:v("UserRestrictionsChangeInfo"),blocking:!0,onChange:f}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:p},a.ZP.createElement("span",{className:"title"},v("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},I))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},v("PrivacyExceptions")),a.ZP.createElement(Te.Z,{icon:"add-user",onClick:E},v("ChannelAddException")),y.map((e=>a.ZP.createElement(Te.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>C(e)},a.ZP.createElement(Ae.Z,{userId:e.userId,status:S(e)})))))),a.ZP.createElement(tn.Z,{isShown:h,onClick:b,ariaLabel:v("Save"),disabled:P},P?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Br=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e;return{currentUserId:t}}),((e,t)=>(0,b.ei)(t,["loadMoreMembers","deleteChatMember"])))((({chat:e,currentUserId:t,isOpen:n,onClose:r,loadMoreMembers:o,deleteChatMember:i})=>{var l;const 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,g.kK)(a,r,d)}),[null===(l=e.fullInfo)||void 0===l?void 0:l.members,t,d]),P=(0,a.I4)((t=>{i({chatId:e.id,userId:t}),r()}),[e.id,i,r]);return a.ZP.createElement(Le,{isOpen:n,chatOrUserIds:Z,filterRef:h,filterPlaceholder:c("ChannelBlockUser"),filter:d,onFilterChange:m,loadMore:o,onSelectChatOrUser:P,onClose:r})}))),$r=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t),{byId:a}=e.users;return{chat:n,usersById:a,canDeleteMembers:n&&((0,g.VE)(n,"banUsers")||n.isCreator)}}),((e,t)=>(0,b.ei)(t,["updateChatMemberBannedRights"])))((({chat:e,usersById:t,canDeleteMembers:n,updateChatMemberBannedRights:s,onClose:r,isActive:o})=>{const i=(0,u.Z)(),[l,c,d]=(0,Xe.Z)();(0,m.ZP)(o,r);const h=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[]),[e]),Z=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const n=t[e.kickedByUserId];return n?i("UserRemovedBy",(0,g.Js)(n)):void 0}),[i,t]),P=(0,a.I4)((t=>{if(e)return[{title:i("Unblock"),icon:"delete",destructive:!0,handler:()=>s({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[i,e,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:i.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},i("NoBlockedGroup2")),h.map((e=>a.ZP.createElement(Te.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:P(e)},a.ZP.createElement(Ae.Z,{userId:e.userId,status:Z(e)})))),n&&a.ZP.createElement(tn.Z,{isShown:!0,onClick:c,ariaLabel:i("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),e&&n&&a.ZP.createElement(Br,{chat:e,isOpen:l,onClose:d}))))}))),Dr="Channel title can't be empty",xr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t),{progress:a}=e.management;return{chat:n,progress:a,isSignaturesShown:Boolean(null==n?void 0:n.isSignaturesShown),canChangeInfo:(0,g.VE)(n,"changeInfo")}}),((e,t)=>(0,b.ei)(t,["toggleSignatures","updateChat","closeManagement","leaveChannel","deleteChannel","openChat"])))((({chatId:e,chat:t,progress:n,isSignaturesShown:s,canChangeInfo:i,onScreenSelect:l,updateChat:c,toggleSignatures:d,closeManagement:Z,leaveChannel:P,deleteChannel:v,openChat:p,onClose:E,isActive:C})=>{var f,b,I,y;const S=t&&t.title||"",w=null!=t&&t.fullInfo&&t.fullInfo.about||"",k=null==t||null===(f=t.fullInfo)||void 0===f?void 0:f.linkedChatId,[N,M,T]=(0,Xe.Z)(),[F,A]=(0,a.eJ)(!1),[L,R]=(0,a.eJ)(S),[B,$]=(0,a.eJ)(w),[D,x]=(0,a.eJ)(),[U,O]=(0,a.eJ)(),G=t&&(0,g.RT)(t),X=(0,h.Z)(G,!1,r.IU.BlobUrl),J=(0,u.Z)();(0,m.ZP)(C,E),(0,a.d4)((()=>{n===o.wv.Complete&&(A(!1),O(void 0))}),[n]);const _=(null==t||null===(b=t.fullInfo)||void 0===b||null===(I=b.adminMembers)||void 0===I?void 0:I.length)||0,V=(0,a.I4)((()=>{l(o.u1.ChatPrivacyType)}),[l]),H=(0,a.I4)((()=>{l(o.u1.Discussion)}),[l]),Y=(0,a.I4)((()=>{l(o.u1.ChatAdministrators)}),[l]),j=(0,a.I4)((e=>{x(e),A(!0)}),[]),K=(0,a.I4)((e=>{R(e.target.value),A(!0)}),[]),q=(0,a.I4)((e=>{$(e.target.value),A(!0)}),[]),W=(0,a.I4)((()=>{const t=L.trim(),n=B.trim();t.length?c({chatId:e,title:t,about:n,photo:D}):O(Dr)}),[B,e,D,L,c]),Q=(0,a.I4)((()=>{d({chatId:e,isEnabled:!s})}),[e,s,d]),ee=(0,a.I4)((()=>{l(o.u1.ChannelSubscribers)}),[l]),te=(0,a.I4)((()=>{t.isCreator?v({chatId:t.id}):P({chatId:t.id}),T(),Z(),p({id:void 0})}),[t.isCreator,t.id,T,Z,P,v,p]);if(t.isRestricted)return;const ne=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(en.Z,{currentAvatarBlobUrl:X,onChange:j,disabled:!i}),a.ZP.createElement(Ne.Z,{id:"channel-title",label:J("EnterChannelName"),onChange:K,value:L,error:U===Dr?U:void 0,disabled:!i}),a.ZP.createElement(Ne.Z,{id:"channel-about",className:"mb-2",label:J("DescriptionPlaceholder"),onChange:q,value:B,disabled:!i}),t.isCreator&&a.ZP.createElement(Te.Z,{icon:"lock",multiline:!0,onClick:V},a.ZP.createElement("span",{className:"title"},J("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},t.username?J("TypePublic"):J("TypePrivate"))),a.ZP.createElement(Te.Z,{icon:"message",multiline:!0,onClick:H,disabled:!i},a.ZP.createElement("span",{className:"title"},J("Discussion")),a.ZP.createElement("span",{className:"subtitle"},J(k?"DiscussionUnlink":"Add"))),a.ZP.createElement(Te.Z,{icon:"admin",multiline:!0,onClick:Y},a.ZP.createElement("span",{className:"title"},J("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},_)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(un.Z,{checked:s,label:J("ChannelSignMessages"),onChange:Q}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"group",multiline:!0,onClick:ee},a.ZP.createElement("span",{className:"title",dir:"auto"},J("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},J("Subscribers",null!==(y=t.membersCount)&&void 0!==y?y:0,"i")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:M},t.isCreator?J("ChannelDelete"):J("LeaveChannel")))),a.ZP.createElement(tn.Z,{isShown:F,onClick:W,disabled:ne,ariaLabel:J("Save")},ne?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Ge.Z,{isOpen:N,onClose:T,text:t.isCreator?J("ChannelDeleteAlert"):J("ChannelLeaveAlert"),confirmLabel:t.isCreator?J("ChannelDelete"):J("LeaveChannel"),confirmHandler:te,confirmIsDestructive:!0}))})));var Ur=n(88);const Or=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t),{isUsernameAvailable:a}=(0,v.aW)(e,t);return{chat:n,isChannel:(0,g.eA)(n),progress:e.management.progress,isUsernameAvailable:a}}),((e,t)=>(0,b.ei)(t,["checkPublicLink","updatePublicLink","updatePrivateLink"])))((({chat:e,onClose:t,isActive:n,isChannel:s,progress:r,isUsernameAvailable:i,checkPublicLink:l,updatePublicLink:c,updatePrivateLink:d})=>{var h;const Z=Boolean(e.username),P=null===(h=e.fullInfo)||void 0===h?void 0:h.inviteLink,[g,v]=(0,a.eJ)(Z?"public":"private"),[p,E]=(0,a.eJ)(),[C,f,b]=(0,Xe.Z)(),I=Boolean("public"===g&&p&&i||"private"===g&&Z);(0,m.ZP)(n,t),(0,a.d4)((()=>{g&&!P&&d()}),[g,P,d]);const y=(0,a.I4)((e=>{v(e)}),[]),S=(0,a.I4)((()=>{c({username:"public"===g?p:""})}),[g,c,p]),w=(0,a.I4)((()=>{b(),d()}),[b,d]),k=(0,u.Z)(),N=s?"Channel":"Mega",M=s?"Channel":"Group",T=[{value:"private",label:k(`${N}Private`),subLabel:k(`${N}PrivateInfo`)},{value:"public",label:k(`${N}Public`),subLabel:k(`${N}PublicInfo`)}],F=r===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:k.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},k(`${M}Type`)),a.ZP.createElement(tt.Z,{selected:g,name:"channel-type",options:T,onChange:y})),"private"===g?a.ZP.createElement("div",{className:"section",dir:k.isRtl?"rtl":void 0},P?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Ur.Z,{url:P,className:"group-link",text:P}),a.ZP.createElement("p",{className:"section-info",dir:k.isRtl?"rtl":void 0},k(`${N}PrivateLinkHelp`)),a.ZP.createElement(Te.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:f},k("RevokeLink")),a.ZP.createElement(Ge.Z,{isOpen:C,onClose:b,text:k("RevokeAlert"),confirmLabel:k("RevokeButton"),confirmHandler:w,confirmIsDestructive:!0})):a.ZP.createElement(we.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(on,{asLink:!0,currentUsername:e.username,isLoading:F,isUsernameAvailable:i,checkUsername:l,onChange:E}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},k(`${M}.Username.CreatePublicLinkHelp`)))),a.ZP.createElement(tn.Z,{isShown:I,disabled:F,ariaLabel:k("Save"),onClick:S},F?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Gr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,v.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,v.Z1)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&(0,g.eA)(a)}}),((e,t)=>(0,b.ei)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"])))((({chat:e,onClose:t,isActive:n,chatId:s,chatsByIds:r,linkedChat:l,forDiscussionIds:c,isChannel:d,onScreenSelect:h,loadGroupsForDiscussion:Z,linkDiscussionGroup:P,unlinkDiscussionGroup:g})=>{const[v,p]=(0,a.eJ)(),[E,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(!1),I=(0,a.I4)((()=>b(!0)),[]),[y,S,w]=(0,Xe.Z)(),[k,N,M]=(0,Xe.Z)(),T=(0,u.Z)(),F=null==l?void 0:l.id;(0,m.ZP)(n,t),(0,a.d4)((()=>{Z()}),[Z]),(0,a.d4)((()=>{E||(0,Pn.Z)("DiscussionGroups").then(C)}),[E]);const A=(0,a.I4)((()=>{w(),g({channelId:d?s:F}),d||h(o.u1.Initial)}),[w,g,d,s,F,h]),L=(0,a.I4)((()=>{M(),P({channelId:s,chatId:v})}),[M,P,s,v]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-icon"},E&&a.ZP.createElement(gn.Z,{id:"discussionGroupsDucks",size:i.bM,animationData:E,play:f,noLoop:!0,onLoad:I})),l&&a.ZP.createElement("div",null,a.ZP.createElement(Te.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Fe.Z,{chatId:l.id})),a.ZP.createElement(Te.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:S},T(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Ge.Z,{isOpen:y,onClose:w,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(ge.Z,{size:"tiny",chat:l}),a.ZP.createElement("div",{className:"modal-title"},T(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,Pe.Z)(T(d?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",l.title),["br","simple_markdown"]),confirmLabel:T(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:A,confirmIsDestructive:!0})),!l&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},T("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Te.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},T("DiscussionCreateGroup")),c?c.map(((e,t)=>a.ZP.createElement(Te.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{p(e),N()}},a.ZP.createElement(Fe.Z,{chatId:e})))):a.ZP.createElement(Et.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},T("DiscussionChannelHelp2")),a.ZP.createElement(Ge.Z,{isOpen:k,onClose:M,header:function(){const e=r[v];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"},T("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const t=r[v];if(t)return t.hasPrivateLink?(0,Pe.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):(0,Pe.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:T("DiscussionLinkGroup"),confirmHandler:L,isButtonsInOneRow:!0})))))}))),zr=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,v.Z1)(e,t);return{chat:a,isFormFullyDisabled:!(a.isCreator||n)}}),((e,t)=>(0,b.ei)(t,["updateChatMemberBannedRights"])))((({chat:e,selectedChatMemberId:t,onScreenSelect:n,updateChatMemberBannedRights:s,isFormFullyDisabled:r,onClose:i,isActive:l})=>{const[c,d]=(0,a.eJ)({}),[h,Z]=(0,a.eJ)(!1),[P,g]=(0,a.eJ)(!1),[v,p,E]=(0,Xe.Z)(),C=(0,u.Z)();(0,m.ZP)(l,i);const f=(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&&!f&&n(o.u1.GroupPermissions)}),[e,n,f,t]),(0,a.d4)((()=>{d((null==f?void 0:f.bannedRights)||(null==e?void 0:e.defaultBannedRights)||{}),Z(!1),g(!1)}),[e,f]);const b=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}d((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),Z(!0)}),[]),I=(0,a.I4)((()=>{e&&t&&(g(!0),s({chatId:e.id,userId:t,bannedRights:c}))}),[e,t,c,s]),y=(0,a.I4)((()=>{e&&t&&s({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})}),[e,t,s]),S=(0,a.I4)((t=>!!r||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t]),[e,r]);if(f)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ae.Z,{userId:f.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},C("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendMessages",checked:!c.sendMessages,label:C("UserRestrictionsSend"),blocking:!0,disabled:S("sendMessages"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendMedia",checked:!c.sendMedia,label:C("UserRestrictionsSendMedia"),blocking:!0,disabled:S("sendMedia"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendStickers",checked:!c.sendStickers&&!c.sendGifs,label:C("UserRestrictionsSendStickers"),blocking:!0,disabled:S("sendStickers"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"sendPolls",checked:!c.sendPolls,label:C("UserRestrictionsSendPolls"),blocking:!0,disabled:S("sendPolls"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"embedLinks",checked:!c.embedLinks,label:C("UserRestrictionsEmbedLinks"),blocking:!0,disabled:S("embedLinks"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:C("UserRestrictionsInviteUsers"),blocking:!0,disabled:S("inviteUsers"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"pinMessages",checked:!c.pinMessages,label:C("UserRestrictionsPinMessages"),blocking:!0,disabled:S("pinMessages"),onChange:b})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!c.changeInfo,label:C("UserRestrictionsChangeInfo"),blocking:!0,disabled:S("changeInfo"),onChange:b}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:p},C("UserRestrictionsBlock")))),a.ZP.createElement(tn.Z,{isShown:h,onClick:I,ariaLabel:C("Save"),disabled:P},P?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Ge.Z,{isOpen:v,onClose:E,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:y,confirmIsDestructive:!0}))}))),Xr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,v.Z1)(e,t),{byId:a}=e.users;return{chat:n,currentUserId:e.currentUserId,isChannel:(0,g.eA)(n),usersById:a}}))((({chat:e,isChannel:t,currentUserId:n,usersById:s,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)((e=>{if(e.isOwner)return d("ChannelCreator");const t=e.promotedByUserId?s[e.promotedByUserId]:void 0;return t?d("EditAdminPromotedBy",(0,g.Js)(t)):d("ChannelAdmin")}),[d,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.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(Te.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>Z(e)},a.ZP.createElement(Ae.Z,{userId:e.userId,status:P(e),forceShowSelf:!0})))))))}))),Jr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,v.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(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.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(un.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllAdmins"),onChange:void 0})),r.map((e=>a.ZP.createElement(Te.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(un.Z,{label:"",checked:!0}),a.ZP.createElement(Ae.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),_r=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,v.Z1)(e,t),{byId:s}=e.users,{currentUserId:r}=e;return{chat:a,usersById:s,currentUserId:r,isChannel:(0,g.eA)(a),isFormFullyDisabled:!(a.isCreator||n)}}),((e,t)=>(0,b.ei)(t,["updateChatAdmin"])))((({selectedChatMemberId:e,onScreenSelect:t,chat:n,usersById:s,currentUserId:r,isChannel:i,isFormFullyDisabled:l,updateChatAdmin:c,onClose:d,isActive:h})=>{const[Z,P]=(0,a.eJ)({}),[v,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(!1),[f,b,I]=(0,Xe.Z)(),[y,S]=(0,a.eJ)(""),w=(0,u.Z)();(0,m.ZP)(h,d);const k=(0,a.Ye)((()=>{if(n.fullInfo&&n.fullInfo.adminMembers)return n.fullInfo.adminMembers.find((({userId:t})=>t===e))}),[n,e]);(0,a.d4)((()=>{null!=n&&n.fullInfo&&e&&!k&&t(o.u1.ChatAdministrators)}),[n,t,k,e]),(0,a.d4)((()=>{P((null==k?void 0:k.adminRights)||{}),S(((null==k?void 0:k.customTitle)||"").substr(0,16)),p(!1),C(!1)}),[k]);const N=(0,a.I4)((e=>{const{name:t}=e.target;P((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),p(!0)}),[]),M=(0,a.I4)((()=>{e&&(C(!0),c({chatId:n.id,userId:e,adminRights:Z,customTitle:y}))}),[n,e,Z,y,c]),T=(0,a.I4)((()=>{e&&(c({chatId:n.id,userId:e,adminRights:{}}),I())}),[n.id,I,e,c]),F=(0,a.I4)((e=>!((0,g.G9)(n)||!l&&n.adminRights&&n.adminRights[e])),[n,l]),A=(0,a.Ye)((()=>{if(!k)return;if(k.isOwner)return w("ChannelCreator");const e=k.promotedByUserId?s[k.promotedByUserId]:void 0;return e?w("EditAdminPromotedBy",(0,g.Js)(e)):w("ChannelAdmin")}),[k,s,w]),L=(0,a.I4)((e=>{const{value:t}=e.target;S(t),p(!0)}),[]);if(k)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Te.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(Ae.Z,{userId:k.userId,status:A,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},w("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"changeInfo",checked:!!Z.changeInfo,label:w(i?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:F("changeInfo"),onChange:N})),i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"postMessages",checked:!!Z.postMessages,label:w("EditAdminPostMessages"),blocking:!0,disabled:F("postMessages"),onChange:N})),i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"editMessages",checked:!!Z.editMessages,label:w("EditAdminEditMessages"),blocking:!0,disabled:F("editMessages"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"deleteMessages",checked:!!Z.deleteMessages,label:w(i?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:F("deleteMessages"),onChange:N})),!i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"banUsers",checked:!!Z.banUsers,label:w("EditAdminBanUsers"),blocking:!0,disabled:F("banUsers"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"inviteUsers",checked:!!Z.inviteUsers,label:w("EditAdminAddUsers"),blocking:!0,disabled:F("inviteUsers"),onChange:N})),!i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"pinMessages",checked:!!Z.pinMessages,label:w("EditAdminPinMessages"),blocking:!0,disabled:F("pinMessages"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"addAdmins",checked:!!Z.addAdmins,label:w("EditAdminAddAdmins"),blocking:!0,disabled:F("addAdmins"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"manageCall",checked:!!Z.manageCall,label:w("StartVoipChatPermission"),blocking:!0,disabled:F("manageCall"),onChange:N})),!i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(un.Z,{name:"anonymous",checked:!!Z.anonymous,label:w("EditAdminSendAnonymously"),blocking:!0,disabled:F("anonymous"),onChange:N})),l&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},w("Channel.EditAdmin.CannotEdit")),!i&&a.ZP.createElement(Ne.Z,{id:"admin-title",label:w("EditAdminRank"),onChange:L,value:y,disabled:l,maxLength:16}),r!==e&&!l&&a.ZP.createElement(Te.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:b},w("EditAdminRemoveAdmin")))),a.ZP.createElement(tn.Z,{isShown:v,onClick:M,ariaLabel:w("Save"),disabled:E},E?a.ZP.createElement(z.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Ge.Z,{isOpen:f,onClose:I,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:T,confirmIsDestructive:!0}))}))),Vr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,v.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,g.eA)(a),serverTimeOffset:e.serverTimeOffset}}),((e,t)=>(0,b.ei)(t,["openUserInfo"])))((({members:e,usersById:t,userStatusesById:n,isChannel:s,openUserInfo:r,onClose:o,isActive:i,serverTimeOffset:l})=>{const c=(0,a.Ye)((()=>{if(e&&t)return(0,g.Z0)(e.map((({userId:e})=>e)),t,n,void 0,l)}),[e,l,t,n]),d=(0,a.I4)((e=>{r({id:e})}),[r]);return(0,m.ZP)(i,o),a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},c?c.map(((e,t)=>a.ZP.createElement(Te.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>d(e)},a.ZP.createElement(Ae.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(Et.Z,{teactOrderKey:0,key:"nothing-found",text:s?"No subscribers found":"No members found"}))))}))),Hr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,v.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,g.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,g.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(Te.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>h(e)},a.ZP.createElement(Ae.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(Et.Z,{teactOrderKey:0,key:"nothing-found",text:s?"No subscribers found":"No members found"}))))}))),Yr=(0,a.X$)((0,s.c$)((e=>({managementType:(0,v.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(Fr,{key:e,userId:e,onClose:l,isActive:c});case"group":return a.ZP.createElement(Lr,{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.GroupRecentActions].includes(t)});case"channel":return a.ZP.createElement(xr,{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.GroupRecentActions].includes(t)})}break;case o.u1.ChatPrivacyType:return a.ZP.createElement(Or,{chatId:e,isActive:c,onClose:l});case o.u1.Discussion:return a.ZP.createElement(Gr,{chatId:e,onScreenSelect:r,isActive:c,onClose:l});case o.u1.GroupPermissions:return a.ZP.createElement(Rr,{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($r,{chatId:e,isActive:c,onClose:l});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(Hr,{chatId:e,onChatMemberSelect:i,onScreenSelect:r,isActive:c||[o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupUserPermissions:return a.ZP.createElement(zr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChatAdministrators:return a.ZP.createElement(Xr,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t),onClose:l});case o.u1.GroupRecentActions:return a.ZP.createElement(Jr,{chatId:e,isActive:c,onClose:l});case o.u1.ChatAdminRights:return a.ZP.createElement(_r,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(Vr,{chatId:e,isActive:c,onClose:l})}})));var jr=n(9937);const Kr=/^4[0-9]{12}(?:[0-9]{1,3})?$/,qr=/^5[1-5][0-9]{11,14}$/,Wr=/^2[2-7][0-9]{11,14}$/;let Qr;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(Qr||(Qr={}));const eo={[Qr.Default]:"",[Qr.Visa]:"visa",[Qr.Mastercard]:"mastercard"};function to(e){return e=e.replace(/\s/g,""),Kr.test(e)?Qr.Visa:qr.test(e)||Wr.test(e)?Qr.Mastercard:Qr.Default}const no={},ao=/(\d{1,3})(\d{1,3})?(\d{1,3})?(\d{1,3})?(\d{1,3})?/,so="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 ao;const t=e[0];let n;if(!no[t]){const e=t.split("").map(Number);n=e.reduce(((e,t,n)=>`${e}(\\d{1,${t}})${n>0?"?":""}`),""),no[t]=new RegExp(`${n}${"()?".repeat(5-e.length)}`)}return no[t]}(e.match(/\d+$/))}))),ro={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},oo=(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:io(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:io(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function io(e){const t=so.find((({id:t})=>t===e));return t?t.name:""}function lo(e,t=400){(0,a.d4)((()=>{f.$b||setTimeout((()=>{(0,G.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const co=(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))})),mo=(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)();lo(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]),g=(0,a.I4)((e=>{o({type:"changeCountry",payload:e.target.value})}),[o]),v=(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(Ne.Z,{ref:i,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:b.streetLine1}),a.ZP.createElement(Ne.Z,{label:"Address2 (Street)",onChange:h,value:e.streetLine2,inputMode:"text",error:b.streetLine2}),a.ZP.createElement(Ne.Z,{label:"City",onChange:Z,value:e.city,inputMode:"text",error:b.city}),a.ZP.createElement(Ne.Z,{label:"State",onChange:P,value:e.state,inputMode:"text",error:b.state}),a.ZP.createElement(co,{label:"Country",placeholder:"Country",onChange:g,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:b.countryIso2,ref:c},so.map((({name:e,id:t})=>a.ZP.createElement("option",{value:t,className:"county-item"},e)))),a.ZP.createElement(Ne.Z,{label:"Post Code",onChange:v,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(Ne.Z,{label:"Full name",onChange:p,value:e.fullName,inputMode:"text",error:b.fullName}),t&&a.ZP.createElement(Ne.Z,{label:"Email",onChange:E,value:e.email,inputMode:"email",error:b.email}),n&&a.ZP.createElement(Ne.Z,{label:"Phone number",onChange:C,value:e.phone,inputMode:"tel",error:b.phone,ref:l}),a.ZP.createElement(un.Z,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:f})))})),uo=(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,jr.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(tt.Z,{name:"shipping-options",options:i,onChange:o,selected:e.shipping})))}));function ho(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,jr.x)(n,s,e)))}function Zo(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 Po=(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:g,shippingMethod:v}=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=>ho(i.code,e.label,e.amount,r))),n&&n.map((e=>ho(i.code,e.label,e.amount,r))),void 0!==o&&ho(i.code,i("Checkout.TotalAmount"),o,r,!0)),a.ZP.createElement("div",{className:"invoice-info"},m&&Zo("icon-card",m,"Payment method"),h&&Zo("stripe-provider",h,"Payment provider"),Z&&Zo("icon-location",Z,"Shipping address"),P&&Zo("icon-user",P,"Name"),g&&Zo("icon-phone",g,"Phone number"),v&&Zo("icon-truck",v,"Shipping method")))})),go=(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(Ne.Z,{label:"Expiry date",ref:s,onChange:o,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}));var vo=n(6352),po=n(5753);const Eo=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null);lo(s);const[r,o]=(0,a.eJ)(Qr.Default);(0,a.d4)((()=>{const t=to(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=to(e.target.value);o(a),n(t),s.current&&(s.current.value=t)}),[n,s]),l=function(e){switch(e){case Qr.Mastercard:return a.ZP.createElement("img",{src:vo,alt:""});case Qr.Visa:return a.ZP.createElement("img",{src:po,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},l),a.ZP.createElement(Ne.Z,{ref:s,label:"Card number",onChange:i,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))})),Co=(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]),g=(0,u.Z)(),{formErrors:v={}}=e;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,g("PaymentCardTitle")),a.ZP.createElement(Eo,{onChange:l,value:e.cardNumber,error:v.cardNumber}),n&&a.ZP.createElement(Ne.Z,{label:"Name on card",onChange:c,value:e.cardholder,inputMode:"text",error:v.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(go,{value:e.expiry,onChange:d,error:v.expiry}),a.ZP.createElement(Ne.Z,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:v.cvv})),s||r?a.ZP.createElement("h5",null,g("PaymentBillingAddress")):void 0,s&&a.ZP.createElement(co,{label:"Country",placeholder:"Country",onChange:h,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:v.billingCountry,ref:i},so.map((({name:e})=>a.ZP.createElement("option",{value:e,className:"county-item"},e)))),r&&a.ZP.createElement(Ne.Z,{label:"Post Code",onChange:Z,value:e.billingZip,inputMode:"text",error:v.billingZip}),t&&a.ZP.createElement(un.Z,{label:g("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:P})))})),fo=(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:g,emailRequested:v,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:g,emailRequested:v,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I,isProviderError:m,invoiceContent:o,needCardholderName:u,needCountry:h,needZip:Z,error:d}}),((e,t)=>(0,b.ei)(t,["validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError"])))((({isOpen:e,onClose:t,step:n,shippingOptions:s,savedInfo:r,canSaveCredentials:i,nameRequested:l,shippingAddressRequested:c,phoneRequested:d,emailRequested:m,phoneToProvider:h,emailToProvider:Z,currency:P,passwordMissing:g,isProviderError:v,invoiceContent:p,nativeProvider:E,prices:C,needCardholderName:f,needCountry:b,needZip:I,error:y,validateRequestedInfo:S,sendPaymentForm:w,setPaymentStep:k,sendCredentialsInfo:N,clearPaymentError:M})=>{const[T,A]=(0,Ht.Z)(oo,ro),[R,B]=(0,a.eJ)(!1),$=(0,u.Z)();(0,a.d4)((()=>{(n||y)&&B(!1)}),[n,y]),(0,a.d4)((()=>{null!=y&&y.field&&A({type:"setFormErrors",payload:{[y.field]:y.message}})}),[y,A]),(0,a.d4)((()=>{if(r){const{name:e,phone:t,email:n,shippingAddress:a}=r;A({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...a||{}}})}}),[r,A]);const D=(0,a.I4)((()=>{M()}),[M]),x=(0,a.Ye)((()=>n!==o.KB.Checkout?0:function(e=[],t,n){const a=t?Io(t,n):[];let s=0;return s=e.concat(a||[]).reduce(((e,t)=>e+t.amount),s),s}(C,s,T.shipping)),[n,T.shipping,C,s]),U=(0,a.Ye)((()=>{if(n===o.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=to(e);return eo[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?bo(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:o,phone:r,shippingMethod:null==i?void 0:i.title}}(T,s,E||"")}),[n,T,s,E]),O=(0,a.I4)((()=>{const{saveInfo:e}=T,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}}}(T);S({requestInfo:t,saveInfo:e})}),[S,T]),G=(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}}}(T);N({credentials:e})}),[N,T]),X=(0,a.I4)((()=>{w({shippingOptionId:T.shipping,saveCredentials:T.saveCredentials})}),[w,T]),J=(0,a.I4)((e=>{k({step:e})}),[k]),_=(0,a.I4)((()=>{switch(B(!0),n){case o.KB.ShippingInfo:return O();case o.KB.Shipping:return J(o.KB.PaymentInfo);case o.KB.PaymentInfo:return G();case o.KB.Checkout:return X();default:return()=>{}}}),[n,O,J,G,X]),V=(0,a.Ye)((()=>{switch(n){case o.KB.ShippingInfo:return $("PaymentShippingInfo");case o.KB.Shipping:return $("PaymentShippingMethod");case o.KB.PaymentInfo:return $("PaymentCardInfo");case o.KB.Checkout:return $("PaymentCheckout");default:return""}}),[n,$]),H=(0,a.Ye)((()=>{switch(n){case o.KB.Checkout:return $("Checkout.PayPrice",(0,jr.x)(x,P,$.code));default:return $("Next")}}),[n,$,P,x]);return v?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(F.Z,{isText:!0,onClick:t},$("OK"))):a.ZP.createElement(ke.Z,{className:"PaymentModal",isOpen:e,onClose:t},a.ZP.createElement("div",{className:"header",dir:$.isRtl?"rtl":void 0},a.ZP.createElement(F.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,V)),void 0!==n?a.ZP.createElement(L.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(mo,{state:T,dispatch:A,needAddress:Boolean(c),needEmail:Boolean(m||Z),needPhone:Boolean(d||h),needName:Boolean(l)});case o.KB.Shipping:return a.ZP.createElement(uo,{state:T,dispatch:A,shippingOptions:s||[],currency:P});case o.KB.PaymentInfo:return a.ZP.createElement(Co,{state:T,dispatch:A,canSaveCredentials:Boolean(!g&&i),needCardholderName:f,needCountry:b,needZip:I});case o.KB.Checkout:return a.ZP.createElement(Po,{prices:C,shippingPrices:T.shipping&&s?Io(s,T.shipping):void 0,totalPrice:x,invoiceContent:p,checkoutInfo:U,currency:P});default:return}}(n)))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(z.Z,{color:"gray"})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(F.Z,{type:"submit",onClick:_,disabled:R,isLoading:R},H)),y&&!y.field&&function(){if(y)return a.ZP.createElement(ke.Z,{className:"error",isOpen:Boolean(y),onClose:D},a.ZP.createElement("h4",null,y.description||"Error"),a.ZP.createElement("p",null,y.description||"Error"),a.ZP.createElement(F.Z,{isText:!0,onClick:M},$("OK")))}())})));function bo(e,t){return e.find((({id:e})=>e===t))}function Io(e,t){const n=bo(e,t);return null==n?void 0:n.prices}const yo=(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(F.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(Po,{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:g})=>{const v=(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((()=>{v.current.focus()}),c)}),[]),(0,a.d4)((()=>{n&&requestAnimationFrame((()=>{v.current.focus(),v.current.select()}))}),[n]),a.ZP.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||f&&g(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:v,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),[g,v]=(0,a.eJ)(!1);(0,a.d4)((()=>{n?setTimeout((()=>v(!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:g?"hidden":"shown",animationData:n,playSegment:l,noLoop:!0,onLoad:p}),u&&a.ZP.createElement(i.Z,{id:"peekMonkey",size:t?s.K2:m,className:g?"shown":"hidden",animationData:u,playSegment:e?c:d,noLoop:!0}))}))},7324:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(6137),s=n(647);const r={MonkeyIdle:n(1679),MonkeyTracking:n(4889),MonkeyClose:n(4185),MonkeyPeek:n(8431),FoldersAll:n(6041),FoldersNew:n(7196),DiscussionGroups:n(4349),CameraFlip:n(6280),HandFilled:n(9129),HandOutline:n(1039),Speaker:n(9261),VoiceAllowTalk:n(2873),VoiceMini:n(7242),VoiceMuted:n(1274),VoiceOutlined:n(973)};function o(e){const t=r[e].replace(window.location.origin,"");return s.he(`file${t}`,a.IU.Lottie)}},710:(e,t,n)=>{n.d(t,{Z:()=>g});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};let u,h,Z;const P=(0,a.X$)((({file:e,onChange:t,onClose:s})=>{const[P,g]=(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((()=>g(!0))))}),[e,P]);const v=(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:v("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),g=(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))}}))}))},4349:(e,t,n)=>{e.exports=n.p+"DiscussionGroupsDucks.9ea453d1be9d1b0ee77a..tgs"},6041:(e,t,n)=>{e.exports=n.p+"FoldersAll.3f9f9e243d19f0fbf9aa..tgs"},7196:(e,t,n)=>{e.exports=n.p+"FoldersNew.9a40d71c0c8be70f5bd1..tgs"},4185:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyClose.604c4c833d322b7e6c3e..tgs"},1679:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyIdle.dea4a492c144df84ddab..tgs"},8431:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyPeek.1905436b042520363d7e..tgs"},4889:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyTracking.eb5a7a6f166fb7589c12..tgs"},6280:(e,t,n)=>{e.exports=n.p+"CameraFlip.1a9fe44cf01fcb22347d..tgs"},9129:(e,t,n)=>{e.exports=n.p+"HandFilled.f87939d160f1dc288586..tgs"},1039:(e,t,n)=>{e.exports=n.p+"HandOutline.f9831751ba60df30c484..tgs"},9261:(e,t,n)=>{e.exports=n.p+"Speaker.04bb3743412b41ff83c5..tgs"},2873:(e,t,n)=>{e.exports=n.p+"VoiceAllowTalk.a9cc7c39ec438973ddc9..tgs"},7242:(e,t,n)=>{e.exports=n.p+"VoiceMini.bf00ffdf69625c579569..tgs"},1274:(e,t,n)=>{e.exports=n.p+"VoiceMuted.a4b4ec6bfd7c6c5fb275..tgs"},973:(e,t,n)=>{e.exports=n.p+"VoiceOutlined.91b394ab3562cdfad6bc..tgs"},6352:(e,t,n)=>{e.exports=n.p+"mastercard.4216118edafe23cc2dec..svg"},5753:(e,t,n)=>{e.exports=n.p+"visa.e5a7c336e1deb4b92a63..svg"}}]); //# sourceMappingURL=477.51d8c60b6925b9015068.js.map