telegram-tt/dist/3.86fc6942f17ca54599b3.js
Alexander Zinchuk 0c7add95c8 [Build]
2021-08-05 13:38:03 +03:00

2 lines
258 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{106:function(e,t,a){"use strict";a.r(t),a.d(t,"MediaViewer",(function(){return me})),a.d(t,"ForwardPicker",(function(){return Ce})),a.d(t,"Dialogs",(function(){return Ne})),a.d(t,"Notifications",(function(){return Se})),a.d(t,"SafeLinkModal",(function(){return Fe})),a.d(t,"HistoryCalendar",(function(){return Te})),a.d(t,"CalendarModal",(function(){return Re})),a.d(t,"DeleteMessageModal",(function(){return De})),a.d(t,"PinMessageModal",(function(){return Be})),a.d(t,"UnpinAllMessagesModal",(function(){return Ue})),a.d(t,"MessageSelectToolbar",(function(){return He})),a.d(t,"LeftSearch",(function(){return It})),a.d(t,"Settings",(function(){return mn})),a.d(t,"ContactList",(function(){return hn})),a.d(t,"NewChat",(function(){return On})),a.d(t,"NewChatStep1",(function(){return gn})),a.d(t,"NewChatStep2",(function(){return pn})),a.d(t,"ArchivedChats",(function(){return jn})),a.d(t,"ContextMenuContainer",(function(){return Ln})),a.d(t,"StickerSetModal",(function(){return An})),a.d(t,"HeaderMenuContainer",(function(){return Tn})),a.d(t,"MobileSearch",(function(){return Un})),a.d(t,"AttachmentModal",(function(){return Zn})),a.d(t,"PollModal",(function(){return Xn})),a.d(t,"SymbolMenu",(function(){return ks})),a.d(t,"AttachMenu",(function(){return Ns})),a.d(t,"MentionTooltip",(function(){return Yn})),a.d(t,"StickerTooltip",(function(){return ws})),a.d(t,"BotKeyboardMenu",(function(){return Ss})),a.d(t,"CustomSendMenu",(function(){return Is})),a.d(t,"DropArea",(function(){return Ps.b})),a.d(t,"TextFormatter",(function(){return Fs.a})),a.d(t,"EmojiTooltip",(function(){return Ls})),a.d(t,"InlineBotTooltip",(function(){return xs})),a.d(t,"RightSearch",(function(){return zs})),a.d(t,"StickerSearch",(function(){return $s})),a.d(t,"GifSearch",(function(){return Vs})),a.d(t,"PollResults",(function(){return Ks})),a.d(t,"Management",(function(){return ic})),a.d(t,"PaymentModal",(function(){return Rc})),a.d(t,"ReceiptModal",(function(){return Bc}));var n=a(0),s=a(1),c=a(8),r=a(13),o=a(2),l=a(6),i=a(54),d=a(118),m=a(7),u=a(4),h=a(3),b=a(137),g=a(49),p=a(185),v=a(31),O=a(110),E=a(123),j=a(200),f=a(29),C=a(37),y=a(151);function k(e,t,a,n,s,c){const{mediaEl:l}=P(t,c);if(!l)return;const{width:m}=i.a.get(),{width:u,height:h}=Object(d.l)(e,s),{width:b,height:g}=Object(d.f)(u,h,n.width,n.height),p=(m-b)/2,v=function(e){const t=window.matchMedia(d.c);let a=4.125;e&&(a+=t.matches?.875:3.375);return a*d.d}(e)+(h-g)/2;let{top:O,left:E,width:j,height:f}=l.getBoundingClientRect();if([r.h.SharedMedia,r.h.Album,r.h.ScheduledAlbum,r.h.SearchResult].includes(t)){const e=function(e,t,a,n,s,c){if(e===t){const r=Math.max(s,c)*(e/t);n-=(r-s)/2,a-=(r-c)/2,s=r,c=r}else if(e>t){const a=s;n-=((s=c*(e/t))-a)/2}else if(t>e){const n=c;a-=((c=s*(t/e))-n)/2}return{top:a,left:n,width:s,height:c}}(b,g,O,E,j,f);O=e.top,E=e.left,j=e.width,f=e.height}const C=E+j/2-(p+b/2),y=O+f/2-(v+g/2),k=j/b,N=f/g,S=w(a||l);I(S,{top:v+"px",left:p+"px",width:b+"px",height:g+"px",transform:`translate3d(${C}px, ${y}px, 0) scale(${k}, ${N})`}),F(S,t),document.body.classList.add("ghost-animating"),requestAnimationFrame(()=>{document.body.appendChild(S),requestAnimationFrame(()=>{S.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(S),setTimeout(()=>{requestAnimationFrame(()=>{document.body.contains(S)&&document.body.removeChild(S),document.body.classList.remove("ghost-animating")})},200+o.c)})})}function N(e,t,a){const{container:n,mediaEl:s}=P(e,a);if(!s)return;const c=document.getElementById("MediaViewer").querySelector(".active .media-viewer-content img, .active .media-viewer-content video");if(!c||!s)return;const{top:l,left:d,width:m,height:u}=c.getBoundingClientRect(),{top:h,left:b,width:g,height:p}=s.getBoundingClientRect();let v=h;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:a}=i.a.get();return t.top<=a&&t.top+t.height>=0}(n)){const{height:e}=i.a.get();v=h<l?-p:e}const O=d+m/2-(b+g/2),E=l+u/2-(v+p/2);let j=m/g,f=u/p;const C=[r.h.Inline,r.h.ScheduledInline].includes(e)&&!S(n,s)||[r.h.Album,r.h.ScheduledAlbum].includes(e)&&!S(n,s);[r.h.SharedMedia,r.h.Album,r.h.ScheduledAlbum,r.h.SearchResult].includes(e)&&(j>f?j=f:f>j&&(f=j));const y=document.getElementsByClassName("ghost")[0],k=y||w(t||s,e===r.h.ProfileAvatar);y||I(k,{top:v+"px",left:b+"px",width:g+"px",height:p+"px",transform:`translate3d(${O}px, ${E}px, 0) scale(${j}, ${f})`}),requestAnimationFrame(()=>{if(y){const{top:e,left:t,width:a,height:n}=y.getBoundingClientRect();I(k,{transition:"none",top:v+"px",left:b+"px",transformOrigin:"top left",transform:`translate3d(${t-b}px, ${e-v}px, 0) scale(${a/g}, ${n/p})`,width:g+"px",height:p+"px"})}document.body.classList.add("ghost-animating"),y||document.body.appendChild(k),requestAnimationFrame(()=>{y&&(y.style.transition=""),k.style.transform="",C&&(k.style.opacity="0"),F(k,e),setTimeout(()=>{requestAnimationFrame(()=>{document.body.contains(k)&&document.body.removeChild(k),document.body.classList.remove("ghost-animating")})},200+o.c)})})}function w(e,t=!1){const a=document.createElement("div");a.classList.add("ghost");const n=new Image;if("string"==typeof e?n.src=e:e instanceof HTMLVideoElement?n.src=e.poster:n.src=e.src,a.appendChild(n),t){a.classList.add("ProfileInfo");const e=document.querySelector("#RightColumn .ProfileInfo .info");e&&a.appendChild(e.cloneNode(!0))}return a}function S(e,t){const a=document.querySelector(".active > .MessageList");let n=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(n+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),n>a.scrollTop&&n+t.offsetHeight<a.scrollTop+a.offsetHeight}function I(e,t){Object.assign(e.style,t)}function P(e,t){let a,n;switch(e){case r.h.Album:case r.h.ScheduledAlbum:a=".active > .MessageList #album-media-"+t.id,n=".full-media";break;case r.h.SharedMedia:a="#shared-media"+t.id,n="img";break;case r.h.SearchResult:a="#search-media"+t.id,n="img";break;case r.h.MiddleHeaderAvatar:a=".MiddleHeader .ChatInfo .Avatar",n="img.avatar-media";break;case r.h.ProfileAvatar:a="#RightColumn .ProfileInfo .active .ProfilePhoto",n="img.avatar-media";break;case r.h.ScheduledInline:case r.h.Inline:default:a=".active > .MessageList #message"+t.id,n=".message-content .full-media, .message-content .thumbnail"}const s=document.querySelector(a),c=s&&s.querySelectorAll(n);return{container:s,mediaEl:c&&c[c.length-1]}}function F(e,t){switch(t){case r.h.Album:case r.h.ScheduledAlbum:case r.h.Inline:case r.h.ScheduledInline:e.classList.add("rounded-corners");break;case r.h.SharedMedia:case r.h.ProfileAvatar:case r.h.SearchResult:e.firstChild.style.objectFit="cover";break;case r.h.MiddleHeaderAvatar:e.classList.add("circle")}}var M=a(16),L=a(39),A=a(26),R=a(163),T=a(113),D=a(21),B=a(30),U=a(22),x=a(114);a(267);var G=Object(s.h)((e,{chatId:t,messageId:a,isAvatar:n})=>{if(n&&t)return{sender:Object(u.ob)(t)?Object(m.Jb)(e,t):Object(m.g)(e,t)};if(!a||!t)return{};const s=Object(m.l)(e,t,a);return{message:s,sender:s&&Object(m.vb)(e,s)}},(e,t)=>Object(h.l)(t,["closeMediaViewer","focusMessage"]))(({chatId:e,messageId:t,sender:a,isAvatar:s,message:c,closeMediaViewer:r,focusMessage:o})=>{const l=Object(n.m)(()=>{r(),o({chatId:e,messageId:t})},[e,o,t,r]),i=Object(M.a)();if(!a||!c&&!s)return;const d=a.id<0,m=Object(u.X)(i,a);return n.a.createElement("div",{className:"SenderInfo",onClick:l},d?n.a.createElement(x.a,{key:a.id,size:"medium",chat:a}):n.a.createElement(x.a,{key:a.id,size:"medium",user:a}),n.a.createElement("div",{className:"meta"},n.a.createElement("div",{className:"title",dir:"auto"},m&&Object(U.a)(m)),n.a.createElement("div",{className:"date",dir:"auto"},s?i("lng_mediaview_profile_photo"):Object(B.d)(i,1e3*c.date))))}),z=a(188),q=a(63),_=a(43),H=a(124);a(268);var $=({mediaData:e,isVideo:t,isZoomed:a,message:s,fileName:c,isAvatar:r,onCloseMediaViewer:o,onForward:i,onZoomToggle:d})=>{const{isDownloadStarted:m,downloadProgress:h,handleDownloadClick:b}=Object(z.a)(s&&t?Object(u.E)(s,"download"):void 0,c),g=Object(M.a)(),p=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},n.a.createElement("i",{className:"icon-more"})),[]);return l.l?n.a.createElement("div",{className:"MediaViewerActions-mobile"},n.a.createElement(q.a,{trigger:p,positionX:"right"},!r&&n.a.createElement(_.a,{icon:"forward",onClick:i},g("Forward")),t?n.a.createElement(_.a,{icon:m?"close":"download",onClick:b},m?Math.round(100*h)+"% Downloading...":"Download"):n.a.createElement(_.a,{icon:"download",href:e,download:c},g("AccActionDownload"))),m&&n.a.createElement(H.a,{progress:h,size:"s",noCross:!0})):n.a.createElement("div",{className:"MediaViewerActions"},!r&&n.a.createElement(n.a.Fragment,null,n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("Forward"),onClick:i},n.a.createElement("i",{className:"icon-forward"}))),t?n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("AccActionDownload"),onClick:b},m?n.a.createElement(H.a,{progress:h,size:"s",onClick:b}):n.a.createElement("i",{className:"icon-download"})):n.a.createElement(D.a,{href:e,download:c,round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("AccActionDownload")},n.a.createElement("i",{className:"icon-download"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:a?"Zoom Out":"Zoom In",onClick:d},n.a.createElement("i",{className:a?"icon-zoom-out":"icon-zoom-in"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:g("Close"),onClick:o},n.a.createElement("i",{className:"icon-close"})))},V=a(10),W=a(9);a(269);var K=({text:e="",isHidden:t,isForVideo:a,onClick:s})=>{const[c,r]=Object(n.r)(!1);Object(n.n)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;r(t>2*d.d)};t();const a=Object(V.h)(t,500,!0);return window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[]);const o=Object(W.a)("MediaViewerFooter",a&&"is-for-video",t&&"is-hidden");return n.a.createElement("div",{className:o,onClick:function(t){e&&t.stopPropagation()}},e&&n.a.createElement("div",{className:"media-viewer-footer-content",onClick:l.l?void 0:s},n.a.createElement("p",{className:"media-text custom-scroll "+(c?"multiline":""),dir:"auto"},e)))},Y=a(40),Q=a(141);const Z=function(){if(void 0!==document.fullscreenElement)return"fullscreenElement";if(void 0!==document.mozFullScreenElement)return"mozFullScreenElement";if(void 0!==document.webkitFullscreenElement)return"webkitFullscreenElement";return""}();var J=a(152),X=a(140);const ee=["bytes","kB","MB","GB","TB","PB"];var te=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${ee[t]}`};a(270);const ae=e=>{e.stopPropagation()};var ne=({bufferedProgress:e,currentTime:t,duration:a,fileSize:s,isForceVisible:c,isForceMobileVersion:r,isPlayed:o,isFullscreenSupported:i,isFullscreen:d,onChangeFullscreen:m,onPlayPause:u,onSeek:h})=>{const[b,g]=Object(n.r)(!0);Object(n.n)(()=>{c&&g(c)},[c]),Object(n.n)(()=>{let e;return c||(l.l?g(!1):e=window.setTimeout(()=>{g(!1)},800)),()=>{e&&window.clearTimeout(e)}},[c]),Object(n.n)(()=>((b||c)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[c,b]);const p=Object(M.a)();var v,O;if(b||c)return n.a.createElement("div",{className:"VideoPlayerControls "+(r?"mobile":""),onClick:ae},function(e,t,a,s){const c=e/t*100,r=100*a;return n.a.createElement("div",{className:"player-seekline"},n.a.createElement("div",{className:"player-seekline-track"},n.a.createElement("div",{className:"player-seekline-buffered",style:`width: ${r||0}%`}),n.a.createElement("div",{className:"player-seekline-played",style:`width: ${c||0}%`}),n.a.createElement("input",{min:"0",max:"100",step:.01,type:"range",onInput:s,className:"player-seekline-input",value:c||0})))}(t,a,e,h),n.a.createElement(D.a,{ariaLabel:p("AccActionPlay"),size:"tiny",ripple:!l.l,color:"translucent-white",className:"play",onClick:u},n.a.createElement("i",{className:o?"icon-pause":"icon-play"})),function(e,t){return n.a.createElement("div",{className:"player-time"},`${Object(B.e)(e)} / ${Object(B.e)(t)}`)}(t,a),e<1&&(v=e,O=s,n.a.createElement("div",{className:"player-file-size"},`${te(O*v)} / ${te(O)}`)),i&&n.a.createElement(D.a,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:m},n.a.createElement("i",{className:""+(d?"icon-smallscreen":"icon-fullscreen")})))};a(271);function se(){return(se=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}var ce=Object(n.h)(({url:e,isGif:t,posterData:a,posterSize:s,downloadProgress:c,fileSize:r,isMediaViewerOpen:o,noPlay:i,onClose:d})=>{const m=Object(n.q)(null),[u,h]=Object(n.r)(!l.n||!l.e),[b,g]=Object(n.r)(0),[p,v]=Object(n.r)(!0),[O,E,j]=function(e,t){const[a,s]=Object(n.r)(Boolean(Z&&document[Z]));return Object(n.o)(()=>{const a=()=>{s(Boolean(Z&&document[Z]))},n=()=>{s(!0)},c=()=>{s(!1),t(!1)},r=e.current;return document.addEventListener("fullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),r&&(r.addEventListener("webkitbeginfullscreen",n,!1),r.addEventListener("webkitendfullscreen",c,!1)),()=>{document.removeEventListener("fullscreenchange",a,!1),document.removeEventListener("webkitfullscreenchange",a,!1),document.removeEventListener("mozfullscreenchange",a,!1),r&&(r.removeEventListener("webkitbeginfullscreen",n,!1),r.removeEventListener("webkitendfullscreen",c,!1))}},[]),Z||"iOS"===l.r?[a,()=>{e.current&&(Z||"iOS"===l.r)&&(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]}(m,h),{isBuffered:f,bufferedProgress:C,bufferingHandlers:y}=Object(Q.a)(),{shouldRender:k,transitionClassNames:N}=Object(Y.a)(!f,void 0,void 0,"slow"),{shouldRender:w,transitionClassNames:S}=Object(Y.a)(l.e&&!u&&!k,void 0,void 0,"slow");Object(n.n)(()=>{i||!o?m.current.pause():e&&!l.n&&Object(X.a)(m.current)},[i,o,e]),Object(n.n)(()=>{m.current.currentTime===m.current.duration?(g(0),h(!1)):g(m.current.currentTime)},[b]);const I=Object(n.m)(e=>{e.stopPropagation(),u?(m.current.pause(),h(!1)):(m.current.play(),h(!0))},[u]);Object(J.a)(m,[]);const P=Object(n.m)(()=>{v(!0)},[]),F=Object(n.m)(()=>{v(!1)},[]),M=Object(n.m)(e=>{g(e.currentTarget.currentTime)},[]),L=Object(n.m)(()=>{g(0),h(!1)},[]),A=Object(n.m)(()=>{O&&j?j():!O&&E&&E()},[j,O,E]),R=Object(n.m)(e=>{e.stopPropagation(),m.current.currentTime=Number(e.target.value)*m.current.duration/100},[]),T=Object(n.m)(e=>{e.stopPropagation(),v(!p)},[p]);Object(n.n)(()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),I(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}},[I]);const B=s&&`width: ${s.width}px; height: ${s.height}px`,U=`background-image: url(${a})`;return n.a.createElement("div",{className:"VideoPlayer",onClick:!t&&l.l?T:void 0,onMouseOver:t?void 0:P,onMouseOut:t?void 0:F},n.a.createElement("div",{style:B},n.a.createElement("video",se({ref:m,autoPlay:l.n,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:U,onEnded:L,onClick:l.l?void 0:I,onDoubleClick:A},y,{onTimeUpdate:M}),e&&n.a.createElement("source",{src:e}))),w&&n.a.createElement(D.a,{round:!0,className:"play-button "+S,onClick:I},n.a.createElement("i",{className:"icon-play"})),k&&n.a.createElement("div",{className:["spinner-container",N].join(" ")},!f&&n.a.createElement("div",{className:"buffering"},"Buffering..."),n.a.createElement(H.a,{size:"xl",progress:f?1:c,square:!0,onClick:d})),!t&&!k&&n.a.createElement(ne,{isPlayed:u,bufferedProgress:C,currentTime:b,isFullscreenSupported:Boolean(E),isFullscreen:O,fileSize:r,duration:m.current?m.current.duration:0,isForceVisible:!u||p,isForceMobileVersion:s&&s.width<400,onSeek:R,onChangeFullscreen:A,onPlayPause:I}))});a(272);var re=Object(n.h)(({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:a}=Object(Y.a)(e),s=Object(f.a)(e),c=Object(n.q)(null),[r,o]=Object(n.r)(1),i=Object(n.q)(!1);Object(n.n)(()=>{e&&!s&&o(1.5)},[e,s]);const d=Object(n.m)(()=>{i.current=!0},[]),m=Object(n.m)(()=>{i.current=!1,1===r&&t(r,!i.current)},[t,r]);Object(n.n)(()=>{t(r,!i.current)},[r,t]);const u=Object(M.a)(),h=Object(W.a)("ZoomControls",a);return n.a.createElement("div",{className:h},n.a.createElement(D.a,{disabled:1===r,size:"tiny",color:"translucent-white",ariaLabel:u("ZoomOut"),className:"zoom-out",ripple:!l.l,onClick:()=>{c.current&&o(Math.max(1,r-.5))}},n.a.createElement("i",{className:"icon-zoom-out"})),n.a.createElement(D.a,{disabled:3===r,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!l.l,onClick:()=>{c.current&&o(Math.min(3,r+.5))}},n.a.createElement("i",{className:"icon-zoom-in"})),n.a.createElement("div",{className:"seekline"},n.a.createElement("div",{className:"seekline-track"},n.a.createElement("div",{className:"seekline-played",style:`width: ${50*(r-1)}%`}),n.a.createElement("input",{ref:c,min:1,max:3,step:"0.5",value:r,type:"range",className:"seekline-input",onChange:e=>{o(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:d,onMouseUp:m}))))});a(273);const oe=[1,0,0,1,0,0],le={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5};var ie=Object(n.h)(({children:e,className:t,noWrap:a,canPan:s,zoomLevel:c,panDeltaX:r,panDeltaY:o,onPan:l})=>{const i=le[c]||c,[d,m]=Object(n.r)(!1),[u,b]=Object(n.r)({dx:r,dy:o,x:0,y:0}),[g,p]=Object(n.r)(oe),v=Object(n.q)(null),O=Object(n.q)(null);Object(n.n)(()=>{const e=i||g[0],t=r||g[4],a=o||g[5],n=[...g];g[0]!==e&&(n[0]=e||n[0],n[3]=e||n[3]),g[4]!==t&&(n[4]=t),g[5]!==a&&(n[5]=a),Object(h.a)(g,n)||p(function(e,t,a){const n=a&&a.querySelector(".active img");if(!a||!n)return t;const s=a.getBoundingClientRect(),c=n.getBoundingClientRect(),r=c.width/e*t[0],o=c.height/e*t[3],l=(s.width-r)/2+t[4],i=(s.height-o)/2+t[5];return s.width&&s.width-150<l?t[4]-=l+s.width-150:r&&r+l<150&&(t[4]-=r+l-150),s.height&&s.height-150<i?t[5]-=i+s.height-150:o&&o+i<150&&(t[5]-=o+i-150),t}(g[0],n,v.current))},[r,o,i]),Object(n.n)(()=>{s||p(oe)},[s]),Object(n.n)(()=>{O.current&&(O.current.style.transform=`matrix(${g.toString()})`)},[a,g]);return a?e:n.a.createElement("div",{ref:v,className:"pan-wrapper "+(t||""),onMouseDown:e=>{if(!s)return;e.stopPropagation(),e.preventDefault();const t={dx:g[4],dy:g[5],x:e.pageX,y:e.pageY};b(t),m(!0),v.current&&v.current.classList.add("move")},onMouseUp:()=>{m(!1),v.current&&v.current.classList.remove("move"),l&&l(g[4],g[5])},onMouseMove:e=>{if(d){const t=function(e,t){const a=[...g],n=u.x-e,s=u.y-t;return a[4]=u.dx-n,a[5]=u.dy-s,a}(e.pageX,e.pageY);p(t),O.current&&(O.current.style.transform=`matrix(${g.toString()})`)}}},n.a.createElement("div",{ref:O,className:"pan-container"},e))});a(274);function de(e,t,a){return e?n.a.createElement("img",{src:e,alt:"",style:t?`width: ${t.width}px`:"",draggable:Boolean(a)}):n.a.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},n.a.createElement(A.a,{color:"white"}))}var me=Object(n.h)(Object(s.h)(e=>{const{chatId:t,threadId:a,messageId:n,avatarOwnerId:s,profilePhotoIndex:c,origin:o}=e.mediaViewer,{animationLevel:l}=e.settings.byKey;if(o===r.h.SearchResult){if(!t||!n)return{animationLevel:l};const a=Object(m.l)(e,t,n);return a?{chatId:t,messageId:n,senderId:a.senderId,origin:o,message:a,animationLevel:l}:{animationLevel:l}}if(s){return{messageId:-1,senderId:s,avatarOwner:Object(m.Jb)(e,s)||Object(m.g)(e,s),profilePhotoIndex:c||0,animationLevel:l,origin:o}}if(!(t&&a&&n))return{animationLevel:l};let i,d,u;if(i=o&&[r.h.ScheduledAlbum,r.h.ScheduledInline].includes(o)?Object(m.rb)(e,t,n):Object(m.l)(e,t,n),!i)return{animationLevel:l};if(d=o&&[r.h.ScheduledAlbum,r.h.ScheduledInline].includes(o)?Object(m.sb)(e,t):Object(m.n)(e,t),o===r.h.Inline||o===r.h.Album)u=Object(m.hb)(e,t,a)||Object(m.Z)(e,t,a);else if(o===r.h.SharedMedia){const t=Object(m.w)(e),{foundIds:a}=t&&t.resultsByType&&t.resultsByType.media||{};u=a}return{chatId:t,threadId:a,messageId:n,senderId:i.senderId,origin:o,message:i,chatMessages:d,collectionIds:u,animationLevel:l}},(e,t)=>Object(h.l)(t,["openMediaViewer","closeMediaViewer","openForwardMenu","focusMessage"]))(({chatId:e,threadId:t,messageId:a,senderId:s,origin:m,avatarOwner:h,profilePhotoIndex:w,message:S,chatMessages:I,collectionIds:P,openMediaViewer:F,closeMediaViewer:A,openForwardMenu:B,focusMessage:U,animationLevel:x})=>{const z=Boolean(h||a),q=m===r.h.SharedMedia,_=m===r.h.SearchResult,H=S?Object(u.H)(S):void 0,V=S?Object(u.Q)(S):void 0,W=S?Object(u.S)(S):void 0,Y=S?Object(u.T)(S):void 0,Q=!!S&&Object(u.vb)(S),Z=!!S&&Object(u.wb)(S),J=Boolean(V||Y||Z),X=Boolean(!J&&(H||W||Q)),{isGif:ee}=V||Y||{},te=Boolean(h),ae=Boolean(W||Y),ne=Object(n.p)(()=>ae&&a?[a]:Object(u.h)(I||{},P||[],q),[ae,a,I,P,q]),se=a?ne.indexOf(a):-1,oe=0===se||-1===se,le=se===ne.length-1||-1===se,me=Object(n.q)(),ue=Object(f.a)(s);!z||ue&&ue===s&&me.current||(me.current=se);const he=x>=1?"mv-slide":"none",be=2===x?"slide-fade":"none",ge=2===x,[pe,ve]=Object(n.r)(!1),[Oe,Ee]=Object(n.r)(!1),[je,fe]=Object(n.r)(!1),[Ce,ye]=Object(n.r)(1),[ke,Ne]=Object(n.r)({x:0,y:0});function we(e){if(te&&void 0!==w){const{photos:t}=h;return t&&t[w]?`photo${t[w].id}?size=c`:Object(u.e)(h,e?"big":"normal")}return S&&Object(u.E)(S,e?"viewerFull":"viewerPreview")}const Se=Object(O.a)(S&&(q||_)&&Object(u.E)(S,"pictogram"),void 0,c.ApiMediaFormat.BlobUrl,void 0,ge&&350),Ie=we(),Pe=Object(O.a)(Ie,void 0,te&&Ie&&Ie.startsWith("profilePhoto")?c.ApiMediaFormat.DataUri:c.ApiMediaFormat.BlobUrl,void 0,ge&&350),{mediaData:Fe,downloadProgress:Me}=Object(E.a)(we(!0),void 0,S&&Object(u.D)(S,"viewerFull"),void 0,ge&&350),Le=H||V?(H||V).blobUrl:void 0;let Ae=!J&&(Le||Fe)||Pe||Se;const Re=Object(j.a)(!Ae&&S&&Object(u.F)(S));Ae||m===r.h.SearchResult||(Ae=Re);const Te=S?Object(u.A)(S):void 0,De=S?Object(u.z)(S):te?`avatar${h.id}-${w}.jpg`:void 0;let Be;S?Q||Z?Be=Object(u.y)(S).mediaSize:H||W?Be=Object(u.U)(H||W):(V||Y)&&(Be=Object(u.db)(V||Y)):Be=d.a,Object(n.n)(()=>{l.l&&document.body.classList.toggle("is-media-viewer-open",z)},[z]);const Ue=Object(v.a)();Object(n.n)(()=>{const e=window.matchMedia(d.c);return"function"==typeof e.addEventListener?e.addEventListener("change",Ue):"function"==typeof e.addListener&&e.addListener(Ue),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",Ue):"function"==typeof e.removeListener&&e.removeListener(Ue)}},[Ue]);const xe=Object(f.a)(S),Ge=Object(f.a)(m),ze=Object(f.a)(h),qe=Object(f.a)(Ae);Object(n.n)(()=>{if(ge&&z&&!xe&&!ze){Object(C.d)(350+o.c);const e=S?Object(y.a)(S):void 0;k(Boolean(e),m,Ae,Be,J,S)}ge&&!z&&(xe||ze)&&(Object(C.d)(350+o.c),N(Ge,qe,xe||void 0))},[ge,z,m,Ge,S,xe,ze,Ae,qe,Be,J]),Object(n.n)(()=>{let e;return je?Ee(!0):e=window.setTimeout(()=>{Ee(!1)},350),()=>{e&&window.clearTimeout(e)}},[je]);const _e=()=>{fe(!1),ye(1),Ne({x:0,y:0})},He=Object(n.m)(()=>{fe(!je),ye(je?1:1.5),je&&Ne({x:0,y:0})},[je]),$e=Object(n.m)((e,t=!1)=>{ye(e),1===e&&t&&_e()},[]),Ve=Object(n.m)(()=>{A(),_e()},[A]),We=Object(n.m)(()=>{Ve(),U({chatId:e,threadId:t,messageId:a})},[Ve,e,t,U,a]),Ke=Object(n.m)(()=>{B({fromChatId:e,messageIds:[a]}),_e()},[B,e,a]);Object(n.n)(()=>z?Object(g.a)(()=>{je?_e():Ve()}):void 0,[Ve,z,je]),Object(n.n)(()=>{J&&!ee&&Object(p.b)()},[ee,J]),Object(n.n)(()=>{if(z)return i.a.disableRefresh(),()=>{i.a.enableRefresh()}},[z]);const Ye=Object(n.m)((e,t)=>{let a=ne.indexOf(e);return(-1===t&&a>0||1===t&&a<ne.length-1)&&(a+=t),ne[a]},[ne]),Qe=Object(n.m)(()=>{oe||F({chatId:e,threadId:t,messageId:a?Ye(a,-1):void 0,origin:m})},[e,t,Ye,oe,a,F,m]),Ze=Object(n.m)(()=>{le||F({chatId:e,threadId:t,messageId:a?Ye(a,1):void 0,origin:m})},[e,t,Ye,le,a,F,m]);Object(n.n)(()=>{const e=e=>{switch(e.key){case"Left":case"ArrowLeft":Qe();break;case"Right":case"ArrowRight":Ze()}};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),Object(n.n)(()=>{const e=document.querySelector(".slide-container > .active, .slide-container > .to");if(!e)return;const t=ee&&!l.e;return Object(b.b)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:()=>{je||l.n||Ve()},onSwipe:l.n?(e,t)=>{t===b.a.Right?Qe():t===b.a.Left?Ze():e.target&&e.target.closest(".MediaViewerFooter")||Ve()}:void 0})},[Ve,pe,ee,X,je,Ze,Qe]);const Je=Object(n.m)((e,t)=>{Ne({x:e,y:t})},[]),Xe=Object(n.m)(()=>{l.n&&(X||ee)&&ve(!pe)},[pe,ee,X]),et=Object(M.a)();function tt(t){if(te)return n.a.createElement("div",{key:e,className:"media-viewer-content"},de(Fe||Pe,Object(d.h)(d.a,!1),!l.l&&!je));if(S){const e=Object(y.a)(S),s=Boolean(e);return n.a.createElement("div",{key:a,className:"media-viewer-content "+(s?"has-footer":""),onClick:Xe},X&&de(Le||Fe||Pe||Se,S&&Object(d.h)(Be,s),!l.l&&!je),J&&n.a.createElement(ce,{key:a,url:Le||Fe,isGif:ee,posterData:Ae,posterSize:S&&Object(d.h)(Be,s,!0),downloadProgress:Me,fileSize:Te,isMediaViewerOpen:z,noPlay:!t,onClose:Ve}),e&&n.a.createElement(K,{text:e,onClick:We,isHidden:pe&&(!J||ee),isForVideo:J&&!ee}))}}function at(){return te?n.a.createElement(G,{key:h.id,chatId:h.id,isAvatar:!0}):n.a.createElement(G,{key:a,chatId:e,messageId:a})}return Object(L.a)(z,A,F,{chatId:e,threadId:t,messageId:a,origin:m,avatarOwnerId:h&&h.id}),n.a.createElement(R.a,{id:"MediaViewer",className:je?"zoomed":"",isOpen:z},()=>n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"media-viewer-head",dir:et.isRtl?"rtl":void 0},l.l&&n.a.createElement(D.a,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:et("Close"),onClick:Ve},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(T.a,{activeKey:me.current,name:be},at),n.a.createElement($,{mediaData:Fe||Pe,isVideo:J,isZoomed:je,message:S,fileName:De,onCloseMediaViewer:Ve,onForward:Ke,onZoomToggle:He,isAvatar:te})),n.a.createElement(ie,{noWrap:!Oe,canPan:je,panDeltaX:ke.x,panDeltaY:ke.y,zoomLevel:Ce,onPan:Je},n.a.createElement(T.a,{className:"slide-container",activeKey:se,name:he},tt)),!oe&&n.a.createElement("button",{type:"button",className:"navigation prev "+(J&&!ee&&"inline"),"aria-label":et("AccDescrPrevious"),dir:et.isRtl?"rtl":void 0,onClick:Qe}),!le&&n.a.createElement("button",{type:"button",className:"navigation next "+(J&&!ee&&"inline"),"aria-label":et("Next"),dir:et.isRtl?"rtl":void 0,onClick:Ze}),n.a.createElement(re,{isShown:je,onChangeZoom:$e})))})),ue=a(53),he=a(133),be=a(64),ge=a(20),pe=a(112),ve=a(47),Oe=a(115),Ee=a(108),je=a(111),fe=a(130);a(275);var Ce=Object(n.h)(Object(s.h)(e=>{const{chats:{byId:t,listIds:a,orderedPinnedIds:n},currentUserId:s}=e;return{chatsById:t,pinnedIds:n.active,activeListIds:a.active,archivedListIds:a.archived,currentUserId:s}},(e,t)=>Object(h.l)(t,["setForwardChatId","exitForwardMode","loadMoreChats"]))(({chatsById:e,pinnedIds:t,activeListIds:a,archivedListIds:s,currentUserId:r,isOpen:o,setForwardChatId:i,exitForwardMode:d,loadMoreChats:m})=>{const[b,g]=Object(n.r)(""),p=Object(n.q)(null),v=Object(M.a)();Object(n.n)(()=>{o?l.l||setTimeout(()=>{requestAnimationFrame(()=>{p.current&&p.current.focus()})},500):(p.current&&p.current.blur(),setTimeout(()=>{g("")},300))},[o]);const O=Object(n.p)(()=>{const n=[...a||[],...s||[]];let o=t||[];return r&&(o=Object(h.o)([r,...o])),Object(u.Ib)([...n.filter(t=>{const a=e[t];return!a||!!Object(u.d)(a,c.MAIN_THREAD_ID)&&(!b||Object(ue.a)(Object(u.k)(v,e[t],void 0,t===r),b))})],e,void 0,o)},[a,s,e,r,b,v,t]),[E,j]=Object(he.a)(m,O,Boolean(b)),f=Object(n.m)(e=>{g(e.currentTarget.value)},[]),C=Object(n.q)(null),y=Object(be.a)(C,o,e=>{E&&E.length>0&&i({id:E[-1===e?0:e]})},".ListItem-button",!0),k=n.a.createElement("div",{className:"modal-header",dir:v.isRtl?"rtl":void 0},n.a.createElement(D.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:v("Close"),onClick:d},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(ve.a,{ref:p,value:b,onChange:f,onKeyDown:y,placeholder:v("ForwardTo")}));return n.a.createElement(pe.a,{isOpen:o,onClose:d,className:"ForwardPicker",header:k},E&&E.length?n.a.createElement(Oe.a,{className:"picker-list custom-scroll",items:E,onLoadMore:j,noScrollRestore:Boolean(b),ref:C,onKeyDown:y},E.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>i({id:e})},Object(u.ob)(e)?n.a.createElement(je.a,{status:e===r?v("SavedMessagesInfo"):void 0,userId:e}):n.a.createElement(fe.a,{chatId:e})))):E&&!E.length?n.a.createElement("p",{className:"no-results"},"Sorry, nothing found."):n.a.createElement(ge.a,null))})),ye=a(177);a(276);function ke(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}var Ne=Object(n.h)(Object(s.h)(e=>Object(h.l)(e,["dialogs"]),(e,t)=>Object(h.l)(t,["dismissDialog","acceptInviteConfirmation"]))(({dialogs:e,dismissDialog:t,acceptInviteConfirmation:a})=>{const s=Object(M.a)();if(!e.length)return;return n.a.createElement("div",{id:"Dialogs"},e.map(e=>{return"hash"in e?(e=>{const{hash:c,title:r,participantsCount:o,isChannel:l}=e,i=s(l?"Subscribers":"Members",o,"i"),d=s(l?"ChannelJoin":"JoinGroup");return n.a.createElement(pe.a,{isOpen:!0,onClose:t,className:"error",title:r},void 0!==o&&n.a.createElement("p",null,i),n.a.createElement(D.a,{isText:!0,className:"confirm-dialog-button",onClick:()=>{a({hash:c}),t()}},d),n.a.createElement(D.a,{isText:!0,className:"confirm-dialog-button",onClick:t},s("Cancel")))})(e):(c=e,n.a.createElement(pe.a,{isOpen:!0,onClose:t,className:"error",title:ke(c)},c.hasErrorKey?Object(ye.a)(c):Object(U.a)(c.message,["emoji","br"]),n.a.createElement("div",null,n.a.createElement(D.a,{isText:!0,onClick:t},s("OK")))));var c}))})),we=a(189);var Se=Object(n.h)(Object(s.h)(e=>Object(h.l)(e,["notifications"]),(e,t)=>Object(h.l)(t,["dismissNotification"]))(({notifications:e,dismissNotification:t})=>{if(e.length)return n.a.createElement("div",{id:"Notifications"},e.map(({message:e})=>n.a.createElement(we.a,{message:Object(U.a)(e,["emoji","br","links","simple_markdown"]),onDismiss:t})))})),Ie=a(139),Pe=a(120);var Fe=Object(n.h)(Object(s.h)(void 0,(e,t)=>Object(h.l)(t,["toggleSafeLinkModal"]))(({url:e,toggleSafeLinkModal:t})=>{const a=Object(M.a)(),s=Object(n.m)(()=>{window.open(e),t({url:void 0})},[t,e]),c=Object(n.m)(()=>{t({url:void 0})},[t]),r=Object(Ie.a)(e);return n.a.createElement(Pe.a,{isOpen:Boolean(e),onClose:c,title:a("OpenUrlTitle"),textParts:Object(U.a)(a("OpenUrlAlert2",r),["links"]),confirmLabel:a("OpenUrlTitle"),confirmHandler:s})}));a(277);const Me=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function Le(e,t,a,n,s){const c=new Date(e,t,a,0,0,0,0),r=n&&new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0),o=s&&new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0);return!!(o&&c>o)||!!(r&&c<r)}function Ae(e){return String(e).padStart(2,"0")}var Re=Object(n.h)(({selectedAt:e,maxAt:t,isFutureMode:a,isPastMode:s,isOpen:c,withTimePicker:r,submitButtonLabel:o,secondButtonLabel:l,onClose:i,onSubmit:d,onSecondButtonClick:m})=>{const u=Object(M.a)(),h=new Date,b=Object(n.p)(()=>e?new Date(e):new Date,[e]),g=t?new Date(t):void 0,p=Object(f.a)(c),[v,O]=Object(n.r)(b),[E,j]=Object(n.r)(Ae(b.getHours())),[C,y]=Object(n.r)(Ae(b.getMinutes())),k=v.getFullYear(),N=v.getMonth(),w=v.getDate();Object(n.n)(()=>{!p&&c&&O(b)},[c,b,p]);const S=s&&k>=h.getFullYear()&&N>=h.getMonth()||g&&k>=g.getFullYear()&&N>=g.getMonth(),I=a&&k<=h.getFullYear()&&N<=h.getMonth(),P=Object(n.p)(()=>function(e,t){const a=[],n=new Date;n.setFullYear(e),n.setMonth(t),n.setDate(1);const s=n.getDay()||7;for(let e=1;e<s;e++)a.push(0);for(;n.getMonth()===t;){const e=n.getDate();a.push(e),n.setDate(e+1)}return a}(k,N),[N,k]);const F=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return j(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),23)),n=new Date(v.getTime());n.setHours(a),O(n);const s=Ae(a);j(s),e.target.value=s},[v]),L=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return y(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),59)),n=new Date(v.getTime());n.setMinutes(a),O(n);const s=Ae(a);y(s),e.target.value=s},[v]);return n.a.createElement(pe.a,{isOpen:c,onClose:i,className:"CalendarModal"},n.a.createElement("div",{className:"container"},n.a.createElement("div",{className:"month-selector"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:i},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h4",null,u("lng_month"+(v.getMonth()+1))," ",v.getFullYear()),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",disabled:I,onClick:I?void 0:function(){O(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})}},n.a.createElement("i",{className:"icon-previous"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",disabled:S,onClick:S?void 0:function(){O(e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t})}},n.a.createElement("i",{className:"icon-next"})))),n.a.createElement("div",{className:"calendar-wrapper"},n.a.createElement("div",{className:"calendar-grid"},Me.map(e=>n.a.createElement("div",{className:"day-button faded weekday"},n.a.createElement("span",null,u(e)))),P.map(e=>n.a.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void O(e=>{const a=new Date(e);return a.setDate(t),a});var t},className:Object(W.a)("day-button",Le(k,N,e,a?h:void 0,s?h:g)?"disabled":""+(e?"clickable":""),e===w&&"selected")},!!e&&n.a.createElement("span",null,e))))),r&&n.a.createElement("div",{className:"timepicker"},n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:E,onChange:F}),":",n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:C,onChange:L})),n.a.createElement("div",{className:"footer"},n.a.createElement(D.a,{onClick:function(){d(v)}},r?function(e,t){const a=Object(B.a)(t,e.code),n=Object(B.a)(new Date,e.code);if(a===n)return e("Conversation.ScheduleMessage.SendToday",Object(B.h)(t));return e("Conversation.ScheduleMessage.SendOn",[a,Object(B.h)(t)])}(u,v):o),l&&n.a.createElement(D.a,{onClick:m,isText:!0},l)))});var Te=Object(n.h)(Object(s.h)(e=>({selectedAt:e.historyCalendarSelectedAt}),(e,t)=>Object(h.l)(t,["searchMessagesByDate","closeHistoryCalendar"]))(({isOpen:e,selectedAt:t,searchMessagesByDate:a,closeHistoryCalendar:s})=>{const c=Object(n.m)(e=>{a({timestamp:e.valueOf()/1e3}),s()},[s,a]),r=Object(M.a)();return n.a.createElement(Re,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:s,onSubmit:c})}));var De=Object(n.h)(Object(s.h)((e,{message:t,isSchedule:a})=>{const{threadId:n}=Object(m.z)(e)||{},{canDeleteForAll:s}=n&&Object(m.b)(e,t,n)||{},c=Object(m.g)(e,t.chatId);return{canDeleteForAll:!a&&s,contactName:c&&Object(u.ob)(c.id)?Object(u.ab)(Object(m.Jb)(e,Object(u.W)(c))):void 0,willDeleteForCurrentUserOnly:c&&Object(u.lb)(c)&&!s,willDeleteForAll:c&&Object(u.qb)(c)}},(e,t)=>Object(h.l)(t,["deleteMessages","deleteScheduledMessages"]))(({isOpen:e,isSchedule:t,message:a,album:s,canDeleteForAll:c,contactName:r,willDeleteForCurrentUserOnly:o,willDeleteForAll:l,onClose:i,deleteMessages:d,deleteScheduledMessages:m})=>{const u=Object(n.m)(()=>{const e=s&&s.messages?s.messages.map(({id:e})=>e):[a.id];d({messageIds:e,shouldDeleteForAll:!0}),i()},[d,a.id,i,s]),h=Object(n.m)(()=>{const e=s&&s.messages?s.messages.map(({id:e})=>e):[a.id];t?m({messageIds:e}):d({messageIds:e,shouldDeleteForAll:!1}),i()},[s,a.id,t,i,m,d]),b=Object(M.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:i,onEnter:e&&!c?h:void 0,className:"delete",title:b("DeleteSingleMessagesTitle")},n.a.createElement("p",null,b("AreYouSureDeleteSingleMessage")),o&&n.a.createElement("p",null,b("lng_delete_for_me_chat_hint",1,"i")),l&&n.a.createElement("p",null,b("lng_delete_for_everyone_hint",1,"i")),c&&n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},r&&Object(U.a)(b("Conversation.DeleteMessagesFor",r)),!r&&b("Conversation.DeleteMessagesForEveryone")),n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},b(c?"ChatList.DeleteForCurrentUser":"Delete")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:i},b("Cancel")))}));var Be=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(u.ob)(t),n=Object(m.P)(e,t),s=Object(m.g)(e,t),c=!!s&&Object(u.mb)(s),r=!!s&&Object(u.lb)(s),o=!!s&&Object(u.qb)(s);return{isPrivateChat:a,isChatWithSelf:n,isChannel:c,isGroup:r,isSuperGroup:o,canPinForAll:a&&!n||o||r,contactName:s&&Object(u.ob)(s.id)?Object(u.ab)(Object(m.Jb)(e,Object(u.W)(s))):void 0}},(e,t)=>Object(h.l)(t,["pinMessage"]))(({isOpen:e,messageId:t,chatId:a,isChannel:s,isGroup:c,isSuperGroup:r,canPinForAll:o,contactName:l,onClose:i,pinMessage:d})=>{const m=Object(n.m)(()=>{d({chatId:a,messageId:t,isUnpin:!1}),i()},[d,a,t,i]),u=Object(n.m)(()=>{d({chatId:a,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),i()},[a,t,i,d]),h=Object(M.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:i,className:"pin",title:h("PinMessageAlertTitle")},n.a.createElement("p",null,h(s?"PinMessageAlertChannel":c||r?"PinMessageAlert":"PinMessageAlertChat")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:u},h("DialogPin")),o&&n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:m},l?Object(U.a)(h("Conversation.PinMessagesFor",l)):h("Conversation.PinMessageAlert.PinAndNotifyMembers")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:i},h("Cancel")))}));var Ue=Object(n.h)(({isOpen:e,pinnedMessagesCount:t=0,onClose:a,onUnpin:s})=>{const c=Object(M.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:a,className:"unpin-all",title:c("Chat.PanelUnpinAllMessages")},n.a.createElement("p",null,c("Chat.UnpinAllMessagesConfirmation",t,"i")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:s},c("DialogUnpin")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:a},c("Cancel")))}),xe=a(25),Ge=a(56);var ze=Object(n.h)(Object(s.h)((e,{isSchedule:t})=>{const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:n}=Object(m.e)(e),s=Object(m.s)(e);return{selectedMessageIds:a,canDeleteForAll:!t&&n,contactName:s&&Object(u.ob)(s.id)?Object(u.ab)(Object(m.Jb)(e,Object(u.W)(s))):void 0,willDeleteForCurrentUserOnly:s&&Object(u.lb)(s)&&!n,willDeleteForAll:s&&Object(u.qb)(s)}},(e,t)=>Object(h.l)(t,["deleteMessages","deleteScheduledMessages","exitMessageSelectMode"]))(({isOpen:e,isSchedule:t,selectedMessageIds:a,canDeleteForAll:s,contactName:c,willDeleteForCurrentUserOnly:r,willDeleteForAll:o,onClose:l,deleteMessages:i,deleteScheduledMessages:d,exitMessageSelectMode:m})=>{const u=Object(f.a)(e),h=Object(n.m)(()=>{l(),i({messageIds:a,shouldDeleteForAll:!0})},[i,a,l]),b=Object(n.m)(()=>{t?d({messageIds:a}):i({messageIds:a,shouldDeleteForAll:!1}),l()},[t,l,d,a,i]),g=Object(M.a)();if(Object(n.n)(()=>{!e&&u&&m()},[m,e,u]),a)return n.a.createElement(pe.a,{isOpen:e,onClose:l,onEnter:s?void 0:b,className:"delete",title:g("Conversation.DeleteManyMessages")},n.a.createElement("p",null,g("AreYouSureDeleteFewMessages")),r&&n.a.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),o&&n.a.createElement("p",null,"This will delete them for everyone in this chat."),s&&n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},c?Object(U.a)(g("ChatList.DeleteForEveryone",c)):g("Conversation.DeleteMessagesForEveryone")),n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:b},g(s?"ChatList.DeleteForCurrentUser":"Delete")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:l},g("Cancel")))})),qe=a(126);var _e=Object(n.h)(Object(s.h)(void 0,(e,t)=>Object(h.l)(t,["reportMessages","exitMessageSelectMode"]))(({isOpen:e,messageIds:t,reportMessages:a,exitMessageSelectMode:s,onClose:c})=>{const[r,o]=Object(n.r)("spam"),[l,i]=Object(n.r)(""),d=()=>{a({messageIds:t,reason:r,description:l}),s(),c()},m=Object(n.m)(e=>{o(e)},[]),u=Object(n.m)(e=>{i(e.target.value)},[]),h=Object(M.a)(),b=[{value:"spam",label:h("lng_report_reason_spam")},{value:"violence",label:h("lng_report_reason_violence")},{value:"pornography",label:h("lng_report_reason_pornography")},{value:"childAbuse",label:h("lng_report_reason_child_abuse")},{value:"copyright",label:h("ReportPeer.ReasonCopyright")},{value:"other",label:h("lng_report_reason_other")}];if(t)return n.a.createElement(pe.a,{isOpen:e,onClose:c,onEnter:e?d:void 0,className:"report",title:h("lng_report_message_title")},n.a.createElement(qe.a,{name:"report-message",options:b,onChange:m,selected:r}),n.a.createElement(ve.a,{label:h("lng_report_reason_description"),value:l,onChange:u}),n.a.createElement(D.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d},h("lng_report_button")),n.a.createElement(D.a,{className:"confirm-dialog-button",isText:!0,onClick:c},h("Cancel")))}));a(278);var He=Object(n.h)(Object(s.h)(e=>{const{type:t}=Object(m.z)(e)||{},{canDelete:a}=Object(m.e)(e),n=Object(m.f)(e),{messageIds:s}=e.selectedMessages||{};return{isSchedule:"scheduled"===t,selectedMessagesCount:Object(m.ub)(e),canDeleteMessages:a,canReportMessages:n,selectedMessageIds:s}},(e,t)=>Object(h.l)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages"]))(({canPost:e,isActive:t,messageListType:a,isSchedule:s,selectedMessagesCount:c,canDeleteMessages:r,canReportMessages:o,selectedMessageIds:l,exitMessageSelectMode:i,openForwardMenuForSelectedMessages:d})=>{const[m,u,h]=Object(xe.a)(),[b,g,p]=Object(xe.a)();Object(n.n)(()=>!t||m||b?void 0:Object(Ge.a)({onBackspace:u,onDelete:u,onEsc:i}),[t,m,b,u,i]);const v=Object(f.a)(c||void 0,!0),O=t?c:v,E=Object(M.a)(),j=E("VoiceOver.Chat.MessagesSelected",O),C=Object(W.a)("MessageSelectToolbar",e&&"with-composer",t&&"shown");return n.a.createElement("div",{className:C},n.a.createElement("div",{className:"MessageSelectToolbar-inner"},n.a.createElement(D.a,{color:"translucent",round:!0,onClick:i,ariaLabel:"Exit select mode"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("span",{className:"MessageSelectToolbar-count",title:j},j),!!c&&n.a.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==a&&n.a.createElement(_.a,{icon:"forward",ariaLabel:"Forward Messages",onClick:d},n.a.createElement("span",{className:"item-text"},E("Forward"))),o&&n.a.createElement(_.a,{icon:"flag",onClick:g,disabled:!o,ariaLabel:E("Conversation.ReportMessages")},n.a.createElement("span",{className:"item-text"},E("Report"))),n.a.createElement(_.a,{destructive:!0,icon:"delete",onClick:u,disabled:!r,ariaLabel:E("EditAdminGroupDeleteMessages")},n.a.createElement("span",{className:"item-text"},E("Delete"))))),n.a.createElement(ze,{isOpen:m,isSchedule:s,onClose:h}),n.a.createElement(_e,{isOpen:b,onClose:p,messageIds:l}))})),$e=a(176),Ve=a(51),We=a(179),Ke=e=>{const t=Object(n.q)(null),a=Object(n.m)(a=>{if("Enter"!==a.key)return;t.current===document.activeElement&&e()},[e]);return Object(n.n)(()=>(window.addEventListener("keydown",a,!1),()=>window.removeEventListener("keydown",a)),[a]),t},Ye=a(162);var Qe=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),n=a&&Object(u.W)(a);return{chat:a,privateChatUser:n?Object(m.Jb)(e,n):void 0,isPinned:Object(m.N)(e,t),isMuted:a?Object(u.Hb)(a,Object(m.fb)(e),Object(m.eb)(e)):void 0}})(({chatId:e,chat:t,privateChatUser:a,isPinned:s,isMuted:c,withUsername:r,onClick:o})=>{const[l,i,d]=Object(xe.a)(),m=Object(We.a)({chat:t,privateChatUser:a,isPinned:s,isMuted:c,handleDelete:i}),h=()=>{o(e)},b=Ke(h);if(t)return n.a.createElement(Ee.a,{className:"chat-item-clickable search-result",onClick:h,contextActions:m,buttonRef:b},Object(u.ob)(e)?n.a.createElement(je.a,{userId:e,withUsername:r,avatarSize:"large"}):n.a.createElement(fe.a,{chatId:e,withUsername:r,avatarSize:"large"}),n.a.createElement(Ye.a,{isOpen:l,onClose:d,chat:t}))})),Ze=a(148);a(279);const Je=Object(V.h)(e=>e(),6e4,!0);var Xe=Object(n.h)(Object(s.h)(e=>{const{userIds:t}=e.topPeers,a=e.users.byId,{recentlyFoundChatIds:n}=e.globalSearch;return{topUserIds:t,usersById:a,recentlyFoundChatIds:n}},(e,t)=>Object(h.l)(t,["loadTopUsers","loadContactList","openChat","addRecentlyFoundChatId","clearRecentlyFoundChats"]))(({topUserIds:e,usersById:t,recentlyFoundChatIds:a,onReset:s,loadTopUsers:c,loadContactList:r,openChat:o,addRecentlyFoundChatId:l,clearRecentlyFoundChats:i})=>{const d=Object(n.q)(null);Object(n.n)(()=>{Je(()=>{c(),r()})},[c,r]),Object(Ze.a)(d.current,!e);const m=Object(n.m)(e=>{o({id:e,shouldReplaceHistory:!0}),s(),setTimeout(()=>{l({id:e})},250)},[o,l,s]),h=Object(M.a)();return n.a.createElement("div",{className:"RecentContacts custom-scroll"},e&&n.a.createElement("div",{className:"top-peers-section",dir:h.isRtl?"rtl":void 0},n.a.createElement("div",{ref:d,className:"top-peers no-selection"},e.map(e=>n.a.createElement("div",{className:"top-peer-item",onClick:()=>m(e),dir:h.isRtl?"rtl":void 0},n.a.createElement(x.a,{user:t[e]}),n.a.createElement("div",{className:"top-peer-name"},Object(U.a)(Object(u.ab)(t[e])||" ")))))),a&&n.a.createElement("div",{className:"search-section pt-1"},n.a.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:h.isRtl?"rtl":void 0},h("Recent"),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:i,isRtl:h.isRtl},n.a.createElement("i",{className:"icon-close"}))),a.map(e=>n.a.createElement(Qe,{chatId:e,onClick:m}))))})),et=a(138),tt=a(32);a(280);var at=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t);if(!a)return{};const n=Object(u.W)(a);return{chat:a,lastSyncTime:e.lastSyncTime,...n&&{privateChatUser:Object(m.Jb)(e,n)}}},(e,t)=>Object(h.l)(t,["focusMessage"]))(({message:e,searchQuery:t,chatId:a,chat:s,privateChatUser:c,focusMessage:r,lastSyncTime:o})=>{const i=Object(u.F)(e),d=Object(O.a)(Object(u.E)(e,"micro")),m=Boolean(Object(u.J)(e)),h=Object(n.m)(()=>{r({chatId:a,messageId:e.id})},[a,r,e.id]),b=Object(M.a)(),g=Ke(h);if(s)return n.a.createElement(Ee.a,{className:"ChatMessage chat-item-clickable",ripple:!l.l,onClick:h,buttonRef:g},n.a.createElement(x.a,{chat:s,user:c,withOnlineStatus:!0,isSavedMessages:c&&c.isSelf,lastSyncTime:o}),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"info-row"},n.a.createElement("div",{className:"title"},n.a.createElement("h3",{dir:"auto"},Object(U.a)(Object(u.k)(b,s,c))),s.isVerified&&n.a.createElement(et.a,null)),n.a.createElement("div",{className:"message-date"},n.a.createElement(tt.a,{className:"date"},Object(B.g)(b,1e3*e.date)))),n.a.createElement("div",{className:"subtitle"},n.a.createElement("div",{className:"message",dir:"auto"},function(e,t,a,s,c){if(!a)return Object(U.a)(Object(u.O)(e,t));return n.a.createElement("span",{className:"media-preview"},n.a.createElement("img",{src:a,alt:"",className:c?"round":void 0}),Object(u.Q)(t)&&n.a.createElement("i",{className:"icon-play"}),Object(U.a)(Object(u.O)(e,t,!0),["emoji","highlight"],{highlight:s}))}(b,e,d||i,t,m)))))}));a(281);var nt=Object(n.h)(({searchDate:e,onSelect:t})=>{const a=Object(n.p)(()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:Object(B.a)(t)}]}const t=[],a=new Date,n=a.getFullYear(),s=a.getTime()>new Date(`${n}-${e}`).getTime()?n:n-1;for(let a=0;a<8;a++){const n=new Date(`${s-a}-${e}`);t.push({date:n,text:Object(B.a)(n)})}return t}(e),[e]);return n.a.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},a.map(({date:e,text:a})=>n.a.createElement("div",{onClick:()=>t(e),className:"date-item",key:a},n.a.createElement("i",{className:"icon-calendar"}),n.a.createElement("span",null,a))))}),st=a(121),ct=a(146);const rt=Object(V.h)(e=>e(),500,!0);var ot=Object(n.h)(Object(s.h)(e=>{const{byId:t}=e.chats,{byId:a}=e.users,{userIds:n}=e.contactList||{};if(!n)return{chatsById:t,usersById:a};const{currentUserId:s,messages:c,lastSyncTime:r}=e,{fetchingStatus:o,globalResults:l,localResults:i,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=l||{},{chatIds:h,userIds:b}=i||{},{byChatId:g}=c,{foundIds:p}=d&&d.text||{};return{currentUserId:s,localContactIds:n,localChatIds:h,localUserIds:b,globalChatIds:m,globalUserIds:u,foundIds:p,globalMessagesByChatId:g,chatsById:t,usersById:a,fetchingStatus:o,lastSyncTime:r}},(e,t)=>Object(h.l)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"]))(({searchQuery:e,searchDate:t,dateSearchQuery:a,currentUserId:s,localContactIds:c,localChatIds:o,localUserIds:i,globalChatIds:d,globalUserIds:m,foundIds:b,globalMessagesByChatId:g,chatsById:p,usersById:v,fetchingStatus:O,lastSyncTime:E,onReset:j,onSearchDateSelect:f,openChat:C,addRecentlyFoundChatId:y,searchMessagesGlobal:k,setGlobalSearchChatId:N})=>{const w=Object(M.a)(),[S,I]=Object(n.r)(!1),[P,F]=Object(n.r)(!1),L=Object(n.m)(({direction:t})=>{E&&t===r.e.Backwards&&rt(()=>{k({type:"text",query:e})})},[E,k,e]),A=Object(n.m)(e=>{C({id:e,shouldReplaceHistory:!0}),e!==s&&y({id:e}),l.l||j()},[s,C,y,j]),R=Object(n.m)(e=>{N({id:e})},[N]),T=Object(n.p)(()=>{if(!e||e.startsWith("@")&&e.length<2)return Ve.a;const t=c?c.filter(t=>{const a=v[t];if(!a)return!1;const n=Object(u.bb)(a);return n&&Object(ue.a)(n,e)||Object(ue.a)(a.username,e)}):[];return[...s&&Object(ue.a)(w("SavedMessages"),e)?[s]:[],...Object(u.Ib)(Object(h.o)([...t,...o||[],...i||[]]),p)]},[e,c,s,w,o,i,p,v]),D=Object(n.p)(()=>!e||e.length<4||!d||!m?Ve.a:Object(u.Ib)(Object(h.o)([...d,...m]),p,!0),[p,d,m,e]),B=Object(n.p)(()=>(e||t)&&b&&0!==b.length?b.map(e=>{const[t,a]=e.split("_").map(Number);return g&&g[t]&&g[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):Ve.a,[b,g,e,t]),U=Object(n.m)(()=>{I(!S)},[S]),x=Object(n.m)(()=>{F(!P)},[P]);const G=O&&!O.chats&&!O.messages&&!T.length&&!D.length&&!B.length;return e||t?n.a.createElement(Oe.a,{className:"LeftSearch custom-scroll",items:B,onLoadMore:L,noScrollRestoreOnTop:!0,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(nt,{searchDate:a,onSelect:f})),G&&n.a.createElement(st.a,{text:w("ChatList.Search.NoResults"),description:w("ChatList.Search.NoResultsDescription")}),!!T.length&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:w.isRtl?"rtl":void 0},T.map(e=>n.a.createElement(ct.a,{chatOrUserId:e,onClick:R,clickArg:e}))),!!T.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},T.length>3&&n.a.createElement(tt.a,{onClick:U},w(S?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionDialogs")),T.map((e,t)=>{if(S||!(t>=3))return n.a.createElement(Qe,{chatId:e,onClick:A})})),!!D.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},D.length>3&&n.a.createElement(tt.a,{onClick:x},w(P?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionGlobal")),D.map((e,t)=>{if(P||!(t>=3))return n.a.createElement(Qe,{chatId:e,withUsername:!0,onClick:A})})),!!B.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},w("SearchMessages")),B.map((function(t){const a=Object(u.O)(w,t),s=p[t.chatId];if(a&&s)return n.a.createElement(at,{chatId:t.chatId,message:t,searchQuery:e})})))):n.a.createElement(Xe,{onReset:j})}));const lt=Object(V.h)(e=>e(),500,!0);var it=Object(n.h)(Object(s.h)(e=>{const{byId:t}=e.chats,{currentUserId:a,messages:{byChatId:n},lastSyncTime:s}=e,{fetchingStatus:c,resultsByType:r}=e.globalSearch,{foundIds:o}=r&&r.text||{};return{currentUserId:a,foundIds:o,globalMessagesByChatId:n,chatsById:t,fetchingStatus:c,lastSyncTime:s}},(e,t)=>Object(h.l)(t,["searchMessagesGlobal"]))(({searchQuery:e,currentUserId:t,dateSearchQuery:a,foundIds:s,globalMessagesByChatId:c,chatsById:o,fetchingStatus:l,lastSyncTime:i,searchMessagesGlobal:d,onSearchDateSelect:m})=>{const h=Object(M.a)(),b=Object(n.m)(({direction:a})=>{i&&a===r.e.Backwards&&lt(()=>{d({type:"text",query:e,chatId:t})})},[t,i,d,e]),g=Object(n.p)(()=>s&&0!==s.length?s.map(e=>{const[t,a]=e.split("_").map(Number);return c&&c[t]&&c[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):Ve.a,[s,c]);const p=l&&!l.chats&&!l.messages&&!g.length;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content custom-scroll chat-list",items:g,onLoadMore:b,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(nt,{searchDate:a,onSelect:m})),p&&n.a.createElement(st.a,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),!!g.length&&g.map((function(t){const a=Object(u.O)(h,t),s=o[t.chatId];if(a&&s)return n.a.createElement(at,{chatId:t.chatId,message:t,searchQuery:e})}))))}));function dt(e){return(t,a)=>{const{byId:n}=t.chats,{byId:s}=t.users,{fetchingStatus:c,resultsByType:r,chatId:o}=t.globalSearch,l="audio"!==e?e:a&&a.isVoice?"voice":"audio",{byChatId:i}=t.messages,{foundIds:d}=r&&r[l]||{};return{theme:Object(m.Db)(t),isLoading:void 0===d||!!c&&Boolean(c.chats||c.messages),chatsById:n,usersById:s,globalMessagesByChatId:i,foundIds:d,searchChatId:o,lastSyncTime:t.lastSyncTime}}}var mt=a(122),ut=a(172);const ht=Object(V.h)(e=>e(),500,!0);var bt=Object(n.h)(Object(s.h)(dt("media"),(e,t)=>Object(h.l)(t,["searchMessagesGlobal","openMediaViewer"]))(({searchQuery:e,searchChatId:t,isLoading:a,globalMessagesByChatId:s,foundIds:c,lastSyncTime:l,searchMessagesGlobal:i,openMediaViewer:d})=>{const m=Object(M.a)(),u=Object(n.m)(({direction:a})=>{l&&a===r.e.Backwards&&ht(()=>{i({type:"media",query:e,chatId:t})})},[l,i,e,t]),h=Object(n.p)(()=>c&&s?c.map(e=>{const[t,a]=e.split("_").map(Number);return s[t]&&s[t].byId[a]}).filter(Boolean):Ve.a,[s,c]),b=Object(n.m)((e,t)=>{d({chatId:t,messageId:e,origin:r.h.SearchResult})},[d]);const g=Object(mt.a)([e],o.Bb)&&!a,p=g&&c&&c.length>0&&!e,v=g&&c&&c.length>0&&e,O=Object(W.a)("search-content custom-scroll",v&&"chat-list");return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:O,items:h,itemSelector:e?".ListItem":".Media",onLoadMore:u,noFastList:!0},!g&&n.a.createElement(ge.a,null),g&&(!c||0===c.length)&&n.a.createElement(st.a,{text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),p&&n.a.createElement("div",{className:"media-list",dir:m.isRtl?"rtl":void 0},h.map(e=>n.a.createElement(ut.a,{key:e.id,idPrefix:"search-media",message:e,onClick:b}))),v&&h.map(e=>n.a.createElement(at,{key:e.id,chatId:e.chatId,message:e}))))}));function gt(e,t,a,n){const{senderId:s}=t;if(!s)return;const c=Object(u.ob)(s)?n[s]:a[s];let r=Object(u.X)(e,c);const o=a[t.chatId];return o&&(Object(u.ob)(s)&&c.isSelf?r=`${e("FromYou")}${Object(u.k)(e,o)}`:Object(u.nb)(o)&&(r+=" → "+Object(u.k)(e,o))),r}var pt=a(194);const vt=Object(V.h)(e=>e(),500,!0);var Ot=Object(n.h)(Object(s.h)(dt("links"),(e,t)=>Object(h.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:s,usersById:c,globalMessagesByChatId:l,foundIds:i,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:u})=>{const h=Object(M.a)(),b=Object(n.m)(({direction:a})=>{d&&a===r.e.Backwards&&vt(()=>{m({type:"links",query:e,chatId:t})})},[d,m,e,t]),g=Object(n.p)(()=>i&&l?i.map(e=>{const[t,a]=e.split("_").map(Number);return l[t]&&l[t].byId[a]}).filter(Boolean):Ve.a,[l,i]),p=Object(n.m)((e,t)=>{u({chatId:t,messageId:e})},[u]);const v=Object(mt.a)([e],o.Bb)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:g,onLoadMore:b,noFastList:!0},!v&&n.a.createElement(ge.a,null),v&&(!i||0===i.length)&&n.a.createElement(st.a,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),v&&i&&i.length>0&&g.map((e,t)=>{const a=0===t||Object(B.n)(e.date)!==Object(B.n)(g[t-1].date);return n.a.createElement("div",{className:"ListItem",dir:h.isRtl?"rtl":void 0,key:e.id},a&&n.a.createElement("p",{className:"section-heading",dir:h.isRtl?"rtl":void 0},Object(B.f)(h,new Date(1e3*e.date))),n.a.createElement(pt.a,{key:e.id,message:e,senderTitle:gt(h,e,s,c),onMessageClick:p}))})))})),Et=a(166);const jt=Object(V.h)(e=>e(),500,!0);var ft=Object(n.h)(Object(s.h)(dt("documents"),(e,t)=>Object(h.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:s,usersById:c,globalMessagesByChatId:l,foundIds:i,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:h})=>{const b=Object(M.a)(),g=Object(n.m)(({direction:a})=>{d&&a===r.e.Backwards&&jt(()=>{m({type:"documents",query:e,chatId:t})})},[d,m,e,t]),p=Object(n.p)(()=>i&&l?i.map(e=>{const[t,a]=e.split("_").map(Number),n=l[t]&&l[t].byId[a];return n&&Object(u.y)(n)?n:void 0}).filter(Boolean):Ve.a,[l,i]),v=Object(n.m)((e,t)=>{h({chatId:t,messageId:e})},[h]);const O=Object(mt.a)([e],o.Bb)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:g,noFastList:!0},!O&&n.a.createElement(ge.a,null),O&&(!i||0===i.length)&&n.a.createElement(st.a,{text:b("ChatList.Search.NoResults"),description:b("ChatList.Search.NoResultsDescription")}),O&&i&&i.length>0&&p.map((e,t)=>{const a=0===t||Object(B.n)(e.date)!==Object(B.n)(p[t-1].date);return n.a.createElement("div",{className:"ListItem",key:e.id},a&&n.a.createElement("p",{className:"section-heading"},Object(B.f)(b,new Date(1e3*e.date))),n.a.createElement(Et.a,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:gt(b,e,s,c),className:"scroll-item",onDateClick:v}))})))})),Ct=a(175);const yt=Object(V.h)(e=>e(),500,!0);var kt=Object(n.h)(Object(s.h)(dt("audio"),(e,t)=>Object(h.l)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"]))(({theme:e,isVoice:t,searchQuery:a,searchChatId:s,isLoading:c,chatsById:l,usersById:i,globalMessagesByChatId:d,foundIds:m,lastSyncTime:u,searchMessagesGlobal:h,focusMessage:b,openAudioPlayer:g})=>{const p=Object(M.a)(),v=t?"voice":"audio",O=Object(n.m)(({direction:e})=>{u&&e===r.e.Backwards&&yt(()=>{h({type:v,query:a,chatId:s})})},[v,u,h,a,s]),E=Object(n.p)(()=>m&&d?m.map(e=>{const[t,a]=e.split("_").map(Number);return d[t]&&d[t].byId[a]}).filter(Boolean):Ve.a,[d,m]),j=Object(n.m)((e,t)=>{b({chatId:t,messageId:e})},[b]),f=Object(n.m)((e,t)=>{g({chatId:t,messageId:e})},[g]);const C=Object(mt.a)([a],o.Bb)&&!c;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(Oe.a,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:O,noFastList:!0},!C&&n.a.createElement(ge.a,null),C&&(!m||0===m.length)&&n.a.createElement(st.a,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),C&&m&&m.length>0&&E.map((t,a)=>{const s=0===a||Object(B.n)(t.date)!==Object(B.n)(E[a-1].date);return n.a.createElement("div",{className:"ListItem",key:t.id},s&&n.a.createElement("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0},Object(B.f)(p,new Date(1e3*t.date))),n.a.createElement(Ct.a,{key:t.id,theme:e,message:t,target:"searchResult",senderTitle:gt(p,t,l,i),date:t.date,lastSyncTime:u,className:"scroll-item",onPlay:f,onDateClick:j}))})))}));a(282);const Nt=[{type:r.c.ChatList,title:"SearchAllChatsShort"},{type:r.c.Media,title:"SharedMediaTab2"},{type:r.c.Links,title:"SharedLinksTab2"},{type:r.c.Files,title:"SharedFilesTab2"},{type:r.c.Music,title:"SharedMusicTab2"},{type:r.c.Voice,title:"SharedVoiceTab2"}],wt=[{type:r.c.ChatList,title:"All Messages"},...Nt.slice(1)],St=Object.keys(r.c).length/2;var It=Object(n.h)(Object(s.h)(e=>{const{currentContent:t,chatId:a}=e.globalSearch;return{currentContent:t,chatId:a}},(e,t)=>Object(h.l)(t,["setGlobalSearchContent","setGlobalSearchDate"]))(({searchQuery:e,searchDate:t,isActive:a,currentContent:s=r.c.ChatList,chatId:c,setGlobalSearchContent:o,setGlobalSearchDate:l,onReset:i})=>{const d=Object(M.a)(),[m,u]=Object(n.r)(s),h=Object(n.p)(()=>Object(B.l)(e),[e]),b=Object(n.m)(e=>{const t=Nt[e];o({content:t.type}),u(e)},[o]),g=Object(n.m)(e=>{l({date:e.getTime()/1e3})},[l]);Object(L.a)(a,i,void 0,void 0,!0);const p=Object(n.q)(null),v=Object(be.a)(p,a,void 0,".ListItem-button",!0);return n.a.createElement("div",{className:"LeftSearch",ref:p,onKeyDown:v},n.a.createElement($e.a,{activeTab:m,tabs:c?wt:Nt,onSwitchTab:b}),n.a.createElement(T.a,{name:d.isRtl?"slide-reversed":"slide",renderCount:St,activeKey:s},()=>{switch(s){case r.c.ChatList:return c?n.a.createElement(it,{searchQuery:e,dateSearchQuery:h,onReset:i,onSearchDateSelect:g}):n.a.createElement(ot,{searchQuery:e,searchDate:t,dateSearchQuery:h,onReset:i,onSearchDateSelect:g});case r.c.Media:return n.a.createElement(bt,{searchQuery:e});case r.c.Links:return n.a.createElement(Ot,{searchQuery:e});case r.c.Files:return n.a.createElement(ft,{searchQuery:e});case r.c.Music:return n.a.createElement(kt,{key:"audio",searchQuery:e});case r.c.Voice:return n.a.createElement(kt,{key:"voice",isVoice:!0,searchQuery:e});default:return}}))})),Pt=a(158);const Ft={currentPassword:"",password:"",hint:"",email:""},Mt=(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 Ft;default:return e}};var Lt=Object(n.h)(Object(s.h)(void 0,(e,t)=>Object(h.l)(t,["signOut","deleteChatFolder"]))(({currentScreen:e,editedFolderId:t,onReset:a,onSaveFilter:s,signOut:c,deleteChatFolder:o})=>{const[i,d]=Object(n.r)(!1),[m,u]=Object(n.r)(!1),h=Object(n.m)(()=>{d(!0)},[]),b=Object(n.m)(()=>{d(!1)},[]),g=Object(n.m)(()=>{u(!0)},[]),p=Object(n.m)(()=>{u(!1)},[]),v=Object(n.m)(()=>{b(),c()},[b,c]),O=Object(n.m)(()=>{p(),o({id:t}),a()},[t,p,o,a]),E=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(D.a,{round:!0,ripple:!l.l,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},n.a.createElement("i",{className:"icon-more"})),[]),j=Object(M.a)();return n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:j("AccDescrGoBack")},n.a.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case r.n.EditProfile:return n.a.createElement("h3",null,j("lng_settings_information"));case r.n.General:return n.a.createElement("h3",null,j("General"));case r.n.Notifications:return n.a.createElement("h3",null,j("Notifications"));case r.n.Privacy:return n.a.createElement("h3",null,j("PrivacySettings"));case r.n.Language:return n.a.createElement("h3",null,j("Language"));case r.n.GeneralChatBackground:return n.a.createElement("h3",null,j("ChatBackground"));case r.n.GeneralChatBackgroundColor:return n.a.createElement("h3",null,j("SetColor"));case r.n.PrivacyPhoneNumber:return n.a.createElement("h3",null,j("PrivacyPhone"));case r.n.PrivacyLastSeen:return n.a.createElement("h3",null,j("PrivacyLastSeen"));case r.n.PrivacyProfilePhoto:return n.a.createElement("h3",null,j("Privacy.ProfilePhoto"));case r.n.PrivacyForwarding:return n.a.createElement("h3",null,j("PrivacyForwards"));case r.n.PrivacyGroupChats:return n.a.createElement("h3",null,j("AutodownloadGroupChats"));case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyGroupChatsAllowedContacts:return n.a.createElement("h3",null,j("AlwaysShareWith"));case r.n.PrivacyPhoneNumberDeniedContacts:case r.n.PrivacyLastSeenDeniedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:case r.n.PrivacyForwardingDeniedContacts:case r.n.PrivacyGroupChatsDeniedContacts:return n.a.createElement("h3",null,j("NeverShareWith"));case r.n.PrivacyActiveSessions:return n.a.createElement("h3",null,j("SessionsTitle"));case r.n.PrivacyBlockedUsers:return n.a.createElement("h3",null,j("BlockedUsers"));case r.n.TwoFaDisabled:case r.n.TwoFaEnabled:return n.a.createElement("h3",null,j("TwoStepVerification"));case r.n.TwoFaNewPassword:case r.n.TwoFaChangePasswordNew:case r.n.TwoFaChangePasswordConfirm:return n.a.createElement("h3",null,j("PleaseEnterCurrentPassword"));case r.n.TwoFaNewPasswordConfirm:return n.a.createElement("h3",null,j("PleaseReEnterPassword"));case r.n.TwoFaNewPasswordHint:case r.n.TwoFaChangePasswordHint:return n.a.createElement("h3",null,j("PasswordHint"));case r.n.TwoFaNewPasswordEmail:case r.n.TwoFaRecoveryEmail:return n.a.createElement("h3",null,j("RecoveryEmailTitle"));case r.n.TwoFaNewPasswordEmailCode:case r.n.TwoFaRecoveryEmailCode:return n.a.createElement("h3",null,"Recovery Email Code");case r.n.TwoFaCongratulations:return n.a.createElement("h3",null,j("TwoStepVerificationPasswordSet"));case r.n.TwoFaChangePasswordCurrent:case r.n.TwoFaTurnOff:case r.n.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement("h3",null,j("PleaseEnterCurrentPassword"));case r.n.Folders:return n.a.createElement("h3",null,j("Filters"));case r.n.FoldersCreateFolder:return n.a.createElement("h3",null,j("FilterNew"));case r.n.FoldersEditFolder:case r.n.FoldersEditFolderFromChatList:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,j("FilterEdit")),t&&n.a.createElement(q.a,{className:"settings-more-menu",trigger:E,positionX:"right"},n.a.createElement(_.a,{icon:"delete",destructive:!0,onClick:g},j("Delete"))));case r.n.FoldersIncludedChats:case r.n.FoldersIncludedChatsFromChatList:case r.n.FoldersExcludedChats:case r.n.FoldersExcludedChatsFromChatList:return n.a.createElement("div",{className:"settings-main-header"},e===r.n.FoldersIncludedChats||e===r.n.FoldersIncludedChatsFromChatList?n.a.createElement("h3",null,j("FilterInclude")):n.a.createElement("h3",null,j("FilterExclude")),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:s,ariaLabel:j("AutoDeleteConfirm")},n.a.createElement("i",{className:"icon-check"})));default:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,j("SETTINGS")),n.a.createElement(q.a,{className:"settings-more-menu",trigger:E,positionX:"right"},n.a.createElement(_.a,{icon:"logout",onClick:h},j("LogOutTitle"))))}}(),n.a.createElement(Pe.a,{isOpen:i,onClose:b,text:j("lng_sure_logout"),confirmLabel:j("AccountSettings.Logout"),confirmHandler:v,confirmIsDestructive:!0}),n.a.createElement(Pe.a,{isOpen:m,onClose:p,text:j("FilterDeleteAlert"),confirmLabel:j("Delete"),confirmHandler:O,confirmIsDestructive:!0}))})),At=a(23);var Rt=Object(n.h)(Object(s.h)(e=>{const{currentUserId:t}=e;return{currentUser:t?Object(m.Jb)(e,t):void 0}})(({isActive:e,onScreenSelect:t,onReset:a,currentUser:s})=>{const c=Object(M.a)(),o=Object(u.bb)(s);return Object(L.a)(e,a,t,r.n.Main),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-main-menu"},s&&n.a.createElement("div",{className:"settings-current-user"},n.a.createElement(x.a,{user:s,size:"jumbo"}),n.a.createElement("p",{className:"name"},o&&Object(U.a)(o)),n.a.createElement("p",{className:"phone"},Object(At.c)(s.phoneNumber))),n.a.createElement(Ee.a,{icon:"edit",onClick:()=>t(r.n.EditProfile)},c("lng_settings_information")),n.a.createElement(Ee.a,{icon:"folder",onClick:()=>t(r.n.Folders)},c("Filters")),n.a.createElement(Ee.a,{icon:"settings",onClick:()=>t(r.n.General)},c("Telegram.GeneralSettingsViewController")),n.a.createElement(Ee.a,{icon:"unmute",onClick:()=>t(r.n.Notifications)},c("Notifications")),n.a.createElement(Ee.a,{icon:"lock",onClick:()=>t(r.n.Privacy)},c("PrivacySettings")),n.a.createElement(Ee.a,{icon:"language",onClick:()=>t(r.n.Language)},c("Language"))))})),Tt=a(136),Dt=a(116);const Bt=/https:\/\/t\.me\/?/i,Ut=/^([a-zA-Z0-9_]+)$/,xt=Object(V.a)(e=>e(),250,!1);var Gt=Object(n.h)(({currentUsername:e,asLink:t,isLoading:a,isUsernameAvailable:s,checkUsername:c,onChange:r})=>{const[o,l]=Object(n.r)(e||""),i=Object(M.a)(),d=t?"SetUrl":"Username",m=i(t?"SetUrlPlaceholder":"Username"),[u,h]=Object(n.p)(()=>o.length?o.length<5?[void 0,m+" is too short"]:o.length>32?[void 0,m+" is too long"]:Ut.test(o)?void 0===s?[]:[s?i(d+"Available","Username"):void 0,!1===s?i(d+"InUse"):void 0]:[void 0,m+" contains invalid characters"]:[],[o,s,i,d,m]);Object(n.n)(()=>{l(e||"")},[t,e]);const b=Object(n.m)(e=>{const a=e.target.value.trim().replace(Bt,"");l(a),e.target.value=`${t?"https://t.me/":""}${a}`;const n=function(e){return e.length>=5&&e.length<=32&&Ut.test(e)}(a);n&&xt(()=>{c({username:a})}),r&&r(!!n&&a)},[t,c,r]);return n.a.createElement(ve.a,{value:`${t?"https://t.me/":""}${o}`,onChange:b,label:m,error:h,success:u,readOnly:a})});const zt=Object(V.h)(e=>e(),6e4,!0);var qt=Object(n.h)(Object(s.h)(e=>{const{currentUserId:t}=e,{progress:a,isUsernameAvailable:n}=e.profileEdit||{},s=t?Object(m.Jb)(e,t):void 0;if(!s)return{progress:a,isUsernameAvailable:n};const{firstName:c,lastName:r,username:o,fullInfo:l}=s,{bio:i}=l||{};return{currentAvatarHash:Object(u.e)(s),currentFirstName:c,currentLastName:r,currentBio:i,currentUsername:o,progress:a,isUsernameAvailable:n}},(e,t)=>Object(h.l)(t,["loadCurrentUser","updateProfile","checkUsername"]))(({isActive:e,onScreenSelect:t,onReset:a,currentAvatarHash:s,currentFirstName:o,currentLastName:l,currentBio:i,currentUsername:d,progress:m,isUsernameAvailable:u,loadCurrentUser:h,updateProfile:b,checkUsername:g})=>{const p=Object(M.a)(),[v,E]=Object(n.r)(!1),[j,f]=Object(n.r)(!1),[C,y]=Object(n.r)(),[k,N]=Object(n.r)(),[w,S]=Object(n.r)(o||""),[I,P]=Object(n.r)(l||""),[F,R]=Object(n.r)(i||""),[T,D]=Object(n.r)(d||""),B=Object(O.a)(s,!1,c.ApiMediaFormat.BlobUrl),x=m===r.k.InProgress,G=!1===T,z=Object(n.p)(()=>!G&&(Boolean(k)||j||!0===u),[k,j,G,u]);Object(L.a)(e,a,t,r.n.EditProfile),Object(n.n)(()=>{zt(()=>{h()})},[h]),Object(n.n)(()=>{N(void 0)},[B]),Object(n.n)(()=>{S(o||""),P(l||""),R(i||"")},[o,l,i]),Object(n.n)(()=>{D(d||"")},[d]),Object(n.n)(()=>{m===r.k.Complete&&(f(!1),E(!1),y(void 0))},[m]);const q=Object(n.m)(e=>{N(e)},[]),_=Object(n.m)(e=>{S(e.target.value),f(!0)},[]),H=Object(n.m)(e=>{P(e.target.value),f(!0)},[]),$=Object(n.m)(e=>{R(e.target.value),f(!0)},[]),V=Object(n.m)(e=>{D(e),E(!0)},[]),W=Object(n.m)(()=>{const e=w.trim(),t=I.trim(),a=F.trim();e.length?a.length>70?y("Bio can' be longer than 70 characters"):b({photo:k,...j&&{firstName:e,lastName:t,bio:a},...v&&{username:T}}):y("Please provide your first name")},[k,w,I,F,j,T,v,b]);return n.a.createElement("div",{className:"settings-fab-wrapper"},n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-edit-profile"},n.a.createElement(Tt.a,{currentAvatarBlobUrl:B,onChange:q,title:"Edit your profile photo",disabled:x}),n.a.createElement(ve.a,{value:w,onChange:_,label:p("FirstName"),disabled:x,error:"Please provide your first name"===C?C:void 0}),n.a.createElement(ve.a,{value:I,onChange:H,label:p("LastName"),disabled:x}),n.a.createElement(ve.a,{value:F,onChange:$,label:p("UserBio"),disabled:x,error:"Bio can' be longer than 70 characters"===C?C:void 0}),n.a.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},Object(U.a)(p("lng_settings_about_bio"),["br","simple_markdown"]))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("Username")),n.a.createElement(Gt,{currentUsername:T||"",isLoading:x,isUsernameAvailable:u,checkUsername:g,onChange:V}),n.a.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},Object(U.a)(p("UsernameHelp"),["br","simple_markdown"])),T&&n.a.createElement("p",{className:"settings-item-description",dir:p.isRtl?"rtl":void 0},p("lng_username_link"),n.a.createElement("br",null),n.a.createElement("span",{className:"username-link"},"https://t.me/",T)))),n.a.createElement(Dt.a,{isShown:z,onClick:W,disabled:x,ariaLabel:"Save changes"},x?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),_t=a(132),Ht=a(119);const $t=Object(V.h)(e=>e(),6e4,!0);var Vt=Object(n.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a}}=e,{orderedIds:n,byId:s,recommended:c}=e.chatFolders;return{chatsById:t,usersById:a,orderedFolderIds:n,foldersById:s,recommendedChatFolders:c,notifySettings:Object(m.fb)(e),notifyExceptions:Object(m.eb)(e)}},(e,t)=>Object(h.l)(t,["loadRecommendedChatFolders","addChatFolder","showDialog"]))(({onCreateFolder:e,onEditFolder:t,isActive:a,onScreenSelect:s,onReset:c,chatsById:l,usersById:i,orderedFolderIds:d,foldersById:m,recommendedChatFolders:h,notifySettings:b,notifyExceptions:g,loadRecommendedChatFolders:p,addChatFolder:v,showDialog:O})=>{const[E,j]=Object(n.r)(),[f,C]=Object(n.r)(!1),y=Object(n.m)(()=>C(!0),[]);Object(n.n)(()=>{E||Object(_t.a)("FoldersAll").then(j)},[E]),Object(n.n)(()=>{$t(()=>{p()})},[p]);const k=Object(n.m)(()=>{Object.keys(m).length>=10?O({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):e()},[m,O,e]),N=Object(M.a)();Object(L.a)(a,c,s,r.n.Folders);const w=Object(n.p)(()=>{if(!d)return;const e=Object.keys(l).map(Number);return d.map(t=>{const a=m[t];return{id:a.id,title:a.title,subtitle:Object(u.n)(N,l,i,a,e,b,g)}})},[d,l,m,i,b,g,N]),S=Object(n.m)(e=>{Object.keys(m).length>=10?O({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):v({folder:e})},[m,v,O]);return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement("div",{className:"settings-content-icon"},E&&n.a.createElement(Ht.a,{id:"settingsFoldersMain",size:o.Fb,animationData:E,play:f,noLoop:!0,onLoad:y})),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},N("CreateNewFilterInfo")),n.a.createElement(D.a,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:k,isRtl:N.isRtl},n.a.createElement("i",{className:"icon-add"}),N("CreateNewFilter"))),n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("Filters")),w&&w.length?w.map(e=>n.a.createElement(Ee.a,{className:"mb-2",narrow:!0,multiline:!0,onClick:()=>t(m[e.id])},n.a.createElement("span",{className:"title"},e.title),n.a.createElement("span",{className:"subtitle"},e.subtitle))):w&&!w.length?n.a.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):n.a.createElement(ge.a,null)),h&&!!h.length&&n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("FilterRecommended")),h.map(e=>n.a.createElement(Ee.a,{className:"mb-2",narrow:!0,onClick:()=>S(e)},n.a.createElement("div",{className:"settings-folders-recommended-item"},n.a.createElement("div",{className:"multiline-item"},n.a.createElement("span",{className:"title"},e.title),n.a.createElement("span",{className:"subtitle"},e.description)),n.a.createElement(D.a,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:N.isRtl},N("Add")))))))})),Wt=a(145);a(283);var Kt=({count:e,itemName:t,itemPluralName:a,isLoading:s,onClick:c})=>{const r=Object(M.a)();return n.a.createElement(D.a,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:s,isRtl:r.isRtl,onClick:c},n.a.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?a||t+"s":t)};const Yt="Please provide a title for this folder.";var Qt=Object(n.h)(Object(s.h)(e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}},(e,t)=>Object(h.l)(t,["editChatFolder","addChatFolder","loadMoreChats"]))(({state:e,dispatch:t,onAddIncludedChats:a,onAddExcludedChats:s,isActive:c,onScreenSelect:l,onReset:i,onBack:d,loadedActiveChatIds:m,loadedArchivedChatIds:b,editChatFolder:g,addChatFolder:p,loadMoreChats:v})=>{const[O,E]=Object(n.r)(),[j,f]=Object(n.r)(!1),C=Object(n.m)(()=>f(!0),[]),[y,k]=Object(n.r)(!1),[N,w]=Object(n.r)(!1),{selectedChatIds:S,selectedChatTypes:I}=Object(Wt.d)(e,"included"),{selectedChatIds:P,selectedChatTypes:F}=Object(Wt.d)(e,"excluded");Object(n.n)(()=>{O||Object(_t.a)("FoldersNew").then(E)},[O]),Object(n.n)(()=>{k(!1),w(!1)},[e.folderId]);const[R,T]=Object(n.p)(()=>{const e=new Set([...m||[],...b||[]]),t=Object(h.f)(S,e),a=Object(h.f)(P,e);return[y?t:t.slice(0,5-I.length),N?a:a.slice(0,5-F.length)]},[P,S,I,F,N,y,m,b]);Object(n.n)(()=>{(R.length<S.length||T.length<P.length)&&v({listType:"active"})},[v,P.length,S.length,T.length,R.length]);const D=Object(M.a)();function B(e){const t="included"===e?I:F,a="included"===e?R:T,s="included"===e?y:N,c=("included"===e?S:P).length-t.length-a.length,r="included"===e?()=>k(!0):()=>w(!0);return n.a.createElement(n.a.Fragment,null,t.map(t=>function(e,t){const a="included"===t?Wt.b.find(({key:t})=>t===e):Wt.a.find(({key:t})=>t===e);if(a)return n.a.createElement(Ee.a,{key:a.key,className:"settings-folders-list-item mb-1",icon:a.icon,narrow:!0,inactive:!0},D(a.title))}(t,e)),a.map(e=>n.a.createElement(Ee.a,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},Object(u.ob)(e)?n.a.createElement(je.a,{avatarSize:"small",userId:e}):n.a.createElement(fe.a,{avatarSize:"small",chatId:e}))),!s&&c>0&&n.a.createElement(Kt,{count:c,itemName:"chat",onClick:r}))}return Object(L.a)(c,d,l,"edit"===e.mode?r.n.FoldersEditFolder:r.n.FoldersCreateFolder),n.a.createElement("div",{className:"settings-fab-wrapper"},n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement("div",{className:"settings-content-icon"},O&&n.a.createElement(Ht.a,{id:"settingsFoldersEdit",size:o.Fb,animationData:O,play:j&&String(e.folderId),noLoop:!0,onLoad:C})),"create"===e.mode&&n.a.createElement("p",{className:"settings-item-description mb-3",dir:D.isRtl?"rtl":void 0},D("FilterIncludeInfo")),n.a.createElement(ve.a,{className:"mb-0",label:D("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:a}=e;t({type:"setTitle",payload:a.value.trim()})},error:e.error&&e.error===Yt?Yt:void 0})),n.a.createElement("div",{className:"settings-item no-border pt-3"},e.error&&"ChatList.Filter.Error.Empty"===e.error&&n.a.createElement("p",{className:"settings-item-description color-danger mb-2",dir:D.isRtl?"rtl":void 0},D(e.error)),n.a.createElement("h4",{className:"settings-item-header mb-3",dir:D.isRtl?"rtl":void 0},D("FilterInclude")),n.a.createElement(Ee.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:a},D("FilterAddChats")),B("included")),n.a.createElement("div",{className:"settings-item no-border pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:D.isRtl?"rtl":void 0},D("FilterExclude")),n.a.createElement(Ee.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},D("FilterAddChats")),B("excluded"))),n.a.createElement(Dt.a,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:a}=e.folder;a?S.length||Object.keys(I).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?g({id:e.folderId,folderUpdate:e.folder}):p({folder:e.folder}),setTimeout(()=>{i()},500)):t({type:"setError",payload:"ChatList.Filter.Error.Empty"}):t({type:"setError",payload:Yt})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),Zt=a(48);a(195),a(284);var Jt=Object(n.h)(({mode:e,chatIds:t,selectedIds:a,selectedChatTypes:s,filterValue:c,onSelectedIdsChange:r,onSelectedChatTypesChange:o,onFilterChange:l,onLoadMore:i})=>{const d=Object(n.q)(null),m="included"===e?Wt.b:Wt.a,h=a.length+s.length>10,b=a.length>=100;Object(n.n)(()=>{setTimeout(()=>{requestAnimationFrame(()=>{d.current.focus()})},500)},[]);const g=Object(n.m)(e=>{const t=[...a];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),r(t)},[a,r]),p=Object(n.m)(e=>{const t=[...s];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),o(t)},[s,o]),v=Object(n.m)(e=>{const{value:t}=e.currentTarget;l(t)},[l]),O=Object(M.a)();const[E,j]=Object(he.a)(i,t,Boolean(c));return n.a.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},n.a.createElement("div",{className:"picker-header custom-scroll"},s.map((function(e){const t=m.find(({key:t})=>e===t);if(t)return n.a.createElement(ct.a,{icon:t.icon,title:O(t.title),isMinimized:h,canClose:!0,onClick:p,clickArg:t.key})})),a.map((e,t)=>n.a.createElement(ct.a,{chatOrUserId:e,isMinimized:h&&t<a.length-5,canClose:!0,onClick:g,clickArg:e})),b?n.a.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):n.a.createElement(ve.a,{ref:d,value:c,onChange:v,placeholder:O("Search")})),n.a.createElement(Oe.a,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:E,onLoadMore:j},(!E||!E.length||E.includes(t[0]))&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h4",{key:"header1",className:"settings-item-header",dir:O.isRtl?"rtl":void 0},O("FilterChatTypes")),m.map((function(e){return n.a.createElement(Ee.a,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>p(e.key),ripple:!0},n.a.createElement("i",{className:"icon-"+e.icon}),n.a.createElement("h3",{className:"chat-type",dir:"auto"},O(e.title)),n.a.createElement(Zt.a,{label:"",checked:s.includes(e.key),round:!0}))})),n.a.createElement("div",{key:"divider",className:"picker-list-divider"}),n.a.createElement("h4",{key:"header2",className:"settings-item-header",dir:O.isRtl?"rtl":void 0},O("FilterChats"))),E&&E.length?E.map((function(e){const t=a.includes(e);return n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>g(e),ripple:!0,disabled:!t&&b},Object(u.ob)(e)?n.a.createElement(je.a,{userId:e}):n.a.createElement(fe.a,{chatId:e,withChatType:!0}),n.a.createElement(Zt.a,{label:"",checked:t,round:!0}))})):E&&!E.length?n.a.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):n.a.createElement(ge.a,{key:"loading"})))});var Xt=Object(n.h)(Object(s.h)(e=>{const{chats:{byId:t,listIds:a,orderedPinnedIds:n}}=e;return{chatsById:t,listIds:a.active,orderedPinnedIds:n.active,archivedPinnedIds:n.archived,archivedListIds:a.archived}},(e,t)=>Object(h.l)(t,["loadMoreChats"]))(({isActive:e,onScreenSelect:t,onReset:a,mode:s,state:c,dispatch:o,chatsById:l,listIds:i,orderedPinnedIds:d,archivedListIds:m,archivedPinnedIds:h,loadMoreChats:b})=>{const{chatFilter:g}=c,{selectedChatIds:p,selectedChatTypes:v}=Object(Wt.d)(c,s,!0),O=Object(M.a)(),E=Object(n.p)(()=>{const e=i?Object(u.Fb)(l,i,d,"all"):void 0,t=m?Object(u.Fb)(l,m,h,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[l,i,d,m,h]),j=Object(n.p)(()=>{if(E)return E.filter(e=>!g||Object(ue.a)(Object(u.k)(O,e),g)||p.includes(e.id)).map(({id:e})=>e)},[E,g,O,p]),f=Object(n.m)(e=>{o({type:"setChatFilter",payload:e})},[o]),C=Object(n.m)(e=>{o("included"===s?{type:"setIncludeFilters",payload:{...c.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...c.excludeFilters,excludedChatIds:e}})},[s,c,o]),y=Object(n.m)(e=>{const t={};e.forEach(e=>{t[e]=!0}),o("included"===s?{type:"setIncludeFilters",payload:{includedChatIds:p,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:p,...t}})},[s,p,o]);return Object(L.a)(e,a,t,"included"===s?r.n.FoldersIncludedChats:r.n.FoldersExcludedChats),j?n.a.createElement(Jt,{mode:s,chatIds:j,selectedIds:p,selectedChatTypes:v,filterValue:g,onSelectedIdsChange:C,onSelectedChatTypesChange:y,onFilterChange:f,onLoadMore:b}):n.a.createElement(ge.a,null)}));a(285);var ea=Object(n.h)(({currentScreen:e,shownScreen:t,state:a,dispatch:s,isActive:c,onScreenSelect:o,onReset:l})=>{const i=Object(n.m)(()=>{e!==r.n.FoldersCreateFolder&&e!==r.n.FoldersEditFolder&&e!==r.n.FoldersEditFolderFromChatList||setTimeout(()=>{s({type:"reset"})},200),e!==r.n.FoldersIncludedChats&&e!==r.n.FoldersExcludedChats?l():"create"===a.mode?o(r.n.FoldersCreateFolder):o(r.n.FoldersEditFolder)},[a.mode,s,e,l,o]),d=Object(n.m)(()=>{s({type:"reset"}),o(r.n.FoldersCreateFolder)},[o,s]),m=Object(n.m)(e=>{s({type:"editFolder",payload:e}),o(r.n.FoldersEditFolder)},[s,o]),u=Object(n.m)(()=>{s({type:"editIncludeFilters"}),o(e===r.n.FoldersEditFolderFromChatList?r.n.FoldersIncludedChatsFromChatList:r.n.FoldersIncludedChats)},[e,s,o]),h=Object(n.m)(()=>{s({type:"editExcludeFilters"}),o(e===r.n.FoldersEditFolderFromChatList?r.n.FoldersExcludedChatsFromChatList:r.n.FoldersExcludedChats)},[e,s,o]);switch(e){case r.n.Folders:return n.a.createElement(Vt,{onCreateFolder:d,onEditFolder:m,onScreenSelect:o,isActive:c||[r.n.FoldersCreateFolder,r.n.FoldersEditFolder,r.n.FoldersIncludedChats,r.n.FoldersExcludedChats].includes(t),onReset:l});case r.n.FoldersCreateFolder:case r.n.FoldersEditFolder:case r.n.FoldersEditFolderFromChatList:return n.a.createElement(Qt,{state:a,dispatch:s,onAddIncludedChats:u,onAddExcludedChats:h,onReset:i,onScreenSelect:o,isActive:c||[r.n.FoldersIncludedChats,r.n.FoldersExcludedChats].includes(t),onBack:l});case r.n.FoldersIncludedChats:case r.n.FoldersIncludedChatsFromChatList:return n.a.createElement(Xt,{mode:"included",state:a,dispatch:s,onReset:i,onScreenSelect:o,isActive:c});case r.n.FoldersExcludedChats:case r.n.FoldersExcludedChatsFromChatList:return n.a.createElement(Xt,{mode:"excluded",state:a,dispatch:s,onReset:i,onScreenSelect:o,isActive:c});default:return}}),ta=a(109);a(286);var aa=Object(n.h)(({options:e,range:t,label:a,value:s,disabled:c,onChange:r})=>{const o=Object(M.a)(),l=Object(n.m)(e=>{r(Number(e.currentTarget.value))},[r]),i=Object(W.a)("RangeSlider",c&&"disabled"),d=Object(n.p)(()=>{if(e)return s/(e.length-1)*100;if(t){const e=(t.max-t.min)/(t.step||1);return(s-t.min)/e*100}return 0},[s,e,t]),[m,u,h]=Object(n.p)(()=>e?[0,e.length-1,1]:t?[t.min,t.max,t.step||1]:[0,0,0],[t,e]);return n.a.createElement("div",{className:i},a&&n.a.createElement("div",{className:"slider-top-row",dir:o.isRtl?"rtl":void 0},n.a.createElement("span",{className:"label",dir:"auto"},a),t&&n.a.createElement("span",{className:"value",dir:"auto"},s)),n.a.createElement("div",{className:"slider-main"},n.a.createElement("div",{className:"slider-fill-track",style:`width: ${d}%`}),n.a.createElement("input",{min:m,max:u,value:s,step:h,type:"range",onChange:l}),e&&n.a.createElement("div",{className:"slider-options"},e.map((e,t)=>n.a.createElement("div",{className:Object(W.a)("slider-option no-selection",t===s&&"active"),onClick:()=>r(t)},e)))))}),na=a(117),sa=a(50);var ca=Object(n.h)(({size:e=o.Mb,stickerSet:t,observeIntersection:a})=>{const s=Object(n.q)(null),r=Object(ta.b)(s,a),l="stickerSet"+t.id,i=Object(O.a)(l,!r,c.ApiMediaFormat.Lottie),{shouldRenderFullMedia:d,transitionClassNames:m}=Object(na.a)(i,"slow");return n.a.createElement("div",{ref:s,className:"sticker-set-cover"},!d&&Object(sa.c)(t.title,2),d&&i&&n.a.createElement(Ht.a,{id:l,size:e,animationData:i,className:m}))});var ra=Object(n.h)(({stickerSet:e,observeIntersection:t})=>{const a=Object(n.q)(null),s=Object(ta.b)(a,t),c=Object(O.a)(e.hasThumbnail&&"stickerSet"+e.id,!s),{shouldRenderFullMedia:r,transitionClassNames:o}=Object(na.a)(c,"slow");return n.a.createElement("div",{ref:a,className:"sticker-set-cover"},!r&&Object(sa.c)(e.title,2),r&&n.a.createElement("img",{src:c,className:o,alt:""}))}),oa=a(125);a(287);var la=Object(n.h)(({stickerSet:e,observeIntersection:t,onClick:a})=>{const s=Object(M.a)();if(!e||!e.stickers)return;const c=e.stickers&&e.stickers[0];return e.hasThumbnail||!c?n.a.createElement(Ee.a,{narrow:!0,className:"SettingsStickerSet",inactive:!c,onClick:()=>c&&a(c)},n.a.createElement(D.a,{ariaLabel:e.title,color:"translucent",isRtl:s.isRtl},e.isAnimated?n.a.createElement(ca,{size:o.Gb,stickerSet:e,observeIntersection:t}):n.a.createElement(ra,{stickerSet:e,observeIntersection:t})),n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("div",{className:"title"},e.title),n.a.createElement("div",{className:"subtitle"},s("StickerPack.StickerCount",e.count,"i")))):n.a.createElement(Ee.a,{narrow:!0,className:"SettingsStickerSet",onClick:()=>a(c)},n.a.createElement(oa.a,{sticker:c,size:o.Gb,title:e.title,observeIntersection:t}),n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("div",{className:"title"},e.title),n.a.createElement("div",{className:"subtitle"},s("StickerPack.StickerCount",e.count,"i"))))}),ia=a(167);const da=["Solid and Steady","Nice and Fast","Lots of Stuff"];var ma=Object(n.h)(Object(s.h)(e=>({...Object(h.l)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldAutoDownloadMediaFromContacts","shouldAutoDownloadMediaInPrivateChats","shouldAutoDownloadMediaInGroups","shouldAutoDownloadMediaInChannels","shouldAutoPlayGifs","shouldAutoPlayVideos","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById}),(e,t)=>Object(h.l)(t,["setSettingOption","loadStickerSets","loadAddedStickers"]))(({isActive:e,onScreenSelect:t,onReset:a,stickerSetIds:s,stickerSetsById:c,messageTextSize:o,animationLevel:i,messageSendKeyCombo:d,shouldAutoDownloadMediaFromContacts:m,shouldAutoDownloadMediaInPrivateChats:u,shouldAutoDownloadMediaInGroups:h,shouldAutoDownloadMediaInChannels:b,shouldAutoPlayGifs:g,shouldAutoPlayVideos:p,shouldSuggestStickers:v,shouldLoopStickers:O,setSettingOption:E,loadStickerSets:j,loadAddedStickers:f})=>{const C=Object(n.q)(null),{observe:y}=Object(ta.a)({rootRef:C}),[k,N,w]=Object(xe.a)(),[S,I]=Object(n.r)(),P=Object(M.a)(),F=l.n?void 0:[{value:"enter",label:P("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:P(l.f?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];Object(n.n)(()=>{j()},[j]),Object(n.n)(()=>{s&&s.length&&f()},[s,f]);const A=Object(n.m)(e=>{da.forEach((t,a)=>{document.body.classList.toggle("animation-level-"+a,e===a)}),E({animationLevel:e})},[E]),R=Object(n.m)(e=>{document.documentElement.style.setProperty("--composer-text-size",Math.max(e,l.e?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()),E({messageTextSize:e})},[E]),T=Object(n.m)(e=>{I(e),N()},[N]),D=s&&s.map(e=>!!(c&&c[e]&&c[e].installedDate)&&c[e]).filter(Boolean);return Object(L.a)(e,a,t,r.n.General),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("SETTINGS")),n.a.createElement(aa,{label:P("TextSize"),range:{min:12,max:20},value:o,onChange:R}),n.a.createElement(Ee.a,{icon:"photo",onClick:()=>t(r.n.GeneralChatBackground)},P("ChatBackground"))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},"Animation Level"),n.a.createElement("p",{className:"settings-item-description",dir:P.isRtl?"rtl":void 0},"Choose the desired animations amount."),n.a.createElement(aa,{options:da,value:i,onChange:A})),F&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("VoiceOver.Keyboard")),n.a.createElement(qe.a,{name:"keyboard-send-settings",options:F,onChange:e=>E({messageSendKeyCombo:e}),selected:d})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("AutoDownloadMedia")),n.a.createElement(Zt.a,{label:P("Contacts"),checked:m,onCheck:e=>E({shouldAutoDownloadMediaFromContacts:e})}),n.a.createElement(Zt.a,{label:P("AutodownloadPrivateChats"),checked:u,onCheck:e=>E({shouldAutoDownloadMediaInPrivateChats:e})}),n.a.createElement(Zt.a,{label:P("AutodownloadGroupChats"),checked:h,onCheck:e=>E({shouldAutoDownloadMediaInGroups:e})}),n.a.createElement(Zt.a,{label:P("FilterChannels"),checked:b,onCheck:e=>E({shouldAutoDownloadMediaInChannels:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("AutoplayMedia")),n.a.createElement(Zt.a,{label:P("GifsTab2"),checked:g,onCheck:e=>E({shouldAutoPlayGifs:e})}),n.a.createElement(Zt.a,{label:P("DataAndStorage.Autoplay.Videos"),checked:p,onCheck:e=>E({shouldAutoPlayVideos:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0},P("AccDescrStickers")),n.a.createElement(Zt.a,{label:P("SuggestStickers"),checked:v,onCheck:e=>E({shouldSuggestStickers:e})}),n.a.createElement(Zt.a,{label:P("LoopAnimatedStickers"),checked:O,onCheck:e=>E({shouldLoopStickers:e})}),n.a.createElement("div",{className:"mt-4",ref:C},D&&D.map(e=>n.a.createElement(la,{key:e.id,stickerSet:e,observeIntersection:y,onClick:T}))),S&&n.a.createElement(ia.a,{isOpen:k,fromSticker:S,onClose:w})))}));let ua;function ha(e="*",t,a=!1){ua||(ua=document.createElement("input"),ua.setAttribute("type","file")),ua.setAttribute("accept",e),a?ua.removeAttribute("multiple"):ua.setAttribute("multiple","multiple"),ua.onchange=null,ua.value="",ua.onchange=t,ua.click()}var ba=a(17);function ga(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function pa(e){const t=e[0].toString(16),a=e[1].toString(16),n=e[2].toString(16);return(1==t.length?"0"+t:t)+(1==a.length?"0"+a:a)+(1==n.length?"0"+n:n)}function va([e,t,a]){e/=255,t/=255,a/=255;let n,s,c=Math.max(e,t,a),r=Math.min(e,t,a),o=c,l=c-r;if(s=0==c?0:l/c,c==r)n=0;else{switch(c){case e:n=(t-a)/l+(t<a?6:0);break;case t:n=(a-e)/l+2;break;case a:n=(e-t)/l+4}n/=6}return[n,s,o]}function Oa([e,t,a]){let n,s,c,r=Math.floor(6*e),o=6*e-r,l=a*(1-t),i=a*(1-o*t),d=a*(1-(1-o)*t);switch(r%6){case 0:n=a,s=d,c=l;break;case 1:n=i,s=a,c=l;break;case 2:n=l,s=a,c=d;break;case 3:n=l,s=i,c=a;break;case 4:n=d,s=l,c=a;break;case 5:n=a,s=l,c=i}return[Math.round(255*n),Math.round(255*s),Math.round(255*c)]}function Ea(e){let[t,a,n]=va(e);return a=Math.min(1,a+.05+.1*(1-a)),n=n>.5?Math.max(0,.65*n):Math.max(0,Math.min(1,1-.65*n)),`hsla(${360*t}, ${100*a}%, ${100*n}%, .4)`}var ja=a(12),fa=a(168);a(288);var Ca=Object(n.h)(({wallpaper:e,theme:t,isSelected:a,onClick:s})=>{const{slug:c,document:l}=e,i="wallpaper"+l.id,d=l.previewBlobUrl,m=Object(O.a)(i+"?size=m"),u=Object(fa.a)(l.thumbnail&&l.thumbnail.dataUri,Boolean(m),!0),{shouldRenderThumb:h,shouldRenderFullMedia:b,transitionClassNames:g}=Object(na.a)(m||d,"slow"),[p,v]=Object(n.r)(!1),{mediaData:j,downloadProgress:C}=Object(E.a)(i,!p),y=!1===Object(f.a)(p),{shouldRender:k,transitionClassNames:N}=Object(Y.a)(p&&!j||c===r.o,void 0,y,"slow"),w=Object(n.q)();w.current=t;const S=Object(n.m)(()=>{(async()=>{const e=await Object(ba.e)(j);await ja.d(o.o,w.current,e),s(c)})()},[j,s,c]);Object(n.n)(()=>{j&&S()},[j,S]);const I=Object(n.m)(()=>{j?S():v(e=>!e)},[j,S]),P=Object(W.a)("WallpaperTile",a&&"selected");return n.a.createElement("div",{className:P,onClick:I},n.a.createElement("div",{className:"media-inner"},h&&n.a.createElement("canvas",{ref:u,className:"thumbnail"}),b&&n.a.createElement("img",{src:m||d,className:"full-media "+g,alt:""}),k&&n.a.createElement("div",{className:Object(W.a)("spinner-container",N)},n.a.createElement(H.a,{progress:C,onClick:I}))))});a(289);const ya=Object(V.h)(e=>e(),6e4,!0);var ka=Object(n.h)(Object(s.h)(e=>{const t=Object(m.Db)(e),{background:a,isBlurred:n}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:a,isBlurred:n,loadedWallpapers:s,theme:t}},(e,t)=>Object(h.l)(t,["loadWallpapers","uploadWallpaper","setThemeSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,background:s,isBlurred:c,loadedWallpapers:l,theme:i,loadWallpapers:d,uploadWallpaper:m,setThemeSettings:u})=>{const h=Object(n.q)();h.current=i,Object(n.n)(()=>{ya(()=>{d()})},[d]);const b=Object(n.m)(e=>{const{files:t}=e.target;t&&t.length>0&&m(t[0])},[m]),g=Object(n.m)(()=>{ha("image/jpeg",b,!0)},[b]),p=Object(n.m)(()=>{t(r.n.GeneralChatBackgroundColor)},[t]),v=Object(n.m)(()=>{u({theme:i,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===i?o.q:o.x})},[u,i]),O=Object(n.m)(e=>{u({theme:h.current,background:e});const t=l&&l.find(t=>t.slug===e);t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let a,n,s,c,r=-4,o=[0,0,0],l=0;const i=document.createElement("canvas"),d=i.getContext&&i.getContext("2d");if(!d)return t;const m=await Object(ba.g)(e);s=m.naturalHeight||m.offsetHeight||m.height,n=m.naturalWidth||m.offsetWidth||m.width,i.height=s,i.width=n,d.drawImage(m,0,0);try{a=d.getImageData(0,0,n,s)}catch(e){return t}for(c=a.data.length;(r+=20)<c;)++l,o[0]+=a.data[r],o[1]+=a.data[r+1],o[2]+=a.data[r+2];return o[0]=Math.floor(o[0]/l),o[1]=Math.floor(o[1]/l),o[2]=Math.floor(o[2]/l),o}(t.document.thumbnail.dataUri).then(e=>{const t=Ea(e),a="#"+pa(e);u({theme:h.current,backgroundColor:a,patternColor:t})})},[l,u]),E=Object(n.m)(e=>{u({theme:h.current,isBlurred:e.target.checked})},[u]),j=Object(M.a)();Object(L.a)(e,a,t,r.n.GeneralChatBackground);const f=l&&l[0]&&l[0].slug===r.o;return n.a.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement(Ee.a,{icon:"camera-add",className:"mb-0",disabled:f,onClick:g},j("UploadImage")),n.a.createElement(Ee.a,{icon:"colorize",className:"mb-0",onClick:p},j("SetColor")),n.a.createElement(Ee.a,{icon:"favorite",onClick:v},j("ThemeResetToDefaults")),n.a.createElement(Zt.a,{label:j("BackgroundBlurred"),checked:Boolean(c),onChange:E})),l?n.a.createElement("div",{className:"settings-wallpapers"},l.map(e=>n.a.createElement(Ca,{wallpaper:e,theme:i,isSelected:s===e.slug,onClick:O}))):n.a.createElement(ge.a,null))}));a(290);const Na=va(ga("e6ebee")),wa=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Sa(e,t){return{colorPosition:[Math.round(e[1]*(t.colorRect.width-1)),Math.round((1-e[2])*(t.colorRect.height-1))],huePosition:Math.round(e[0]*(t.hueRect.width-1))}}function Ia({colorPosition:e,huePosition:t},a){return[t/(a.hueRect.width-1),e[0]/(a.colorRect.width-1),1-e[1]/(a.colorRect.height-1)]}var Pa=Object(n.h)(Object(s.h)(e=>{const t=Object(m.Db)(e),{backgroundColor:a}=e.settings.themes[t]||{};return{backgroundColor:a,theme:t}},(e,t)=>Object(h.l)(t,["setThemeSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,theme:s,backgroundColor:c,setThemeSettings:o})=>{const l=Object(n.q)();l.current=s;const i=Object(n.q)(null),d=Object(n.q)(null),m=Object(n.q)(null),u=Object(n.q)(!0),[g,p]=Object(n.r)(function(e){return e&&e.startsWith("#")?va(ga(e.replace("#",""))):Na}(c)),v=Object(n.q)(g);Object(n.n)(()=>{v.current=g},[g]);const[O,E,j]=Object(xe.a)(),[f,C]=Object(n.r)(""),[y,k]=Object(n.r)(""),N=Object(n.q)(),w=Object(n.q)();Object(n.n)(()=>{const e={offsetLeft:d.current.offsetLeft,...Object(h.l)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...Object(h.l)(m.current.getBoundingClientRect(),["width"])};function a(t){const a=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+i.current.scrollTop),e.height-1)],{huePosition:n}=Sa(v.current,N.current);p(Ia({colorPosition:a,huePosition:n},N.current)),E()}function n(e){const{colorPosition:a}=Sa(v.current,N.current),n=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);p(Ia({colorPosition:a,huePosition:n},N.current)),E()}N.current={colorRect:e,hueRect:t},Object(b.b)(d.current,{onCapture:a,onDrag:a,onRelease:j,onClick:j,withCursor:!0}),Object(b.b)(m.current,{onCapture:n,onDrag:n,onRelease:j,onClick:j,withCursor:!0})},[E,j]);const{colorPosition:S=[0,0],huePosition:I=0}=N.current?Sa(g,N.current):{},P=pa(Oa(g)),F=g[0],M=pa(Oa([F,1,1]));Object(n.n)(()=>{const e=Oa(g),t="#"+pa(e);if(C(e.join(", ")),k(t),!u.current){const a=Ea(e);o({theme:l.current,background:void 0,backgroundColor:t,patternColor:a})}u.current=!1},[g,o]),Object(n.n)(()=>{!function(e,t,a,n){let s,c,r;a.current&&n.current?(s=n.current.colorRect.width,c=n.current.colorRect.height,r=a.current):(s=e.offsetWidth,c=e.offsetHeight,r=e.getContext("2d"),e.width=s,e.height=c,a.current=r);const o=r.createImageData(s,c),l=o.data,i=Oa([t,1,1]);let d=0;for(let e=0;e<c;e++){const t=1-e/(c-1),a=[255*t,255*t,255*t],n=[i[0]*t,i[1]*t,i[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);l[d++]=a[0]+(n[0]-a[0])*t,l[d++]=a[1]+(n[1]-a[1])*t,l[d++]=a[2]+(n[2]-a[2])*t,l[d++]=255}}r.putImageData(o,0,0)}(d.current.firstChild,F,w,N)},[F]),Object(n.n)(()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const a=e.getContext("2d"),n=a.createImageData(t,1),s=n.data;let c=0;for(let e=0;e<t;e++){const a=Oa([e/(t-1),1,1]);s[c++]=a[0],s[c++]=a[1],s[c++]=a[2],s[c++]=255}a.putImageData(n,0,0)}(m.current.firstChild)},[]);const A=Object(n.m)(e=>{const t=e.currentTarget.value.replace(/[^\d, ]/g,"").slice(0,13);if(t.match(/^\d{1,3},\s?\d{1,3},\s?\d{1,3}$/)){const e=t.split(",").map(e=>Number(e.trim()));p(va(e))}e.currentTarget.value=t},[]),R=Object(n.m)(e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&p(va(ga(t.replace("#","")))),e.currentTarget.value=t},[]),T=Object(n.m)(e=>{p(va(ga(e.currentTarget.dataset.color.replace("#",""))))},[]),D=Object(W.a)("SettingsGeneralBackgroundColor settings-content custom-scroll",O&&"is-dragging");return Object(L.a)(e,a,t,r.n.GeneralChatBackgroundColor),n.a.createElement("div",{ref:i,className:D},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("div",{ref:d,className:"color-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translate(${S[0]}px, ${S[1]}px); background-color: #${P};`})),n.a.createElement("div",{ref:m,className:"hue-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translateX(${I}px); background-color: #${M};`})),n.a.createElement("div",{className:"tools"},n.a.createElement(ve.a,{value:y,label:"HEX",onChange:R}),n.a.createElement(ve.a,{value:f,label:"RGB",onChange:A}))),n.a.createElement("div",{className:"predefined-colors"},wa.map(e=>n.a.createElement("div",{className:e==="#"+P?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:T}))))}));var Fa=Object(n.h)(Object(s.h)(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)}),(e,t)=>Object(h.l)(t,["loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,hasPrivateChatsNotifications:s,hasPrivateChatsMessagePreview:c,hasGroupNotifications:o,hasGroupMessagePreview:l,hasBroadcastNotifications:i,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,loadNotificationSettings:u,updateContactSignUpNotification:h,updateNotificationSettings:b})=>{Object(n.n)(()=>{u()},[u]);const g=Object(n.m)((e,t,a)=>{const n="contact"===t?!s:!("group"===t?o:i),r="contact"===t?c:"group"===t?l:d;b({peerType:t,..."silent"===a&&{isSilent:!e.target.checked,shouldShowPreviews:r},..."showPreviews"===a&&{shouldShowPreviews:e.target.checked,isSilent:n}})},[d,i,l,o,c,s,b]),p=Object(n.m)(e=>{h({isSilent:!e.target.checked})},[h]),v=Object(M.a)();return Object(L.a)(e,a,t,r.n.Notifications),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("AutodownloadPrivateChats")),n.a.createElement(Zt.a,{label:v("NotificationsForPrivateChats"),subLabel:v(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{g(e,"contact","silent")}}),n.a.createElement(Zt.a,{label:v("MessagePreview"),subLabel:v(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{g(e,"contact","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("FilterGroups")),n.a.createElement(Zt.a,{label:v("NotificationsForGroups"),subLabel:v(o?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:o,onChange:e=>{g(e,"group","silent")}}),n.a.createElement(Zt.a,{label:v("MessagePreview"),subLabel:v(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{g(e,"group","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("FilterChannels")),n.a.createElement(Zt.a,{label:v("NotificationsForChannels"),subLabel:v(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{g(e,"broadcast","silent")}}),n.a.createElement(Zt.a,{label:v("MessagePreview"),subLabel:v(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{g(e,"broadcast","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:v.isRtl?"rtl":void 0},v("PhoneOther")),n.a.createElement(Zt.a,{label:v("ContactJoined"),checked:m,onChange:p})))}));var Ma=Object(n.h)(Object(s.h)(e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:a,canChangeSensitive:n},privacy:s},blocked:c,activeSessions:r}=e;return{hasPassword:t,blockedCount:c.totalCount,sessionsCount:r.length,isSensitiveEnabled:a,canChangeSensitive:n,visibilityPrivacyPhoneNumber:s.phoneNumber&&s.phoneNumber.visibility,visibilityPrivacyLastSeen:s.lastSeen&&s.lastSeen.visibility,visibilityPrivacyProfilePhoto:s.profilePhoto&&s.profilePhoto.visibility,visibilityPrivacyForwarding:s.forwards&&s.forwards.visibility,visibilityPrivacyGroupChats:s.chatInvite&&s.chatInvite.visibility}},(e,t)=>Object(h.l)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings","loadContentSettings","updateContentSettings"]))(({isActive:e,onScreenSelect:t,onReset:a,hasPassword:s,blockedCount:c,sessionsCount:o,isSensitiveEnabled:l,canChangeSensitive:i,visibilityPrivacyPhoneNumber:d,visibilityPrivacyLastSeen:m,visibilityPrivacyProfilePhoto:u,visibilityPrivacyForwarding:h,visibilityPrivacyGroupChats:b,loadPrivacySettings:g,loadBlockedContacts:p,loadAuthorizations:v,loadContentSettings:O,updateContentSettings:E})=>{Object(n.n)(()=>{p(),v(),g(),O()},[p,v,g,O]);const j=Object(M.a)();function f(e){switch(e){case"everybody":return j("P2PEverybody");case"contacts":return j("P2PContacts");case"nobody":return j("P2PNobody")}}return Object(L.a)(e,a,t,r.n.Privacy),n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement(Ee.a,{icon:"delete-user",narrow:!0,onClick:()=>t(r.n.PrivacyBlockedUsers)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("BlockedUsers")),c>0&&n.a.createElement("span",{className:"subtitle",dir:"auto"},j("Users",c)))),n.a.createElement(Ee.a,{icon:"lock",narrow:!0,onClick:()=>t(s?r.n.TwoFaEnabled:r.n.TwoFaDisabled)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("TwoStepVerification")),n.a.createElement("span",{className:"subtitle",dir:"auto"},j(s?"PasswordOn":"PasswordOff")))),n.a.createElement(Ee.a,{icon:"active-sessions",narrow:!0,onClick:()=>t(r.n.PrivacyActiveSessions)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("SessionsTitle")),o>0&&n.a.createElement("span",{className:"subtitle",dir:"auto"},1===o?"1 session":o+" sessions")))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:j.isRtl?"rtl":void 0},j("PrivacyTitle")),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyPhoneNumber)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("PrivacyPhoneTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(d)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyLastSeen)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("LastSeenTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(m)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyProfilePhoto)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("PrivacyProfilePhotoTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(u)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyForwarding)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("PrivacyForwardsTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(h)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>t(r.n.PrivacyGroupChats)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},j("WhoCanAddMe")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(b))))),i&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:j.isRtl?"rtl":void 0},j("lng_settings_sensitive_title")),n.a.createElement(Zt.a,{label:j("lng_settings_sensitive_disable_filtering"),subLabel:j("lng_settings_sensitive_about"),checked:Boolean(l),disabled:!i,onCheck:E})))})),La=a(14);var Aa=Object(n.h)(Object(s.h)(e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language}),(e,t)=>Object(h.l)(t,["loadLanguages","setSettingOption"]))(({isActive:e,onScreenSelect:t,onReset:a,languages:s,language:c,loadLanguages:o,setSettingOption:l})=>{const[i,d]=Object(n.r)(c),[m,u,h]=Object(xe.a)();Object(n.n)(()=>{o()},[o]);const b=Object(n.m)(e=>{d(e),u(),Object(La.d)(e,()=>{h(),l({language:e})})},[u,h,l]),g=Object(n.p)(()=>s?function(e){const t=(window.navigator.language||"en").toLowerCase(),a=t.substr(0,2);return e.map(({langCode:e,nativeName:t,name:a})=>({value:e,label:t,subLabel:a})).sort(e=>!t||e.value!==t&&e.value!==a?0:-1)}(s):void 0,[s]);return Object(L.a)(e,a,t,r.n.Language),n.a.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},g?n.a.createElement(qe.a,{name:"keyboard-send-settings",options:g,selected:i,loadingOption:m?i:void 0,onChange:b}):n.a.createElement(ge.a,null))}));function Ra(e){switch(e){case r.n.PrivacyPhoneNumber:case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case r.n.PrivacyLastSeen:case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyLastSeenDeniedContacts:return"lastSeen";case r.n.PrivacyProfilePhoto:case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case r.n.PrivacyForwarding:case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyForwardingDeniedContacts:return"forwards";case r.n.PrivacyGroupChats:case r.n.PrivacyGroupChatsAllowedContacts:case r.n.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}var Ta=Object(n.h)(Object(s.h)((e,{screen:t})=>{let a;const{chats:{byId:n},settings:{privacy:s}}=e;switch(t){case r.n.PrivacyPhoneNumber:a=s.phoneNumber;break;case r.n.PrivacyLastSeen:a=s.lastSeen;break;case r.n.PrivacyProfilePhoto:a=s.profilePhoto;break;case r.n.PrivacyForwarding:a=s.forwards;break;case r.n.PrivacyGroupChats:a=s.chatInvite}return a?{...a,chatsById:n}:{}},(e,t)=>Object(h.l)(t,["setPrivacyVisibility"]))(({screen:e,isActive:t,onScreenSelect:a,onReset:s,visibility:c,allowUserIds:o,allowChatIds:l,blockUserIds:i,blockChatIds:d,chatsById:m,setPrivacyVisibility:u})=>{const h=Object(M.a)(),b=Object(n.p)(()=>{switch(e){case r.n.PrivacyProfilePhoto:case r.n.PrivacyGroupChats:return[{value:"everybody",label:h("P2PEverybody")},{value:"contacts",label:h("P2PContacts")}];default:return[{value:"everybody",label:h("P2PEverybody")},{value:"contacts",label:h("P2PContacts")},{value:"nobody",label:h("P2PNobody")}]}},[h,e]),g={shouldShowDenied:"nobody"!==c,shouldShowAllowed:"everybody"!==c},p=Ra(e),v=Object(n.p)(()=>{switch(e){case r.n.PrivacyPhoneNumber:return h("PrivacyPhoneTitle");case r.n.PrivacyLastSeen:return h("LastSeenTitle");case r.n.PrivacyProfilePhoto:return h("PrivacyProfilePhotoTitle");case r.n.PrivacyForwarding:return h("PrivacyForwardsTitle");case r.n.PrivacyGroupChats:return h("WhoCanAddMe");default:return}},[h,e]);Object(L.a)(t,s,a,e);const O=Object(n.p)(()=>{switch(e){case r.n.PrivacyLastSeen:return h("CustomHelp");default:return}},[h,e]),E=(()=>{switch(e){case r.n.PrivacyPhoneNumber:return r.n.PrivacyPhoneNumberAllowedContacts;case r.n.PrivacyLastSeen:return r.n.PrivacyLastSeenAllowedContacts;case r.n.PrivacyProfilePhoto:return r.n.PrivacyProfilePhotoAllowedContacts;case r.n.PrivacyForwarding:return r.n.PrivacyForwardingAllowedContacts;default:return r.n.PrivacyGroupChatsAllowedContacts}})(),j=(()=>{switch(e){case r.n.PrivacyPhoneNumber:return r.n.PrivacyPhoneNumberDeniedContacts;case r.n.PrivacyLastSeen:return r.n.PrivacyLastSeenDeniedContacts;case r.n.PrivacyProfilePhoto:return r.n.PrivacyProfilePhotoDeniedContacts;case r.n.PrivacyForwarding:return r.n.PrivacyForwardingDeniedContacts;default:return r.n.PrivacyGroupChatsDeniedContacts}})(),f=Object(n.p)(()=>o&&l&&m?l.reduce((e,t)=>e+(m[t]?m[t].membersCount:0),o.length):0,[l,o,m]),C=Object(n.p)(()=>i&&d&&m?d.reduce((e,t)=>e+(m[t]?m[t].membersCount:0),i.length):0,[d,i,m]),y=Object(n.m)(e=>{u({privacyKey:p,visibility:e})},[p,u]);return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0},v),n.a.createElement(qe.a,{name:"visibility-"+p,options:b,onChange:y,selected:c}),O&&n.a.createElement("p",{className:"settings-item-description-larger",dir:h.isRtl?"rtl":void 0},O)),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:h.isRtl?"rtl":void 0},h("PrivacyExceptions")),g.shouldShowAllowed&&n.a.createElement(Ee.a,{narrow:!0,icon:"add-user",onClick:()=>{a(E)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},f>0&&n.a.createElement("span",{className:"date",dir:"auto"},"+",f),n.a.createElement("span",{className:"title"},h("AlwaysShareWith")),n.a.createElement("span",{className:"subtitle"},h("EditAdminAddUsers")))),g.shouldShowDenied&&n.a.createElement(Ee.a,{narrow:!0,icon:"delete-user",onClick:()=>{a(j)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},C>0&&n.a.createElement("span",{className:"date",dir:"auto"},"",C),n.a.createElement("span",{className:"title"},h("NeverShareWith")),n.a.createElement("span",{className:"subtitle"},h("EditAdminAddUsers"))))))}));function Da(e){return[e.region,e.country].filter(Boolean).join(", ")}function Ba(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}var Ua=Object(n.h)(Object(s.h)(e=>({activeSessions:e.activeSessions}),(e,t)=>Object(h.l)(t,["loadAuthorizations","terminateAuthorization","terminateAllAuthorizations"]))(({isActive:e,onScreenSelect:t,onReset:a,activeSessions:s,loadAuthorizations:c,terminateAuthorization:o,terminateAllAuthorizations:l})=>{const[i,d,m]=Object(xe.a)();Object(n.n)(()=>{c()},[c]);const u=Object(n.m)(e=>{o({hash:e})},[o]),h=Object(n.m)(()=>{m(),l()},[m,l]),b=Object(n.p)(()=>s.find(e=>e.isCurrent),[s]),g=Object(n.p)(()=>s.filter(e=>!e.isCurrent),[s]),p=Object(M.a)();function v(e){return n.a.createElement(Ee.a,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{u(e.hash)}}]},n.a.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},n.a.createElement("span",{className:"date"},Object(B.g)(p,1e3*e.dateActive)),n.a.createElement("span",{className:"title"},e.appName),n.a.createElement("span",{className:"subtitle black tight"},Ba(e)),n.a.createElement("span",{className:"subtitle"},e.ip," - ",Da(e))))}return Object(L.a)(e,a,t,r.n.PrivacyActiveSessions),n.a.createElement("div",{className:"settings-content custom-scroll"},b&&(E=b,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:p.isRtl?"rtl":void 0},p("AuthSessions.CurrentSession")),n.a.createElement(Ee.a,{narrow:!0,inactive:!0},n.a.createElement("div",{className:"multiline-menu-item",dir:"auto"},n.a.createElement("span",{className:"title",dir:"auto"},E.appName),n.a.createElement("span",{className:"subtitle black tight"},Ba(E)),n.a.createElement("span",{className:"subtitle"},E.ip," - ",Da(E)))),n.a.createElement(Ee.a,{className:"destructive mb-0",icon:"stop",ripple:!0,narrow:!0,onClick:d},p("TerminateAllSessions")))),g&&(O=g,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:p.isRtl?"rtl":void 0},p("OtherSessions")),O.map(v))),g&&n.a.createElement(Pe.a,{isOpen:i,onClose:m,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:h,confirmIsDestructive:!0}));var O,E}));var xa=Object(n.h)(Object(s.h)(e=>{const{chats:{byId:t},users:{byId:a},blocked:{ids:n}}=e;return{chatsByIds:t,usersByIds:a,blockedIds:n}},(e,t)=>Object(h.l)(t,["unblockContact"]))(({isActive:e,onScreenSelect:t,onReset:a,chatsByIds:s,usersByIds:c,blockedIds:l,unblockContact:i})=>{const d=Object(n.m)(e=>{i({contactId:e})},[i]),m=Object(M.a)();return Object(L.a)(e,a,t,r.n.PrivacyBlockedUsers),n.a.createElement("div",{className:"settings-fab-wrapper"},n.a.createElement("div",{className:"settings-content infinite-scroll"},n.a.createElement("div",{className:"settings-item"},n.a.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:m.isRtl?"rtl":void 0},m("BlockedUsersInfo"))),n.a.createElement("div",{className:"chat-list custom-scroll"},l&&l.length?n.a.createElement("div",{className:"scroll-container"},l.map((e,t)=>function(e,t,a){const r=Object(u.ob)(e),l=r?c[e]:void 0,i=r?void 0:s[e],h=Object(W.a)("Chat chat-item-clickable blocked-list-item",r?"private":"group");return n.a.createElement(Ee.a,{key:e,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{d(e)}}],style:`top: ${(a+t)*o.k}px;`},n.a.createElement(x.a,{size:"medium",user:l,chat:i}),n.a.createElement("div",{className:"contact-info",dir:"auto"},n.a.createElement("h3",{dir:"auto"},Object(U.a)((r?Object(u.bb)(l):Object(u.k)(m,i))||"")),l&&l.phoneNumber&&n.a.createElement("div",{className:"contact-phone",dir:"auto"},Object(At.c)(l.phoneNumber)),l&&!l.phoneNumber&&l.username&&n.a.createElement("div",{className:"contact-username",dir:"auto"},"@",l.username)))}(e,t,0))):l&&!l.length?n.a.createElement("div",{className:"no-results",dir:"auto"},"List is empty"):n.a.createElement(ge.a,{key:"loading"}))),n.a.createElement(Dt.a,{isShown:!0,onClick:()=>{},className:"not-implemented",ariaLabel:"Add a blocked user"},n.a.createElement("i",{className:"icon-add"})))})),Ga=a(129);var za=Object(n.h)(Object(s.h)(e=>({animatedEmoji:Object(m.c)(e,"🔐")}))(({isActive:e,onReset:t,animatedEmoji:a,onScreenSelect:s})=>{const c=Object(M.a)();return Object(L.a)(e,t,s,r.n.TwoFaEnabled),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ga.a,{sticker:a,size:"large"}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},Object(U.a)(c("EnabledPasswordText"),["br"]))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(Ee.a,{icon:"edit",onClick:()=>s(r.n.TwoFaChangePasswordCurrent)},c("ChangePassword")),n.a.createElement(Ee.a,{icon:"password-off",onClick:()=>s(r.n.TwoFaTurnOff)},c("TurnPasswordOff")),n.a.createElement(Ee.a,{icon:"email",onClick:()=>s(r.n.TwoFaRecoveryEmailCurrentPassword)},c("SetRecoveryEmail"))))})),qa=a(153),_a=a(154);var Ha=Object(n.h)(({screen:e,isActive:t,onScreenSelect:a,onReset:s,error:c,isLoading:r,expectedPassword:o,placeholder:l="Current Password",hint:i,submitLabel:d,clearError:m,onSubmit:u})=>{const[h,b]=Object(n.r)(""),[g,p]=Object(n.r)(!1),v=Object(n.m)(e=>{o&&e!==o?b("Passwords Should Be Equal"):u(e)},[u,o]),O=Object(n.m)(()=>{m&&m(),b("")},[m]),E=Object(M.a)();return Object(L.a)(t,s,a,e),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(qa.a,{isBig:!0,isPasswordVisible:g})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(_a.a,{error:h||c,hint:i,placeholder:l,submitLabel:d||E("Next"),clearError:O,isLoading:r,isPasswordVisible:g,onChangePasswordVisibility:p,onSubmit:v})))});var $a=Object(n.h)(Object(s.h)(e=>({animatedEmoji:Object(m.c)(e,"🔐")}))(({isActive:e,onScreenSelect:t,onReset:a,animatedEmoji:s,onStart:c})=>{const o=Object(M.a)();return Object(L.a)(e,a,t,r.n.TwoFaDisabled),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ga.a,{sticker:s,size:"large"}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},o("SetAdditionalPasswordInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(D.a,{onClick:c},o("EditAdminTransferSetPassword"))))}));const Va=l.l?550:400;var Wa=Object(n.h)(Object(s.h)((e,{icon:t})=>({animatedEmoji:Object(m.c)(e,"email"===t?"💌":"💡")}))(({animatedEmoji:e,type:t="text",isLoading:a,error:s,placeholder:c,shouldConfirm:r,clearError:o,onSubmit:i,isActive:d,onScreenSelect:m,onReset:u,screen:h})=>{const b=Object(n.q)(null),[g,p]=Object(n.r)(""),[v,O,E]=Object(xe.a)(!1);Object(n.n)(()=>{l.n||setTimeout(()=>{b.current.focus()},Va)},[]);const j=Object(M.a)();return Object(L.a)(d,u,m,h),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ga.a,{sticker:e,size:"large"})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),b.current&&i(g)}},n.a.createElement(ve.a,{ref:b,value:g,inputMode:t,label:c,error:s,onChange:e=>{s&&o&&o(),p(e.target.value)}}),g?n.a.createElement(D.a,{type:"submit",isLoading:a,ripple:!0},j("Continue")):n.a.createElement(D.a,{isText:!0,isLoading:a,ripple:!0,onClick:r?O:()=>{i()}},j("YourEmailSkip"))),r&&n.a.createElement(pe.a,{className:"narrow",isOpen:v,title:j("YourEmailSkipWarning"),onClose:E},Object(U.a)(j("YourEmailSkipWarningText"),["br","simple_markdown"]),n.a.createElement("div",{className:"dialog-buttons"},n.a.createElement(D.a,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{E(),i()}},j("YourEmailSkip")),n.a.createElement(D.a,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:E},j("Cancel"))))))}));var Ka=Object(n.h)(Object(s.h)(e=>({animatedEmoji:Object(m.c)(e,"🥳")}))(({isActive:e,onReset:t,animatedEmoji:a,onScreenSelect:s})=>{const c=Object(M.a)();return Object(L.a)(e,t,s,r.n.TwoFaCongratulations),n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ga.a,{sticker:a,size:"large"}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},c("TwoStepVerificationPasswordSetInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(D.a,{onClick:()=>{s(r.n.Privacy)}},c("TwoStepVerificationPasswordReturnSettings"))))}));const Ya=l.l?550:400;var Qa=Object(n.h)(Object(s.h)(e=>({animatedEmoji:Object(m.c)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength}))(({animatedEmoji:e,codeLength:t,isLoading:a,error:s,clearError:c,onSubmit:r,isActive:o,onScreenSelect:i,onReset:d,screen:m})=>{const u=Object(n.q)(null),[h,b]=Object(n.r)("");Object(n.n)(()=>{l.n||setTimeout(()=>{u.current.focus()},Ya)},[]);const g=Object(M.a)();Object(L.a)(o,d,i,m);return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ga.a,{sticker:e,size:"large"})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(ve.a,{value:h,ref:u,inputMode:"decimal",label:g("YourEmailCode"),error:s,onChange:e=>{s&&c&&c();const a=e.target.value.slice(0,t);a.length===t&&r(a),b(a),e.target.value=a}}),a&&n.a.createElement(ge.a,null)))}));var Za=Object(n.h)(Object(s.h)(e=>({...e.twoFaSettings}),(e,t)=>Object(h.l)(t,["updatePassword","updateRecoveryEmail","clearPassword","provideTwoFaEmailCode","checkPassword","clearTwoFaError"]))(({currentScreen:e,shownScreen:t,state:a,hint:s,isLoading:c,error:o,waitingEmailCodeLength:l,dispatch:i,isActive:d,onScreenSelect:m,onReset:u,updatePassword:h,checkPassword:b,clearTwoFaError:g,updateRecoveryEmail:p,provideTwoFaEmailCode:v,clearPassword:O})=>{Object(n.n)(()=>{l&&(e===r.n.TwoFaNewPasswordEmail?m(r.n.TwoFaNewPasswordEmailCode):e===r.n.TwoFaRecoveryEmail&&m(r.n.TwoFaRecoveryEmailCode))},[e,m,l]);const E=Object(n.m)(()=>{i({type:"reset"}),m(r.n.TwoFaNewPassword)},[i,m]),j=Object(n.m)(e=>{i({type:"setPassword",payload:e}),m(r.n.TwoFaNewPasswordConfirm)},[i,m]),f=Object(n.m)(()=>{m(r.n.TwoFaNewPasswordHint)},[m]),C=Object(n.m)(e=>{i({type:"setHint",payload:e}),m(r.n.TwoFaNewPasswordEmail)},[i,m]),y=Object(n.m)(e=>{i({type:"setEmail",payload:e}),h({...a,email:e,onSuccess:()=>{m(r.n.TwoFaCongratulations)}})},[i,m,a,h]),k=Object(n.m)(e=>{i({type:"setCurrentPassword",payload:e}),b({currentPassword:e,onSuccess:()=>{m(r.n.TwoFaChangePasswordNew)}})},[b,i,m]),N=Object(n.m)(e=>{i({type:"setPassword",payload:e}),m(r.n.TwoFaChangePasswordConfirm)},[i,m]),w=Object(n.m)(()=>{m(r.n.TwoFaChangePasswordHint)},[m]),S=Object(n.m)(e=>{i({type:"setHint",payload:e}),h({...a,hint:e,onSuccess:()=>{m(r.n.TwoFaCongratulations)}})},[i,m,a,h]),I=Object(n.m)(e=>{O({currentPassword:e,onSuccess:()=>{m(r.n.Privacy)}})},[O,m]),P=Object(n.m)(e=>{i({type:"setCurrentPassword",payload:e}),b({currentPassword:e,onSuccess:()=>{m(r.n.TwoFaRecoveryEmail)}})},[b,i,m]),F=Object(n.m)(e=>{i({type:"setEmail",payload:e}),p({...a,email:e,onSuccess:()=>{m(r.n.TwoFaCongratulations)}})},[i,m,a,p]),L=Object(n.m)(e=>{v({code:e})},[v]),A=Object(M.a)();switch(e){case r.n.TwoFaDisabled:return n.a.createElement($a,{onStart:E,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPassword,r.n.TwoFaNewPasswordConfirm,r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPassword:return n.a.createElement(Ha,{screen:e,placeholder:A("PleaseEnterPassword"),submitLabel:A("Continue"),onSubmit:j,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordConfirm,r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordConfirm:return n.a.createElement(Ha,{screen:e,expectedPassword:a.password,placeholder:A("PleaseReEnterPassword"),submitLabel:A("Continue"),onSubmit:f,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordHint:return n.a.createElement(Wa,{icon:"hint",placeholder:A("PasswordHintPlaceholder"),onSubmit:C,screen:e,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordEmail:return n.a.createElement(Wa,{icon:"email",type:"email",isLoading:c,error:o,clearError:g,placeholder:A("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:y,screen:e,onScreenSelect:m,isActive:d||[r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaNewPasswordEmailCode:return n.a.createElement(Qa,{isLoading:c,error:o,clearError:g,onSubmit:L,screen:e,onScreenSelect:m,isActive:d||t===r.n.TwoFaCongratulations,onReset:u});case r.n.TwoFaCongratulations:return n.a.createElement(Ka,{onScreenSelect:m,isActive:d,onReset:u});case r.n.TwoFaEnabled:return n.a.createElement(za,{onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordCurrent,r.n.TwoFaChangePasswordNew,r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaTurnOff,r.n.TwoFaRecoveryEmailCurrentPassword,r.n.TwoFaRecoveryEmail,r.n.TwoFaRecoveryEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordCurrent:return n.a.createElement(Ha,{screen:e,isLoading:c,error:o,clearError:g,hint:s,onSubmit:k,onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordNew,r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordNew:return n.a.createElement(Ha,{screen:e,placeholder:A("PleaseEnterNewFirstPassword"),onSubmit:N,onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordConfirm:return n.a.createElement(Ha,{screen:e,expectedPassword:a.password,placeholder:A("PleaseReEnterPassword"),onSubmit:w,onScreenSelect:m,isActive:d||[r.n.TwoFaChangePasswordHint,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaChangePasswordHint:return n.a.createElement(Wa,{isLoading:c,error:o,clearError:g,icon:"hint",placeholder:A("PasswordHintPlaceholder"),onSubmit:S,onScreenSelect:m,isActive:d||t===r.n.TwoFaCongratulations,onReset:u,screen:e});case r.n.TwoFaTurnOff:return n.a.createElement(Ha,{isLoading:c,error:o,clearError:g,hint:s,onSubmit:I,onScreenSelect:m,isActive:d,onReset:u,screen:e});case r.n.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement(Ha,{screen:e,isLoading:c,error:o,clearError:g,hint:s,onSubmit:P,onScreenSelect:m,isActive:d||[r.n.TwoFaRecoveryEmail,r.n.TwoFaRecoveryEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaRecoveryEmail:return n.a.createElement(Wa,{screen:e,icon:"email",type:"email",placeholder:A("RecoveryEmailTitle"),onSubmit:F,onScreenSelect:m,isActive:d||[r.n.TwoFaRecoveryEmailCode,r.n.TwoFaCongratulations].includes(t),onReset:u});case r.n.TwoFaRecoveryEmailCode:return n.a.createElement(Qa,{screen:e,isLoading:c,error:o,clearError:g,onSubmit:L,onScreenSelect:m,isActive:d||t===r.n.TwoFaCongratulations,onReset:u});default:return}})),Ja=a(173);function Xa(e,t){const{privacy:a}=e.settings;switch(t){case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyPhoneNumberDeniedContacts:return a.phoneNumber;case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyLastSeenDeniedContacts:return a.lastSeen;case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:return a.profilePhoto;case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyForwardingDeniedContacts:return a.forwards;case r.n.PrivacyGroupChatsDeniedContacts:case r.n.PrivacyGroupChatsAllowedContacts:return a.chatInvite}}var en=Object(n.h)(Object(s.h)((e,{screen:t})=>{const{chats:{byId:a,listIds:n,orderedPinnedIds:s},currentUserId:c}=e;return{currentUserId:c,chatsById:a,listIds:n.active,orderedPinnedIds:s.active,archivedPinnedIds:s.archived,archivedListIds:n.archived,settings:Xa(e,t)}},(e,t)=>Object(h.l)(t,["setPrivacySettings"]))(({currentUserId:e,isAllowList:t,screen:a,settings:s,chatsById:c,listIds:o,orderedPinnedIds:l,archivedListIds:i,archivedPinnedIds:d,setPrivacySettings:m,isActive:h,onScreenSelect:b,onReset:g})=>{const p=Object(M.a)(),v=Object(n.p)(()=>s?t?[...s.allowUserIds,...s.allowChatIds]:[...s.blockUserIds,...s.blockChatIds]:[],[t,s]),[O,E]=Object(n.r)(""),[j,f]=Object(n.r)(!1),[C,y]=Object(n.r)(v),k=Object(n.p)(()=>{const e=o?Object(u.Fb)(c,o,l,"all"):void 0,t=i?Object(u.Fb)(c,i,d,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[c,o,l,i,d]),N=Object(n.p)(()=>{if(k)return k.filter(t=>(Object(u.ob)(t.id)&&t.id!==e||Object(u.nb)(t))&&(!O||Object(ue.a)(Object(u.k)(p,t),O)||v.includes(t.id))).map(({id:e})=>e)},[k,e,p,O,v]),w=Object(n.m)(e=>{y(e),f(!0)},[]),S=Object(n.m)(()=>{m({privacyKey:Ra(a),isAllowList:Boolean(t),contactsIds:C}),b(r.n.Privacy)},[t,C,b,a,m]);return Object(L.a)(h,g,b,a),n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(Ja.a,{itemIds:N||[],selectedIds:C,filterValue:O,filterPlaceholder:p(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:w,onFilterChange:E}),n.a.createElement(Dt.a,{isShown:j,onClick:S,ariaLabel:p(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},n.a.createElement("i",{className:"icon-arrow-right"})))}));a(291);const tn=Object.keys(r.n).length/2,an=[r.n.TwoFaDisabled,r.n.TwoFaNewPassword,r.n.TwoFaNewPasswordConfirm,r.n.TwoFaNewPasswordHint,r.n.TwoFaNewPasswordEmail,r.n.TwoFaNewPasswordEmailCode,r.n.TwoFaCongratulations,r.n.TwoFaEnabled,r.n.TwoFaChangePasswordCurrent,r.n.TwoFaChangePasswordNew,r.n.TwoFaChangePasswordConfirm,r.n.TwoFaChangePasswordHint,r.n.TwoFaTurnOff,r.n.TwoFaRecoveryEmailCurrentPassword,r.n.TwoFaRecoveryEmail,r.n.TwoFaRecoveryEmailCode],nn=[r.n.Folders,r.n.FoldersCreateFolder,r.n.FoldersEditFolder,r.n.FoldersEditFolderFromChatList,r.n.FoldersIncludedChats,r.n.FoldersIncludedChatsFromChatList,r.n.FoldersExcludedChats,r.n.FoldersExcludedChatsFromChatList],sn=[r.n.PrivacyBlockedUsers,r.n.PrivacyActiveSessions],cn=[r.n.PrivacyPhoneNumberAllowedContacts,r.n.PrivacyPhoneNumberDeniedContacts],rn=[r.n.PrivacyLastSeenAllowedContacts,r.n.PrivacyLastSeenDeniedContacts],on=[r.n.PrivacyProfilePhotoAllowedContacts,r.n.PrivacyProfilePhotoDeniedContacts],ln=[r.n.PrivacyForwardingAllowedContacts,r.n.PrivacyForwardingDeniedContacts],dn=[r.n.PrivacyGroupChatsAllowedContacts,r.n.PrivacyGroupChatsDeniedContacts];var mn=Object(n.h)(({isActive:e,currentScreen:t,foldersState:a,foldersDispatch:s,onScreenSelect:c,onReset:o,shouldSkipTransition:i})=>{const[d,m]=Object(Pt.a)(Mt,Ft),u=Object(n.m)(()=>{t!==r.n.FoldersCreateFolder&&t!==r.n.FoldersEditFolder&&t!==r.n.FoldersEditFolderFromChatList||setTimeout(()=>{s({type:"reset"})},200),t!==r.n.FoldersIncludedChats&&t!==r.n.FoldersExcludedChats?o():"create"===a.mode?c(r.n.FoldersCreateFolder):c(r.n.FoldersEditFolder)},[a.mode,s,t,o,c]),h=Object(n.m)(()=>{s({type:"saveFilters"}),u()},[s,u]);function b(o,l,i){return n.a.createElement(n.a.Fragment,null,n.a.createElement(Lt,{currentScreen:t,onReset:u,onSaveFilter:h,editedFolderId:a.folderId}),function(o,l){const i={[r.n.PrivacyPhoneNumber]:cn.includes(l),[r.n.PrivacyLastSeen]:rn.includes(l),[r.n.PrivacyProfilePhoto]:on.includes(l),[r.n.PrivacyForwarding]:ln.includes(l),[r.n.PrivacyGroupChats]:dn.includes(l)},h=an.includes(l),b=nn.includes(l),g=sn.includes(l)||h||Object.keys(i).includes(l.toString())||Object.values(i).find(e=>!0===e);switch(t){case r.n.Main:return n.a.createElement(Rt,{onScreenSelect:c,isActive:e,onReset:u});case r.n.EditProfile:return n.a.createElement(qt,{onScreenSelect:c,isActive:e&&o,onReset:u});case r.n.General:return n.a.createElement(ma,{onScreenSelect:c,isActive:o||l===r.n.GeneralChatBackgroundColor||l===r.n.GeneralChatBackground||g||b,onReset:u});case r.n.Notifications:return n.a.createElement(Fa,{onScreenSelect:c,isActive:o,onReset:u});case r.n.Privacy:return n.a.createElement(Ma,{onScreenSelect:c,isActive:o||g||h,onReset:u});case r.n.Language:return n.a.createElement(Aa,{onScreenSelect:c,isActive:o,onReset:u});case r.n.GeneralChatBackground:return n.a.createElement(ka,{onScreenSelect:c,isActive:o||l===r.n.GeneralChatBackgroundColor,onReset:u});case r.n.GeneralChatBackgroundColor:return n.a.createElement(Pa,{onScreenSelect:c,isActive:o,onReset:u});case r.n.PrivacyActiveSessions:return n.a.createElement(Ua,{onScreenSelect:c,isActive:o,onReset:u});case r.n.PrivacyBlockedUsers:return n.a.createElement(xa,{onScreenSelect:c,isActive:o,onReset:u});case r.n.PrivacyPhoneNumber:case r.n.PrivacyLastSeen:case r.n.PrivacyProfilePhoto:case r.n.PrivacyForwarding:case r.n.PrivacyGroupChats:return n.a.createElement(Ta,{screen:t,onScreenSelect:c,isActive:o||i[t],onReset:u});case r.n.PrivacyPhoneNumberAllowedContacts:case r.n.PrivacyLastSeenAllowedContacts:case r.n.PrivacyProfilePhotoAllowedContacts:case r.n.PrivacyForwardingAllowedContacts:case r.n.PrivacyGroupChatsAllowedContacts:return n.a.createElement(en,{isAllowList:!0,screen:t,onScreenSelect:c,isActive:o||i[t],onReset:u});case r.n.PrivacyPhoneNumberDeniedContacts:case r.n.PrivacyLastSeenDeniedContacts:case r.n.PrivacyProfilePhotoDeniedContacts:case r.n.PrivacyForwardingDeniedContacts:case r.n.PrivacyGroupChatsDeniedContacts:return n.a.createElement(en,{screen:t,onScreenSelect:c,isActive:o,onReset:u});case r.n.Folders:case r.n.FoldersCreateFolder:case r.n.FoldersEditFolder:case r.n.FoldersEditFolderFromChatList:case r.n.FoldersIncludedChats:case r.n.FoldersIncludedChatsFromChatList:case r.n.FoldersExcludedChats:case r.n.FoldersExcludedChatsFromChatList:return n.a.createElement(ea,{currentScreen:t,shownScreen:l,state:a,dispatch:s,isActive:o,onScreenSelect:c,onReset:u});case r.n.TwoFaDisabled:case r.n.TwoFaNewPassword:case r.n.TwoFaNewPasswordConfirm:case r.n.TwoFaNewPasswordHint:case r.n.TwoFaNewPasswordEmail:case r.n.TwoFaNewPasswordEmailCode:case r.n.TwoFaCongratulations:case r.n.TwoFaEnabled:case r.n.TwoFaChangePasswordCurrent:case r.n.TwoFaChangePasswordNew:case r.n.TwoFaChangePasswordConfirm:case r.n.TwoFaChangePasswordHint:case r.n.TwoFaTurnOff:case r.n.TwoFaRecoveryEmailCurrentPassword:case r.n.TwoFaRecoveryEmail:case r.n.TwoFaRecoveryEmailCode:return n.a.createElement(Za,{currentScreen:t,state:d,dispatch:m,shownScreen:l,isActive:o,onScreenSelect:c,onReset:u});default:return}}(o,i))}return n.a.createElement(T.a,{id:"Settings",name:i?"none":l.p,activeKey:t,renderCount:tn},b)});const un=Object(V.h)(e=>e(),6e4,!0);var hn=Object(n.h)(Object(s.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users;return{usersById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(h.l)(t,["loadContactList","openChat"]))(({isActive:e,onReset:t,filter:a,usersById:s,contactIds:c,loadContactList:r,openChat:o,serverTimeOffset:i})=>{Object(n.n)(()=>{un(()=>{r()})}),Object(L.a)(e,t);const d=Object(n.m)(e=>{o({id:e,shouldReplaceHistory:!0})},[o]),m=Object(n.p)(()=>{if(!c)return;const e=a?c.filter(e=>{const t=s[e];if(!t)return!1;const n=Object(u.bb)(t);return n&&Object(ue.a)(n,a)}):c;return Object(u.Jb)(e,s,void 0,i)},[c,a,s,i]),[h,b]=Object(he.a)(void 0,m,Boolean(a));return n.a.createElement(Oe.a,{items:h,onLoadMore:b,className:"chat-list custom-scroll"},h&&h.length?h.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable",onClick:()=>d(e),ripple:!l.l},n.a.createElement(je.a,{userId:e,forceShowSelf:!0,avatarSize:"large"}))):h&&!h.length?n.a.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},a.length?"No contacts matched your search.":"Contact list is empty."):n.a.createElement(ge.a,{key:"loading"}))}));const bn=Object(V.h)(e=>e(),6e4,!0);var gn=Object(n.h)(Object(s.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users,{byId:n}=e.chats,{currentUserId:s}=e,{query:c,fetchingStatus:r,globalResults:o,localResults:l}=e.globalSearch,{userIds:i}=o||{},{userIds:d}=l||{};return{currentUserId:s,usersById:a,chatsById:n,localContactIds:t,searchQuery:c,isSearching:r&&r.chats,globalUserIds:i,localUserIds:d}},(e,t)=>Object(h.l)(t,["loadContactList","setGlobalSearchQuery"]))(({isChannel:e,isActive:t,selectedMemberIds:a,onSelectedMemberIdsChange:s,onNextStep:c,onReset:r,currentUserId:o,usersById:l,chatsById:i,localContactIds:d,searchQuery:m,isSearching:b,localUserIds:g,globalUserIds:p,loadContactList:v,setGlobalSearchQuery:O})=>{Object(n.n)(()=>{bn(()=>{v()})});const E=Object(M.a)();Object(L.a)(t,r);const j=Object(n.m)(e=>{O({query:e})},[O]),f=Object(n.p)(()=>{const e=d?Object(u.Ib)(d.filter(e=>e!==o),i):[];if(!m)return e;const t=e.filter(e=>{const t=l[e];if(!t)return!1;const a=Object(u.bb)(t);return a&&Object(ue.a)(a,m)});return Object(u.Ib)(Object(h.o)([...t,...g||[],...p||[]]).filter(e=>{const t=l[e];return!t||!Object(u.Bb)(t)||t.canBeInvitedToGroup}),i,!1,a)},[d,i,m,g,p,a,o,l]),C=Object(n.m)(()=>{(a.length||e)&&(O({query:""}),c())},[a.length,e,O,c]);return n.a.createElement("div",{className:"NewChat step-1"},n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:r,ariaLabel:"Return to Chat List"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,E("GroupAddMembers"))),n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(Ja.a,{itemIds:f,selectedIds:a,filterValue:m,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:b,onSelectedIdsChange:s,onFilterChange:j}),n.a.createElement(Dt.a,{isShown:Boolean(a.length||e),onClick:C,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},n.a.createElement("i",{className:"icon-arrow-right"}))))}));var pn=Object(n.h)(Object(s.h)(e=>{const{progress:t,error:a}=e.chatCreation||{};return{creationProgress:t,creationError:a}},(e,t)=>Object(h.l)(t,["createGroupChat","createChannel"]))(({isChannel:e,isActive:t,memberIds:a,onReset:s,creationProgress:c,creationError:o,createGroupChat:l,createChannel:i})=>{const d=Object(M.a)();Object(L.a)(t,s);const[m,u]=Object(n.r)(""),[h,b]=Object(n.r)(""),[g,p]=Object(n.r)(),[v,O]=Object(n.r)(),E=c===r.a.InProgress,j=Object(n.m)(e=>{const{value:t}=e.currentTarget,a=t.replace(/^\s+/,"");u(a),a!==t&&(e.currentTarget.value=a)},[]),f=Object(n.m)(e=>{b(e.currentTarget.value)},[]),C=Object(n.m)(()=>{m.length?a.length>199?O("Sorry, creating supergroups is not yet supported"):l({title:m,photo:g,memberIds:a}):O("Chat title can't be empty")},[m,a,l,g,"Chat title can't be empty","Sorry, creating supergroups is not yet supported"]),y=Object(n.m)(()=>{m.length?i({title:m,about:h,photo:g,memberIds:a}):O("Channel title can't be empty")},[m,i,h,g,a,"Channel title can't be empty"]);Object(n.n)(()=>{c===r.a.Complete&&s(!0)},[c,s]);const k=o||("Chat title can't be empty"!==v&&"Channel title can't be empty"!==v?v:void 0);return n.a.createElement("div",{className:"NewChat"},n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>s(),ariaLabel:"Return to member selection"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,d(e?"NewChannel":"NewGroup"))),n.a.createElement("div",{className:"NewChat-inner step-2"},n.a.createElement(Tt.a,{onChange:p,title:d("AddPhoto")}),n.a.createElement(ve.a,{value:m,onChange:j,label:d(e?"EnterChannelName":"GroupName"),error:"Chat title can't be empty"===v||"Channel title can't be empty"===v?v:void 0}),e&&n.a.createElement(n.a.Fragment,null,n.a.createElement(ve.a,{value:h,onChange:f,label:d("DescriptionOptionalPlaceholder")}),n.a.createElement("p",{className:"note"},d("DescriptionInfo"))),k&&n.a.createElement("p",{className:"error"},k),a.length>0&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"chat-members-heading"},d("GroupInfo.ParticipantCount",a.length,"i")),n.a.createElement("div",{className:"chat-members-list custom-scroll"},a.map(e=>n.a.createElement(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(je.a,{userId:e})))))),n.a.createElement(Dt.a,{isShown:0!==m.length,onClick:e?y:C,disabled:E,ariaLabel:e?d("ChannelIntro.CreateChannel"):"Create Group"},E?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-arrow-right"})))}));a(292);const vn=Object.keys(r.d).length/2;var On=Object(n.h)(({isActive:e,isChannel:t=!1,content:a,onContentChange:s,onReset:c})=>{const[o,i]=Object(n.r)([]),d=Object(n.m)(()=>{s(t?r.d.NewChannelStep2:r.d.NewGroupStep2)},[t,s]);return n.a.createElement(T.a,{id:"NewChat",name:l.p,renderCount:vn,activeKey:a},s=>{switch(a){case r.d.NewChannelStep1:case r.d.NewGroupStep1:return n.a.createElement(gn,{isChannel:t,isActive:e,selectedMemberIds:o,onSelectedMemberIdsChange:i,onNextStep:d,onReset:c});case r.d.NewChannelStep2:case r.d.NewGroupStep2:return n.a.createElement(pn,{isChannel:t,isActive:s&&e,memberIds:o,onReset:c});default:return}})}),En=a(198);a(293);var jn=Object(n.h)(({isActive:e,onReset:t,onContentChange:a})=>{const s=Object(M.a)();return Object(L.a)(e,t,a,r.d.Archived),n.a.createElement("div",{className:"ArchivedChats"},n.a.createElement("div",{className:"left-header"},n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:t,ariaLabel:"Return to chat list"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,s("ArchivedChats"))),n.a.createElement(En.a,{folderType:"archived",isActive:e}))});const fn={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};const Cn=e=>{e.preventDefault()};function yn(e){fn[e.key]&&!function(e){if(!(e&&e instanceof HTMLElement))return!1;const t=e,a=t.tagName.toLowerCase();if("textarea"===a)return!0;if("input"!==a)return!1;const n=t.getAttribute("type");return!!n&&["text","password","number","email","tel","url","search","date","datetime","datetime-local","time","month","week"].indexOf(n.toLowerCase())>-1}(e.target)&&Cn(e)}function kn(){document.addEventListener("wheel",Cn,{passive:!1}),window.ontouchmove=Cn,document.onkeydown=yn}function Nn(){document.removeEventListener("wheel",Cn),window.ontouchmove=null,document.onkeydown=null}var wn=a(57),Sn=a(171);function In(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}var Pn=a(182),Fn=a(55);a(294);var Mn=({isOpen:e,message:t,anchor:a,canSendNow:s,canReschedule:r,canReply:o,canEdit:l,canPin:i,canUnpin:d,canDelete:m,canReport:h,canForward:b,canFaveSticker:g,canUnfaveSticker:p,canCopy:v,canCopyLink:O,canSelect:E,onReply:j,onEdit:f,onPin:C,onUnpin:y,onForward:k,onDelete:N,onReport:w,onFaveSticker:S,onUnfaveSticker:I,onSelect:P,onSend:F,onReschedule:L,onClose:A,onCloseAnimationEnd:R,onCopyLink:T})=>{const D=function(e,t,a){const n=[],s=Object(u.P)(e),r=Object(u.H)(e)||(Object(u.T)(e)?void 0:Object(u.S)(e)),o=Object(u.E)(e,"inline"),l=r&&(o||Object(u.eb)(e))&&Sn.a,i=window.getSelection();if(l&&n.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(o?wn.b(o,c.ApiMediaFormat.BlobUrl):r.blobUrl).then(Sn.b),t&&t()}}),s){const e=Boolean(i&&i.anchorNode&&i.anchorNode.parentNode&&i.anchorNode.parentNode.closest(".Message .content-inner")&&""!==i.toString().replace(/(?:\r\n|\r|\n)/g,""));n.push({label:In(e),handler:()=>{const a=e&&i?i.toString():s;Object(Sn.c)(a),t&&t()}})}return a&&n.push({label:"lng_context_copy_message_link",handler:()=>{a(),t&&t()}}),n}(t,A,O?T:void 0),B=Object(n.m)(()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`),[t.id]),U=Object(n.m)(()=>document.querySelector(".active > .MessageList"),[]),x=Object(n.m)(()=>document.querySelector(".MessageContextMenu .bubble"),[]),{positionX:G,positionY:z,style:q}=Object(Pn.a)(a,B,U,x,10,document.querySelector(".MiddleHeader").offsetHeight),H=Object(M.a)();return n.a.createElement(Fn.a,{isOpen:e,positionX:G,positionY:z,style:q,className:"MessageContextMenu fluid",onClose:A,onCloseAnimationEnd:R},s&&n.a.createElement(_.a,{icon:"send-outline",onClick:F},H("MessageScheduleSend")),r&&n.a.createElement(_.a,{icon:"schedule",onClick:L},H("MessageScheduleEditTime")),o&&n.a.createElement(_.a,{icon:"reply",onClick:j},H("Reply")),l&&n.a.createElement(_.a,{icon:"edit",onClick:f},H("Edit")),g&&n.a.createElement(_.a,{icon:"favorite",onClick:S},H("AddToFavorites")),p&&n.a.createElement(_.a,{icon:"favorite",onClick:I},H("Stickers.RemoveFromFavorites")),v&&D.map(e=>n.a.createElement(_.a,{key:e.label,icon:"copy",onClick:e.handler},H(e.label))),i&&n.a.createElement(_.a,{icon:"pin",onClick:C},H("DialogPin")),d&&n.a.createElement(_.a,{icon:"unpin",onClick:y},H("DialogUnpin")),b&&n.a.createElement(_.a,{icon:"forward",onClick:k},H("Forward")),E&&n.a.createElement(_.a,{icon:"select",onClick:P},H("Common.Select")),h&&n.a.createElement(_.a,{icon:"flag",onClick:w},H("lng_context_report_msg")),m&&n.a.createElement(_.a,{destructive:!0,icon:"delete",onClick:N},H("Delete")))};var Ln=Object(n.h)(Object(s.h)((e,{message:t,messageListType:a})=>{const{threadId:n}=Object(m.z)(e)||{},{noOptions:s,canReply:c,canPin:r,canUnpin:o,canDelete:l,canReport:i,canEdit:d,canForward:u,canFaveSticker:h,canUnfaveSticker:b,canCopy:g,canCopyLink:p,canSelect:v}=n&&Object(m.b)(e,t,n)||{},O="pinned"===a,E="scheduled"===a;return{noOptions:s,canSendNow:E,canReschedule:E,canReply:!O&&!E&&c,canPin:!E&&r,canUnpin:!E&&o,canDelete:l,canReport:i,canEdit:!O&&d,canForward:!E&&u,canFaveSticker:!E&&h,canUnfaveSticker:!E&&b,canCopy:g,canCopyLink:!E&&p,canSelect:v}},(e,t)=>Object(h.l)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage"]))(({isOpen:e,messageListType:t,chatUsername:a,message:s,album:c,anchor:r,onClose:o,onCloseAnimationEnd:l,noOptions:i,canSendNow:d,canReschedule:m,canReply:u,canPin:h,canUnpin:b,canDelete:g,canReport:p,canEdit:v,canForward:O,canFaveSticker:E,canUnfaveSticker:j,canCopy:f,canCopyLink:C,canSelect:y,setReplyingToId:k,setEditingId:N,pinMessage:w,openForwardMenu:S,faveSticker:I,unfaveSticker:P,toggleMessageSelection:F,sendScheduledMessages:M,rescheduleMessage:L})=>{const{transitionClassNames:A}=Object(Y.a)(e,l,void 0,!1),[R,T]=Object(n.r)(!0),[D,U]=Object(n.r)(!1),[x,G]=Object(n.r)(!1),[z,q]=Object(n.r)(!1),[_,H,$]=Object(xe.a)(),V=Object(n.m)(()=>{T(!1),U(!0)},[]),W=Object(n.m)(()=>{T(!1),G(!0)},[]),K=Object(n.m)(()=>{T(!1),o()},[o]),Q=Object(n.m)(()=>{U(!1),o()},[o]),Z=Object(n.m)(()=>{G(!1),o()},[o]),J=Object(n.m)(()=>{q(!1),o()},[o]),X=Object(n.m)(()=>{$(),o()},[$,o]),ee=Object(n.m)(()=>{k({messageId:s.id}),K()},[k,s.id,K]),te=Object(n.m)(()=>{N({messageId:s.id}),K()},[N,s.id,K]),ae=Object(n.m)(()=>{T(!1),q(!0)},[]),ne=Object(n.m)(()=>{w({messageId:s.id,isUnpin:!0}),K()},[w,s.id,K]),se=Object(n.m)(()=>{if(K(),c&&c.messages){const e=c.messages.map(({id:e})=>e);S({fromChatId:s.chatId,messageIds:e})}else S({fromChatId:s.chatId,messageIds:[s.id]})},[S,s,K,c]),ce=Object(n.m)(()=>{K(),I({sticker:s.content.sticker})},[K,s.content.sticker,I]),re=Object(n.m)(()=>{K(),P({sticker:s.content.sticker})},[K,s.content.sticker,P]),oe=Object(n.m)(()=>{const e=c&&c.messages?{messageId:s.id,childMessageIds:c.messages.map(({id:e})=>e),withShift:!1}:{messageId:s.id,withShift:!1};F(e),K()},[K,s.id,F,c]),le=Object(n.m)(()=>{M({chatId:s.chatId,id:s.id}),K()},[K,s.chatId,s.id,M]),ie=Object(n.m)(()=>{T(!1),H()},[H]),de=Object(n.m)(e=>{L({chatId:s.chatId,messageId:s.id,scheduledAt:Math.round(e.getTime()/1e3)})},[s.chatId,s.id,L]),me=Object(n.m)(()=>{Object(Sn.c)(`https://t.me/${a||"c/"+Math.abs(s.chatId)}/${s.id}`),K()},[a,K,s.chatId,s.id]);Object(n.n)(()=>(kn(),Nn),[]);const ue=Object(n.p)(()=>(c?c.messages:[s]).map(({id:e})=>e),[c,s]);if(i)return void K();const he=new Date;return he.setFullYear(he.getFullYear()+1),n.a.createElement("div",{className:["ContextMenuContainer",A].join(" ")},n.a.createElement(Mn,{message:s,isOpen:R,anchor:r,canSendNow:d,canReschedule:m,canReply:u,canDelete:g,canReport:p,canPin:h,canUnpin:b,canEdit:v,canForward:O,canFaveSticker:E,canUnfaveSticker:j,canCopy:f,canCopyLink:C,canSelect:y,onReply:ee,onEdit:te,onPin:ae,onUnpin:ne,onForward:se,onDelete:V,onReport:W,onFaveSticker:ce,onUnfaveSticker:re,onSelect:oe,onSend:le,onReschedule:ie,onClose:K,onCopyLink:me}),n.a.createElement(De,{isOpen:D,isSchedule:"scheduled"===t,onClose:Q,album:c,message:s}),n.a.createElement(_e,{isOpen:x,onClose:Z,messageIds:ue}),n.a.createElement(Be,{isOpen:z,messageId:s.id,chatId:s.chatId,onClose:J}),n.a.createElement(Re,{isOpen:_,withTimePicker:!0,selectedAt:1e3*s.date,maxAt:Object(B.k)(he),isFutureMode:!0,onClose:X,onSubmit:de}))}));a(295);var An=Object(n.h)(Object(s.h)((e,{fromSticker:t})=>({stickerSet:Object(m.zb)(e,t.stickerSetId)}),(e,t)=>Object(h.l)(t,["loadStickers","toggleStickerSet","sendMessage"]))(({isOpen:e,fromSticker:t,stickerSet:a,onClose:s,loadStickers:c,toggleStickerSet:r,sendMessage:l})=>{const i=Object(n.q)(null),d=Object(M.a)(),{observe:m}=Object(ta.a)({rootRef:i,throttleMs:200,isDisabled:!e});Object(n.n)(()=>{if(e){const{stickerSetId:e,stickerSetAccessHash:a}=t;c({stickerSetId:e,stickerSetAccessHash:a})}},[e,t,c]);const u=Object(n.m)(e=>{e={...e,isPreloadedGlobally:!0},l({sticker:e}),s()},[s,l]),h=Object(n.m)(()=>{r({stickerSetId:t.stickerSetId}),s()},[t.stickerSetId,s,r]);return n.a.createElement(pe.a,{className:"StickerSetModal",isOpen:e,onClose:s,hasCloseButton:!0,title:a?Object(U.a)(a.title,["emoji","links"]):d("AccDescrStickerSet")},a&&a.stickers?n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{ref:i,className:"stickers custom-scroll"},a.stickers.map(e=>n.a.createElement(oa.a,{sticker:e,size:o.Kb,observeIntersection:m,onClick:u,clickArg:e}))),n.a.createElement("div",{className:"button-wrapper"},n.a.createElement(D.a,{size:"smaller",fluid:!0,color:a.installedDate?"danger":"primary",onClick:h},d(a.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",a.count,"i")))):n.a.createElement(ge.a,null))})),Rn=a(128);a(296);var Tn=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t);return!a||a.isRestricted?{}:{chat:a,isMuted:Object(u.Hb)(a,Object(m.fb)(e),Object(m.eb)(e)),isPrivate:Object(u.ob)(a.id),canDeleteChat:Object(u.c)(a)}},(e,t)=>Object(h.l)(t,["updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot"]))(({chatId:e,isOpen:t,anchor:a,isChannel:s,canStartBot:c,canRestartBot:r,canSubscribe:o,canSearch:i,canMute:d,canSelect:m,canLeave:u,chat:h,isPrivate:b,isMuted:g,canDeleteChat:p,onSubscribeChannel:v,onSearchClick:O,onClose:E,onCloseAnimationEnd:j,updateChatMutedState:f,enterMessageSelectMode:C,sendBotCommand:y,restartBot:k})=>{const[N,w]=Object(n.r)(!0),[S,I]=Object(n.r)(!1),{x:P,y:F}=a;Object(Y.a)(t,j,void 0,!1);const L=Object(n.m)(()=>{w(!1),I(!0)},[]),A=Object(n.m)(()=>{w(!1),E()},[E]),R=Object(n.m)(()=>{I(!1),E()},[E]),T=Object(n.m)(()=>{y({command:"/start"})},[y]),D=Object(n.m)(()=>{k({chatId:e})},[e,k]),B=Object(n.m)(()=>{f({chatId:e,isMuted:!g}),A()},[e,A,g,f]),U=Object(n.m)(()=>{v(),A()},[A,v]),x=Object(n.m)(()=>{O(),A()},[A,O]),G=Object(n.m)(()=>{C(),A()},[A,C]);Object(n.n)(()=>(kn(),Nn),[]);const z=Object(M.a)();return n.a.createElement(Rn.a,null,n.a.createElement("div",{className:"HeaderMenuContainer"},n.a.createElement(Fn.a,{isOpen:N,positionX:"right",style:`left: ${P}px;top: ${F}px;`,onClose:A},l.l&&c&&n.a.createElement(_.a,{icon:"bots",onClick:T},z("BotStart")),l.l&&r&&n.a.createElement(_.a,{icon:"bots",onClick:D},z("BotRestart")),l.l&&o&&n.a.createElement(_.a,{icon:s?"channel":"group",onClick:U},z(s?"Subscribe":"Join Group")),l.l&&i&&n.a.createElement(_.a,{icon:"search",onClick:x},z("Search")),d&&n.a.createElement(_.a,{icon:g?"unmute":"mute",onClick:B},z(g?"ChatsUnmute":"ChatsMute")),m&&n.a.createElement(_.a,{icon:"select",onClick:G},z("ReportSelectMessages")),u&&n.a.createElement(_.a,{destructive:!0,icon:"delete",onClick:L},z(b?"Delete":p?"GroupInfo.DeleteAndExit":s?"LeaveChannel":"Group.LeaveGroup"))),h&&n.a.createElement(Ye.a,{isOpen:S,onClose:R,chat:h})))})),Dn=a(159);a(297);const Bn=Object(V.a)(e=>e(),200,!1);var Un=Object(n.h)(Object(s.h)(e=>{const t=Object(m.s)(e);if(!t)return{};const{query:a,results:n}=Object(m.B)(e)||{},{totalCount:s,foundIds:c}=n||{};return{chat:t,query:a,totalCount:s,foundIds:c,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}},(e,t)=>Object(h.l)(t,["setLocalTextSearchQuery","searchTextMessagesLocal","focusMessage","closeLocalTextSearch","openHistoryCalendar"]))(({isActive:e,chat:t,query:a,totalCount:s,foundIds:c,isHistoryCalendarOpen:r,setLocalTextSearchQuery:o,searchTextMessagesLocal:l,focusMessage:i,closeLocalTextSearch:d,openHistoryCalendar:m})=>{const u=Object(n.q)(null),[h,b]=Object(n.r)(0);Object(n.n)(()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),a=()=>{const{activeElement:a}=document;if(a&&a===u.current){const{pageTop:a,height:n}=e;t.style.transform=`translateY(${a}px)`,t.style.height=n+"px",document.documentElement.scrollTop=a}else t.style.transform="",t.style.height=""};return e.addEventListener("resize",a),()=>{e.removeEventListener("resize",a)}},[]),Object(n.n)(()=>{t&&c&&c.length?(i({chatId:t.id,messageId:c[c.length-1]}),b(0)):b(-1)},[t,i,c]),Object(n.n)(()=>{Array.from(document.querySelectorAll("input")).forEach(t=>{t.disabled=Boolean(e&&t!==u.current)}),Array.from(document.querySelectorAll("div[contenteditable]")).forEach(t=>{t.contentEditable=e?"false":"true"})},[e]),Object(n.n)(()=>{e||u.current.blur()},[e]),Object(n.o)(()=>{document.querySelector("#MobileSearch input").blur()},[r]);const g=Object(n.m)(e=>{o({query:e}),e.length&&Bn(l)},[l,o]),p=Object(n.m)(()=>{if(t&&c){const e=h+1;i({chatId:t.id,messageId:c[c.length-1-e]}),b(e)}},[t,h,i,c]),v=Object(n.m)(()=>{if(t&&c){const e=h-1;i({chatId:t.id,messageId:c[c.length-1-e]}),b(e)}},[t,h,i,c]);return n.a.createElement("div",{id:"MobileSearch",className:e?"active":""},n.a.createElement("div",{className:"header"},n.a.createElement(D.a,{size:"smaller",round:!0,color:"translucent",onClick:d},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement(Dn.a,{ref:u,value:a,onChange:g})),n.a.createElement("div",{className:"footer"},n.a.createElement("div",{className:"counter"},a?c&&c.length?`${h+1} of ${s}`:c&&!c.length?"No results":"":n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>m({selectedAt:Object(B.k)(Date.now())}),ariaLabel:"Search messages by date"},n.a.createElement("i",{className:"icon-calendar"}))),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:p,disabled:!c||!c.length||h===c.length-1},n.a.createElement("i",{className:"icon-up"})),n.a.createElement(D.a,{round:!0,size:"smaller",color:"translucent",onClick:v,disabled:!c||!c.length||0===h},n.a.createElement("i",{className:"icon-down"}))))})),xn=a(60),Gn=a(199),zn=a(191),qn=a(187),_n=a(193);function Hn(e,t,a=0,n=!1,s=!1,c=!1){const r=e[c?"scrollLeft":"scrollTop"],o=r+e[c?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:i}=l,d=[];let m=!1;for(let e=0;e<i;e++){const t=l[e],i=t[c?"offsetLeft":"offsetTop"],u=i+t[c?"offsetWidth":"offsetHeight"];if(s?u>=r-a&&u<=o+a:i<=o+a&&u>=r-a)d.push(e),m=!0;else if(m&&!n)break}return{allElements:l,visibleIndexes:d}}var $n=function(e,t,a=!1){const n=e[a?"scrollLeft":"scrollTop"],s=n+e[a?"offsetWidth":"offsetHeight"],c=t[a?"offsetLeft":"offsetTop"],r=c+t[a?"offsetWidth":"offsetHeight"];return c>n&&r<s},Vn=a(131);function Wn(e,t,a){const n=a.current;if(!n||t<0)return;const{visibleIndexes:s,allElements:c}=Hn(n,e,8,!0,!0);if(!c.length||!c[t])return;const r=s[0];if(!s.includes(t)||t===r&&!$n(n,c[r])){const e=t>s[s.length-1]?"start":"end";Object(Vn.a)(n,c[t],e,10)}}var Kn=a(134);a(298);var Yn=Object(n.h)(({isOpen:e,filter:t,onClose:a,onInsertUserName:s,usersById:c,filteredUsers:r})=>{const o=Object(n.q)(null),{shouldRender:l,transitionClassNames:i}=Object(Y.a)(e,void 0,void 0,!1),d=Object(n.m)(e=>{if(!r)return-1;const t=r.length;return Object(Kn.a)(t,e)},[r]),[m,u]=Object(n.r)(-1),h=Object(n.m)((e,t)=>{t.preventDefault(),u(t=>d(t+e))},[u,d]),b=Object(n.m)((e,t=!1)=>{const a=c&&c[e];a&&s(a,t)},[c,s]),g=Object(n.m)(e=>{if(r&&r.length&&m>-1){const t=r[m];t&&(e.preventDefault(),b(t.id,!0))}},[r,m,b]);Object(n.n)(()=>e?Object(Ge.a)({onEsc:a,onUp:e=>h(-1,e),onDown:e=>h(1,e),onEnter:g,onTab:g}):void 0,[e,a,h,g]),Object(n.n)(()=>{r&&!r.length&&a()},[r,a]),Object(n.n)(()=>{u(0)},[t]),Object(n.n)(()=>{Wn(".chat-item-clickable",m,o)},[m]);const p=Object(f.a)(r&&r.length?r:void 0,l),v=r&&!r.length?p:r;if(!l||v&&!v.length)return;const O=Object(W.a)("MentionTooltip composer-tooltip custom-scroll",i);return n.a.createElement("div",{className:O,ref:o},v&&v.map(({id:e},t)=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>b(e),focus:m===t},n.a.createElement(je.a,{userId:e,avatarSize:"small",withUsername:!0}))))}),Qn=a(192);a(299);var Zn=Object(n.h)(({attachments:e,caption:t,isReady:a,currentUserId:s,groupChatMembers:c,usersById:r,recentEmojis:l,baseEmojiKeywords:i,emojiKeywords:d,addRecentEmoji:m,onCaptionUpdate:u,onSend:h,onFileAppend:b,onClear:p})=>{const v=Object(n.q)(null),O=Object(f.a)(e),E=e.length?e:O,j=Boolean(e.length),[C,y,k]=Object(xe.a)(),N=Boolean(E&&E.every(e=>e.quick)),w=Object(M.a)(),{isMentionTooltipOpen:S,mentionFilter:I,closeMentionTooltip:P,insertMention:F,mentionFilteredUsers:L}=Object(Gn.a)(j,t,u,o.A,c,void 0,s,r),{isEmojiTooltipOpen:A,closeEmojiTooltip:R,filteredEmojis:T,insertEmoji:B}=Object(zn.a)(j,t,l,o.A,u,i,d,!a);Object(n.n)(()=>j?Object(g.a)(p):void 0,[j,p]);const U=Object(n.m)(()=>{j&&h()},[j,h]),x=Object(n.m)(e=>{e.preventDefault(),k();const{dataTransfer:{files:t}}=e;if(t&&t.length){const e=N?Array.from(t).filter(e=>e.type&&o.n.has(e.type)):Array.from(t);b(e,N)}},[N,b,k]);if(!E)return;const G=E.every(e=>e.mimeType.startsWith("image/")),z=E.every(e=>e.mimeType.startsWith("video/"));let q="";return q=w(G?"PreviewSender.SendPhoto":z?"PreviewSender.SendVideo":"PreviewSender.SendFile",E.length,"i"),n.a.createElement(pe.a,{isOpen:j,onClose:p,header:function(){if(E)return n.a.createElement("div",{className:"modal-header-condensed",dir:w.isRtl?"rtl":void 0},n.a.createElement(D.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:p},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("div",{className:"modal-title"},q),n.a.createElement(D.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:U},w("Send")))}(),className:"AttachmentModal "+(C?"hovered":"")},n.a.createElement("div",{className:"drop-target",onDragEnter:y,onDrop:x,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),v.current&&window.clearTimeout(v.current)},onDragLeave:e=>{const{relatedTarget:t,target:a}=e;a.matches(".drop-target")&&!t&&(v.current=window.setTimeout(k,150)),a&&a.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),k())},"data-attach-description":w("Preview.Dragging.AddItems",10)},N?n.a.createElement("div",{className:"media-wrapper custom-scroll"},E.map(e=>e.mimeType.startsWith("image/")?n.a.createElement("img",{src:e.blobUrl,alt:""}):n.a.createElement("video",{src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0}))):n.a.createElement("div",{className:"document-wrapper custom-scroll"},E.map(e=>n.a.createElement(qn.a,{name:e.filename,extension:Object(xn.d)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}))),n.a.createElement("div",{className:"attachment-caption-wrapper"},n.a.createElement(Yn,{isOpen:S,onClose:P,filter:I,onInsertUserName:F,filteredUsers:L,usersById:r}),n.a.createElement(Qn.a,{isOpen:A,emojis:T,onClose:R,onEmojiSelect:B,addRecentEmoji:m}),n.a.createElement(_n.a,{id:"caption-input-text",isAttachmentModalInput:!0,html:t,editableInputId:o.A,placeholder:w("Caption"),onUpdate:u,onSend:h,shouldSetFocus:j}))))}),Jn=a(142);a(300);var Xn=Object(n.h)(({isOpen:e,onSend:t,onClear:a})=>{const s=Object(n.q)(null),c=Object(n.q)(null),r=Object(n.q)(null),[o,l]=Object(n.r)(""),[i,d]=Object(n.r)([""]),[m,u]=Object(n.r)(!0),[h,b]=Object(n.r)(!1),[p,v]=Object(n.r)(!1),[O,E]=Object(n.r)(),[j,f]=Object(n.r)(),[C,y]=Object(n.r)(!1),k=Object(M.a)(),N=Object(n.m)(t=>{e&&t.current&&t.current.focus()},[e]);Object(n.n)(()=>e?Object(g.a)(a):void 0,[e,a]),Object(n.n)(()=>{e||(l(""),d([""]),u(!0),b(!1),v(!1),E(""),f(""),y(!1))},[e]),Object(n.n)(()=>N(s),[N,e]),Object(n.o)(()=>{const e=r.current;e&&O!==e.innerHTML&&(e.innerHTML=O)},[O]);const w=Object(n.m)((e=[])=>{d([...e,""]),requestAnimationFrame(()=>{const e=c.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))})},[]),S=Object(n.m)(()=>{if(y(!1),!e)return;const a=o.trim().substring(0,255),n=i.map(e=>e.trim().substring(0,100)).filter(e=>e.length);if(!a||n.length<2)return l(a),n.length?n.length<2?w(n):d(n):w(),void y(!0);if(p&&(!j||!n[Number(j)]))return void y(!0);const s={summary:{question:a,answers:n.map((e,t)=>({text:e.trim(),option:String(t),...String(t)===j&&{correct:!0}})),...!m&&{isPublic:!0},...h&&{multipleChoice:!0},...p&&{quiz:!0}}};if(p){const{text:e,entities:t}=O&&Object(Jn.a)(O.substring(0,200))||{};s.quiz={correctAnswers:[j],...e&&{solution:e},...t&&{solutionEntities:t}}}t(s)},[e,o,i,p,j,m,h,t,w,O]),I=Object(n.m)((e,t)=>{const a=[...i];a[e]=t,a[a.length-1].trim().length&&a.length<10?w(a):d(a)},[i,w]),P=Object(n.m)(e=>{const t=[...i];t.splice(e,1),d(t),requestAnimationFrame(()=>{c.current&&c.current.classList.toggle("overflown",c.current.scrollHeight>320)})},[i]),F=Object(n.m)(e=>{f(e)},[f]),L=Object(n.m)(e=>{u(e.target.checked)},[]),A=Object(n.m)(e=>{b(e.target.checked)},[]),R=Object(n.m)(e=>{v(e.target.checked)},[]),T=Object(n.m)(e=>{13===e.keyCode&&S()},[S]),B=Object(n.m)(()=>{if(C&&!o.trim().length)return k("lng_polls_choose_question")},[C,k,o]),U=Object(n.m)(e=>{const t=i.map(e=>e.trim()).filter(e=>e.length);if(C&&t.length<2&&!i[e].trim().length)return k("lng_polls_choose_answers")},[C,k,i]);function x(){return i.map((e,t)=>n.a.createElement("div",{className:"option-wrapper"},n.a.createElement(ve.a,{label:t!==i.length-1||10===i.length?k("OptionHint"):k("CreatePoll.AddOption"),error:U(t),value:e,onChange:e=>I(t,e.currentTarget.value),onKeyPress:T}),t!==i.length-1&&n.a.createElement(D.a,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:k("Delete"),onClick:()=>P(t)},n.a.createElement("i",{className:"icon-close"}))))}return n.a.createElement(pe.a,{isOpen:e,onClose:a,header:n.a.createElement("div",{className:"modal-header-condensed"},n.a.createElement(D.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:a},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("div",{className:"modal-title"},k("NewPoll")),n.a.createElement(D.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:S},k("Create"))),className:"PollModal"},n.a.createElement(ve.a,{ref:s,label:k("AskAQuestion"),value:o,error:B(),onChange:e=>l(e.currentTarget.value),onKeyPress:T}),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"options-list custom-scroll",ref:c},n.a.createElement("h3",{className:"options-header"},k("PollOptions")),C&&function(){const e=i.map(e=>e.trim()).filter(e=>e.length);return p&&(!j||!e[Number(j)])&&n.a.createElement("p",{className:"error"},k("lng_polls_choose_correct"))}(),p?n.a.createElement(qe.a,{name:"correctOption",options:x().map((e,t)=>({value:String(t),label:e,hidden:t===i.length-1})),onChange:F}):x()),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"quiz-mode"},n.a.createElement(Zt.a,{label:k("PollAnonymous"),checked:m,onChange:L}),n.a.createElement(Zt.a,{label:k("PollMultiple"),checked:h,disabled:p,onChange:A}),n.a.createElement(Zt.a,{label:k("PollQuiz"),checked:p,disabled:h,onChange:R}),p&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"options-header"},k("lng_polls_solution_title")),n.a.createElement("div",{ref:r,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>E(e.currentTarget.innerHTML)}),n.a.createElement("div",{className:"note"},k("CreatePoll.ExplanationInfo")))))});let es;function ts(e,t,a=250,s=!1){const c=Object(n.q)(!1);Object(n.n)(()=>{es&&(clearTimeout(es),es=void 0),!e||l.n||s||(es=window.setTimeout(()=>{c.current||t()},2*a))},[s,e,a,t]);return[Object(n.m)(()=>{c.current=!0},[]),Object(n.m)(()=>{c.current=!1,es&&(clearTimeout(es),es=void 0),es=window.setTimeout(()=>{c.current||t()},a)},[a,t])]}var as=a(66),ns=a(147);a(301);var ss=Object(n.h)(({emoji:e,focus:t,onClick:a})=>{const s=Object(n.m)(t=>{t.preventDefault(),a(e.native,e.id)},[e,a]);return n.a.createElement("div",{className:"EmojiButton "+(t?"focus":""),onMouseDown:s,title:`:${e.names[0]}:`},l.d?e.native:n.a.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))});var cs=Object(n.h)(({category:e,index:t,allEmojis:a,observeIntersection:s,shouldRender:c,onEmojiSelect:r})=>{const o=Object(n.q)(null);Object(ta.c)(o,s);const{transitionClassNames:d}=Object(Y.a)(c,void 0,void 0,"slow"),m=Object(M.a)(),u=l.l?Math.floor((i.a.get().width-8)/44):9,h=44*Math.ceil(e.emojis.length/u);return n.a.createElement("div",{ref:o,key:e.id,id:"emoji-category-"+t,className:"symbol-set"},n.a.createElement("p",{className:"symbol-set-name",dir:"auto"},m("recent"===e.id?"RecentStickers":"Emoji"+t)),n.a.createElement("div",{className:Object(W.a)("symbol-set-container",d),style:`height: ${h}px;`,dir:m.isRtl?"rtl":void 0},c&&e.emojis.map(e=>{const t=a[e],s="id"in t?t:t[1];return n.a.createElement(ss,{key:s.id,emoji:s,onClick:r})})))});a(302);const rs={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 ls,is,ds;var ms=Object(n.h)(Object(s.h)(e=>Object(h.l)(e,["recentEmojis"]))(({className:e,onEmojiSelect:t,recentEmojis:s})=>{const c=Object(n.q)(null),r=Object(n.q)(null),[i,d]=Object(n.r)(),[m,u]=Object(n.r)(),[h,b]=Object(n.r)(0),{observe:g}=Object(ta.a)({rootRef:c,throttleMs:200},e=>{e.forEach(e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const a=Number(t.replace("emoji-category-",""));os[a]=e.isIntersecting});const t=os.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&b(t[Math.floor(t.length/2)].index)});Object(Ze.a)(r.current,!l.l),Object(n.n)(()=>{if(!i)return;const e=r.current;if(!e)return;const t=42*h-e.offsetWidth/2+21;Object(ns.a)(e,t)},[i,h]);const p=Object(M.a)(),v=Object(n.p)(()=>{if(!i)return Ve.a;const e=[...i];return s&&s.length&&e.unshift({id:"recent",name:p("RecentStickers"),emojis:s}),e},[i,p,s]);Object(n.n)(()=>{setTimeout(()=>{const e=()=>{d(ds.categories),u(ds.emojis)};ds?e():async function(){ls||(ls=a.e(1).then(a.t.bind(null,331,3)),is=(await ls).default,ds=Object(as.b)(is));return ls}().then(e)},200)},[]);const O=Object(n.m)(e=>{b(e);const t=document.getElementById("emoji-category-"+e);Object(Vn.a)(c.current,t,"start",50,800)},[]),E=Object(n.m)((e,a)=>{t(e,a)},[t]),j=Object(mt.a)([],o.eb);const f=Object(W.a)("EmojiPicker",e);return m&&j?n.a.createElement("div",{className:f},n.a.createElement("div",{ref:r,className:"EmojiPicker-header",dir:p.isRtl?"rtl":""},v.map((function(e,t){const a=rs[e.id];return a&&n.a.createElement(D.a,{className:"symbol-set-button "+(t===h?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>O(t),ariaLabel:e.name},n.a.createElement("i",{className:a}))}))),n.a.createElement("div",{ref:c,className:Object(W.a)("EmojiPicker-main no-selection",l.n?"no-scrollbar":"custom-scroll")},v.map((e,t)=>n.a.createElement(cs,{category:e,index:t,allEmojis:m,observeIntersection:g,shouldRender:h>=t-1&&h<=t+1,onEmojiSelect:E})))):n.a.createElement("div",{className:f},n.a.createElement(ge.a,null))}));const us=l.l?8:16;var hs=Object(n.h)(({stickerSet:e,loadAndPlay:t,index:a,observeIntersection:s,shouldRender:c,onStickerSelect:r,onStickerUnfave:d})=>{const m=Object(n.q)(null);Object(ta.c)(m,s);const{transitionClassNames:u}=Object(Y.a)(c,void 0,void 0,"slow"),h=l.l?Math.floor((i.a.get().width-8)/(o.Lb+us)):5,b=Math.ceil(e.count/h)*(o.Lb+us);return n.a.createElement("div",{ref:m,key:e.id,id:"sticker-set-"+a,className:"symbol-set"},n.a.createElement("p",{className:"symbol-set-name"},e.title),n.a.createElement("div",{className:Object(W.a)("symbol-set-container",u),style:`height: ${b}px;`},c&&e.stickers&&e.stickers.map(a=>n.a.createElement(oa.a,{key:a.id,sticker:a,size:o.Lb,observeIntersection:s,noAnimate:!t,onClick:r,clickArg:a,onUnfaveClick:"favorite"===e.id?d:void 0}))))});a(303);const bs=[];var gs=Object(n.h)(Object(s.h)(e=>{const{setsById:t,added:a,recent:n,favorite:s}=e.stickers;return{recentStickers:n.stickers,favoriteStickers:s.stickers,stickerSetsById:t,addedSetIds:a.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}},(e,t)=>Object(h.l)(t,["loadStickerSets","loadRecentStickers","loadFavoriteStickers","loadAddedStickers","addRecentSticker","unfaveSticker"]))(({className:e,loadAndPlay:t,canSendStickers:a,recentStickers:s,favoriteStickers:c,addedSetIds:r,stickerSetsById:i,shouldPlay:d,onStickerSelect:m,loadStickerSets:u,loadRecentStickers:h,loadFavoriteStickers:b,loadAddedStickers:g,addRecentSticker:p,unfaveSticker:v})=>{const O=Object(n.q)(null),E=Object(n.q)(null),[j,f]=Object(n.r)(0),{observe:C}=Object(ta.a)({rootRef:O,throttleMs:200},e=>{e.forEach(e=>{const{id:t}=e.target;if(!t||!t.startsWith("sticker-set-"))return;const a=Number(t.replace("sticker-set-",""));bs[a]=e.isIntersecting});const t=bs.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&f(t[Math.floor(t.length/2)].index)}),{observe:y}=Object(ta.a)({rootRef:E}),k=Object(M.a)(),N=Boolean(r),w=Object(n.p)(()=>r?[{id:"recent",title:k("RecentStickers"),stickers:s,count:s.length},{id:"favorite",title:k("FavoriteStickers"),stickers:c,count:c.length},...r.map(e=>i[e]).filter(Boolean)]:Ve.a,[r,k,s,c,i]),S=Object(n.p)(()=>N&&0===w.filter(e=>e.stickers&&e.stickers.length).length,[w,N]);Object(n.n)(()=>{t&&(u(),h(),b())},[t,b,h,u]),Object(n.n)(()=>{r&&r.length&&g()},[r,g]),Object(Ze.a)(E.current),Object(n.n)(()=>{if(!N)return;const e=E.current;if(!e)return;const t=52*j-(e.offsetWidth/2-26);Object(ns.a)(e,t)},[N,j]);const I=Object(n.m)(e=>{f(e);const t=document.getElementById("sticker-set-"+e);Object(Vn.a)(O.current,t,"start",void 0,500)},[]),P=Object(n.m)(e=>{m(e),p({sticker:e})},[p,m]),F=Object(n.m)(e=>{v({sticker:e})},[v]),L=Object(mt.a)([],o.Bb);const A=Object(W.a)("StickerPicker",e);return N&&L&&!S&&a?n.a.createElement("div",{className:A},n.a.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},w.map((function(e,t){const a=e.stickers&&e.stickers[0],s=Object(W.a)("symbol-set-button sticker-set-button",t===j&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!a?n.a.createElement(D.a,{key:e.id,className:s,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>I(t)},"recent"===e.id?n.a.createElement("i",{className:"icon-recent"}):"favorite"===e.id?n.a.createElement("i",{className:"icon-favorite"}):e.isAnimated?n.a.createElement(ca,{stickerSet:e,observeIntersection:y}):n.a.createElement(ra,{stickerSet:e,observeIntersection:y})):n.a.createElement(oa.a,{key:e.id,sticker:a,size:o.Mb,title:e.title,className:s,observeIntersection:y,onClick:I,clickArg:t})}))),n.a.createElement("div",{ref:O,className:Object(W.a)("StickerPicker-main no-selection",l.n?"no-scrollbar":"custom-scroll")},w.map((e,a)=>n.a.createElement(hs,{key:e.id,stickerSet:e,loadAndPlay:Boolean(d&&t),index:a,observeIntersection:C,shouldRender:j>=a-1&&j<=a+1,onStickerSelect:P,onStickerUnfave:F})))):n.a.createElement("div",{className:A},a?S?n.a.createElement("div",{className:"picker-disabled"},"You have no saved Stickers."):n.a.createElement(ge.a,null):n.a.createElement("div",{className:"picker-disabled"},"Sending stickers is not allowed in this chat."))}));a(304);function ps(){return(ps=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}var vs=Object(n.h)(({gif:e,observeIntersection:t,isDisabled:a,className:s,onClick:r})=>{const o=Object(n.q)(null),l=Object(n.q)(null),i=e.thumbnail&&!!e.thumbnail.dataUri,d="gif"+e.id,m=Object(ta.b)(o,t)&&!a,u=Object(O.a)(d+"?size=m",!m,c.ApiMediaFormat.BlobUrl),h=Object(fa.a)(e.thumbnail&&e.thumbnail.dataUri,Boolean(u)),b=Object(O.a)(d,!m,c.ApiMediaFormat.BlobUrl),g=Boolean(m&&b),{transitionClassNames:p}=Object(na.a)(i||u||b,"slow"),{isBuffered:v,bufferingHandlers:E}=Object(Q.a)(!0),j=m&&!v;Object(J.a)(l,[g]);const f=Object(n.m)(()=>r({...e,blobUrl:b}),[r,e,b]),C=Object(W.a)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",p,d,s);return n.a.createElement("div",{ref:o,className:C,onClick:f},i&&n.a.createElement("canvas",{ref:h,className:"thumbnail"}),!i&&u&&n.a.createElement("img",{src:u,alt:"",className:"thumbnail"}),(g||u)&&n.a.createElement("video",ps({ref:l,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},E),n.a.createElement("source",{src:b})),j&&n.a.createElement(A.a,{color:u||i?"white":"black"}))});a(305);var Os=Object(n.h)(Object(s.h)(e=>({savedGifs:e.gifs.saved.gifs}),(e,t)=>Object(h.l)(t,["loadSavedGifs"]))(({className:e,loadAndPlay:t,canSendGifs:a,savedGifs:s,onGifSelect:c,loadSavedGifs:r})=>{const i=Object(n.q)(null),{observe:d}=Object(ta.a)({rootRef:i,debounceMs:300});Object(n.n)(()=>{t&&r()},[t,r]);const m=Object(mt.a)([],o.Bb);return n.a.createElement("div",{ref:i,className:Object(W.a)("GifPicker",e,l.n?"no-scrollbar":"custom-scroll")},a?m&&s&&s.length?s.map(e=>n.a.createElement(vs,{key:e.id,gif:e,observeIntersection:d,isDisabled:!t,onClick:c})):m&&s?n.a.createElement("div",{className:"picker-disabled"},"No saved GIFs."):n.a.createElement(ge.a,null):n.a.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))}));let Es;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(Es||(Es={}));const js=Object.values(Es).filter(e=>"string"==typeof e),fs={[Es.Emoji]:"icon-smile",[Es.Stickers]:"icon-stickers",[Es.GIFs]:"icon-gifs"};var Cs=Object(n.h)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:a,onSearchOpen:s})=>{const c=Object(M.a)();function r(a){return n.a.createElement(D.a,{className:"symbol-tab-button "+(e===a?"activated":""),onClick:()=>t(a),ariaLabel:js[a],round:!0,faded:!0,color:"translucent"},n.a.createElement("i",{className:fs[a]}))}const o=Object(n.m)(()=>{s(e===Es.Stickers?"stickers":"gifs")},[e,s]);return n.a.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:c.isRtl?"rtl":void 0},e!==Es.Emoji&&n.a.createElement(D.a,{className:"symbol-search-button",ariaLabel:e===Es.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:o},n.a.createElement("i",{className:"icon-search"})),r(Es.Emoji),r(Es.Stickers),r(Es.GIFs),e===Es.Emoji&&n.a.createElement(D.a,{className:"symbol-delete-button",onClick:a,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},n.a.createElement("i",{className:"icon-delete-left"})))});a(306);let ys=!1;var ks=Object(n.h)(Object(s.h)(e=>({isLeftColumnShown:e.isLeftColumnShown}))(({isOpen:e,allowedAttachmentOptions:t,isLeftColumnShown:a,onLoad:s,onClose:c,onEmojiSelect:r,onStickerSelect:o,onGifSelect:i,onRemoveSymbol:d,onSearchOpen:m,addRecentEmoji:u})=>{const[h,b]=Object(n.r)(0),[g,p]=Object(n.r)([]),[v,O]=ts(e,c,void 0,l.l),{shouldRender:E,transitionClassNames:j}=Object(Y.a)(e,c,!1,!1);!ys&&e&&(ys=!0),Object(n.n)(()=>{s()},[s]),Object(n.o)(()=>{if(l.l)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&Object(V.b)(()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout(()=>{document.body.classList.remove("enable-symbol-menu-transforms")},350)})}},[e]);const f=Object(n.q)(g);f.current=g,Object(n.n)(()=>{f.current.length&&(f.current.forEach(e=>{u({emoji:e})}),p([]))},[e,h,u]);const C=Object(n.m)((e,t)=>{p(e=>[...e,t]),r(e)},[r]),y=Object(n.m)(e=>{c(),m(e)},[c,m]),k=Object(n.m)(e=>{o(e,!0)},[o]),N=Object(M.a)(),{canSendStickers:w,canSendGifs:S}=t;function I(t,a){switch(h){case Es.Emoji:return n.a.createElement(ms,{className:"picker-tab",onEmojiSelect:C});case Es.Stickers:return n.a.createElement(gs,{className:"picker-tab",loadAndPlay:!!w&&(e&&(t||a)),canSendStickers:w,onStickerSelect:k});case Es.GIFs:return n.a.createElement(Os,{className:"picker-tab",loadAndPlay:!!S&&(e&&(t||a)),canSendGifs:S,onGifSelect:i})}}const P=n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},ys&&n.a.createElement(T.a,{name:"slide",activeKey:h,renderCount:js.length},I)),l.l&&n.a.createElement(D.a,{round:!0,faded:!0,color:"translucent",ariaLabel:N("Close"),className:"symbol-close-button",size:"tiny",onClick:c},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(Cs,{activeTab:h,onSwitchTab:b,onRemoveSymbol:d,onSearchOpen:y}));if(l.l){if(!E)return;const e=Object(W.a)("SymbolMenu mobile-menu",j,!a&&"middle-column-open");return n.a.createElement(Rn.a,null,n.a.createElement("div",{className:e},P))}return n.a.createElement(Fn.a,{isOpen:e,positionX:"left",positionY:"bottom",onClose:c,className:"SymbolMenu",onCloseAnimationEnd:c,onMouseEnter:l.n?void 0:v,onMouseLeave:l.n?void 0:O,noCloseOnBackdrop:!l.n},P)}));a(307);var Ns=Object(n.h)(({isOpen:e,allowedAttachmentOptions:t,onFileSelect:a,onPollCreate:s,onClose:c})=>{const[r,i]=ts(e,c),d=Object(n.m)((e,t)=>{const{files:n}=e.target;n&&n.length>0&&a(Array.from(n),t)},[a]),m=Object(n.m)(()=>{ha(Array.from(o.n).join(","),e=>d(e,!0))},[d]),u=Object(n.m)(()=>{ha("*",e=>d(e,!1))},[d]),h=Object(M.a)(),{canAttachMedia:b,canAttachPolls:g}=t;return n.a.createElement(Fn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:c,className:"AttachMenu fluid",onCloseAnimationEnd:c,onMouseEnter:l.n?void 0:r,onMouseLeave:l.n?void 0:i,noCloseOnBackdrop:!l.n},!b&&n.a.createElement(_.a,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),b&&n.a.createElement(n.a.Fragment,null,n.a.createElement(_.a,{icon:"photo",onClick:m},h("AttachmentMenu.PhotoOrVideo")),n.a.createElement(_.a,{icon:"document",onClick:u},h("AttachDocument"))),g&&n.a.createElement(_.a,{icon:"poll",onClick:s},h("Poll")))});a(308);var ws=Object(n.h)(Object(s.h)(e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}},(e,t)=>Object(h.l)(t,["clearStickersForEmoji"]))(({isOpen:e,onStickerSelect:t,stickers:a,clearStickersForEmoji:s})=>{const c=Object(n.q)(null),{shouldRender:r,transitionClassNames:i}=Object(Y.a)(e,void 0,void 0,!1),d=Object(f.a)(a,!0),m=a||d,{observe:u}=Object(ta.a)({rootRef:c,throttleMs:200});Object(n.n)(()=>e?Object(g.a)(s):void 0,[e,s]);const h=Object(W.a)("StickerTooltip composer-tooltip custom-scroll",i,!(m&&m.length)&&"hidden");return n.a.createElement("div",{ref:c,className:h,onMouseEnter:l.n?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:l.n?void 0:()=>{document.body.classList.remove("no-select")}},r&&m?m.map(e=>n.a.createElement(oa.a,{key:e.id,sticker:e,size:o.Lb,observeIntersection:u,onClick:t,clickArg:e})):r?n.a.createElement(ge.a,null):void 0)}));a(309);var Ss=Object(n.h)(Object(s.h)((e,{messageId:t})=>{const{chatId:a}=Object(m.z)(e)||{};return a?{message:Object(m.l)(e,a,t)}:{}},(e,t)=>Object(h.l)(t,["clickInlineButton"]))(({isOpen:e,message:t,onClose:a,clickInlineButton:s})=>{const[c,r]=ts(e,a);if(t&&t.keyboardButtons)return n.a.createElement(Fn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:a,className:"KeyboardMenu",onCloseAnimationEnd:a,onMouseEnter:l.n?void 0:c,onMouseLeave:l.n?void 0:r,noCloseOnBackdrop:!l.n},n.a.createElement("div",{className:"content"},t.keyboardButtons.map(e=>n.a.createElement("div",{className:"row"},e.map(e=>n.a.createElement(D.a,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>s({button:e})},e.text))))))}));a(310);var Is=Object(n.h)(({isOpen:e,onSilentSend:t,onScheduleSend:a,onClose:s,onCloseAnimationEnd:c})=>{const[r,o]=ts(e,s),i=Object(M.a)();return n.a.createElement(Fn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:s,onCloseAnimationEnd:c,onMouseEnter:l.n?void 0:r,onMouseLeave:l.n?void 0:o,noCloseOnBackdrop:!l.n},t&&n.a.createElement(_.a,{icon:"mute",onClick:t},i("SendWithoutSound")),a&&n.a.createElement(_.a,{icon:"schedule",onClick:a},i("ScheduleMessage")))}),Ps=a(143),Fs=a(170),Ms=a(183);a(311);var Ls=Object(n.h)(({isOpen:e,emojis:t,onClose:a,onEmojiSelect:s,addRecentEmoji:c})=>{const r=Object(n.q)(null),{shouldRender:o,transitionClassNames:i}=Object(Y.a)(e,void 0,void 0,!1),d=Object(Ms.a)(t.length?t:void 0,350)||[],[m,u]=Object(n.r)(-1);Object(n.n)(()=>{u(0)},[t]),Object(n.n)(()=>{!function(e,t){const a=t.current;if(!a)return;const{visibleIndexes:n,allElements:s}=Hn(a,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const c=n[0];if(!n.includes(e)||e===c&&!$n(a,s[c],!0)){const t="start"===(e>n[n.length-1]?"start":"end")?44*e:0;Object(ns.a)(a,t)}}(m,r)},[m]);const h=Object(n.m)(e=>{if(!t.length)return-1;const a=t.length;return Object(Kn.a)(a,e)},[t]),b=Object(n.m)((e,t)=>{t.preventDefault(),u(t=>h(t+e))},[u,h]),g=Object(n.m)(e=>{if(t.length&&m>-1){const a=t[m];a&&(e.preventDefault(),s(a.native),c({emoji:a.id}))}},[c,t,s,m]),p=Object(n.m)((e,t)=>{s(e),c({emoji:t})},[c,s]);Object(n.n)(()=>e?Object(Ge.a)({onEsc:a,onLeft:e=>b(-1,e),onRight:e=>b(1,e),onEnter:g}):void 0,[b,g,e,a]);const v=Object(W.a)("EmojiTooltip composer-tooltip custom-scroll-x",i);return n.a.createElement("div",{ref:r,className:v,onMouseEnter:l.n?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:l.n?void 0:()=>{document.body.classList.remove("no-select")}},o&&d?d.map((e,t)=>n.a.createElement(ss,{key:e.id,emoji:e,focus:m===t,onClick:p})):o?n.a.createElement(ge.a,null):void 0)});a(312);var As=Object(n.h)(({title:e,description:t,thumbnail:a,thumbUrl:s,focus:c,transitionClassNames:r="",onClick:o})=>{let l="";const i=Object(O.a)(a?"webDocument:"+a.url:void 0);return(s=s||i)?l=n.a.createElement("img",{src:s,className:r,alt:"",decoding:"async",draggable:"false"}):e&&(l=Object(sa.c)(e,1)),n.a.createElement(Ee.a,{focus:c,className:"BaseResult chat-item-clickable",onClick:o},n.a.createElement("span",{className:"thumb"},"string"==typeof l?Object(U.a)(l):l),n.a.createElement("div",{className:"content-inner"},e&&n.a.createElement("div",{className:"title"},e),t&&n.a.createElement("div",{className:"description"},t)))});a(313);var Rs=Object(n.h)(({focus:e,isForGallery:t,inlineResult:a,onClick:s})=>{let c,r,o;"photo"in a&&(c=a.photo),"thumbnail"in a&&(r=a.thumbnail),"webThumbnail"in a&&t&&(o=a.webThumbnail);const l=Object(O.a)(o?"webDocument:"+o.url:void 0),i=Object(O.a)(c&&`photo${c.id}?size=m`),{shouldRenderThumb:d,shouldRenderFullMedia:m,transitionClassNames:u}=Object(na.a)(i,"slow"),h=Object(n.m)(()=>{s(a)},[a,s]);if(t)return n.a.createElement("div",{className:"MediaResult chat-item-clickable",onClick:h},d&&n.a.createElement("img",{src:c&&c.thumbnail&&c.thumbnail.dataUri||l,alt:""}),m&&n.a.createElement("img",{src:i,className:u+" full-media",alt:""}));const{title:b,description:g}=a;return n.a.createElement(As,{focus:e,thumbUrl:m?i:r&&r.dataUri||l,transitionClassNames:m?u:void 0,title:b,description:g,onClick:h})});var Ts=Object(n.h)(({focus:e,inlineResult:t,onClick:a})=>{const{title:s,url:c,description:r,webThumbnail:o}=t,l=Object(n.m)(()=>{a(t)},[t,a]);return n.a.createElement(As,{focus:e,thumbnail:o,title:s||c,description:r,onClick:l})});var Ds=Object(n.h)(({inlineResult:e,observeIntersection:t,onClick:a})=>{const{gif:s}=e,c=Object(n.m)(()=>{a(e)},[e,a]);if(s)return n.a.createElement(vs,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:c})});var Bs=Object(n.h)(({inlineResult:e,observeIntersection:t,onClick:a})=>{const{sticker:s}=e;if(s)return n.a.createElement(oa.a,{sticker:s,size:o.Hb,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:a,clickArg:e})});a(314);const Us=Object(V.h)(e=>e(),500,!0);var xs=Object(n.h)(Object(s.h)(void 0,(e,t)=>Object(h.l)(t,["sendBotCommand","openChat","sendInlineBotResult"]))(({isOpen:e,botId:t,isGallery:a,inlineBotResults:s,switchPm:c,loadMore:o,onClose:i,openChat:d,sendBotCommand:m,onSelectResult:u})=>{const h=Object(n.q)(null),{shouldRender:b,transitionClassNames:g}=Object(Y.a)(e,void 0,void 0,!1),[p,v]=Object(n.r)(-1),{observe:O}=Object(ta.a)({rootRef:h,debounceMs:200,isDisabled:!e});Object(n.n)(()=>{v(a?-1:0)},[s,a]),Object(n.n)(()=>{Wn(".chat-item-clickable",p,h)},[p]);const E=Object(n.m)(e=>s&&s.length?Object(Kn.a)(s.length,e):-1,[s]),j=Object(n.m)((e,t)=>{a||(t.preventDefault(),v(t=>E(t+e)))},[a,E]),C=Object(n.m)(e=>{if(s&&s.length&&p>-1){const t=s[p];t&&(e.preventDefault(),u(t))}},[s,u,p]),y=Object(n.m)(({direction:e})=>{e===r.e.Backwards&&Us(o)},[o]);Object(n.n)(()=>e?Object(Ge.a)({onEsc:i,onUp:e=>j(-1,e),onDown:e=>j(1,e),onEnter:C}):void 0,[j,C,a,e,i]);const k=Object(n.m)(()=>{d({id:t}),m({chatId:t,command:"/start "+c.startParam})},[t,d,m,c]),N=Object(f.a)(s&&s.length?s:void 0,b),w=s&&!s.length?N:s;if(!b||!w||!w.length&&!c)return;const S=Object(W.a)("InlineBotTooltip composer-tooltip",l.n?"no-scrollbar":"custom-scroll",a&&"gallery",g);return n.a.createElement(Oe.a,{ref:h,className:S,items:w,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:y,sensitiveArea:160},c&&n.a.createElement(Ee.a,{ripple:!0,className:"switch-pm scroll-item",onClick:k},n.a.createElement("span",{className:"title"},c.text)),w.map((e,t)=>{switch(e.type){case"gif":return n.a.createElement(Ds,{key:e.id,inlineResult:e,observeIntersection:O,onClick:u});case"photo":return n.a.createElement(Rs,{key:e.id,isForGallery:a,inlineResult:e,onClick:u});case"sticker":return n.a.createElement(Bs,{key:e.id,inlineResult:e,observeIntersection:O,onClick:u});case"video":case"game":return n.a.createElement(Rs,{key:e.id,focus:p===t,inlineResult:e,onClick:u});case"article":case"audio":return n.a.createElement(Ts,{key:e.id,focus:p===t,inlineResult:e,onClick:u});default:return}}))})),Gs=a(180);a(315);var zs=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),n=a&&Object(m.n)(e,a.id);if(!a||!n)return{};const{query:s,results:c}=Object(m.B)(e)||{},{totalCount:r,foundIds:o}=c||{};return{chat:a,messagesById:n,query:s,totalCount:r,foundIds:o}},(e,t)=>Object(h.l)(t,["searchTextMessagesLocal","focusMessage"]))(({chatId:e,threadId:t,onClose:a,isActive:c,chat:r,messagesById:o,query:l,totalCount:i,foundIds:d,searchTextMessagesLocal:b,focusMessage:g})=>{const p=Object(M.a)(),v=Object(n.p)(()=>{if(!(l&&d&&d.length&&o))return Ve.a;const a=d.map(a=>{const n=o[a];if(!n)return;const c=n.senderId?Object(m.Jb)(Object(s.e)(),n.senderId):void 0;let l;if(r&&Object(u.mb)(r))l=r;else if(n.forwardInfo){const{isChannelPost:e,fromChatId:t}=n.forwardInfo;l=e&&t?Object(m.g)(Object(s.e)(),t):void 0}else l=n.senderId?Object(m.g)(Object(s.e)(),n.senderId):void 0;return{message:n,senderUser:c,senderChat:l,onClick:()=>g({chatId:e,threadId:t,messageId:a})}}).filter(Boolean);return Object(h.k)(a,({message:e})=>e.date,"desc")},[e,t,g,d,r,o,l]);Object(L.a)(c,a);const O=Object(n.q)(null),E=Object(be.a)(O,!0,e=>{const t=v&&v[-1===e?0:e];t&&t.onClick()},".ListItem-button",!0);return n.a.createElement(Oe.a,{className:"RightSearch custom-scroll",items:v,preloadBackwards:0,onLoadMore:b,noFastList:!0,onKeyDown:E,ref:O},n.a.createElement("p",{className:"helper-text",dir:"auto"},l?0!==i&&v.length?1===i?"1 message found":(v.length&&(i||v.length))+" messages found":p("lng_search_no_results"):p("lng_dlg_search_for_messages")),v.map(({message:e,senderUser:t,senderChat:a,onClick:s})=>{const c=a?Object(u.k)(p,a):Object(u.bb)(t),r=Object(u.O)(p,e);return n.a.createElement(Ee.a,{className:"chat-item-clickable search-result-message m-0",onClick:s},n.a.createElement(x.a,{chat:a,user:t}),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"title"},n.a.createElement("h3",{dir:"auto"},c&&Object(U.a)(c)),n.a.createElement(Gs.a,{message:e})),n.a.createElement("div",{className:"subtitle",dir:"auto"},Object(U.a)(r,["emoji","highlight"],{highlight:l}))))}))})),qs=a(52);var _s=Object(n.h)(Object(s.h)((e,{stickerSetId:t})=>({set:Object(m.zb)(e,t),shouldPlay:Object(m.yb)(e)}),(e,t)=>Object(h.l)(t,["loadStickers","toggleStickerSet"]))(({stickerSetId:e,observeIntersection:t,set:a,shouldPlay:s,loadStickers:c,toggleStickerSet:r,isSomeModalOpen:l,onModalToggle:i})=>{const d=Object(M.a)(),m=a&&Boolean(a.installedDate),u=Boolean(a&&a.stickers),[h,b,g]=Object(xe.a)();Object(qs.a)(()=>{i(h)},[h,i]);const p=Object(n.p)(()=>{if(!a)return[];const e=(a.covers||[]).map(({id:e})=>e),t=a.stickers?a.stickers.filter(({id:t})=>!e.includes(t)):[];return[...a.covers||[],...t].slice(0,5)},[a]);Object(n.n)(()=>{!u&&p.length<5&&c({stickerSetId:e})},[u,p.length,c,e]);const v=Object(n.m)(()=>{r({stickerSetId:e})},[r,e]);if(!a)return;const O=p.length>0;return n.a.createElement("div",{key:a.id,className:"sticker-set",dir:d.isRtl?"rtl":void 0},n.a.createElement("div",{className:"sticker-set-header"},n.a.createElement("div",{className:"title-wrapper"},n.a.createElement("h3",{className:"title",dir:"auto"},a.title),n.a.createElement("p",{className:"count",dir:"auto"},d("Stickers",a.count,"i"))),n.a.createElement(D.a,{className:m?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:v},d(m?"Stickers.Installed":"Stickers.Install"))),n.a.createElement("div",{className:"sticker-set-main"},!O&&n.a.createElement(A.a,null),O&&p.map(e=>n.a.createElement(oa.a,{sticker:e,size:o.Nb,observeIntersection:t,noAnimate:!s||h||l,onClick:b}))),O&&n.a.createElement(ia.a,{isOpen:h,fromSticker:p[0],onClose:g}))}));a(316);const Hs=Object(V.h)(e=>e(),6e4,!0);var $s=Object(n.h)(Object(s.h)(e=>{const t=Object(m.A)(e),{query:a,resultIds:n}=t||{},{featured:s}=e.stickers;return{query:a,featuredIds:s.setIds,resultIds:n}},(e,t)=>Object(h.l)(t,["loadFeaturedStickers"]))(({onClose:e,isActive:t,query:a,featuredIds:s,resultIds:c,loadFeaturedStickers:r})=>{const o=Object(n.q)(null),l=Object(M.a)(),[i,d]=Object(n.r)(!1),{observe:m}=Object(ta.a)({rootRef:o,throttleMs:200});return Object(n.n)(()=>{Hs(()=>{r()})}),Object(L.a)(t,e),n.a.createElement("div",{ref:o,className:"StickerSearch custom-scroll",dir:l.isRtl?"rtl":void 0},function(){if(void 0!==a)return!a&&s?s.map(e=>n.a.createElement(_s,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:i,onModalToggle:d})):c?c.length?c.map(e=>n.a.createElement(_s,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:i,onModalToggle:d})):n.a.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):n.a.createElement(ge.a,null)}())}));a(317);var Vs=Object(n.h)(Object(s.h)(e=>{const t=Object(m.t)(e),{query:a,results:n}=t||{},{chatId:s}=Object(m.z)(e)||{},c=s?Object(m.g)(e,s):void 0;return{query:a,results:n,chat:c,isChatWithBot:c?Object(m.O)(e,c):void 0}},(e,t)=>Object(h.l)(t,["searchMoreGifs","sendMessage","setGifSearchQuery"]))(({onClose:e,isActive:t,query:a,results:s,chat:c,isChatWithBot:r,searchMoreGifs:o,sendMessage:i,setGifSearchQuery:d})=>{const m=Object(n.q)(null),{observe:h}=Object(ta.a)({rootRef:m,debounceMs:300}),{canSendGifs:b}=Object(u.b)(c,r),g=Object(n.m)(e=>{b&&i({gif:e}),l.n&&d({query:void 0})},[b,i,d]),p=Object(M.a)();Object(L.a)(t,e);const v=Boolean(void 0!==a&&s&&s.length);return n.a.createElement("div",{className:"GifSearch",dir:p.isRtl?"rtl":void 0},n.a.createElement(Oe.a,{ref:m,className:Object(W.a)("gif-container custom-scroll",v&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:o},function(){if(void 0!==a)return s?s.length?s.map(e=>n.a.createElement(vs,{key:e.id,gif:e,observeIntersection:h,onClick:g})):n.a.createElement("p",{className:"helper-text",dir:"auto"},p("NoGIFsFound")):n.a.createElement(ge.a,null)}()))}));a(318);var Ws=Object(n.h)(Object(s.h)((e,{answer:t})=>{const{voters:a,offsets:n}=e.pollResults;return{voters:a&&a[t.option],offset:n&&n[t.option]||""}},(e,t)=>Object(h.l)(t,["loadPollOptionResults","openChat","closePollResults"]))(({chat:e,message:t,answer:a,answerVote:s,totalVoters:c,voters:r,offset:o,loadPollOptionResults:l,openChat:i,closePollResults:d})=>{const m=Object(f.a)(s.votersCount),[u,h]=Object(n.r)(!0),b=Boolean(r),{option:g,text:p}=a,v=Object(M.a)();Object(n.n)(()=>{b&&m===s.votersCount||l({chat:e,messageId:t.id,option:g,offset:o,limit:4,shouldResetVoters:!0})},[s.votersCount,b]);const O=Object(n.m)(()=>{h(!0),l({chat:e,messageId:t.id,option:g,offset:o,limit:50})},[e,l,t.id,o,g]);Object(n.n)(()=>{h(!1)},[r]);const E=Object(n.m)(e=>{i({id:e}),d()},[d,i]);return n.a.createElement("div",{className:"PollAnswerResults"},n.a.createElement("div",{className:"poll-voters"},r?r.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable",onClick:()=>E(e)},n.a.createElement(je.a,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}))):n.a.createElement(ge.a,null),r&&function(){const e=s.votersCount-r.length;return s.votersCount>4&&e>0&&n.a.createElement(Kt,{count:e,itemName:"voter",isLoading:u,onClick:O})}()),n.a.createElement("div",{className:"answer-head",dir:v.isRtl?"rtl":void 0},n.a.createElement("span",{className:"answer-title",dir:"auto"},p),n.a.createElement("span",{className:"answer-percent",dir:v.isRtl?"auto":void 0},(j=s.votersCount,(C=c)>0?(j/C*100).toFixed():0),"%")));var j,C}));a(319);var Ks=Object(n.h)(Object(s.h)(e=>{const{pollResults:{chatId:t,messageId:a},lastSyncTime:n}=e;if(!t||!a)return{};return{chat:Object(m.g)(e,t),message:Object(m.l)(e,t,a),lastSyncTime:n}})(({onClose:e,isActive:t,chat:a,message:s,lastSyncTime:c})=>{const r=Object(M.a)();if(Object(L.a)(t,e),!s||!a)return n.a.createElement(ge.a,null);const{summary:o,results:l}=Object(u.I)(s);if(!l.results)return;const i=Object(h.c)(l.results,"option");return n.a.createElement("div",{className:"PollResults",dir:r.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"poll-question",dir:"auto"},o.question),n.a.createElement("div",{className:"poll-results-list custom-scroll"},c&&o.answers.map(e=>n.a.createElement(Ws,{key:`${s.id}-${e.option}`,chat:a,message:s,answer:e,answerVote:i[e.option],totalVoters:l.totalVoters})),!c&&n.a.createElement(ge.a,null)))}));a(174);var Ys=Object(n.h)(Object(s.h)((e,{userId:t})=>{const a=Object(m.Jb)(e,t),n=Object(m.g)(e,t),{progress:s}=e.management;return{user:a,chat:n,progress:s,isMuted:Object(u.Hb)(n,Object(m.fb)(e),Object(m.eb)(e))}},(e,t)=>Object(h.l)(t,["updateContact","deleteUser","closeManagement","openChat","deleteHistory"]))(({userId:e,user:t,chat:a,progress:s,isMuted:c,updateContact:o,deleteUser:l,deleteHistory:i,closeManagement:d,openChat:m,onClose:u,isActive:h})=>{const[b,g,p]=Object(xe.a)(),[v,O]=Object(n.r)(!1),[E,j]=Object(n.r)(),f=Object(M.a)();Object(L.a)(h,u);const C=t&&t.firstName||"",y=t&&t.lastName||"",[k,N]=Object(n.r)(C),[w,S]=Object(n.r)(y),[I,P]=Object(n.r)(!c);Object(n.n)(()=>{P(!c)},[c]),Object(n.n)(()=>{O(!1),p()},[p,e]),Object(n.n)(()=>{N(C),S(y)},[C,y,t]),Object(n.n)(()=>{s===r.f.Complete&&(O(!1),j(void 0),p())},[p,s]);const F=Object(n.m)(e=>{N(e.target.value),O(!0)},[]),R=Object(n.m)(e=>{S(e.target.value),O(!0)},[]),T=Object(n.m)(e=>{P(e.target.checked),O(!0)},[]),D=Object(n.m)(()=>{const t=k.trim(),a=w.trim();t.length||j("Please provide first name"),o({userId:e,isMuted:!I,firstName:t,lastName:a})},[k,w,o,e,I]),B=Object(n.m)(()=>{i({chatId:a.id,shouldDeleteForAll:!1}),l({userId:e}),p(),d(),m({id:void 0})},[a.id,p,d,i,l,m,e]);if(!t)return;const U=s===r.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(je.a,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),n.a.createElement(ve.a,{id:"user-first-name",label:f("UserInfo.FirstNamePlaceholder"),onChange:F,value:k,error:"Please provide first name"===E?E:void 0}),n.a.createElement(ve.a,{id:"user-last-name",label:f("UserInfo.LastNamePlaceholder"),onChange:R,value:w}),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(Zt.a,{checked:I,label:f("Notifications"),subLabel:f(I?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:T}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:g},f("DeleteContact")))),n.a.createElement(Dt.a,{isShown:v,onClick:D,disabled:U,ariaLabel:f("Save")},U?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:b,onClose:p,text:f("AreYouSureDeleteContact"),confirmLabel:f("DeleteContact"),confirmHandler:B,confirmIsDestructive:!0}))}));var Qs=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{progress:n}=e.management,s=Boolean(a.fullInfo&&a.fullInfo.linkedChatId),c=Object(u.lb)(a);return{chat:a,progress:n,isBasicGroup:c,hasLinkedChannel:s,canChangeInfo:c?a.isCreator:Object(u.p)(a,"changeInfo"),canBanUsers:c?a.isCreator:Object(u.p)(a,"banUsers")}},(e,t)=>Object(h.l)(t,["togglePreHistoryHidden","updateChat","closeManagement","leaveChannel","deleteChannel","deleteChat","openChat"]))(({chatId:e,chat:t,progress:a,isBasicGroup:s,hasLinkedChannel:o,canChangeInfo:l,canBanUsers:i,onScreenSelect:d,togglePreHistoryHidden:m,updateChat:h,deleteChat:b,leaveChannel:g,deleteChannel:p,closeManagement:v,openChat:E,onClose:j,isActive:f})=>{const[C,y,k]=Object(xe.a)(),N=t.title,w=t.fullInfo&&t.fullInfo.about||"",[S,I]=Object(n.r)(!1),[P,F]=Object(n.r)(N),[R,T]=Object(n.r)(w),[D,B]=Object(n.r)(),[x,G]=Object(n.r)(),z=Object(u.e)(t),q=Object(O.a)(z,!1,c.ApiMediaFormat.BlobUrl),_=Object(M.a)();Object(L.a)(f,j),Object(n.n)(()=>{a===r.f.Complete&&(I(!1),G(void 0))},[a]);const H=Object(n.m)(()=>{d(r.g.ChatPrivacyType)},[d]),$=Object(n.m)(()=>{d(r.g.Discussion)},[d]),V=Object(n.m)(()=>{d(r.g.GroupPermissions)},[d]),W=Object(n.m)(()=>{d(r.g.ChatAdministrators)},[d]),K=Object(n.m)(e=>{B(e),I(!0)},[]),Y=Object(n.m)(e=>{F(e.target.value),I(!0)},[]),Q=Object(n.m)(e=>{T(e.target.value),I(!0)},[]),Z=Object(n.m)(()=>{const t=P.trim(),a=R.trim();t.length?h({chatId:e,title:t,about:a,photo:D}):G("Group title can't be empty")},[R,e,D,P,h]),J=Object(n.m)(()=>{d(r.g.GroupMembers)},[d]),X=Object(n.m)(()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;m({chatId:t.id,isEnabled:!e})},[t,m]),ee=Object(n.p)(()=>{if(!t.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter(e=>!t.defaultBannedRights[e]).length;const{sendStickers:a,sendGifs:n}=t.defaultBannedRights;return a||n||(e+=1),e},[t]),te=t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,ae=Object(n.m)(()=>{s?b({chatId:t.id}):t.isCreator?p({chatId:t.id}):g({chatId:t.id}),k(),v(),E({id:void 0})},[s,t.isCreator,t.id,k,v,g,p,b,E]);if(t.isRestricted)return;const ne=a===r.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Tt.a,{currentAvatarBlobUrl:q,onChange:K,disabled:!l}),n.a.createElement(ve.a,{id:"group-title",label:_("GroupName"),onChange:Y,value:P,error:"Group title can't be empty"===x?x:void 0,disabled:!l}),n.a.createElement(ve.a,{id:"group-about",className:"mb-2",label:_("DescriptionPlaceholder"),onChange:Q,value:R,disabled:!l}),t.isCreator&&n.a.createElement(Ee.a,{icon:"lock",multiline:!0,onClick:H},n.a.createElement("span",{className:"title"},_("GroupType")),n.a.createElement("span",{className:"subtitle"},t.username?_("TypePublic"):_("TypePrivate"))),o&&n.a.createElement(Ee.a,{icon:"message",multiline:!0,onClick:$},n.a.createElement("span",{className:"title"},_("LinkedChannel")),n.a.createElement("span",{className:"subtitle"},_("DiscussionUnlink"))),n.a.createElement(Ee.a,{icon:"permissions",multiline:!0,onClick:V,disabled:!i},n.a.createElement("span",{className:"title"},_("ChannelPermissions")),n.a.createElement("span",{className:"subtitle",dir:"auto"},ee,"/",8)),n.a.createElement(Ee.a,{icon:"admin",multiline:!0,onClick:W},n.a.createElement("span",{className:"title"},_("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},Object(sa.a)(te)))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"group",multiline:!0,onClick:J},n.a.createElement("span",{className:"title"},_("GroupMembers")),n.a.createElement("span",{className:"subtitle"},Object(sa.a)(t.membersCount))),t.fullInfo&&n.a.createElement("div",{className:"ListItem narrow no-selection"},n.a.createElement(Zt.a,{checked:!t.fullInfo.isPreHistoryHidden,label:_("ChatHistory"),onChange:X,disabled:!i}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:y},_("DeleteMega")))),n.a.createElement(Dt.a,{isShown:S,onClick:Z,disabled:ne,ariaLabel:_("Save")},ne?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:C,onClose:k,textParts:Object(U.a)(s||!t.isCreator?_("AreYouSureDeleteAndExit"):_("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:s||!t.isCreator?_("DeleteMega"):_("DeleteGroupForAll"),confirmHandler:ae,confirmIsDestructive:!0}))}));var Zs=Object(n.h)(Object(s.h)((e,{chatId:t})=>({chat:Object(m.g)(e,t),currentUserId:e.currentUserId}),(e,t)=>Object(h.l)(t,["updateChatDefaultBannedRights"]))(({onScreenSelect:e,onChatMemberSelect:t,chat:a,currentUserId:s,updateChatDefaultBannedRights:c,onClose:o,isActive:l})=>{const[i,d]=Object(n.r)({}),[m,u]=Object(n.r)(!1),[h,b]=Object(n.r)(!1),g=Object(M.a)();Object(L.a)(l,o);const p=Object(n.m)(()=>{e(r.g.GroupRemovedUsers)},[e]),v=Object(n.m)(()=>{e(r.g.GroupUserPermissionsCreate)},[e]),O=Object(n.m)(a=>{t(a.userId,a.promotedByUserId===s),e(r.g.GroupUserPermissions)},[s,t,e]);Object(n.n)(()=>{d(a&&a.defaultBannedRights||{}),u(!1),setTimeout(()=>{b(!1)},250)},[a]);const E=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}d(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),u(!0)},[]),j=Object(n.m)(()=>{a&&(b(!0),c({chatId:a.id,bannedRights:i}))},[a,i,c]),f=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.kickedMembers?a.fullInfo.kickedMembers.length:0,[a]),C=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.members?a.fullInfo.members.filter(({bannedRights:e})=>!!e):[],[a]),y=Object(n.m)(e=>{const{bannedRights:t}=e;if(!t||!a)return;const{defaultBannedRights:n}=a;return Object.keys(t).reduce((e,a)=>{if(!t[a]||n&&n[a]||"sendInline"===a||"viewMessages"===a||"sendGames"===a)return e;const s=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";default:return}}(a);if(!s)return e;const c=g(s);return`${e}${e.length?", "+c:c}`},"")},[a,g]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading",dir:"auto"},g("ChannelPermissionsHeader")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendMessages",checked:!i.sendMessages,label:g("UserRestrictionsSend"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendMedia",checked:!i.sendMedia,label:g("UserRestrictionsSendMedia"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendStickers",checked:!i.sendStickers&&!i.sendGifs,label:g("UserRestrictionsSendStickers"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendPolls",checked:!i.sendPolls,label:g("UserRestrictionsSendPolls"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"embedLinks",checked:!i.embedLinks,label:g("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"inviteUsers",checked:!i.inviteUsers,label:g("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"pinMessages",checked:!i.pinMessages,label:g("UserRestrictionsPinMessages"),blocking:!0,onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!i.changeInfo,label:g("UserRestrictionsChangeInfo"),blocking:!0,onChange:E}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete-user",multiline:!0,narrow:!0,onClick:p},n.a.createElement("span",{className:"title"},g("ChannelBlockedUsers")),n.a.createElement("span",{className:"subtitle"},f))),n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading",dir:"auto"},g("PrivacyExceptions")),n.a.createElement(Ee.a,{icon:"add-user",onClick:v},g("ChannelAddException")),C.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>O(e)},n.a.createElement(je.a,{userId:e.userId,status:y(e)}))))),n.a.createElement(Dt.a,{isShown:m,onClick:j,ariaLabel:g("Save"),disabled:h},h?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var Js=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{chat:a,usersById:n}},(e,t)=>Object(h.l)(t,["updateChatMemberBannedRights"]))(({chat:e,usersById:t,updateChatMemberBannedRights:a,onClose:s,isActive:c})=>{const r=Object(M.a)();Object(L.a)(c,s);const o=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[],[e]),l=Object(n.m)(e=>{if(!e.kickedByUserId)return;const a=t[e.kickedByUserId];return a?r("UserRemovedBy",Object(u.bb)(a)):void 0},[r,t]),i=Object(n.m)(t=>{if(e)return[{title:r("Unblock"),icon:"delete",destructive:!0,handler:()=>a({chatId:e.id,userId:t.userId,bannedRights:{}})}]},[r,e,a]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",dir:r.isRtl?"rtl":void 0},n.a.createElement("p",{className:"text-muted"},r("NoBlockedGroup2")),o.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:i(e)},n.a.createElement(je.a,{userId:e.userId,status:l(e)}))))))}));var Xs=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{progress:n}=e.management;return{chat:a,progress:n,isSignaturesShown:Boolean(a&&a.isSignaturesShown),canChangeInfo:Object(u.p)(a,"changeInfo")}},(e,t)=>Object(h.l)(t,["toggleSignatures","updateChat","closeManagement","leaveChannel","deleteChannel","openChat"]))(({chatId:e,chat:t,progress:a,isSignaturesShown:s,canChangeInfo:o,onScreenSelect:l,updateChat:i,toggleSignatures:d,closeManagement:m,leaveChannel:h,deleteChannel:b,openChat:g,onClose:p,isActive:v})=>{const E=t&&t.title||"",j=t&&t.fullInfo&&t.fullInfo.about||"",f=t&&t.fullInfo&&t.fullInfo.linkedChatId,[C,y,k]=Object(xe.a)(),[N,w]=Object(n.r)(!1),[S,I]=Object(n.r)(E),[P,F]=Object(n.r)(j),[R,T]=Object(n.r)(),[D,B]=Object(n.r)(),U=t&&Object(u.e)(t),x=Object(O.a)(U,!1,c.ApiMediaFormat.BlobUrl),G=Object(M.a)();Object(L.a)(v,p),Object(n.n)(()=>{a===r.f.Complete&&(w(!1),B(void 0))},[a]);const z=t&&t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,q=Object(n.m)(()=>{l(r.g.ChatPrivacyType)},[l]),_=Object(n.m)(()=>{l(r.g.Discussion)},[l]),H=Object(n.m)(()=>{l(r.g.ChatAdministrators)},[l]),$=Object(n.m)(e=>{T(e),w(!0)},[]),V=Object(n.m)(e=>{I(e.target.value),w(!0)},[]),W=Object(n.m)(e=>{F(e.target.value),w(!0)},[]),K=Object(n.m)(()=>{const t=S.trim(),a=P.trim();t.length?i({chatId:e,title:t,about:a,photo:R}):B("Channel title can't be empty")},[P,e,R,S,i]),Y=Object(n.m)(()=>{d({chatId:e,isEnabled:!s})},[e,s,d]),Q=Object(n.m)(()=>{l(r.g.ChannelSubscribers)},[l]),Z=Object(n.m)(()=>{t.isCreator?b({chatId:t.id}):h({chatId:t.id}),k(),m(),g({id:void 0})},[t.isCreator,t.id,k,m,h,b,g]);if(t.isRestricted)return;const J=a===r.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Tt.a,{currentAvatarBlobUrl:x,onChange:$,disabled:!o}),n.a.createElement(ve.a,{id:"channel-title",label:G("EnterChannelName"),onChange:V,value:S,error:"Channel title can't be empty"===D?D:void 0,disabled:!o}),n.a.createElement(ve.a,{id:"channel-about",className:"mb-2",label:G("DescriptionPlaceholder"),onChange:W,value:P,disabled:!o}),t.isCreator&&n.a.createElement(Ee.a,{icon:"lock",multiline:!0,onClick:q},n.a.createElement("span",{className:"title"},G("ChannelType")),n.a.createElement("span",{className:"subtitle"},t.username?G("TypePublic"):G("TypePrivate"))),n.a.createElement(Ee.a,{icon:"message",multiline:!0,onClick:_,disabled:!o},n.a.createElement("span",{className:"title"},G("Discussion")),n.a.createElement("span",{className:"subtitle"},G(f?"DiscussionUnlink":"Add"))),n.a.createElement(Ee.a,{icon:"admin",multiline:!0,onClick:H},n.a.createElement("span",{className:"title"},G("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},z)),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(Zt.a,{checked:s,label:G("ChannelSignMessages"),onChange:Y}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"group",multiline:!0,onClick:Q},n.a.createElement("span",{className:"title",dir:"auto"},G("ChannelSubscribers")),n.a.createElement("span",{className:"subtitle",dir:"auto"},G("Subscribers",t.membersCount,"i")))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:y},t.isCreator?G("ChannelDelete"):G("LeaveChannel")))),n.a.createElement(Dt.a,{isShown:N,onClick:K,disabled:J,ariaLabel:G("Save")},J?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:C,onClose:k,text:t.isCreator?G("ChannelDeleteAlert"):G("ChannelLeaveAlert"),confirmLabel:t.isCreator?G("ChannelDelete"):G("LeaveChannel"),confirmHandler:Z,confirmIsDestructive:!0}))})),ec=a(59);var tc=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{isUsernameAvailable:n}=Object(m.ab)(e,t);return{chat:a,isChannel:Object(u.mb)(a),progress:e.management.progress,isUsernameAvailable:n}},(e,t)=>Object(h.l)(t,["checkPublicLink","updatePublicLink","updatePrivateLink"]))(({chat:e,onClose:t,isActive:a,isChannel:s,progress:c,isUsernameAvailable:o,checkPublicLink:l,updatePublicLink:i,updatePrivateLink:d})=>{const m=Boolean(e.username),u=e.fullInfo&&e.fullInfo.inviteLink,[h,b]=Object(n.r)(m?"public":"private"),[g,p]=Object(n.r)(),[v,O,E]=Object(xe.a)(),j="public"===h&&g&&o||"private"===h&&m;Object(L.a)(a,t),Object(n.n)(()=>{h&&!u&&d()},[h,u,d]);const f=Object(n.m)(e=>{b(e)},[]),C=Object(n.m)(()=>{i({username:"public"===h?g:""})},[h,i,g]),y=Object(n.m)(()=>{E(),d()},[E,d]),k=Object(M.a)(),N=s?"Channel":"Mega",w=s?"Channel":"Group",S=[{value:"private",label:k(N+"Private"),subLabel:k(N+"PrivateInfo")},{value:"public",label:k(N+"Public"),subLabel:k(N+"PublicInfo")}],I=c===r.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",dir:k.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading"},k(w+"Type")),n.a.createElement(qe.a,{selected:h,name:"channel-type",options:S,onChange:f})),"private"===h?n.a.createElement("div",{className:"section",dir:k.isRtl?"rtl":void 0},u?n.a.createElement(n.a.Fragment,null,n.a.createElement(ec.a,{url:u,className:"group-link",text:u}),n.a.createElement("p",{className:"section-info",dir:k.isRtl?"rtl":void 0},k(N+"PrivateLinkHelp")),n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:O},k("RevokeLink")),n.a.createElement(Pe.a,{isOpen:v,onClose:E,text:k("RevokeAlert"),confirmLabel:k("RevokeButton"),confirmHandler:y,confirmIsDestructive:!0})):n.a.createElement(ge.a,null)):n.a.createElement("div",{className:"section no-border"},n.a.createElement(Gt,{asLink:!0,currentUsername:e.username,isLoading:I,isUsernameAvailable:o,checkUsername:l,onChange:p}),n.a.createElement("p",{className:"section-info",dir:"auto"},k(w+".Username.CreatePublicLinkHelp")))),n.a.createElement(Dt.a,{isShown:j,disabled:I,ariaLabel:k("Save"),onClick:C},I?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var ac=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{forDiscussionIds:n,byId:s}=e.chats;return{chat:a,chatsByIds:s,forDiscussionIds:n,linkedChat:a&&a.fullInfo&&a.fullInfo.linkedChatId?Object(m.g)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&Object(u.mb)(a)}},(e,t)=>Object(h.l)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"]))(({chat:e,onClose:t,isActive:a,chatId:s,chatsByIds:c,linkedChat:l,forDiscussionIds:i,isChannel:d,onScreenSelect:m,loadGroupsForDiscussion:u,linkDiscussionGroup:h,unlinkDiscussionGroup:b})=>{const[g,p]=Object(n.r)(),[v,O]=Object(n.r)(),[E,j]=Object(n.r)(!1),f=Object(n.m)(()=>j(!0),[]),[C,y,k]=Object(xe.a)(),[N,w,S]=Object(xe.a)(),I=Object(M.a)(),P=l&&l.id;Object(L.a)(a,t),Object(n.n)(()=>{u()},[u]),Object(n.n)(()=>{v||Object(_t.a)("DiscussionGroups").then(O)},[v]);const F=Object(n.m)(()=>{k(),b({channelId:d?s:P}),d||m(r.g.Initial)},[k,b,d,s,P,m]),A=Object(n.m)(()=>{S(),h({channelId:s,chatId:g})},[S,h,s,g]);function R(){const e=c[g];if(e)return n.a.createElement("div",{className:"modal-header"},n.a.createElement(x.a,{size:"tiny",chat:e}),n.a.createElement("div",{className:"modal-title"},I("Channel.DiscussionGroup.LinkGroup")))}function T(){const t=c[g];if(t)return t.hasPrivateLink?Object(U.a)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):Object(U.a)(`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"])}return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement("div",{className:"section-icon"},v&&n.a.createElement(Ht.a,{id:"discussionGroupsDucks",size:o.Eb,animationData:v,play:E,noLoop:!0,onLoad:f})),l&&n.a.createElement("div",null,n.a.createElement(Ee.a,{className:"chat-item-clickable",inactive:!0},n.a.createElement(fe.a,{chatId:l.id})),n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:y},I(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),n.a.createElement(Pe.a,{isOpen:C,onClose:k,header:n.a.createElement("div",{className:"modal-header"},n.a.createElement(x.a,{size:"tiny",chat:l}),n.a.createElement("div",{className:"modal-title"},I(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:Object(U.a)(I(d?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",l.title),["br","simple_markdown"]),confirmLabel:I(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:F,confirmIsDestructive:!0})),!l&&n.a.createElement("div",null,n.a.createElement("p",{className:"section-help",dir:"auto"},I("DiscussionChannelHelp")),n.a.createElement("div",{teactFastList:!0},n.a.createElement(Ee.a,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},I("DiscussionCreateGroup")),i?i.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{p(e),w()}},n.a.createElement(fe.a,{chatId:e}))):n.a.createElement(st.a,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),n.a.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},I("DiscussionChannelHelp2")),n.a.createElement(Pe.a,{isOpen:N,onClose:S,header:R(),textParts:T(),confirmLabel:I("DiscussionLinkGroup"),confirmHandler:A,isButtonsInOneRow:!0})))))}));var nc=Object(n.h)(Object(s.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(m.g)(e,t);return{chat:n,isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(h.l)(t,["updateChatMemberBannedRights"]))(({chat:e,selectedChatMemberId:t,onScreenSelect:a,updateChatMemberBannedRights:s,isFormFullyDisabled:c,onClose:o,isActive:l})=>{const[i,d]=Object(n.r)({}),[m,u]=Object(n.r)(!1),[h,b]=Object(n.r)(!1),[g,p,v]=Object(xe.a)(),O=Object(M.a)();Object(L.a)(l,o);const E=Object(n.p)(()=>{if(e&&e.fullInfo&&e.fullInfo.members)return e.fullInfo.members.find(({userId:e})=>e===t)},[e,t]);Object(n.n)(()=>{e&&e.fullInfo&&t&&!E&&a(r.g.GroupPermissions)},[e,a,E,t]),Object(n.n)(()=>{d(E&&E.bannedRights||e&&e.defaultBannedRights||{}),u(!1),b(!1)},[e,E]);const j=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}d(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),u(!0)},[]),f=Object(n.m)(()=>{e&&t&&(b(!0),s({chatId:e.id,userId:t,bannedRights:i}))},[e,t,i,s]),C=Object(n.m)(()=>{e&&t&&s({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,s]),y=Object(n.m)(t=>!!c||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,c]);if(E)return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(je.a,{userId:E.userId})),n.a.createElement("h3",{className:"section-heading mt-4",dir:"auto"},O("UserRestrictionsCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendMessages",checked:!i.sendMessages,label:O("UserRestrictionsSend"),blocking:!0,disabled:y("sendMessages"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendMedia",checked:!i.sendMedia,label:O("UserRestrictionsSendMedia"),blocking:!0,disabled:y("sendMedia"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendStickers",checked:!i.sendStickers&&!i.sendGifs,label:O("UserRestrictionsSendStickers"),blocking:!0,disabled:y("sendStickers"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"sendPolls",checked:!i.sendPolls,label:O("UserRestrictionsSendPolls"),blocking:!0,disabled:y("sendPolls"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"embedLinks",checked:!i.embedLinks,label:O("UserRestrictionsEmbedLinks"),blocking:!0,disabled:y("embedLinks"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"inviteUsers",checked:!i.inviteUsers,label:O("UserRestrictionsInviteUsers"),blocking:!0,disabled:y("inviteUsers"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"pinMessages",checked:!i.pinMessages,label:O("UserRestrictionsPinMessages"),blocking:!0,disabled:y("pinMessages"),onChange:j})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!i.changeInfo,label:O("UserRestrictionsChangeInfo"),blocking:!0,disabled:y("changeInfo"),onChange:j}))),!c&&n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete-user",ripple:!0,destructive:!0,onClick:p},O("UserRestrictionsBlock")))),n.a.createElement(Dt.a,{isShown:m,onClick:f,ariaLabel:O("Save"),disabled:h},h?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:g,onClose:v,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:C,confirmIsDestructive:!0}))}));var sc=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{chat:a,currentUserId:e.currentUserId,isChannel:Object(u.mb)(a),usersById:n}})(({chat:e,isChannel:t,currentUserId:a,usersById:s,onScreenSelect:c,onChatMemberSelect:o,onClose:l,isActive:i})=>{const d=Object(M.a)();Object(L.a)(i,l);const m=Object(n.p)(()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),h=Object(n.m)(e=>{o(e.userId,e.promotedByUserId===a),c(r.g.ChatAdminRights)},[a,o,c]),b=Object(n.m)(e=>{if(e.isOwner)return d("ChannelCreator");const t=e.promotedByUserId?s[e.promotedByUserId]:void 0;return t?d("EditAdminPromotedBy",Object(u.bb)(t)):d("ChannelAdmin")},[d,s]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"recent",multiline:!0,onClick:function(){c(r.g.GroupRecentActions)}},n.a.createElement("span",{className:"title"},d("EventLog")),n.a.createElement("span",{className:"subtitle"},d(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),n.a.createElement("div",{className:"section",dir:d.isRtl?"rtl":void 0},n.a.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."),m.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable",onClick:()=>h(e)},n.a.createElement(je.a,{userId:e.userId,status:b(e),forceShowSelf:!0}))))))}));var cc=Object(n.h)(Object(s.h)((e,{chatId:t})=>({chat:Object(m.g)(e,t)}))(({chat:e,onClose:t,isActive:a})=>{const s=Object(M.a)();Object(L.a)(a,t);const c=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),r=Object(n.m)(e=>e.isOwner?s("ChannelCreator"):s("ChannelAdmin"),[s]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section not-implemented",dir:s.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading",dir:"auto"},"Actions"),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogFilterLeavingMembers"),onChange:void 0}))),n.a.createElement("div",{className:"section not-implemented",dir:s.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading",dir:"auto"},s("Channel.Management.Title")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!0,label:s("EventLogAllAdmins"),onChange:void 0})),c.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},n.a.createElement(Zt.a,{label:"",checked:!0}),n.a.createElement(je.a,{userId:e.userId,status:r(e),forceShowSelf:!0}))))))}));var rc=Object(n.h)(Object(s.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(m.g)(e,t),{byId:s}=e.users,{currentUserId:c}=e;return{chat:n,usersById:s,currentUserId:c,isChannel:Object(u.mb)(n),isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(h.l)(t,["updateChatAdmin"]))(({selectedChatMemberId:e,onScreenSelect:t,chat:a,usersById:s,currentUserId:c,isChannel:o,isFormFullyDisabled:l,updateChatAdmin:i,onClose:d,isActive:m})=>{const[h,b]=Object(n.r)({}),[g,p]=Object(n.r)(!1),[v,O]=Object(n.r)(!1),[E,j,f]=Object(xe.a)(),[C,y]=Object(n.r)(""),k=Object(M.a)();Object(L.a)(m,d);const N=Object(n.p)(()=>{if(a.fullInfo&&a.fullInfo.adminMembers)return a.fullInfo.adminMembers.find(({userId:t})=>t===e)},[a,e]);Object(n.n)(()=>{a&&a.fullInfo&&e&&!N&&t(r.g.ChatAdministrators)},[a,t,N,e]),Object(n.n)(()=>{b(N&&N.adminRights||{}),y((N&&N.customTitle||"").substr(0,16)),p(!1),O(!1)},[N]);const w=Object(n.m)(e=>{const{name:t}=e.target;b(e=>{return{...e,[t]:(a=e[t],!a||void 0)};var a}),p(!0)},[]),S=Object(n.m)(()=>{e&&(O(!0),i({chatId:a.id,userId:e,adminRights:h,customTitle:C}))},[a,e,h,C,i]),I=Object(n.m)(()=>{e&&(i({chatId:a.id,userId:e,adminRights:{}}),f())},[a.id,f,e,i]),P=Object(n.m)(e=>!Object(u.lb)(a)&&(!(!l&&a.adminRights)||!a.adminRights[e]),[a,l]),F=Object(n.p)(()=>{if(!N)return;if(N.isOwner)return k("ChannelCreator");const e=N.promotedByUserId?s[N.promotedByUserId]:void 0;return e?k("EditAdminPromotedBy",Object(u.bb)(e)):k("ChannelAdmin")},[N,s,k]),R=Object(n.m)(e=>{const{value:t}=e.target;y(t),p(!0)},[]);if(N)return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(je.a,{userId:N.userId,status:F,forceShowSelf:!0})),n.a.createElement("h3",{className:"section-heading mt-4",dir:"auto"},k("EditAdminWhatCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"changeInfo",checked:!!h.changeInfo,label:k(o?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:P("changeInfo"),onChange:w})),o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"postMessages",checked:!!h.postMessages,label:k("EditAdminPostMessages"),blocking:!0,disabled:P("postMessages"),onChange:w})),o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"editMessages",checked:!!h.editMessages,label:k("EditAdminEditMessages"),blocking:!0,disabled:P("editMessages"),onChange:w})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"deleteMessages",checked:!!h.deleteMessages,label:k(o?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:P("deleteMessages"),onChange:w})),!o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"banUsers",checked:!!h.banUsers,label:k("EditAdminBanUsers"),blocking:!0,disabled:P("banUsers"),onChange:w})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"inviteUsers",checked:!!h.inviteUsers,label:k("EditAdminAddUsers"),blocking:!0,disabled:P("inviteUsers"),onChange:w})),!o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"pinMessages",checked:!!h.pinMessages,label:k("EditAdminPinMessages"),blocking:!0,disabled:P("pinMessages"),onChange:w})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"addAdmins",checked:!!h.addAdmins,label:k("EditAdminAddAdmins"),blocking:!0,disabled:P("addAdmins"),onChange:w})),!o&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(Zt.a,{name:"anonymous",checked:!!h.anonymous,label:k("EditAdminSendAnonymously"),blocking:!0,disabled:P("anonymous"),onChange:w})),l&&n.a.createElement("p",{className:"section-info mb-4",dir:"auto"},k("Channel.EditAdmin.CannotEdit")),!o&&n.a.createElement(ve.a,{id:"admin-title",label:k("EditAdminRank"),onChange:R,value:C,disabled:l,maxLength:16}),c!==e&&!l&&n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},k("EditAdminRemoveAdmin")))),n.a.createElement(Dt.a,{isShown:g,onClick:S,ariaLabel:k("Save"),disabled:v},v?n.a.createElement(A.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(Pe.a,{isOpen:E,onClose:f,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:I,confirmIsDestructive:!0}))}));var oc=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(u.mb)(a),serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(h.l)(t,["openUserInfo"]))(({members:e,usersById:t,isChannel:a,openUserInfo:s,onClose:c,isActive:r,serverTimeOffset:o})=>{const l=Object(n.p)(()=>{if(e&&t)return Object(u.Jb)(e.map(({userId:e})=>e),t,void 0,o)},[e,o,t]),i=Object(n.m)(e=>{s({id:e})},[s]);return Object(L.a)(r,c),n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},l?l.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>i(e)},n.a.createElement(je.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(st.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var lc=Object(n.h)(Object(s.h)((e,{chatId:t})=>{const a=Object(m.g)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(u.mb)(a),serverTimeOffset:e.serverTimeOffset}})(({usersById:e,members:t,isChannel:a,onScreenSelect:s,onChatMemberSelect:c,onClose:o,isActive:l,serverTimeOffset:i})=>{Object(L.a)(l,o);const d=Object(n.p)(()=>{if(t&&e)return Object(u.Jb)(t.filter(e=>!e.isOwner).map(({userId:e})=>e),e,void 0,i)},[t,i,e]),m=Object(n.m)(e=>{c(e),s(r.g.GroupUserPermissions)},[c,s]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},d?d.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e)},n.a.createElement(je.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(st.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var ic=Object(n.h)(Object(s.h)(e=>({managementType:Object(m.v)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:a,isPromotedByCurrentUser:s,onScreenSelect:c,onChatMemberSelect:o,onClose:l,isActive:i,managementType:d})=>{switch(t){case r.g.Initial:switch(d){case"user":return n.a.createElement(Ys,{key:e,userId:e,onClose:l,isActive:i});case"group":return n.a.createElement(Qs,{key:e,chatId:e,onScreenSelect:c,onClose:l,isActive:i||[r.g.ChatPrivacyType,r.g.Discussion,r.g.GroupPermissions,r.g.ChatAdministrators,r.g.GroupRemovedUsers,r.g.GroupUserPermissionsCreate,r.g.GroupUserPermissions,r.g.ChatAdminRights,r.g.GroupRecentActions].includes(t)});case"channel":return n.a.createElement(Xs,{key:e,chatId:e,onScreenSelect:c,onClose:l,isActive:i||[r.g.ChannelSubscribers,r.g.ChatAdministrators,r.g.Discussion,r.g.ChatPrivacyType,r.g.ChatAdminRights,r.g.GroupRecentActions].includes(t)})}break;case r.g.ChatPrivacyType:return n.a.createElement(tc,{chatId:e,isActive:i,onClose:l});case r.g.Discussion:return n.a.createElement(ac,{chatId:e,onScreenSelect:c,isActive:i,onClose:l});case r.g.GroupPermissions:return n.a.createElement(Zs,{chatId:e,onScreenSelect:c,onChatMemberSelect:o,isActive:i||[r.g.GroupRemovedUsers,r.g.GroupUserPermissionsCreate,r.g.GroupUserPermissions].includes(t),onClose:l});case r.g.GroupRemovedUsers:return n.a.createElement(Js,{chatId:e,isActive:i,onClose:l});case r.g.GroupUserPermissionsCreate:return n.a.createElement(lc,{chatId:e,onChatMemberSelect:o,onScreenSelect:c,isActive:i||[r.g.GroupUserPermissions].includes(t),onClose:l});case r.g.GroupUserPermissions:return n.a.createElement(nc,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:s,onScreenSelect:c,isActive:i,onClose:l});case r.g.ChatAdministrators:return n.a.createElement(sc,{chatId:e,onScreenSelect:c,onChatMemberSelect:o,isActive:i||[r.g.ChatAdminRights,r.g.GroupRecentActions].includes(t),onClose:l});case r.g.GroupRecentActions:return n.a.createElement(cc,{chatId:e,isActive:i,onClose:l});case r.g.ChatAdminRights:return n.a.createElement(rc,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:s,onScreenSelect:c,isActive:i,onClose:l});case r.g.ChannelSubscribers:case r.g.GroupMembers:return n.a.createElement(oc,{chatId:e,isActive:i,onClose:l})}}));const dc={USD:"$",EUR:"€",GBP:"£",JPY:"¥",RUB:"₽",UAH:"₴",INR:"₹",AED:"د.إ"};function mc(e){return e&&dc[e]||""}const uc=/^4[0-9]{12}(?:[0-9]{1,3})?$/,hc=/^5[1-5][0-9]{11,14}$/,bc=/^2[2-7][0-9]{11,14}$/;let gc;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(gc||(gc={}));const pc={[gc.Default]:"",[gc.Visa]:"visa",[gc.Mastercard]:"mastercard"};function vc(e){return e=e.replace(/\s/g,""),uc.test(e)?gc.Visa:hc.test(e)||bc.test(e)?gc.Mastercard:gc.Default}var Oc=a(61);const Ec={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},jc=(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:fc(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:fc(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function fc(e){const t=At.a.find(({id:t})=>t===e);return t?t.name:""}function Cc(e,t=400){Object(n.n)(()=>{l.n||setTimeout(()=>{Object(V.b)(()=>{e.current&&e.current.focus()})},t)},[e,t])}var yc=Object(n.h)(e=>{const{id:t,value:a,label:s,hasArrow:c,error:r,ref:o,placeholder:l,onChange:i,children:d}=e,m=r||s,u=Object(W.a)("input-group",a&&"touched",r&&"error",m&&"with-label",c&&"with-arrow","input-group");return n.a.createElement("div",{className:u},n.a.createElement("select",{className:"form-control",id:t,value:a||"",onChange:i,placeholder:l||s,ref:o},d),m&&t&&n.a.createElement("label",{htmlFor:t},m))});a(320);var kc=Object(n.h)(({state:e,needEmail:t,needPhone:a,needName:s,needAddress:c,dispatch:r})=>{const o=Object(n.q)(null),l=Object(n.q)(null),i=Object(n.q)(null);Object(n.n)(()=>{i.current&&i.current.value!==e.countryIso2&&(i.current.value=e.countryIso2)},[e.countryIso2]);const d=Object(M.a)();Cc(o);const m=Object(n.m)(e=>{r({type:"changeAddress1",payload:e.target.value})},[r]),u=Object(n.m)(e=>{r({type:"changeAddress2",payload:e.target.value})},[r]),h=Object(n.m)(e=>{r({type:"changeCity",payload:e.target.value})},[r]),b=Object(n.m)(e=>{r({type:"changeState",payload:e.target.value})},[r]),g=Object(n.m)(e=>{r({type:"changeCountry",payload:e.target.value})},[r]),p=Object(n.m)(e=>{r({type:"changePostCode",payload:e.target.value})},[r]),v=Object(n.m)(e=>{r({type:"changeFullName",payload:e.target.value})},[r]),O=Object(n.m)(e=>{r({type:"changeEmail",payload:e.target.value})},[r]),E=Object(n.m)(e=>{let{value:t}=e.target;t="+"+t.replace(/\D/g,""),l.current&&(l.current.value=t),r({type:"changePhone",payload:t})},[r]),j=Object(n.m)(e=>{r({type:"changeSaveInfo",payload:e.target.value})},[r]),{formErrors:f}=e;return n.a.createElement("div",{className:"ShippingInfo"},n.a.createElement("form",null,c?n.a.createElement("div",null,n.a.createElement("h5",null,d("PaymentShippingAddress")),n.a.createElement(ve.a,{ref:o,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:f.streetLine1}),n.a.createElement(ve.a,{label:"Address2 (Street)",onChange:u,value:e.streetLine2,inputMode:"text",error:f.streetLine2}),n.a.createElement(ve.a,{label:"City",onChange:h,value:e.city,inputMode:"text",error:f.city}),n.a.createElement(ve.a,{label:"State",onChange:b,value:e.state,inputMode:"text",error:f.state}),n.a.createElement(yc,{label:"Country",placeholder:"Country",onChange:g,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:f.countryIso2,ref:i},At.a.map(({name:e,id:t})=>n.a.createElement("option",{value:t,className:"county-item"},e))),n.a.createElement(ve.a,{label:"Post Code",onChange:p,value:e.postCode,inputMode:"text",error:f.postCode})):void 0,s||t||a?n.a.createElement("h5",null,d("PaymentShippingReceiver")):void 0,s&&n.a.createElement(ve.a,{label:"Full name",onChange:v,value:e.fullName,inputMode:"text",error:f.fullName}),t&&n.a.createElement(ve.a,{label:"Email",onChange:O,value:e.email,inputMode:"email",error:f.email}),a&&n.a.createElement(ve.a,{label:"Phone number",onChange:E,value:e.phone,inputMode:"tel",error:f.phone,ref:l}),n.a.createElement(Zt.a,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:j})))});a(321);var Nc=Object(n.h)(({state:e,shippingOptions:t,currency:a,dispatch:s})=>{Object(n.n)(()=>{t&&!e.shipping&&s({type:"changeShipping",payload:t[0].id})},[t,e.shipping,s]);const c=Object(n.m)(e=>{s({type:"changeShipping",payload:e})},[s]),r=Object(n.p)(()=>t.map(({id:e,title:t,amount:n})=>({label:t,subLabel:`${a} ${String(n/100)}`,value:e})),[t,a]);return n.a.createElement("div",{className:"Shipping"},n.a.createElement("form",null,n.a.createElement("p",null,"Select shipping method"),n.a.createElement(qe.a,{name:"shipping-options",options:r,onChange:c,selected:e.shipping})))});a(322);function wc(e,t,a,s=!1){return n.a.createElement("div",{className:"price-info-item "+(s?"price-info-item-main":"")},n.a.createElement("div",{className:"title"},e),n.a.createElement("div",{className:"value"},`${a||""} ${(t/100).toFixed(2)}`))}function Sc(e,t,a){return n.a.createElement("div",{className:"checkout-info-item"},n.a.createElement("i",{className:e}," "),n.a.createElement("div",{className:"info"},n.a.createElement("div",{className:"title"},t),n.a.createElement("p",{className:"data"},a)))}var Ic=Object(n.h)(({invoiceContent:e,prices:t,shippingPrices:a,checkoutInfo:s,currency:c,totalPrice:r})=>{const{photoUrl:o,title:l,text:i}=e||{},{paymentMethod:d,paymentProvider:m,shippingAddress:u,name:h,phone:b,shippingMethod:g}=s||{};return n.a.createElement("div",{className:"Checkout"},n.a.createElement("div",{className:"description has-image"},o&&n.a.createElement("img",{src:o,alt:""}),n.a.createElement("div",{className:"text"},n.a.createElement("h5",null,l),n.a.createElement("p",null,i))),n.a.createElement("div",{className:"price-info"},t&&t.map(e=>wc(e.label,e.amount,c,!1)),a&&a.map(e=>wc(e.label,e.amount,c,!1)),void 0!==r&&wc("Total",r,c,!0)),n.a.createElement("div",{className:"invoice-info"},d&&Sc("icon-card",d,"Payment method"),m&&Sc("stripe-provider",m,"Payment provider"),u&&Sc("icon-location",u,"Shipping address"),h&&Sc("icon-user",h,"Name"),b&&Sc("icon-phone",b,"Phone number"),g&&Sc("icon-truck",g,"Shipping method")))});var Pc=Object(n.h)(({value:e,error:t,onChange:a})=>{const s=Object(n.q)(null),c=Object(n.m)(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]),r=Object(n.m)(e=>{a(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t&&t[0]&&Number(t[0])>12&&(t[0]="12"),t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))},[a]);return n.a.createElement(ve.a,{label:"Expiry date",ref:s,onChange:r,onKeyDown:c,value:e,error:t,inputMode:"numeric",maxLength:5})}),Fc=(a(323),a.p+"mastercard.4216118edafe23cc2dec7b8807ba4622.svg"),Mc=a.p+"visa.e5a7c336e1deb4b92a636e2e053878c4.svg";var Lc=Object(n.h)(({value:e,error:t,onChange:a})=>{const s=Object(n.q)(null);Cc(s);const[c,r]=Object(n.r)(gc.Default);Object(n.n)(()=>{const t=vc(e);r(t)},[]);const o=Object(n.m)(e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),n=vc(e.target.value);r(n),a(t),s.current&&(s.current.value=t)},[a,s]),l=function(e){switch(e){case gc.Mastercard:return n.a.createElement("img",{src:Fc,alt:""});case gc.Visa:return n.a.createElement("img",{src:Mc,alt:""});default:return}}(c);return n.a.createElement("div",{className:"CardInput"},n.a.createElement("span",{className:"left-addon"},l),n.a.createElement(ve.a,{ref:s,label:"Card number",onChange:o,value:e,inputMode:"numeric",className:c?"has-left-addon":"",error:t,maxLength:23}))});a(324);var Ac=Object(n.h)(({state:e,canSaveCredentials:t,needCardholderName:a,needCountry:s,needZip:c,dispatch:r})=>{const o=Object(n.q)(null);Object(n.n)(()=>{o.current&&o.current.value!==e.billingCountry&&(o.current.value=e.billingCountry)},[e.billingCountry]);const l=Object(n.m)(e=>{r({type:"changeCardNumber",payload:e})},[r]),i=Object(n.m)(e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[r]),d=Object(n.m)(e=>{r({type:"changeExpiryDate",payload:e})},[r]),m=Object(n.m)(e=>{r({type:"changeCvvCode",payload:e.target.value})},[r]),u=Object(n.m)(e=>{r({type:"changeBillingCountry",payload:e.target.value})},[r]),h=Object(n.m)(e=>{r({type:"changeBillingZip",payload:e.target.value})},[r]),b=Object(n.m)(e=>{r({type:"changeSaveCredentials",payload:e.target.value})},[r]),g=Object(M.a)(),{formErrors:p={}}=e;return n.a.createElement("div",{className:"PaymentInfo"},n.a.createElement("form",null,n.a.createElement("h5",null,g("PaymentCardTitle")),n.a.createElement(Lc,{onChange:l,value:e.cardNumber,error:p.cardNumber}),a&&n.a.createElement(ve.a,{label:"Name on card",onChange:i,value:e.cardholder,inputMode:"text",error:p.cardholder}),n.a.createElement("section",{className:"inline-inputs"},n.a.createElement(Pc,{value:e.expiry,onChange:d,error:p.expiry}),n.a.createElement(ve.a,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:p.cvv})),s||c?n.a.createElement("h5",null,g("PaymentBillingAddress")):void 0,s&&n.a.createElement(yc,{label:"Country",placeholder:"Country",onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:p.billingCountry,ref:o},At.a.map(({name:e})=>n.a.createElement("option",{value:e,className:"county-item"},e))),c&&n.a.createElement(ve.a,{label:"Post Code",onChange:h,value:e.billingZip,inputMode:"text",error:p.billingZip}),t&&n.a.createElement(Zt.a,{label:g("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:b})))});a(196);var Rc=Object(n.h)(Object(s.h)(e=>{const{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:s,invoice:c,invoiceContent:r,nativeProvider:o,nativeParams:l,passwordMissing:i,error:d}=e.payment,m=Boolean(c&&(!o||"stripe"!==o)),{needCardholderName:u,needCountry:h,needZip:b}=l||{},{nameRequested:g,phoneRequested:p,emailRequested:v,shippingAddressRequested:O,flexible:E,phoneToProvider:j,emailToProvider:f,currency:C,prices:y}=c||{};return{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:s,nativeProvider:o,passwordMissing:i,nameRequested:g,shippingAddressRequested:O,phoneRequested:p,emailRequested:v,flexible:E,phoneToProvider:j,emailToProvider:f,currency:C,prices:y,isProviderError:m,invoiceContent:r,needCardholderName:u,needCountry:h,needZip:b,error:d,globalDialogs:e.dialogs}},(e,t)=>Object(h.l)(t,["validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError"]))(({isOpen:e,onClose:t,step:a,shippingOptions:s,savedInfo:c,canSaveCredentials:o,nameRequested:l,shippingAddressRequested:i,phoneRequested:d,emailRequested:m,phoneToProvider:u,emailToProvider:h,currency:b,passwordMissing:g,isProviderError:p,invoiceContent:v,nativeProvider:O,prices:E,needCardholderName:j,needCountry:f,needZip:C,error:y,globalDialogs:k,validateRequestedInfo:N,sendPaymentForm:w,setPaymentStep:S,sendCredentialsInfo:I,clearPaymentError:P})=>{const[F,L]=Object(Pt.a)(jc,Ec),R=mc(b),[B,U]=Object(n.r)(!1),x=Object(M.a)();Object(n.n)(()=>{(a||y||k)&&U(!1)},[a,y,k]),Object(n.n)(()=>{if(y&&y.field)L({type:"setFormErrors",payload:{[y.field]:y.fieldError}});else if(k&&k.length){const e=Object(Oc.a)(k);L({type:"setFormErrors",payload:{...e}})}},[y,k,L]),Object(n.n)(()=>{if(c){const{name:e,phone:t,email:a,shippingAddress:n}=c;L({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?"+"+t:t,email:a,...n||{}}})}},[c,L]);const G=Object(n.m)(()=>{P()},[P]),z=Object(n.p)(()=>a!==r.j.Checkout?0:function(e=[],t,a){const n=t?Dc(t,a):[];let s=0;const c=e.concat(n||[]);return s=c.reduce((e,t)=>e+t.amount,s),s}(E,s,F.shipping),[a,F.shipping,E,s]),q=Object(n.p)(()=>{if(a===r.j.Checkout)return function(e,t,a){const n=`${function(e){const t=vc(e);return pc[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:c,fullName:r}=e,o=t?Tc(t,e.shipping):void 0,l=o?o.title:void 0;return{paymentMethod:n,paymentProvider:a,shippingAddress:s,name:r,phone:c,shippingMethod:l}}(F,s,O||"")},[a,F,s,O]);const _=Object(n.m)(()=>{const{saveInfo:e}=F,t=function(e){const{streetLine1:t,streetLine2:a,city:n,state:s,countryIso2:c,postCode:r,fullName:o,phone:l,email:i}=e;return{name:o,phone:l,email:i,shippingAddress:{streetLine1:t,streetLine2:a,city:n,state:s,countryIso2:c,postCode:r}}}(F);N({requestInfo:t,saveInfo:e})},[N,F]),H=Object(n.m)(()=>{const e=function(e){const{cardNumber:t,cardholder:a,expiry:n,cvv:s,billingCountry:c,billingZip:r}=e,[o,l]=n.split("/");return{data:{cardNumber:t,cardholder:a,expiryMonth:o,expiryYear:l,cvv:s,country:c,zip:r}}}(F);I({credentials:e})},[I,F]),$=Object(n.m)(()=>{w({shippingOptionId:F.shipping,saveCredentials:F.saveCredentials})},[w,F]),V=Object(n.m)(e=>{S({step:e})},[S]),W=Object(n.m)(()=>{switch(U(!0),a){case r.j.ShippingInfo:return _();case r.j.Shipping:return V(r.j.PaymentInfo);case r.j.PaymentInfo:return H();case r.j.Checkout:return $();default:return()=>{}}},[a,_,V,H,$]),K=Object(n.p)(()=>{switch(a){case r.j.ShippingInfo:return x("PaymentShippingInfo");case r.j.Shipping:return x("PaymentShippingMethod");case r.j.PaymentInfo:return x("PaymentCardInfo");case r.j.Checkout:return x("PaymentCheckout");default:return""}},[a,x]),Y=Object(n.p)(()=>{switch(a){case r.j.Checkout:return x("Checkout.PayPrice",`${R}${(z/100).toFixed(2)}`);default:return x("Next")}},[a,x,R,z]);return p?n.a.createElement(pe.a,{className:"error",isOpen:e,onClose:t},n.a.createElement("p",null,"Sorry, Telegram WebZ doesn't support payments with this provider yet. ",n.a.createElement("br",null),"Please use one of our mobile apps to do this."),n.a.createElement(D.a,{isText:!0,onClick:t},x("OK"))):n.a.createElement(pe.a,{className:"PaymentModal",isOpen:e,onClose:t},n.a.createElement("div",{className:"header",dir:x.isRtl?"rtl":void 0},n.a.createElement(D.a,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h3",null,K)),void 0!==a?n.a.createElement(T.a,{name:"slide",activeKey:a},()=>n.a.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case r.j.ShippingInfo:return n.a.createElement(kc,{state:F,dispatch:L,needAddress:Boolean(i),needEmail:Boolean(m||h),needPhone:Boolean(d||u),needName:Boolean(l)});case r.j.Shipping:return n.a.createElement(Nc,{state:F,dispatch:L,shippingOptions:s||[],currency:R});case r.j.PaymentInfo:return n.a.createElement(Ac,{state:F,dispatch:L,canSaveCredentials:Boolean(!g&&o),needCardholderName:j,needCountry:f,needZip:C});case r.j.Checkout:return n.a.createElement(Ic,{prices:E,shippingPrices:F.shipping&&s?Dc(s,F.shipping):void 0,totalPrice:z,invoiceContent:v,checkoutInfo:q,currency:R});default:return}}(a))):n.a.createElement("div",{className:"empty-content"},n.a.createElement(A.a,{color:"gray"})),n.a.createElement("div",{className:"footer"},n.a.createElement(D.a,{type:"submit",onClick:W,disabled:B,isLoading:B},Y)),y&&!y.field&&function(){if(y)return n.a.createElement(pe.a,{className:"error",isOpen:Boolean(y),onClose:G},n.a.createElement("h4",null,y.description||"Error"),n.a.createElement("p",null,y.description||"Error"),n.a.createElement(D.a,{isText:!0,onClick:P},x("OK")))}())}));function Tc(e,t){return e.find(({id:e})=>e===t)}function Dc(e,t){const a=Tc(e,t);return a?a.prices:void 0}var Bc=Object(n.h)(Object(s.h)(e=>{const{receipt:t}=e.payment,{currency:a,prices:n,info:s,totalAmount:c,credentialsTitle:r,shippingPrices:o,shippingMethod:l,photoUrl:i,text:d,title:m}=t||{};return{currency:a,prices:n,info:s,totalAmount:c,credentialsTitle:r,shippingPrices:o,shippingMethod:l,photoUrl:i,text:d,title:m}})(({isOpen:e,onClose:t,prices:a,shippingPrices:s,totalAmount:c,currency:r,info:o,photoUrl:l,text:i,title:d,credentialsTitle:m,shippingMethod:u})=>{const h=Object(M.a)(),b=mc(r),g=Object(n.p)(()=>function(e,t,a){if(!t)return{paymentMethod:e};const{shippingAddress:n}=t,s=n&&n.streetLine1?`${n.streetLine1}, ${n.city}, ${n.countryIso2}`:void 0,{phone:c,name:r}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:r,phone:c,shippingMethod:a}}(m,o,u),[o,u,m]);return n.a.createElement(pe.a,{className:"PaymentModal PaymentModal-receipt",isOpen:e,onClose:t},n.a.createElement("div",null,n.a.createElement("div",{className:"header",dir:h.isRtl?"rtl":void 0},n.a.createElement(D.a,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h3",null," ",h("PaymentReceipt")," ")),n.a.createElement("div",{className:"receipt-content custom-scroll"},n.a.createElement(Ic,{prices:a,shippingPrices:s,totalPrice:c,invoiceContent:{photoUrl:l,text:i,title:d},checkoutInfo:g,currency:b}))))}))},132:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(8),s=a(57);const c={MonkeyIdle:a.p+"TwoFactorSetupMonkeyIdle.dea4a492c144df84ddab778dc8a3f0cd.tgs",MonkeyTracking:a.p+"TwoFactorSetupMonkeyTracking.eb5a7a6f166fb7589c12e6248561fb58.tgs",MonkeyClose:a.p+"TwoFactorSetupMonkeyClose.604c4c833d322b7e6c3ea19bef058241.tgs",MonkeyPeek:a.p+"TwoFactorSetupMonkeyPeek.1905436b042520363d7e59f5d7f903ab.tgs",FoldersAll:a.p+"FoldersAll.3f9f9e243d19f0fbf9aaaff11cbd4572.tgs",FoldersNew:a.p+"FoldersNew.9a40d71c0c8be70f5bd14ff2d7bc1593.tgs",DiscussionGroups:a.p+"DiscussionGroupsDucks.9ea453d1be9d1b0ee77a992f8e587485.tgs"};function r(e){const t=c[e].replace(window.location.origin,"");return s.b("file"+t,n.ApiMediaFormat.Lottie)}},136:function(e,t,a){"use strict";var n=a(0),s=a(9),c=a(2),r=a(17),o=a(16),l=a(21),i=a(112),d=a(20);a(156);const m={type:"blob",quality:.8,format:"jpeg",circle:!1};let u,h,b;var g=Object(n.h)(({file:e,onChange:t,onClose:s})=>{const[g,p]=Object(n.r)(!1);Object(n.n)(()=>{e&&(g?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:a,offsetHeight:n}=t;b=new u(t,{enableZoom:!0,boundary:{width:a,height:n},viewport:{width:a-16,height:n-16,type:"circle"}});const s=await Object(r.a)(e);await b.bind({url:s})}catch(e){c.r&&console.error(e)}}(e):async function(){return h||(h=Promise.all([a.e(6),a.e(8)]).then(a.bind(null,333)),u=(await h).default),h}().then(()=>p(!0)))},[e,g]);const v=Object(o.a)();return n.a.createElement(i.a,{isOpen:Boolean(e),onClose:s,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},g?n.a.createElement("div",{id:"avatar-crop"}):n.a.createElement(d.a,null),n.a.createElement(l.a,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!b)return;const e=await b.result(m),a="string"==typeof e?e:Object(r.b)(e,"avatar.jpg");t(a)},ariaLabel:v("CropImage")},n.a.createElement("i",{className:"icon-check"})))});a(157);t.a=Object(n.h)(({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:a,onChange:c})=>{const[r,o]=Object(n.r)(),[l,i]=Object(n.r)(a);Object(n.n)(()=>{i(a)},[a]);const d=Object(s.a)(l&&"filled",t&&"disabled");return n.a.createElement("div",{className:"AvatarEditable"},n.a.createElement("label",{className:d,role:"button",tabIndex:0,title:e},n.a.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(o(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),n.a.createElement("i",{className:"icon-camera-add"}),l&&n.a.createElement("img",{src:l,alt:"Avatar"})),n.a.createElement(g,{file:r,onClose:function(){o(void 0)},onChange:function(e){o(void 0),c(e),l&&URL.revokeObjectURL(l),i(URL.createObjectURL(e))}}))})},144:function(e,t,a){},153:function(e,t,a){"use strict";var n=a(0),s=a(2),c=a(6),r=a(132),o=a(119);a(144);const l=[0,50],i=[0,20],d=[20,0],m=c.l?s.Db:s.Cb;t.a=Object(n.h)(({isPasswordVisible:e,isBig:t})=>{const[a,c]=Object(n.r)(),[u,h]=Object(n.r)(),[b,g]=Object(n.r)(!1),[p,v]=Object(n.r)(!1);Object(n.n)(()=>{a?setTimeout(()=>v(!0),2e3):Object(r.a)("MonkeyClose").then(c)},[a]),Object(n.n)(()=>{u||Object(r.a)("MonkeyPeek").then(h)},[u]);const O=Object(n.m)(()=>g(!0),[]);return n.a.createElement("div",{id:"monkey",className:t?"big":""},!b&&n.a.createElement("div",{className:"monkey-preview"}),a&&n.a.createElement(o.a,{id:"closeMonkey",size:t?s.Ob:m,className:p?"hidden":"shown",animationData:a,playSegment:l,noLoop:!0,onLoad:O}),u&&n.a.createElement(o.a,{id:"peekMonkey",size:t?s.Ob:m,className:p?"shown":"hidden",animationData:u,playSegment:e?i:d,noLoop:!0}))})},154:function(e,t,a){"use strict";var n=a(0),s=a(2),c=a(6),r=a(9),o=a(16),l=a(21);const i=c.l?550:400;t.a=Object(n.h)(({isLoading:e=!1,isPasswordVisible:t,error:a,hint:d,placeholder:m="Password",submitLabel:u="Next",clearError:h,onChangePasswordVisibility:b,onInputChange:g,onSubmit:p})=>{const v=Object(n.q)(null),O=Object(o.a)(),[E,j]=Object(n.r)(""),[f,C]=Object(n.r)(!1);return Object(n.n)(()=>{c.n||setTimeout(()=>{v.current.focus()},i)},[]),Object(n.n)(()=>{a&&requestAnimationFrame(()=>{v.current.focus(),v.current.select()})},[a]),n.a.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||f&&p(E)},autoComplete:"off"},n.a.createElement("div",{className:Object(r.a)("input-group password-input",E&&"touched",a&&"error"),dir:O.isRtl?"rtl":void 0},n.a.createElement("input",{ref:v,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:E||"",autoComplete:"current-password",onChange:function(e){a&&h();const{target:t}=e;j(t.value),C(t.value.length>=s.jb),g&&g(t.value)},dir:"auto"}),n.a.createElement("label",null,a||d||m),n.a.createElement("div",{className:"toggle-password",onClick:function(){b(!t)},role:"button",tabIndex:0,title:"Toggle password visibility"},n.a.createElement("i",{className:t?"icon-eye":"icon-eye-closed"}))),f&&n.a.createElement(l.a,{type:"submit",ripple:!0,isLoading:e},u))})},156:function(e,t,a){},157:function(e,t,a){},174:function(e,t,a){},196:function(e,t,a){},267:function(e,t,a){},268:function(e,t,a){},269:function(e,t,a){},270:function(e,t,a){},271:function(e,t,a){},272:function(e,t,a){},273:function(e,t,a){},274:function(e,t,a){},275:function(e,t,a){},276:function(e,t,a){},277:function(e,t,a){},278:function(e,t,a){},279:function(e,t,a){},280:function(e,t,a){},281:function(e,t,a){},282:function(e,t,a){},283:function(e,t,a){},284:function(e,t,a){},285:function(e,t,a){},286:function(e,t,a){},287:function(e,t,a){},288:function(e,t,a){},289:function(e,t,a){},290:function(e,t,a){},291:function(e,t,a){},292:function(e,t,a){},293:function(e,t,a){},294:function(e,t,a){},295:function(e,t,a){},296:function(e,t,a){},297:function(e,t,a){},298:function(e,t,a){},299:function(e,t,a){},300:function(e,t,a){},301:function(e,t,a){},302:function(e,t,a){},303:function(e,t,a){},304:function(e,t,a){},305:function(e,t,a){},306:function(e,t,a){},307:function(e,t,a){},308:function(e,t,a){},309:function(e,t,a){},310:function(e,t,a){},311:function(e,t,a){},312:function(e,t,a){},313:function(e,t,a){},314:function(e,t,a){},315:function(e,t,a){},316:function(e,t,a){},317:function(e,t,a){},318:function(e,t,a){},319:function(e,t,a){},320:function(e,t,a){},321:function(e,t,a){},322:function(e,t,a){},323:function(e,t,a){},324:function(e,t,a){}}]);
//# sourceMappingURL=3.86fc6942f17ca54599b3.js.map