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