mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-03 10:07:55 +01:00
2 lines
247 KiB
JavaScript
2 lines
247 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],Array(102).concat([function(e,t,a){"use strict";a.r(t),a.d(t,"MediaViewer",(function(){return de})),a.d(t,"ForwardPicker",(function(){return je})),a.d(t,"Dialogs",(function(){return ke})),a.d(t,"Notifications",(function(){return Ie})),a.d(t,"SafeLinkModal",(function(){return Pe})),a.d(t,"HistoryCalendar",(function(){return Te})),a.d(t,"CalendarModal",(function(){return Ae})),a.d(t,"DeleteMessageModal",(function(){return Re})),a.d(t,"PinMessageModal",(function(){return De})),a.d(t,"UnpinAllMessagesModal",(function(){return Be})),a.d(t,"MessageSelectToolbar",(function(){return qe})),a.d(t,"LeftSearch",(function(){return Nt})),a.d(t,"Settings",(function(){return on})),a.d(t,"ContactList",(function(){return mn})),a.d(t,"NewChat",(function(){return gn})),a.d(t,"NewChatStep1",(function(){return hn})),a.d(t,"NewChatStep2",(function(){return bn})),a.d(t,"ArchivedChats",(function(){return En})),a.d(t,"ContextMenuContainer",(function(){return Mn})),a.d(t,"StickerSetModal",(function(){return Fn})),a.d(t,"HeaderMenuContainer",(function(){return An})),a.d(t,"MobileSearch",(function(){return Dn})),a.d(t,"AttachmentModal",(function(){return Kn})),a.d(t,"PollModal",(function(){return Zn})),a.d(t,"SymbolMenu",(function(){return jc})),a.d(t,"AttachMenu",(function(){return Cc})),a.d(t,"MentionTooltip",(function(){return Vn})),a.d(t,"StickerTooltip",(function(){return yc})),a.d(t,"BotKeyboardMenu",(function(){return kc})),a.d(t,"CustomSendMenu",(function(){return Nc})),a.d(t,"DropArea",(function(){return Ic.b})),a.d(t,"TextFormatter",(function(){return Sc.a})),a.d(t,"EmojiTooltip",(function(){return Pc})),a.d(t,"RightSearch",(function(){return Fc})),a.d(t,"StickerSearch",(function(){return Rc})),a.d(t,"GifSearch",(function(){return Dc})),a.d(t,"PollResults",(function(){return xc})),a.d(t,"Management",(function(){return Jc})),a.d(t,"PaymentModal",(function(){return kr})),a.d(t,"ReceiptModal",(function(){return Sr}));var n=a(0),c=a(2),r=a(7),s=a(19),l=a(1),o=a(5),i=a(114),d=a(6),m=a(4),u=a(3),h=a(131),b=a(47),p=a(176),g=a(27),v=a(107),E=a(119),f=a(191),O=a(38),j=a(48),C=a(145),y=a(56);function k(e,t,a,n){const{mediaEl:c}=P(t,n);if(!c)return;const{width:r}=y.a.get();let o,d=!1;if(n){const{photo:e,video:t}=Object(m.v)(n),a=Object(m.R)(n),c=Object(m.S)(n);d=Boolean(t||c),o=d?Object(m.cb)(t||c):Object(m.T)(e||a)}else o=i.a;const{width:u,height:h}=Object(i.l)(e,d),{width:b,height:p}=Object(i.f)(u,h,o.width,o.height),g=(r-b)/2,v=function(e){const t=window.matchMedia(i.c);let a=4.125;e&&(a+=t.matches?.875:3.375);return a*i.d}(e)+(h-p)/2;let{top:E,left:f,width:O,height:j}=c.getBoundingClientRect();if([s.h.SharedMedia,s.h.Album,s.h.ScheduledAlbum,s.h.SearchResult].includes(t)){const e=function(e,t,a,n,c,r){if(e===t){const s=Math.max(c,r)*(e/t);n-=(s-c)/2,a-=(s-r)/2,c=s,r=s}else if(e>t){const a=c;n-=((c=r*(e/t))-a)/2}else if(t>e){const n=r;a-=((r=c*(t/e))-n)/2}return{top:a,left:n,width:c,height:r}}(b,p,E,f,O,j);E=e.top,f=e.left,O=e.width,j=e.height}const C=f+O/2-(g+b/2),k=E+j/2-(v+p/2),N=O/b,S=j/p,F=I(a||c);w(F,{top:v+"px",left:g+"px",width:b+"px",height:p+"px",transform:`translate3d(${C}px, ${k}px, 0) scale(${N}, ${S})`}),M(F,t),document.body.classList.add("ghost-animating"),requestAnimationFrame(()=>{document.body.appendChild(F),requestAnimationFrame(()=>{F.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(F),setTimeout(()=>{requestAnimationFrame(()=>{document.body.contains(F)&&document.body.removeChild(F),document.body.classList.remove("ghost-animating")})},200+l.c)})})}function N(e,t,a){const{container:n,mediaEl:c}=P(e,a);if(!c)return;const r=document.getElementById("MediaViewer").querySelector(".active .media-viewer-content img, .active .media-viewer-content video");if(!r||!c)return;const{top:o,left:i,width:d,height:m}=r.getBoundingClientRect(),{top:u,left:h,width:b,height:p}=c.getBoundingClientRect();let g=u;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:a}=y.a.get();return t.top<=a&&t.top+t.height>=0}(n)){const{height:e}=y.a.get();g=u<o?-p:e}const v=i+d/2-(h+b/2),E=o+m/2-(g+p/2);let f=d/b,O=m/p;const j=[s.h.Inline,s.h.ScheduledInline].includes(e)&&!S(n,c)||[s.h.Album,s.h.ScheduledAlbum].includes(e)&&!S(n,c);[s.h.SharedMedia,s.h.Album,s.h.ScheduledAlbum,s.h.SearchResult].includes(e)&&(f>O?f=O:O>f&&(O=f));const C=document.getElementsByClassName("ghost")[0],k=C||I(t||c,e===s.h.ProfileAvatar);C||w(k,{top:g+"px",left:h+"px",width:b+"px",height:p+"px",transform:`translate3d(${v}px, ${E}px, 0) scale(${f}, ${O})`}),requestAnimationFrame(()=>{if(C){const{top:e,left:t,width:a,height:n}=C.getBoundingClientRect();w(k,{transition:"none",top:g+"px",left:h+"px",transformOrigin:"top left",transform:`translate3d(${t-h}px, ${e-g}px, 0) scale(${a/b}, ${n/p})`,width:b+"px",height:p+"px"})}document.body.classList.add("ghost-animating"),C||document.body.appendChild(k),requestAnimationFrame(()=>{C&&(C.style.transition=""),k.style.transform="",j&&(k.style.opacity="0"),M(k,e),setTimeout(()=>{requestAnimationFrame(()=>{document.body.contains(k)&&document.body.removeChild(k),document.body.classList.remove("ghost-animating")})},200+l.c)})})}function I(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 w(e,t){Object.assign(e.style,t)}function P(e,t){let a,n;switch(e){case s.h.Album:case s.h.ScheduledAlbum:a=".active > .MessageList #album-media-"+t.id,n=".full-media";break;case s.h.SharedMedia:a="#shared-media"+t.id,n="img";break;case s.h.SearchResult:a="#search-media"+t.id,n="img";break;case s.h.MiddleHeaderAvatar:a=".MiddleHeader .ChatInfo .Avatar",n="img.avatar-media";break;case s.h.ProfileAvatar:a="#RightColumn .ProfileInfo .active .ProfilePhoto",n="img.avatar-media";break;case s.h.ScheduledInline:case s.h.Inline:default:a=".active > .MessageList #message"+t.id,n=".message-content .full-media, .message-content .thumbnail"}const c=document.querySelector(a),r=c&&c.querySelectorAll(n);return{container:c,mediaEl:r&&r[r.length-1]}}function M(e,t){switch(t){case s.h.Album:case s.h.ScheduledAlbum:case s.h.Inline:case s.h.ScheduledInline:e.classList.add("rounded-corners");break;case s.h.SharedMedia:case s.h.ProfileAvatar:case s.h.SearchResult:e.firstChild.style.objectFit="cover";break;case s.h.MiddleHeaderAvatar:e.classList.add("circle")}}var F=a(26),L=a(21),A=a(157),T=a(110),R=a(23),D=a(36),B=a(24),x=a(111);a(252);var U=Object(c.h)((e,{chatId:t,messageId:a,isAvatar:n})=>{if(n&&t)return{sender:Object(m.mb)(t)?Object(d.Hb)(e,t):Object(d.f)(e,t)};if(!a||!t)return{};const c=Object(d.k)(e,t,a);return{message:c,sender:c&&Object(d.tb)(e,c)}},(e,t)=>Object(u.l)(t,["closeMediaViewer","focusMessage"]))(({chatId:e,messageId:t,sender:a,isAvatar:c,message:r,closeMediaViewer:s,focusMessage:l})=>{const o=Object(n.m)(()=>{s(),l({chatId:e,messageId:t})},[e,l,t,s]),i=Object(F.a)();if(!a||!r&&!c)return;const d=a.id<0,u=Object(m.W)(i,a);return n.a.createElement("div",{className:"SenderInfo",onClick:o},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"},u&&Object(B.a)(u)),n.a.createElement("div",{className:"date",dir:"auto"},c?i("lng_mediaview_profile_photo"):Object(D.d)(i,1e3*r.date))))}),G=a(62),q=a(41),z=a(120),H=a(179);a(253);var $=({mediaData:e,isVideo:t,isZoomed:a,message:c,fileName:r,isAvatar:s,onCloseMediaViewer:l,onForward:i,onZoomToggle:d})=>{const{isDownloadStarted:u,downloadProgress:h,handleDownloadClick:b}=Object(H.a)(c&&t?Object(m.D)(c,"download"):void 0),p=Object(F.a)(),g=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(R.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 o.k?n.a.createElement("div",{className:"MediaViewerActions-mobile"},n.a.createElement(G.a,{trigger:g,positionX:"right"},!s&&n.a.createElement(q.a,{icon:"forward",onClick:i},p("Forward")),t?n.a.createElement(q.a,{icon:u?"close":"download",onClick:b},u?Math.round(100*h)+"% Downloading...":"Download"):n.a.createElement(q.a,{icon:"download",href:e,download:r},p("AccActionDownload"))),u&&n.a.createElement(z.a,{progress:h,size:"s",noCross:!0})):n.a.createElement("div",{className:"MediaViewerActions"},!s&&n.a.createElement(n.a.Fragment,null,n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("Forward"),onClick:i},n.a.createElement("i",{className:"icon-forward"}))),t?n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("AccActionDownload"),onClick:b},u?n.a.createElement(z.a,{progress:h,size:"s",onClick:b}):n.a.createElement("i",{className:"icon-download"})):n.a.createElement(R.a,{href:e,download:r,round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("AccActionDownload")},n.a.createElement("i",{className:"icon-download"})),n.a.createElement(R.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(R.a,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:p("Close"),onClick:l},n.a.createElement("i",{className:"icon-close"})))},_=a(9),V=a(8);a(254);var W=({text:e="",isHidden:t,isForVideo:a,onClick:c})=>{const[r,s]=Object(n.r)(!1);Object(n.n)(()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;s(t>2*i.d)};t();const a=Object(_.h)(t,500,!0);return window.addEventListener("resize",a,!1),()=>{window.removeEventListener("resize",a,!1)}},[]);const l=Object(V.a)("MediaViewerFooter",a&&"is-for-video",t&&"is-hidden");return n.a.createElement("div",{className:l,onClick:function(t){e&&t.stopPropagation()}},e&&n.a.createElement("div",{className:"media-viewer-footer-content",onClick:o.k?void 0:c},n.a.createElement("p",{className:"media-text custom-scroll "+(r?"multiline":""),dir:"auto"},e)))},K=a(35),Y=a(136);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 Q=a(146),X=a(135);const J=["bytes","kB","MB","GB","TB","PB"];var ee=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${J[t]}`};a(255);const te=e=>{e.stopPropagation()};var ae=({bufferedProgress:e,currentTime:t,duration:a,fileSize:c,isForceVisible:r,isForceMobileVersion:s,isPlayed:l,isFullscreenSupported:i,isFullscreen:d,onChangeFullscreen:m,onPlayPause:u,onSeek:h})=>{const[b,p]=Object(n.r)(!0);Object(n.n)(()=>{r&&p(r)},[r]),Object(n.n)(()=>{let e;return r||(o.k?p(!1):e=window.setTimeout(()=>{p(!1)},800)),()=>{e&&window.clearTimeout(e)}},[r]),Object(n.n)(()=>((b||r)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")}),[r,b]);const g=Object(F.a)();var v,E;if(b||r)return n.a.createElement("div",{className:"VideoPlayerControls "+(s?"mobile":""),onClick:te},function(e,t,a,c){const r=e/t*100,s=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: ${s||0}%`}),n.a.createElement("div",{className:"player-seekline-played",style:`width: ${r||0}%`}),n.a.createElement("input",{min:"0",max:"100",step:.01,type:"range",onInput:c,className:"player-seekline-input",value:r||0})))}(t,a,e,h),n.a.createElement(R.a,{ariaLabel:g("AccActionPlay"),size:"tiny",ripple:!o.k,color:"translucent-white",className:"play",onClick:u},n.a.createElement("i",{className:l?"icon-pause":"icon-play"})),function(e,t){return n.a.createElement("div",{className:"player-time"},`${Object(D.e)(e)} / ${Object(D.e)(t)}`)}(t,a),e<1&&(v=e,E=c,n.a.createElement("div",{className:"player-file-size"},`${ee(E*v)} / ${ee(E)}`)),i&&n.a.createElement(R.a,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:m},n.a.createElement("i",{className:""+(d?"icon-smallscreen":"icon-fullscreen")})))};a(256);function ne(){return(ne=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:c,downloadProgress:r,fileSize:s,isMediaViewerOpen:l,noPlay:i,onClose:d})=>{const m=Object(n.q)(null),[u,h]=Object(n.r)(!o.m||!o.e),[b,p]=Object(n.r)(0),[g,v]=Object(n.r)(!0),[E,f,O]=function(e,t){const[a,c]=Object(n.r)(Boolean(Z&&document[Z]));return Object(n.o)(()=>{const a=()=>{c(Boolean(Z&&document[Z]))},n=()=>{c(!0)},r=()=>{c(!1),t(!1)},s=e.current;return document.addEventListener("fullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),s&&(s.addEventListener("webkitbeginfullscreen",n,!1),s.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",a,!1),document.removeEventListener("webkitfullscreenchange",a,!1),document.removeEventListener("mozfullscreenchange",a,!1),s&&(s.removeEventListener("webkitbeginfullscreen",n,!1),s.removeEventListener("webkitendfullscreen",r,!1))}},[]),Z||"iOS"===o.p?[a,()=>{e.current&&(Z||"iOS"===o.p)&&(e.current.requestFullscreen?e.current.requestFullscreen():e.current.webkitRequestFullscreen?e.current.webkitRequestFullscreen():e.current.webkitEnterFullscreen?e.current.webkitEnterFullscreen():e.current.mozRequestFullScreen&&e.current.mozRequestFullScreen(),c(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),c(!1))}]:[!1]}(m,h),{isBuffered:j,bufferedProgress:C,bufferingHandlers:y}=Object(Y.a)(),{shouldRender:k,transitionClassNames:N}=Object(K.a)(!j,void 0,void 0,"slow");Object(n.n)(()=>{i||!l?m.current.pause():e&&!o.m&&Object(X.a)(m.current)},[i,l,e]),Object(n.n)(()=>{m.current.currentTime===m.current.duration?(p(0),h(!1)):p(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(Q.a)(m,[]);const S=Object(n.m)(()=>{v(!0)},[]),w=Object(n.m)(()=>{v(!1)},[]),P=Object(n.m)(e=>{p(e.currentTarget.currentTime)},[]),M=Object(n.m)(()=>{p(0),h(!1)},[]),F=Object(n.m)(()=>{E&&O?O():!E&&f&&f()},[O,E,f]),L=Object(n.m)(e=>{e.stopPropagation(),m.current.currentTime=Number(e.target.value)*m.current.duration/100},[]),A=Object(n.m)(e=>{e.stopPropagation(),v(!g)},[g]);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 T=c&&`width: ${c.width}px; height: ${c.height}px`,R=`background-image: url(${a})`;return n.a.createElement("div",{className:"VideoPlayer",onClick:!t&&o.k?A:void 0,onMouseOver:t?void 0:S,onMouseOut:t?void 0:w},n.a.createElement("div",{style:T},n.a.createElement("video",ne({ref:m,autoPlay:o.m,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:R,onEnded:M,onClick:o.k?void 0:I,onDoubleClick:F},y,{onTimeUpdate:P}),e&&n.a.createElement("source",{src:e}))),k&&n.a.createElement("div",{className:["spinner-container",N].join(" ")},!j&&n.a.createElement("div",{className:"buffering"},"Buffering..."),n.a.createElement(z.a,{size:"xl",progress:j?1:r,square:!0,onClick:d})),!t&&!k&&n.a.createElement(ae,{isPlayed:u,bufferedProgress:C,currentTime:b,isFullscreenSupported:Boolean(f),isFullscreen:E,fileSize:s,duration:m.current?m.current.duration:0,isForceVisible:!u||g,isForceMobileVersion:c&&c.width<400,onSeek:L,onChangeFullscreen:F,onPlayPause:I}))});a(257);var re=Object(n.h)(({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:a}=Object(K.a)(e),c=Object(O.a)(e),r=Object(n.q)(null),[s,l]=Object(n.r)(1),i=Object(n.q)(!1);Object(n.n)(()=>{e&&!c&&l(1.5)},[e,c]);const d=Object(n.m)(()=>{i.current=!0},[]),m=Object(n.m)(()=>{i.current=!1,1===s&&t(s,!i.current)},[t,s]);Object(n.n)(()=>{t(s,!i.current)},[s,t]);const u=Object(F.a)(),h=Object(V.a)("ZoomControls",a);return n.a.createElement("div",{className:h},n.a.createElement(R.a,{disabled:1===s,size:"tiny",color:"translucent-white",ariaLabel:u("ZoomOut"),className:"zoom-out",ripple:!o.k,onClick:()=>{r.current&&l(Math.max(1,s-.5))}},n.a.createElement("i",{className:"icon-zoom-out"})),n.a.createElement(R.a,{disabled:3===s,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!o.k,onClick:()=>{r.current&&l(Math.min(3,s+.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*(s-1)}%`}),n.a.createElement("input",{ref:r,min:1,max:3,step:"0.5",value:s,type:"range",className:"seekline-input",onChange:e=>{l(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:d,onMouseUp:m}))))});a(258);const se=[1,0,0,1,0,0],le={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5};var oe=Object(n.h)(({children:e,className:t,noWrap:a,canPan:c,zoomLevel:r,panDeltaX:s,panDeltaY:l,onPan:o})=>{const i=le[r]||r,[d,m]=Object(n.r)(!1),[h,b]=Object(n.r)({dx:s,dy:l,x:0,y:0}),[p,g]=Object(n.r)(se),v=Object(n.q)(null),E=Object(n.q)(null);Object(n.n)(()=>{const e=i||p[0],t=s||p[4],a=l||p[5],n=[...p];p[0]!==e&&(n[0]=e||n[0],n[3]=e||n[3]),p[4]!==t&&(n[4]=t),p[5]!==a&&(n[5]=a),Object(u.a)(p,n)||g(function(e,t,a){const n=a&&a.querySelector(".active img");if(!a||!n)return t;const c=a.getBoundingClientRect(),r=n.getBoundingClientRect(),s=r.width/e*t[0],l=r.height/e*t[3],o=(c.width-s)/2+t[4],i=(c.height-l)/2+t[5];return c.width&&c.width-150<o?t[4]-=o+c.width-150:s&&s+o<150&&(t[4]-=s+o-150),c.height&&c.height-150<i?t[5]-=i+c.height-150:l&&l+i<150&&(t[5]-=l+i-150),t}(p[0],n,v.current))},[s,l,i]),Object(n.n)(()=>{c||g(se)},[c]),Object(n.n)(()=>{E.current&&(E.current.style.transform=`matrix(${p.toString()})`)},[a,p]);return a?e:n.a.createElement("div",{ref:v,className:"pan-wrapper "+(t||""),onMouseDown:e=>{if(!c)return;e.stopPropagation(),e.preventDefault();const t={dx:p[4],dy:p[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"),o&&o(p[4],p[5])},onMouseMove:e=>{if(d){const t=function(e,t){const a=[...p],n=h.x-e,c=h.y-t;return a[4]=h.dx-n,a[5]=h.dy-c,a}(e.pageX,e.pageY);g(t),E.current&&(E.current.style.transform=`matrix(${p.toString()})`)}}},n.a.createElement("div",{ref:E,className:"pan-container"},e))});a(259);function ie(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(L.a,{color:"white"}))}var de=Object(n.h)(Object(c.h)(e=>{const{chatId:t,threadId:a,messageId:n,avatarOwnerId:c,profilePhotoIndex:r,origin:l}=e.mediaViewer,{animationLevel:o}=e.settings.byKey;if(l===s.h.SearchResult){if(!t||!n)return{animationLevel:o};const a=Object(d.k)(e,t,n);return a?{chatId:t,messageId:n,senderId:a.senderId,origin:l,message:a,animationLevel:o}:{animationLevel:o}}if(c){return{messageId:-1,senderId:c,avatarOwner:Object(d.Hb)(e,c)||Object(d.f)(e,c),profilePhotoIndex:r||0,animationLevel:o,origin:l}}if(!(t&&a&&n))return{animationLevel:o};let i,m,u;if(i=l&&[s.h.ScheduledAlbum,s.h.ScheduledInline].includes(l)?Object(d.pb)(e,t,n):Object(d.k)(e,t,n),!i)return{animationLevel:o};if(m=l&&[s.h.ScheduledAlbum,s.h.ScheduledInline].includes(l)?Object(d.qb)(e,t):Object(d.m)(e,t),l===s.h.Inline||l===s.h.Album)u=Object(d.gb)(e,t,a)||Object(d.Y)(e,t,a);else if(l===s.h.SharedMedia){const t=Object(d.v)(e),{foundIds:a}=t&&t.resultsByType&&t.resultsByType.media||{};u=a}return{chatId:t,threadId:a,messageId:n,senderId:i.senderId,origin:l,message:i,chatMessages:m,collectionIds:u,animationLevel:o}},(e,t)=>Object(u.l)(t,["openMediaViewer","closeMediaViewer","openForwardMenu","focusMessage"]))(({chatId:e,threadId:t,messageId:a,senderId:c,origin:d,avatarOwner:u,profilePhotoIndex:y,message:I,chatMessages:S,collectionIds:w,openMediaViewer:P,closeMediaViewer:M,openForwardMenu:L,focusMessage:D,animationLevel:B})=>{const x=Object(n.q)(null),G=Boolean(u||a),q=I?Object(m.R)(I):void 0,z=I?Object(m.S)(I):void 0,H=I?Object(m.G)(I):void 0,_=I?Object(m.P)(I):void 0,V=Boolean(q),K=Boolean(z),Y=_||z,Z=Boolean(Y),Q=Boolean(!Z&&(H||q)),X=Y?Y.isGif:void 0,J=d===s.h.SharedMedia,ee=d===s.h.SearchResult,te=B>=1?"mv-slide":"none",ae=2===B?"slide-fade":"none",ne=2===B,se=u?`avatar${u.id}-${y}.jpg`:I&&Object(m.B)(I),le=Object(O.a)(c),[de,me]=Object(n.r)(!1),[ue,he]=Object(n.r)(!1),[be,pe]=Object(n.r)(1),[ge,ve]=Object(n.r)({x:0,y:0}),[Ee,fe]=Object(n.r)(!1),Oe=Object(n.p)(()=>(V||K)&&a?[a]:Object(m.h)(S||{},w||[],J),[V,K,a,S,w,J]),je=a?Oe.indexOf(a):-1,Ce=0===je||-1===je,ye=je===Oe.length-1||-1===je;function ke(e){if(u&&void 0!==y){const{photos:t}=u;return t&&t[y]?`photo${t[y].id}?size=c`:Object(m.e)(u,e?"big":"normal")}return I&&Object(m.D)(I,e?"viewerFull":"viewerPreview")}!G||le&&le===c&&x.current||(x.current=je);const Ne=Object(v.a)(I&&(J||ee)&&Object(m.D)(I,"pictogram"),void 0,r.ApiMediaFormat.BlobUrl,void 0,ne&&350),Ie=ke(),Se=Object(v.a)(Ie,void 0,u&&Ie&&Ie.startsWith("profilePhoto")?r.ApiMediaFormat.DataUri:r.ApiMediaFormat.BlobUrl,void 0,ne&&350),{mediaData:we,downloadProgress:Pe}=Object(E.a)(ke(!0),void 0,I&&Object(m.C)(I,"viewerFull"),void 0,ne&&350),Me=H||_?(H||_).blobUrl:void 0;let Fe=!Z&&(Me||we)||Se||Ne;const Le=Object(f.a)(!Fe&&I&&Object(m.E)(I));Fe||d===s.h.SearchResult||(Fe=Le);const Ae=Q?Object(m.T)(V?q:H):void 0,Te=Z?Object(m.cb)(K?z:_):void 0;Object(n.n)(()=>{o.k&&document.body.classList.toggle("is-media-viewer-open",G)},[G]);const Re=Object(g.a)();Object(n.n)(()=>{const e=window.matchMedia(i.c);return"function"==typeof e.addEventListener?e.addEventListener("change",Re):"function"==typeof e.addListener&&e.addListener(Re),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",Re):"function"==typeof e.removeListener&&e.removeListener(Re)}},[Re]);const De=Object(O.a)(I),Be=Object(O.a)(d),xe=Object(O.a)(u),Ue=Object(O.a)(Fe);Object(n.n)(()=>{if(ne&&G&&!De&&!xe){Object(j.b)(350+l.c);const e=I?Object(C.a)(I):void 0;k(Boolean(e),d,Fe,I)}ne&&!G&&(De||xe)&&(Object(j.b)(350+l.c),N(Be,Ue,De||void 0))},[ne,G,d,Be,I,De,xe,Fe,Ue]),Object(n.n)(()=>{let e;return ue?me(!0):e=window.setTimeout(()=>{me(!1)},350),()=>{e&&window.clearTimeout(e)}},[ue]);const Ge=()=>{he(!1),pe(1),ve({x:0,y:0})},qe=Object(n.m)(()=>{he(!ue),pe(ue?1:1.5),ue&&ve({x:0,y:0})},[ue]),ze=Object(n.m)((e,t=!1)=>{pe(e),1===e&&t&&Ge()},[]),He=Object(n.m)(()=>{M(),Ge()},[M]),$e=Object(n.m)(()=>{He(),D({chatId:e,threadId:t,messageId:a})},[He,e,t,D,a]),_e=Object(n.m)(()=>{L({fromChatId:e,messageIds:[a]}),Ge()},[L,e,a]);Object(n.n)(()=>G?Object(b.a)(()=>{ue?Ge():He()}):void 0,[He,G,ue]),Object(n.n)(()=>{Z&&!X&&Object(p.b)()},[X,Z]);const Ve=Object(n.m)((e,t)=>{let a=Oe.indexOf(e);return(-1===t&&a>0||1===t&&a<Oe.length-1)&&(a+=t),Oe[a]},[Oe]),We=Object(n.m)(()=>{Ce||P({chatId:e,threadId:t,messageId:a?Ve(a,-1):void 0,origin:d})},[e,t,Ve,Ce,a,P,d]),Ke=Object(n.m)(()=>{ye||P({chatId:e,threadId:t,messageId:a?Ve(a,1):void 0,origin:d})},[e,t,Ve,ye,a,P,d]);Object(n.n)(()=>{const e=e=>{switch(e.key){case"Left":case"ArrowLeft":We();break;case"Right":case"ArrowRight":Ke()}};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=X&&!o.e;return Object(h.b)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:()=>{ue||o.m||He()},onSwipe:o.m?(e,t)=>{t===h.a.Right?We():t===h.a.Left?Ke():e.target&&e.target.closest(".MediaViewerFooter")||He()}:void 0})},[He,Ee,X,Q,ue,Ke,We]);const Ye=Object(n.m)((e,t)=>{ve({x:e,y:t})},[]),Ze=Object(n.m)(()=>{o.m&&(Q||X)&&fe(!Ee)},[Ee,X,Q]),Qe=Object(F.a)();function Xe(t){if(u)return n.a.createElement("div",{key:e,className:"media-viewer-content"},ie(we||Se,Object(i.h)(i.a,!1),!o.k&&!ue));if(I){const e=Object(C.a)(I),c=Boolean(e);return n.a.createElement("div",{key:a,className:"media-viewer-content "+(c?"has-footer":""),onClick:Ze},Q&&ie(Me||we||Se||Ne,I&&Object(i.h)(Ae,c),!o.k&&!ue),Z&&n.a.createElement(ce,{key:a,url:Me||we,isGif:X,posterData:Fe,posterSize:I&&Object(i.h)(Te,c,!0),downloadProgress:Pe,fileSize:Y.size,isMediaViewerOpen:G,noPlay:!t,onClose:He}),e&&n.a.createElement(W,{text:e,onClick:$e,isHidden:Ee&&(!Z||X),isForVideo:Z&&!X}))}}function Je(){return n.a.createElement(U,{key:u?u.id:a,chatId:u?u.id:e,messageId:a,isAvatar:Boolean(u)})}return n.a.createElement(A.a,{id:"MediaViewer",className:ue?"zoomed":"",isOpen:G},()=>n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"media-viewer-head",dir:Qe.isRtl?"rtl":void 0},o.k&&n.a.createElement(R.a,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:Qe("Close"),onClick:He},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(T.a,{activeKey:x.current,name:ae},Je),n.a.createElement($,{mediaData:we||Se,isVideo:Z,isZoomed:ue,message:I,fileName:se,onCloseMediaViewer:He,onForward:_e,onZoomToggle:qe,isAvatar:Boolean(u)})),n.a.createElement(oe,{noWrap:!de,canPan:ue,panDeltaX:ge.x,panDeltaY:ge.y,zoomLevel:be,onPan:Ye},n.a.createElement(T.a,{className:"slide-container",activeKey:je,name:te},Xe)),!Ce&&n.a.createElement("button",{type:"button",className:"navigation prev "+(Z&&!X&&"inline"),"aria-label":Qe("AccDescrPrevious"),dir:Qe.isRtl?"rtl":void 0,onClick:We}),!ye&&n.a.createElement("button",{type:"button",className:"navigation next "+(Z&&!X&&"inline"),"aria-label":Qe("Next"),dir:Qe.isRtl?"rtl":void 0,onClick:Ke}),n.a.createElement(re,{isShown:ue,onChangeZoom:ze})))})),me=a(52),ue=a(127),he=a(63),be=a(17),pe=a(109),ge=a(45),ve=a(112),Ee=a(105),fe=a(108),Oe=a(123);a(260);var je=Object(n.h)(Object(c.h)(e=>{const{serverTimeOffset:t,chats:{byId:a,listIds:n,orderedPinnedIds:c},currentUserId:r}=e;return{chatsById:a,pinnedIds:c.active,activeListIds:n.active,archivedListIds:n.archived,currentUserId:r,serverTimeOffset:t}},(e,t)=>Object(u.l)(t,["setForwardChatId","exitForwardMode","loadMoreChats"]))(({chatsById:e,pinnedIds:t,activeListIds:a,archivedListIds:c,currentUserId:s,serverTimeOffset:l,isOpen:i,setForwardChatId:d,exitForwardMode:h,loadMoreChats:b})=>{const[p,g]=Object(n.r)(""),v=Object(n.q)(null),E=Object(F.a)();Object(n.n)(()=>{i?o.k||setTimeout(()=>{requestAnimationFrame(()=>{v.current&&v.current.focus()})},500):(v.current&&v.current.blur(),setTimeout(()=>{g("")},300))},[i]);const f=Object(n.p)(()=>{const n=[...a||[],...c||[]];let o=t||[];return s&&(o=Object(u.o)([s,...o])),Object(m.Eb)([...n.filter(t=>{const a=e[t];return!a||!!Object(m.d)(a,r.MAIN_THREAD_ID)&&(!p||Object(me.a)(Object(m.k)(E,e[t],void 0,t===s),p))})],e,void 0,o,l)},[a,c,e,s,p,E,t,l]),[O,j]=Object(ue.a)(b,f,Boolean(p)),C=Object(n.m)(e=>{g(e.currentTarget.value)},[]),y=Object(n.q)(null),k=Object(he.a)(y,i,e=>{O&&d({id:O[e]})},".ListItem-button",!0),N=n.a.createElement("div",{className:"modal-header",dir:E.isRtl?"rtl":void 0},n.a.createElement(R.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:E("Close"),onClick:h},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(ge.a,{ref:v,value:p,onChange:C,onKeyDown:k,placeholder:E("ForwardTo")}));return n.a.createElement(pe.a,{isOpen:i,onClose:h,className:"ForwardPicker",header:N},O&&O.length?n.a.createElement(ve.a,{className:"picker-list custom-scroll",items:O,onLoadMore:j,noScrollRestore:Boolean(p),ref:y,onKeyDown:k},O.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>d({id:e})},Object(m.mb)(e)?n.a.createElement(fe.a,{status:e===s?E("SavedMessagesInfo"):void 0,userId:e}):n.a.createElement(Oe.a,{chatId:e})))):O&&!O.length?n.a.createElement("p",{className:"no-results"},"Sorry, nothing found."):n.a.createElement(be.a,null))})),Ce=a(169);a(261);function ye(e){return e.isSlowMode?"Slowmode enabled":"Something went wrong"}var ke=Object(n.h)(Object(c.h)(e=>Object(u.l)(e,["dialogs"]),(e,t)=>Object(u.l)(t,["dismissDialog","acceptInviteConfirmation"]))(({dialogs:e,dismissDialog:t,acceptInviteConfirmation:a})=>{const c=Object(F.a)();if(!e.length)return;return n.a.createElement("div",{id:"Dialogs"},e.map(e=>{return"hash"in e?(e=>{const{hash:r,title:s,participantsCount:l,isChannel:o}=e,i=c(o?"Subscribers":"Members",l,"i"),d=c(o?"ChannelJoin":"JoinGroup");return n.a.createElement(pe.a,{isOpen:!0,onClose:t,className:"error",title:s},void 0!==l&&n.a.createElement("p",null,i),n.a.createElement(R.a,{isText:!0,className:"confirm-dialog-button",onClick:()=>{a({hash:r}),t()}},d),n.a.createElement(R.a,{isText:!0,className:"confirm-dialog-button",onClick:t},c("Cancel")))})(e):(r=e,n.a.createElement(pe.a,{isOpen:!0,onClose:t,className:"error",title:ye(r)},n.a.createElement("p",null,Object(Ce.a)(r)),n.a.createElement("div",{className:"buttons"},n.a.createElement(R.a,{isText:!0,onClick:t},c("OK")))));var r}))})),Ne=a(180);var Ie=Object(n.h)(Object(c.h)(e=>Object(u.l)(e,["notifications"]),(e,t)=>Object(u.l)(t,["dismissNotification"]))(({notifications:e,dismissNotification:t})=>{if(e.length)return n.a.createElement("div",{id:"Notifications"},e.map(({message:e})=>n.a.createElement(Ne.a,{message:Object(B.a)(e,["emoji","br","links","simple_markdown"]),onDismiss:t})))})),Se=a(134),we=a(116);var Pe=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(u.l)(t,["toggleSafeLinkModal"]))(({url:e,toggleSafeLinkModal:t})=>{const a=Object(F.a)(),c=Object(n.m)(()=>{window.open(e),t({url:void 0})},[t,e]),r=Object(n.m)(()=>{t({url:void 0})},[t]),s=Object(Se.a)(e);return n.a.createElement(we.a,{isOpen:Boolean(e),onClose:r,title:a("OpenUrlTitle"),textParts:Object(B.a)(a("OpenUrlAlert2",s),["links"]),confirmLabel:a("OpenUrlTitle"),confirmHandler:c})}));a(262);const Me=["M","T","W","T","F","S","S"];function Fe(e,t,a,n,c){const r=new Date(e,t,a,0,0,0,0),s=n&&new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0),l=c&&new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0);return!!(l&&r>l)||!!(s&&r<s)}function Le(e){return String(e).padStart(2,"0")}var Ae=Object(n.h)(({selectedAt:e,maxAt:t,isFutureMode:a,isPastMode:c,isOpen:r,withTimePicker:s,submitButtonLabel:l,secondButtonLabel:i,onClose:d,onSubmit:m,onSecondButtonClick:u})=>{const h=Object(F.a)(),b=new Date,p=Object(n.p)(()=>e?new Date(e):new Date,[e]),g=t?new Date(t):void 0,[v,E]=Object(n.r)(p),[f,O]=Object(n.r)(Le(p.getHours())),[j,C]=Object(n.r)(Le(p.getMinutes())),y=v.getFullYear(),k=v.getMonth(),N=v.getDate();Object(n.n)(()=>{r&&E(p)},[r,p]);const I=c&&y>=b.getFullYear()&&k>=b.getMonth()||g&&y>=g.getFullYear()&&k>=g.getMonth(),S=a&&y<=b.getFullYear()&&k<=b.getMonth(),w=Object(n.p)(()=>function(e,t){const a=[],n=new Date;n.setFullYear(e),n.setMonth(t),n.setDate(1);const c=n.getDay();for(let e=1;e<c;e++)a.push(0);for(;n.getMonth()===t;){const e=n.getDate();a.push(e),n.setDate(e+1)}return a}(y,k),[k,y]);const P=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return O(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),23)),n=new Date(v.getTime());n.setHours(a),E(n);const c=Le(a);O(c),e.target.value=c},[v]),M=Object(n.m)(e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return C(""),void(e.target.value="");const a=Math.max(0,Math.min(Number(t),59)),n=new Date(v.getTime());n.setMinutes(a),E(n);const c=Le(a);C(c),e.target.value=c},[v]);return n.a.createElement(pe.a,{isOpen:r,onClose:d,className:"CalendarModal"},n.a.createElement("div",{className:"container"},n.a.createElement("div",{className:"month-selector"},n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",onClick:d},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("h4",null,Object(D.f)(h,v,o.k)),n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",disabled:S,onClick:S?void 0:function(){E(e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t})}},n.a.createElement("i",{className:"icon-previous"})),n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",disabled:I,onClick:I?void 0:function(){E(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,e))),w.map(e=>n.a.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void E(e=>{const a=new Date(e);return a.setDate(t),a});var t},className:Object(V.a)("day-button",Fe(y,k,e,a?b:void 0,c?b:g)?"disabled":""+(e?"clickable":""),e===N&&"selected")},!!e&&n.a.createElement("span",null,e))))),s&&n.a.createElement("div",{className:"timepicker"},n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:f,onChange:P}),":",n.a.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:j,onChange:M})),n.a.createElement("div",{className:"footer"},n.a.createElement(R.a,{onClick:function(){m(v)}},s?function(e,t){const a=Object(D.c)(e,t,!0);if("Today"===a)return e("Conversation.ScheduleMessage.SendToday",Object(D.h)(t));return e("Conversation.ScheduleMessage.SendOn",a).replace("%@",Object(D.h)(t))}(h,v):l),i&&n.a.createElement(R.a,{onClick:u,isText:!0},i)))});var Te=Object(n.h)(Object(c.h)(e=>({selectedAt:e.historyCalendarSelectedAt}),(e,t)=>Object(u.l)(t,["searchMessagesByDate","closeHistoryCalendar"]))(({isOpen:e,selectedAt:t,searchMessagesByDate:a,closeHistoryCalendar:c})=>{const r=Object(n.m)(e=>{a({timestamp:e.valueOf()/1e3}),c()},[c,a]),s=Object(F.a)();return n.a.createElement(Ae,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:s("JumpToDate"),onClose:c,onSubmit:r})}));var Re=Object(n.h)(Object(c.h)((e,{message:t,isSchedule:a})=>{const{threadId:n}=Object(d.y)(e)||{},{canDeleteForAll:c}=n&&Object(d.b)(e,t,n)||{},r=Object(d.f)(e,t.chatId);return{canDeleteForAll:!a&&c,contactName:r&&Object(m.mb)(r.id)?Object(m.Z)(Object(d.Hb)(e,Object(m.V)(r))):void 0,willDeleteForCurrentUserOnly:r&&Object(m.jb)(r)&&!c,willDeleteForAll:r&&Object(m.ob)(r)}},(e,t)=>Object(u.l)(t,["deleteMessages","deleteScheduledMessages"]))(({isOpen:e,isSchedule:t,message:a,album:c,canDeleteForAll:r,contactName:s,willDeleteForCurrentUserOnly:l,willDeleteForAll:o,onClose:i,deleteMessages:d,deleteScheduledMessages:m})=>{const u=Object(n.m)(()=>{const e=c&&c.messages?c.messages.map(({id:e})=>e):[a.id];d({messageIds:e,shouldDeleteForAll:!0}),i()},[d,a.id,i,c]),h=Object(n.m)(()=>{const e=c&&c.messages?c.messages.map(({id:e})=>e):[a.id];t?m({messageIds:e}):d({messageIds:e,shouldDeleteForAll:!1}),i()},[c,a.id,t,i,m,d]),b=Object(F.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:i,onEnter:e&&!r?h:void 0,className:"delete",title:b("DeleteSingleMessagesTitle")},n.a.createElement("p",null,b("AreYouSureDeleteSingleMessage")),l&&n.a.createElement("p",null,b("lng_delete_for_me_chat_hint")),o&&n.a.createElement("p",null,b("lng_delete_for_everyone_hint",1,"i")),r&&n.a.createElement(R.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},s&&b("Conversation.DeleteMessagesFor",Object(B.a)(s)),!s&&b("Conversation.DeleteMessagesForEveryone")),n.a.createElement(R.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},b(r?"ChatList.DeleteForCurrentUser":"Delete")),n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:i},b("Cancel")))}));var De=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(m.mb)(t),n=Object(d.P)(e,t),c=Object(d.f)(e,t),r=!!c&&Object(m.kb)(c),s=!!c&&Object(m.jb)(c),l=!!c&&Object(m.ob)(c);return{isPrivateChat:a,isChatWithSelf:n,isChannel:r,isGroup:s,isSuperGroup:l,canPinForAll:a&&!n||l||s,contactName:c&&Object(m.mb)(c.id)?Object(m.Z)(Object(d.Hb)(e,Object(m.V)(c))):void 0}},(e,t)=>Object(u.l)(t,["pinMessage"]))(({isOpen:e,messageId:t,chatId:a,isChannel:c,isGroup:r,isSuperGroup:s,canPinForAll:l,contactName:o,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(F.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:i,className:"pin",title:h("PinMessageAlertTitle")},n.a.createElement("p",null,h(c?"PinMessageAlertChannel":r||s?"PinMessageAlert":"PinMessageAlertChat")),n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:u},h("DialogPin")),l&&n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:m},o?h("Conversation.PinMessagesFor",o):h("Conversation.PinMessageAlert.PinAndNotifyMembers")),n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:i},h("Cancel")))}));var Be=Object(n.h)(({isOpen:e,pinnedMessagesCount:t=0,onClose:a,onUnpin:c})=>{const r=Object(F.a)();return n.a.createElement(pe.a,{isOpen:e,onClose:a,className:"unpin-all",title:r("Chat.PanelUnpinAllMessages")},n.a.createElement("p",null,r("Chat.UnpinAllMessagesConfirmation",t,"i")),n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:c},r("DialogUnpin")),n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:a},r("Cancel")))}),xe=a(34),Ue=a(55);var Ge=Object(n.h)(Object(c.h)((e,{isSchedule:t})=>{const{messageIds:a}=e.selectedMessages||{},{canDeleteForAll:n}=Object(d.e)(e),c=Object(d.r)(e);return{selectedMessageIds:a,canDeleteForAll:!t&&n,contactName:c&&Object(m.mb)(c.id)?Object(m.Z)(Object(d.Hb)(e,Object(m.V)(c))):void 0,willDeleteForCurrentUserOnly:c&&Object(m.jb)(c)&&!n,willDeleteForAll:c&&Object(m.ob)(c)}},(e,t)=>Object(u.l)(t,["deleteMessages","deleteScheduledMessages","exitMessageSelectMode"]))(({isOpen:e,isSchedule:t,selectedMessageIds:a,canDeleteForAll:c,contactName:r,willDeleteForCurrentUserOnly:s,willDeleteForAll:l,onClose:o,deleteMessages:i,deleteScheduledMessages:d,exitMessageSelectMode:m})=>{const u=Object(n.m)(()=>{i({messageIds:a,shouldDeleteForAll:!0}),m(),o()},[i,m,a,o]),h=Object(n.m)(()=>{t?d({messageIds:a}):i({messageIds:a,shouldDeleteForAll:!1}),m(),o()},[t,m,o,d,a,i]),b=Object(F.a)();if(a)return n.a.createElement(pe.a,{isOpen:e,onClose:o,onEnter:c?void 0:h,className:"delete",title:b("Conversation.DeleteManyMessages")},n.a.createElement("p",null,b("AreYouSureDeleteFewMessages")),s&&n.a.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),l&&n.a.createElement("p",null,"This will delete them for everyone in this chat."),c&&n.a.createElement(R.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},r?b("ChatList.DeleteForEveryone",Object(B.a)(r)):b("Conversation.DeleteMessagesForEveryone")),n.a.createElement(R.a,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},b(c?"ChatList.DeleteForCurrentUser":"Delete")),n.a.createElement(R.a,{className:"confirm-dialog-button",isText:!0,onClick:o},b("Cancel")))}));a(263);var qe=Object(n.h)(Object(c.h)(e=>{const{type:t}=Object(d.y)(e)||{},{canDelete:a}=Object(d.e)(e);return{isSchedule:"scheduled"===t,selectedMessagesCount:Object(d.sb)(e),canDeleteMessages:a}},(e,t)=>Object(u.l)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages"]))(({canPost:e,isActive:t,messageListType:a,isSchedule:c,selectedMessagesCount:r,canDeleteMessages:s,exitMessageSelectMode:l,openForwardMenuForSelectedMessages:o})=>{const[i,d,m]=Object(xe.a)();Object(n.n)(()=>t&&!i?Object(Ue.a)({onBackspace:d,onDelete:d,onEsc:l}):void 0,[t,i,d,l]);const u=Object(O.a)(r||void 0,!0),h=t?r:u,b=Object(F.a)(),p=b("VoiceOver.Chat.MessagesSelected",h),g=Object(V.a)("MessageSelectToolbar",e&&"with-composer",t&&"shown");return n.a.createElement("div",{className:g},n.a.createElement("div",{className:"MessageSelectToolbar-inner"},n.a.createElement(R.a,{color:"translucent",round:!0,onClick:l,ariaLabel:"Exit select mode"},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("span",{className:"MessageSelectToolbar-count",title:p},p),!!r&&n.a.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==a&&n.a.createElement(q.a,{icon:"forward",ariaLabel:"Forward Messages",onClick:o},n.a.createElement("span",{className:"item-text"},b("Forward"))),n.a.createElement(q.a,{destructive:!0,icon:"delete",onClick:d,disabled:!s,ariaLabel:b("EditAdminGroupDeleteMessages")},n.a.createElement("span",{className:"item-text"},b("Delete"))))),n.a.createElement(Ge,{isOpen:i,isSchedule:c,onClose:m}))})),ze=a(168),He=a(50),$e=a(170),_e=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},Ve=a(156);var We=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),n=a&&Object(m.V)(a);return{chat:a,privateChatUser:n?Object(d.Hb)(e,n):void 0,isPinned:Object(d.N)(e,t),isMuted:a?Object(m.Db)(a,Object(d.eb)(e),Object(d.db)(e)):void 0}})(({chatId:e,chat:t,privateChatUser:a,isPinned:c,isMuted:r,withUsername:s,onClick:l})=>{const[o,i,d]=Object(xe.a)(),u=Object($e.a)({chat:t,privateChatUser:a,isPinned:c,isMuted:r,handleDelete:i}),h=()=>{l(e)},b=_e(h);if(t)return n.a.createElement(Ee.a,{className:"chat-item-clickable search-result",onClick:h,contextActions:u,buttonRef:b},Object(m.mb)(e)?n.a.createElement(fe.a,{userId:e,withUsername:s,avatarSize:"large"}):n.a.createElement(Oe.a,{chatId:e,withUsername:s,avatarSize:"large"}),n.a.createElement(Ve.a,{isOpen:o,onClose:d,chat:t}))})),Ke=a(142);a(264);const Ye=Object(_.h)(e=>e(),6e4,!0);var Ze=Object(n.h)(Object(c.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(u.l)(t,["loadTopUsers","loadContactList","openChat","addRecentlyFoundChatId","clearRecentlyFoundChats"]))(({topUserIds:e,usersById:t,recentlyFoundChatIds:a,onReset:c,loadTopUsers:r,loadContactList:s,openChat:l,addRecentlyFoundChatId:o,clearRecentlyFoundChats:i})=>{const d=Object(n.q)(null);Object(n.n)(()=>{Ye(()=>{r(),s()})},[r,s]),Object(Ke.a)(d.current,!e);const u=Object(n.m)(e=>{l({id:e}),c(),setTimeout(()=>{o({id:e})},250)},[l,o,c]),h=Object(F.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:()=>u(e),dir:h.isRtl?"rtl":void 0},n.a.createElement(x.a,{user:t[e]}),n.a.createElement("div",{className:"top-peer-name"},Object(B.a)(Object(m.Z)(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(R.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(We,{chatId:e,onClick:u}))))})),Qe=a(132),Xe=a(28);a(265);var Je=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t);if(!a)return{};const n=Object(m.V)(a);return{chat:a,...n&&{privateChatUser:Object(d.Hb)(e,n)},lastSyncTime:e.lastSyncTime}},(e,t)=>Object(u.l)(t,["focusMessage"]))(({message:e,searchQuery:t,chatId:a,chat:c,privateChatUser:r,focusMessage:s,lastSyncTime:l})=>{const i=Object(m.E)(e),d=Object(v.a)(Object(m.D)(e,"micro")),u=Boolean(Object(m.I)(e)),h=Object(n.m)(()=>{s({chatId:a,messageId:e.id})},[a,s,e.id]),b=Object(F.a)(),p=_e(h);if(c)return n.a.createElement(Ee.a,{className:"ChatMessage chat-item-clickable",ripple:!o.k,onClick:h,buttonRef:p},n.a.createElement(x.a,{chat:c,user:r,withOnlineStatus:!0,isSavedMessages:r&&r.isSelf,lastSyncTime:l}),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(B.a)(Object(m.k)(b,c,r))),c.isVerified&&n.a.createElement(Qe.a,null)),n.a.createElement("div",{className:"message-date"},n.a.createElement(Xe.a,{className:"date"},Object(D.g)(b,1e3*e.date)))),n.a.createElement("div",{className:"subtitle"},n.a.createElement("div",{className:"message",dir:"auto"},function(e,t,a,c,r){if(!a)return Object(B.a)(Object(m.N)(e,t));return n.a.createElement("span",{className:"media-preview"},n.a.createElement("img",{src:a,alt:"",className:r?"round":void 0}),Object(m.P)(t)&&n.a.createElement("i",{className:"icon-play"}),Object(B.a)(Object(m.N)(e,t,!0),["emoji","highlight"],{highlight:c}))}(b,e,d||i,t,u)))))}));a(266);var et=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(D.a)(t)}]}const t=[],a=new Date,n=a.getFullYear(),c=a.getTime()>new Date(`${n}-${e}`).getTime()?n:n-1;for(let a=0;a<8;a++){const n=new Date(`${c-a}-${e}`);t.push({date:n,text:Object(D.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))))}),tt=a(117),at=a(140);const nt=Object(_.h)(e=>e(),500,!0);var ct=Object(n.h)(Object(c.h)(e=>{const{byId:t}=e.chats,{byId:a}=e.users,{userIds:n}=e.contactList||{};if(!n)return{chatsById:t,usersById:a};const{currentUserId:c,messages:r,lastSyncTime:s,serverTimeOffset:l}=e,{fetchingStatus:o,globalResults:i,localResults:d,resultsByType:m}=e.globalSearch,{chatIds:u,userIds:h}=i||{},{chatIds:b,userIds:p}=d||{},{byChatId:g}=r,{foundIds:v}=m&&m.text||{};return{currentUserId:c,localContactIds:n,localChatIds:b,localUserIds:p,globalChatIds:u,globalUserIds:h,foundIds:v,globalMessagesByChatId:g,chatsById:t,usersById:a,fetchingStatus:o,lastSyncTime:s,serverTimeOffset:l}},(e,t)=>Object(u.l)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"]))(({searchQuery:e,searchDate:t,dateSearchQuery:a,currentUserId:c,localContactIds:r,localChatIds:l,localUserIds:i,globalChatIds:d,globalUserIds:h,foundIds:b,globalMessagesByChatId:p,chatsById:g,usersById:v,fetchingStatus:E,lastSyncTime:f,onReset:O,onSearchDateSelect:j,openChat:C,addRecentlyFoundChatId:y,searchMessagesGlobal:k,setGlobalSearchChatId:N,serverTimeOffset:I})=>{const S=Object(F.a)(),[w,P]=Object(n.r)(!1),[M,L]=Object(n.r)(!1),A=Object(n.m)(({direction:t})=>{f&&t===s.e.Backwards&&nt(()=>{k({type:"text",query:e})})},[f,k,e]),T=Object(n.m)(e=>{C({id:e}),e!==c&&y({id:e}),o.k||O()},[c,C,y,O]),R=Object(n.m)(e=>{N({id:e})},[N]),D=Object(n.p)(()=>{if(!e||e.startsWith("@")&&e.length<2)return He.a;const t=r?r.filter(t=>{const a=v[t];if(!a)return!1;const n=Object(m.ab)(a);return n&&Object(me.a)(n,e)||Object(me.a)(a.username,e)}):[];return[...c&&Object(me.a)(S("SavedMessages"),e)?[c]:[],...Object(m.Eb)(Object(u.o)([...t,...l||[],...i||[]]),g,void 0,void 0,I)]},[e,r,c,S,l,i,g,I,v]),B=Object(n.p)(()=>!e||e.length<4||!d||!h?He.a:Object(m.Eb)(Object(u.o)([...d,...h]),g,!0,void 0,I),[g,d,h,e,I]),x=Object(n.p)(()=>(e||t)&&b&&0!==b.length?b.map(e=>{const[t,a]=e.split("_").map(Number);return p&&p[t]&&p[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):He.a,[b,p,e,t]),U=Object(n.m)(()=>{P(!w)},[w]),G=Object(n.m)(()=>{L(!M)},[M]);const q=E&&!E.chats&&!E.messages&&!D.length&&!B.length&&!x.length;return e||t?n.a.createElement(ve.a,{className:"LeftSearch custom-scroll",items:x,onLoadMore:A,noScrollRestoreOnTop:!0,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(et,{searchDate:a,onSelect:j})),q&&n.a.createElement(tt.a,{text:S("ChatList.Search.NoResults"),description:S("ChatList.Search.NoResultsDescription")}),!!D.length&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:S.isRtl?"rtl":void 0},D.map(e=>n.a.createElement(at.a,{chatOrUserId:e,onClick:R,clickArg:e}))),!!D.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},D.length>3&&n.a.createElement(Xe.a,{onClick:U},S(w?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),S("DialogList.SearchSectionDialogs")),D.map((e,t)=>{if(w||!(t>=3))return n.a.createElement(We,{chatId:e,onClick:T})})),!!B.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},B.length>3&&n.a.createElement(Xe.a,{onClick:G},S(M?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),S("DialogList.SearchSectionGlobal")),B.map((e,t)=>{if(M||!(t>=3))return n.a.createElement(We,{chatId:e,withUsername:!0,onClick:T})})),!!x.length&&n.a.createElement("div",{className:"search-section"},n.a.createElement("h3",{className:"section-heading",dir:S.isRtl?"auto":void 0},S("SearchMessages")),x.map((function(t){const a=Object(m.N)(S,t),c=g[t.chatId];if(a&&c)return n.a.createElement(Je,{chatId:t.chatId,message:t,searchQuery:e})})))):n.a.createElement(Ze,{onReset:O})}));const rt=Object(_.h)(e=>e(),500,!0);var st=Object(n.h)(Object(c.h)(e=>{const{byId:t}=e.chats,{currentUserId:a,messages:{byChatId:n},lastSyncTime:c}=e,{fetchingStatus:r,resultsByType:s}=e.globalSearch,{foundIds:l}=s&&s.text||{};return{currentUserId:a,foundIds:l,globalMessagesByChatId:n,chatsById:t,fetchingStatus:r,lastSyncTime:c}},(e,t)=>Object(u.l)(t,["searchMessagesGlobal"]))(({searchQuery:e,currentUserId:t,dateSearchQuery:a,foundIds:c,globalMessagesByChatId:r,chatsById:l,fetchingStatus:o,lastSyncTime:i,searchMessagesGlobal:d,onSearchDateSelect:u})=>{const h=Object(F.a)(),b=Object(n.m)(({direction:a})=>{i&&a===s.e.Backwards&&rt(()=>{d({type:"text",query:e,chatId:t})})},[t,i,d,e]),p=Object(n.p)(()=>c&&0!==c.length?c.map(e=>{const[t,a]=e.split("_").map(Number);return r&&r[t]&&r[t].byId[a]}).filter(Boolean).sort((e,t)=>t.date-e.date):He.a,[c,r]);const g=o&&!o.chats&&!o.messages&&!p.length;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(ve.a,{className:"search-content custom-scroll chat-list",items:p,onLoadMore:b,noFastList:!0},a&&n.a.createElement("div",{className:"chat-selection no-selection no-scrollbar"},n.a.createElement(et,{searchDate:a,onSelect:u})),g&&n.a.createElement(tt.a,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),!!p.length&&p.map((function(t){const a=Object(m.N)(h,t),c=l[t.chatId];if(a&&c)return n.a.createElement(Je,{chatId:t.chatId,message:t,searchQuery:e})}))))}));function lt(e){return(t,a)=>{const{byId:n}=t.chats,{byId:c}=t.users,{fetchingStatus:r,resultsByType:s,chatId:l}=t.globalSearch,o="audio"!==e?e:a&&a.isVoice?"voice":"audio",{byChatId:i}=t.messages,{foundIds:m}=s&&s[o]||{};return{theme:Object(d.Bb)(t),isLoading:void 0===m||!!r&&Boolean(r.chats||r.messages),chatsById:n,usersById:c,globalMessagesByChatId:i,foundIds:m,searchChatId:l,lastSyncTime:t.lastSyncTime}}}var ot=a(118),it=a(165);const dt=Object(_.h)(e=>e(),500,!0);var mt=Object(n.h)(Object(c.h)(lt("media"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","openMediaViewer"]))(({searchQuery:e,searchChatId:t,isLoading:a,globalMessagesByChatId:c,foundIds:r,lastSyncTime:o,searchMessagesGlobal:i,openMediaViewer:d})=>{const m=Object(F.a)(),u=Object(n.m)(({direction:a})=>{o&&a===s.e.Backwards&&dt(()=>{i({type:"media",query:e,chatId:t})})},[o,i,e,t]),h=Object(n.p)(()=>r&&c?r.map(e=>{const[t,a]=e.split("_").map(Number);return c[t]&&c[t].byId[a]}).filter(Boolean):He.a,[c,r]),b=Object(n.m)((e,t)=>{d({chatId:t,messageId:e,origin:s.h.SearchResult})},[d]);const p=Object(ot.a)([e],l.qb)&&!a,g=p&&r&&r.length>0&&!e,v=p&&r&&r.length>0&&e,E=Object(V.a)("search-content custom-scroll",v&&"chat-list");return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(ve.a,{className:E,items:h,itemSelector:e?".ListItem":".Media",onLoadMore:u,noFastList:!0},!p&&n.a.createElement(be.a,null),p&&(!r||0===r.length)&&n.a.createElement(tt.a,{text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),g&&n.a.createElement("div",{className:"media-list",dir:m.isRtl?"rtl":void 0},h.map(e=>n.a.createElement(it.a,{key:e.id,idPrefix:"search-media",message:e,onClick:b}))),v&&h.map(e=>n.a.createElement(Je,{key:e.id,chatId:e.chatId,message:e}))))}));function ut(e,t,a,n){const{senderId:c}=t;if(!c)return;const r=Object(m.mb)(c)?n[c]:a[c];let s=Object(m.W)(e,r);const l=a[t.chatId];return l&&(Object(m.mb)(c)&&r.isSelf?s=`${e("FromYou")} → ${Object(m.k)(e,l)}`:Object(m.lb)(l)&&(s+=" → "+Object(m.k)(e,l))),s}var ht=a(185);const bt=Object(_.h)(e=>e(),500,!0);var pt=Object(n.h)(Object(c.h)(lt("links"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:c,usersById:r,globalMessagesByChatId:o,foundIds:i,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:u})=>{const h=Object(F.a)(),b=Object(n.m)(({direction:a})=>{d&&a===s.e.Backwards&&bt(()=>{m({type:"links",query:e,chatId:t})})},[d,m,e,t]),p=Object(n.p)(()=>i&&o?i.map(e=>{const[t,a]=e.split("_").map(Number);return o[t]&&o[t].byId[a]}).filter(Boolean):He.a,[o,i]),g=Object(n.m)((e,t)=>{u({chatId:t,messageId:e})},[u]);const v=Object(ot.a)([e],l.qb)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(ve.a,{className:"search-content documents-list custom-scroll",items:p,onLoadMore:b,noFastList:!0},!v&&n.a.createElement(be.a,null),v&&(!i||0===i.length)&&n.a.createElement(tt.a,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),v&&i&&i.length>0&&p.map((e,t)=>{const a=0===t||Object(D.n)(e.date)!==Object(D.n)(p[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(D.f)(h,new Date(1e3*e.date))),n.a.createElement(ht.a,{key:e.id,message:e,senderTitle:ut(h,e,c,r),onMessageClick:g}))})))})),gt=a(160);const vt=Object(_.h)(e=>e(),500,!0);var Et=Object(n.h)(Object(c.h)(lt("documents"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","focusMessage"]))(({searchQuery:e,searchChatId:t,isLoading:a,chatsById:c,usersById:r,globalMessagesByChatId:o,foundIds:i,lastSyncTime:d,searchMessagesGlobal:u,focusMessage:h})=>{const b=Object(F.a)(),p=Object(n.m)(({direction:a})=>{d&&a===s.e.Backwards&&vt(()=>{u({type:"documents",query:e,chatId:t})})},[d,u,e,t]),g=Object(n.p)(()=>i&&o?i.map(e=>{const[t,a]=e.split("_").map(Number),n=o[t]&&o[t].byId[a];return n&&Object(m.y)(n)?n:void 0}).filter(Boolean):He.a,[o,i]),v=Object(n.m)((e,t)=>{h({chatId:t,messageId:e})},[h]);const E=Object(ot.a)([e],l.qb)&&!a;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(ve.a,{className:"search-content documents-list custom-scroll",items:g,onLoadMore:p,noFastList:!0},!E&&n.a.createElement(be.a,null),E&&(!i||0===i.length)&&n.a.createElement(tt.a,{text:b("ChatList.Search.NoResults"),description:b("ChatList.Search.NoResultsDescription")}),E&&i&&i.length>0&&g.map((e,t)=>{const a=0===t||Object(D.n)(e.date)!==Object(D.n)(g[t-1].date);return n.a.createElement("div",{className:"ListItem",key:e.id},a&&n.a.createElement("p",{className:"section-heading"},Object(D.f)(b,new Date(1e3*e.date))),n.a.createElement(gt.a,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:ut(b,e,c,r),className:"scroll-item",onDateClick:v}))})))})),ft=a(167);const Ot=Object(_.h)(e=>e(),500,!0);var jt=Object(n.h)(Object(c.h)(lt("audio"),(e,t)=>Object(u.l)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"]))(({theme:e,isVoice:t,searchQuery:a,searchChatId:c,isLoading:r,chatsById:o,usersById:i,globalMessagesByChatId:d,foundIds:m,lastSyncTime:u,searchMessagesGlobal:h,focusMessage:b,openAudioPlayer:p})=>{const g=Object(F.a)(),v=t?"voice":"audio",E=Object(n.m)(({direction:e})=>{u&&e===s.e.Backwards&&Ot(()=>{h({type:v,query:a,chatId:c})})},[v,u,h,a,c]),f=Object(n.p)(()=>m&&d?m.map(e=>{const[t,a]=e.split("_").map(Number);return d[t]&&d[t].byId[a]}).filter(Boolean):He.a,[d,m]),O=Object(n.m)((e,t)=>{b({chatId:t,messageId:e})},[b]),j=Object(n.m)((e,t)=>{p({chatId:t,messageId:e})},[p]);const C=Object(ot.a)([a],l.qb)&&!r;return n.a.createElement("div",{className:"LeftSearch"},n.a.createElement(ve.a,{className:"search-content documents-list custom-scroll",items:f,onLoadMore:E,noFastList:!0},!C&&n.a.createElement(be.a,null),C&&(!m||0===m.length)&&n.a.createElement(tt.a,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),C&&m&&m.length>0&&f.map((t,a)=>{const c=0===a||Object(D.n)(t.date)!==Object(D.n)(f[a-1].date);return n.a.createElement("div",{className:"ListItem",key:t.id},c&&n.a.createElement("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0},Object(D.f)(g,new Date(1e3*t.date))),n.a.createElement(ft.a,{key:t.id,theme:e,message:t,target:"searchResult",senderTitle:ut(g,t,o,i),date:t.date,lastSyncTime:u,className:"scroll-item",onPlay:j,onDateClick:O}))})))}));a(267);const Ct=[{type:s.c.ChatList,title:"SearchAllChatsShort"},{type:s.c.Media,title:"SharedMediaTab2"},{type:s.c.Links,title:"SharedLinksTab2"},{type:s.c.Files,title:"SharedFilesTab2"},{type:s.c.Music,title:"SharedMusicTab2"},{type:s.c.Voice,title:"SharedVoiceTab2"}],yt=[{type:s.c.ChatList,title:"All Messages"},...Ct.slice(1)],kt=Object.keys(s.c).length/2;var Nt=Object(n.h)(Object(c.h)(e=>{const{currentContent:t,chatId:a}=e.globalSearch;return{currentContent:t,chatId:a}},(e,t)=>Object(u.l)(t,["setGlobalSearchContent","setGlobalSearchDate"]))(({searchQuery:e,searchDate:t,isActive:a,currentContent:c=s.c.ChatList,chatId:r,setGlobalSearchContent:l,setGlobalSearchDate:o,onReset:i})=>{const d=Object(F.a)(),[m,u]=Object(n.r)(c),h=Object(n.p)(()=>Object(D.l)(e),[e]),b=Object(n.m)(e=>{const t=Ct[e];l({content:t.type}),u(e)},[l]),p=Object(n.m)(e=>{o({date:e.getTime()/1e3})},[o]),g=Object(n.q)(null),v=Object(he.a)(g,a,void 0,".ListItem-button",!0);return n.a.createElement("div",{className:"LeftSearch",ref:g,onKeyDown:v},n.a.createElement(ze.a,{activeTab:m,tabs:r?yt:Ct,onSwitchTab:b}),n.a.createElement(T.a,{name:d.isRtl?"slide-reversed":"slide",renderCount:kt,activeKey:c},()=>{switch(c){case s.c.ChatList:return r?n.a.createElement(st,{searchQuery:e,dateSearchQuery:h,onReset:i,onSearchDateSelect:p}):n.a.createElement(ct,{searchQuery:e,searchDate:t,dateSearchQuery:h,onReset:i,onSearchDateSelect:p});case s.c.Media:return n.a.createElement(mt,{searchQuery:e});case s.c.Links:return n.a.createElement(pt,{searchQuery:e});case s.c.Files:return n.a.createElement(Et,{searchQuery:e});case s.c.Music:return n.a.createElement(jt,{key:"audio",searchQuery:e});case s.c.Voice:return n.a.createElement(jt,{key:"voice",isVoice:!0,searchQuery:e});default:return}}))}));function It(e,t){const a=Object(n.q)(e),[c,r]=Object(n.r)(t);return[c,Object(n.m)(e=>{r(t=>a.current(t,e))},[])]}const St=[{icon:"user",title:"FilterContacts",key:"contacts"},{icon:"non-contacts",title:"FilterNonContacts",key:"nonContacts"},{icon:"group",title:"FilterGroups",key:"groups"},{icon:"channel",title:"FilterChannels",key:"channels"},{icon:"bots",title:"FilterBots",key:"bots"}],wt=[{icon:"mute",title:"FilterMuted",key:"excludeMuted"},{icon:"archive",title:"FilterArchived",key:"excludeArchived"},{icon:"readchats",title:"FilterRead",key:"excludeRead"}],Pt=["includedChatIds","bots","channels","groups","contacts","nonContacts"],Mt=["excludedChatIds","excludeArchived","excludeMuted","excludeRead"];function Ft(e,t,a){let n=[],c=[];if("included"===t){const{includedChatIds:t,...r}=a?e.includeFilters||{}:Object(u.l)(e.folder,Pt);n=t||[],c=Object.keys(r).filter(e=>Boolean(r[e]))}else{const{excludedChatIds:t,...r}=a?e.excludeFilters||{}:Object(u.l)(e.folder,Mt);n=t||[],c=Object.keys(r).filter(e=>Boolean(r[e]))}return{selectedChatIds:n,selectedChatTypes:c}}function Lt(e){if(e){const{includedChatIds:t,...a}=e;if(Object.values(a).filter(Boolean).length>1||t&&t.length)return"";if(a.bots)return"Bots";if(a.groups)return"Groups";if(a.channels)return"Channels";if(a.contacts)return"Contacts";if(a.nonContacts)return"Non-Contacts"}return""}const At={mode:"create",chatFilter:"",folder:{title:"",includedChatIds:[],excludedChatIds:[]}},Tt=(e,t)=>{switch(t.type){case"setTitle":return{...e,folder:{...e.folder,title:t.payload},isTouched:!0};case"editIncludeFilters":return{...e,includeFilters:Object(u.l)(e.folder,Pt)};case"editExcludeFilters":return{...e,excludeFilters:Object(u.l)(e.folder,Mt)};case"setIncludeFilters":return{...e,includeFilters:t.payload,chatFilter:""};case"setExcludeFilters":return{...e,excludeFilters:t.payload,chatFilter:""};case"saveFilters":return e.includeFilters?{...e,folder:{...Object(u.j)(e.folder,Pt),title:e.folder.title?e.folder.title:Lt(e.includeFilters),...e.includeFilters},includeFilters:void 0,chatFilter:"",isTouched:!0}:e.excludeFilters?{...e,folder:{...Object(u.j)(e.folder,Mt),...e.excludeFilters},excludeFilters:void 0,chatFilter:"",isTouched:!0}:e;case"editFolder":{const{id:e,description:a,...n}=t.payload;return{mode:"edit",folderId:e,folder:n,chatFilter:""}}case"setChatFilter":return{...e,chatFilter:t.payload};case"setIsLoading":return{...e,isLoading:t.payload};case"setError":return{...e,error:t.payload};case"reset":return At;default:return e}};const Rt={currentPassword:"",password:"",hint:"",email:""},Dt=(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 Rt;default:return e}};var Bt=Object(n.h)(Object(c.h)(void 0,(e,t)=>Object(u.l)(t,["signOut","deleteChatFolder"]))(({currentScreen:e,editedFolderId:t,onReset:a,onSaveFilter:c,signOut:r,deleteChatFolder:l})=>{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)},[]),p=Object(n.m)(()=>{u(!0)},[]),g=Object(n.m)(()=>{u(!1)},[]),v=Object(n.m)(()=>{b(),r()},[b,r]),E=Object(n.m)(()=>{g(),l({id:t}),a()},[t,g,l,a]),f=Object(n.p)(()=>({onTrigger:e,isOpen:t})=>n.a.createElement(R.a,{round:!0,ripple:!o.k,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},n.a.createElement("i",{className:"icon-more"})),[]),O=Object(F.a)();return n.a.createElement("div",{className:"left-header"},n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",onClick:a,ariaLabel:O("AccDescrGoBack")},n.a.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case s.m.EditProfile:return n.a.createElement("h3",null,O("lng_settings_information"));case s.m.General:return n.a.createElement("h3",null,O("General"));case s.m.Notifications:return n.a.createElement("h3",null,O("Notifications"));case s.m.Privacy:return n.a.createElement("h3",null,O("PrivacySettings"));case s.m.Language:return n.a.createElement("h3",null,O("Language"));case s.m.GeneralChatBackground:return n.a.createElement("h3",null,O("ChatBackground"));case s.m.GeneralChatBackgroundColor:return n.a.createElement("h3",null,O("SetColor"));case s.m.PrivacyPhoneNumber:return n.a.createElement("h3",null,O("PrivacyPhone"));case s.m.PrivacyLastSeen:return n.a.createElement("h3",null,O("PrivacyLastSeen"));case s.m.PrivacyProfilePhoto:return n.a.createElement("h3",null,O("Privacy.ProfilePhoto"));case s.m.PrivacyForwarding:return n.a.createElement("h3",null,O("PrivacyForwards"));case s.m.PrivacyGroupChats:return n.a.createElement("h3",null,O("AutodownloadGroupChats"));case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyGroupChatsAllowedContacts:return n.a.createElement("h3",null,O("AlwaysShareWith"));case s.m.PrivacyPhoneNumberDeniedContacts:case s.m.PrivacyLastSeenDeniedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:case s.m.PrivacyForwardingDeniedContacts:case s.m.PrivacyGroupChatsDeniedContacts:return n.a.createElement("h3",null,O("NeverShareWith"));case s.m.PrivacyActiveSessions:return n.a.createElement("h3",null,O("SessionsTitle"));case s.m.PrivacyBlockedUsers:return n.a.createElement("h3",null,O("BlockedUsers"));case s.m.TwoFaDisabled:case s.m.TwoFaEnabled:return n.a.createElement("h3",null,O("TwoStepVerification"));case s.m.TwoFaNewPassword:case s.m.TwoFaChangePasswordNew:case s.m.TwoFaChangePasswordConfirm:return n.a.createElement("h3",null,O("PleaseEnterCurrentPassword"));case s.m.TwoFaNewPasswordConfirm:return n.a.createElement("h3",null,O("PleaseReEnterPassword"));case s.m.TwoFaNewPasswordHint:case s.m.TwoFaChangePasswordHint:return n.a.createElement("h3",null,O("PasswordHint"));case s.m.TwoFaNewPasswordEmail:case s.m.TwoFaRecoveryEmail:return n.a.createElement("h3",null,O("RecoveryEmailTitle"));case s.m.TwoFaNewPasswordEmailCode:case s.m.TwoFaRecoveryEmailCode:return n.a.createElement("h3",null,"Recovery Email Code");case s.m.TwoFaCongratulations:return n.a.createElement("h3",null,O("TwoStepVerificationPasswordSet"));case s.m.TwoFaChangePasswordCurrent:case s.m.TwoFaTurnOff:case s.m.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement("h3",null,O("PleaseEnterCurrentPassword"));case s.m.Folders:return n.a.createElement("h3",null,O("Filters"));case s.m.FoldersCreateFolder:return n.a.createElement("h3",null,O("FilterNew"));case s.m.FoldersEditFolder:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,O("FilterEdit")),t&&n.a.createElement(G.a,{className:"settings-more-menu",trigger:f,positionX:"right"},n.a.createElement(q.a,{icon:"delete",destructive:!0,onClick:p},"Delete Folder")));case s.m.FoldersIncludedChats:case s.m.FoldersExcludedChats:return n.a.createElement("div",{className:"settings-main-header"},e===s.m.FoldersIncludedChats?n.a.createElement("h3",null,O("FilterInclude")):n.a.createElement("h3",null,O("FilterExclude")),n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:c,ariaLabel:O("AutoDeleteConfirm")},n.a.createElement("i",{className:"icon-check"})));default:return n.a.createElement("div",{className:"settings-main-header"},n.a.createElement("h3",null,O("SETTINGS")),n.a.createElement(G.a,{className:"settings-more-menu",trigger:f,positionX:"right"},n.a.createElement(q.a,{icon:"logout",onClick:h},O("LogOutTitle"))))}}(),n.a.createElement(we.a,{isOpen:i,onClose:b,text:"Are you sure you want to log out?",confirmLabel:"Log Out",confirmHandler:v,confirmIsDestructive:!0}),n.a.createElement(we.a,{isOpen:m,onClose:g,text:"Are you sure you want to delete this folder?",confirmLabel:"Delete",confirmHandler:E,confirmIsDestructive:!0}))})),xt=a(18);var Ut=Object(n.h)(Object(c.h)(e=>{const{currentUserId:t}=e;return{currentUser:t?Object(d.Hb)(e,t):void 0}})(({onScreenSelect:e,currentUser:t})=>{const a=Object(F.a)();return n.a.createElement("div",{className:"settings-content custom-scroll"},n.a.createElement("div",{className:"settings-main-menu"},t&&n.a.createElement("div",{className:"settings-current-user"},n.a.createElement(x.a,{user:t,size:"jumbo"}),n.a.createElement("p",{className:"name"},Object(m.ab)(t)),n.a.createElement("p",{className:"phone"},Object(xt.c)(t.phoneNumber))),n.a.createElement(Ee.a,{icon:"edit",onClick:()=>e(s.m.EditProfile)},a("lng_settings_information")),n.a.createElement(Ee.a,{icon:"folder",onClick:()=>e(s.m.Folders)},a("Filters")),n.a.createElement(Ee.a,{icon:"settings",onClick:()=>e(s.m.General)},a("Telegram.GeneralSettingsViewController")),n.a.createElement(Ee.a,{icon:"unmute",onClick:()=>e(s.m.Notifications)},a("Notifications")),n.a.createElement(Ee.a,{icon:"lock",onClick:()=>e(s.m.Privacy)},a("PrivacySettings")),n.a.createElement(Ee.a,{icon:"language",onClick:()=>e(s.m.Language)},a("Language"))))})),Gt=a(130);a(268);var qt=({isShown:e,className:t,color:a="primary",ariaLabel:c,disabled:r,onClick:s,children:l})=>{const o=Object(V.a)("FloatingActionButton",e&&"revealed",t);return n.a.createElement(R.a,{className:o,color:a,round:!0,disabled:r,onClick:e&&!r?s:void 0,ariaLabel:c,tabIndex:-1},l)};const zt=/https:\/\/t\.me\/?/i,Ht=/^([a-zA-Z0-9_]+)$/,$t=Object(_.a)(e=>e(),250,!1);var _t=Object(n.h)(({currentUsername:e,asLink:t,isLoading:a,isUsernameAvailable:c,checkUsername:r,onChange:s})=>{const[l,o]=Object(n.r)(e||""),i=Object(F.a)(),d=t?"SetUrl":"Username",m=i(t?"SetUrlPlaceholder":"Username"),[u,h]=Object(n.p)(()=>l.length?l.length<5?[void 0,m+" is too short"]:l.length>32?[void 0,m+" is too long"]:Ht.test(l)?void 0===c?[]:[c?i(d+"Available","Username"):void 0,!1===c?i(d+"InUse"):void 0]:[void 0,m+" contains invalid characters"]:[],[l,c,i,d,m]);Object(n.n)(()=>{o(e||"")},[t,e]);const b=Object(n.m)(e=>{const a=e.target.value.trim().replace(zt,"");o(a),e.target.value=`${t?"https://t.me/":""}${a}`;const n=function(e){return e.length>=5&&e.length<=32&&Ht.test(e)}(a);n&&$t(()=>{r({username:a})}),s&&s(!!n&&a)},[t,r,s]);return n.a.createElement(ge.a,{value:`${t?"https://t.me/":""}${l}`,onChange:b,label:m,error:h,success:u,readOnly:a})});const Vt=Object(_.h)(e=>e(),6e4,!0);var Wt=Object(n.h)(Object(c.h)(e=>{const{currentUserId:t}=e,{progress:a,isUsernameAvailable:n}=e.profileEdit||{},c=t?Object(d.Hb)(e,t):void 0;if(!c)return{progress:a,isUsernameAvailable:n};const{firstName:r,lastName:s,username:l,fullInfo:o}=c,{bio:i}=o||{};return{currentAvatarHash:Object(m.e)(c),currentFirstName:r,currentLastName:s,currentBio:i,currentUsername:l,progress:a,isUsernameAvailable:n}},(e,t)=>Object(u.l)(t,["loadCurrentUser","updateProfile","checkUsername"]))(({currentAvatarHash:e,currentFirstName:t,currentLastName:a,currentBio:c,currentUsername:l,progress:o,isUsernameAvailable:i,loadCurrentUser:d,updateProfile:m,checkUsername:u})=>{const[h,b]=Object(n.r)(!1),[p,g]=Object(n.r)(!1),[E,f]=Object(n.r)(),[O,j]=Object(n.r)(),[C,y]=Object(n.r)(t||""),[k,N]=Object(n.r)(a||""),[I,S]=Object(n.r)(c||""),[w,P]=Object(n.r)(l||""),M=Object(v.a)(e,!1,r.ApiMediaFormat.BlobUrl),A=o===s.j.InProgress,T=!1===w,R=Object(n.p)(()=>!T&&(Boolean(O)||p||!0===i),[O,p,T,i]);Object(n.n)(()=>{Vt(()=>{d()})},[d]),Object(n.n)(()=>{j(void 0)},[M]),Object(n.n)(()=>{y(t||""),N(a||""),S(c||"")},[t,a,c]),Object(n.n)(()=>{P(l||"")},[l]),Object(n.n)(()=>{o===s.j.Complete&&(g(!1),b(!1),f(void 0))},[o]);const D=Object(n.m)(e=>{j(e)},[]),x=Object(n.m)(e=>{y(e.target.value),g(!0)},[]),U=Object(n.m)(e=>{N(e.target.value),g(!0)},[]),G=Object(n.m)(e=>{S(e.target.value),g(!0)},[]),q=Object(n.m)(e=>{P(e),b(!0)},[]),z=Object(n.m)(()=>{const e=C.trim(),t=k.trim(),a=I.trim();e.length?a.length>70?f("Bio can' be longer than 70 characters"):m({photo:O,...p&&{firstName:e,lastName:t,bio:a},...h&&{username:w}}):f("Please provide your first name")},[O,C,k,I,p,w,h,m]),H=Object(F.a)();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(Gt.a,{currentAvatarBlobUrl:M,onChange:D,title:"Edit your profile photo",disabled:A}),n.a.createElement(ge.a,{value:C,onChange:x,label:H("FirstName"),disabled:A,error:"Please provide your first name"===E?E:void 0}),n.a.createElement(ge.a,{value:k,onChange:U,label:H("LastName"),disabled:A}),n.a.createElement(ge.a,{value:I,onChange:G,label:H("UserBio"),disabled:A,error:"Bio can' be longer than 70 characters"===E?E:void 0}),n.a.createElement("p",{className:"settings-item-description",dir:H.isRtl?"rtl":void 0},Object(B.a)(H("lng_settings_about_bio"),["br","simple_markdown"]))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:H.isRtl?"rtl":void 0},H("Username")),n.a.createElement(_t,{currentUsername:w||"",isLoading:A,isUsernameAvailable:i,checkUsername:u,onChange:q}),n.a.createElement("p",{className:"settings-item-description",dir:H.isRtl?"rtl":void 0},Object(B.a)(H("UsernameHelp"),["br","simple_markdown"])),w&&n.a.createElement("p",{className:"settings-item-description",dir:H.isRtl?"rtl":void 0},H("lng_username_link"),n.a.createElement("br",null),n.a.createElement("span",{className:"username-link"},"https://t.me/",w)))),n.a.createElement(qt,{isShown:R,onClick:z,disabled:A,ariaLabel:"Save changes"},A?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),Kt=a(125),Yt=a(115);const Zt=Object(_.h)(e=>e(),6e4,!0);var Qt=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t},users:{byId:a}}=e,{orderedIds:n,byId:c,recommended:r}=e.chatFolders;return{chatsById:t,usersById:a,orderedFolderIds:n,foldersById:c,recommendedChatFolders:r,notifySettings:Object(d.eb)(e),notifyExceptions:Object(d.db)(e)}},(e,t)=>Object(u.l)(t,["loadRecommendedChatFolders","addChatFolder","showDialog"]))(({onCreateFolder:e,onEditFolder:t,chatsById:a,usersById:c,orderedFolderIds:r,foldersById:s,recommendedChatFolders:o,notifySettings:i,notifyExceptions:d,loadRecommendedChatFolders:u,addChatFolder:h,showDialog:b})=>{const[p,g]=Object(n.r)(),[v,E]=Object(n.r)(!1),f=Object(n.m)(()=>E(!0),[]);Object(n.n)(()=>{p||Object(Kt.a)("FoldersAll").then(g)},[p]),Object(n.n)(()=>{Zt(()=>{u()})},[u]);const O=Object(n.m)(()=>{Object.keys(s).length>=10?b({data:{message:"DIALOG_FILTERS_TOO_MUCH"}}):e()},[s,b,e]),j=Object(F.a)(),C=Object(n.p)(()=>{if(!r)return;const e=Object.keys(a).map(Number);return r.map(t=>{const n=s[t];return{id:n.id,title:n.title,subtitle:Object(m.n)(j,a,c,n,e,i,d)}})},[r,a,s,c,i,d,j]),y=Object(n.m)(e=>{Object.keys(s).length>=10?b({data:{message:"DIALOG_FILTERS_TOO_MUCH"}}):h({folder:e})},[s,h,b]);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"},p&&n.a.createElement(Yt.a,{id:"settingsFoldersMain",size:l.ub,animationData:p,play:v,noLoop:!0,onLoad:f})),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},j("CreateNewFilterInfo")),n.a.createElement(R.a,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:O,isRtl:j.isRtl},n.a.createElement("i",{className:"icon-add"}),j("CreateNewFilter"))),n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:j.isRtl?"rtl":void 0},j("Filters")),C&&C.length?C.map(e=>n.a.createElement(Ee.a,{className:"mb-2",narrow:!0,multiline:!0,onClick:()=>t(s[e.id])},n.a.createElement("span",{className:"title"},e.title),n.a.createElement("span",{className:"subtitle"},e.subtitle))):C&&!C.length?n.a.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):n.a.createElement(be.a,null)),o&&!!o.length&&n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:j.isRtl?"rtl":void 0},j("FilterRecommended")),o.map(e=>n.a.createElement(Ee.a,{className:"mb-2",narrow:!0,onClick:()=>y(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(R.a,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:j.isRtl},j("Add")))))))}));a(269);var Xt=({count:e,itemName:t,itemPluralName:a,isLoading:c,onClick:r})=>{const s=Object(F.a)();return n.a.createElement(R.a,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:c,isRtl:s.isRtl,onClick:r},n.a.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?a||t+"s":t)};const Jt="Please provide a title for this folder.",ea="Please select at least one chat for this folder.";var ta=Object(n.h)(Object(c.h)(e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}},(e,t)=>Object(u.l)(t,["editChatFolder","addChatFolder","loadMoreChats"]))(({state:e,dispatch:t,onAddIncludedChats:a,onAddExcludedChats:c,onReset:r,loadedActiveChatIds:s,loadedArchivedChatIds:o,editChatFolder:i,addChatFolder:d,loadMoreChats:h})=>{const[b,p]=Object(n.r)(),[g,v]=Object(n.r)(!1),E=Object(n.m)(()=>v(!0),[]),[f,O]=Object(n.r)(!1),[j,C]=Object(n.r)(!1),{selectedChatIds:y,selectedChatTypes:k}=Ft(e,"included"),{selectedChatIds:N,selectedChatTypes:I}=Ft(e,"excluded");Object(n.n)(()=>{b||Object(Kt.a)("FoldersNew").then(p)},[b]),Object(n.n)(()=>{O(!1),C(!1)},[e.folderId]);const[S,w]=Object(n.p)(()=>{const e=new Set([...s||[],...o||[]]),t=Object(u.f)(y,e),a=Object(u.f)(N,e);return[f?t:t.slice(0,5-k.length),j?a:a.slice(0,5-I.length)]},[N,y,k,I,j,f,s,o]);Object(n.n)(()=>{(S.length<y.length||w.length<N.length)&&h({listType:"active"})},[h,N.length,y.length,w.length,S.length]);const P=Object(F.a)();function M(e){const t="included"===e?k:I,a="included"===e?S:w,c="included"===e?f:j,r=("included"===e?y:N).length-t.length-a.length,s="included"===e?()=>O(!0):()=>C(!0);return n.a.createElement(n.a.Fragment,null,t.map(t=>function(e,t){const a="included"===t?St.find(({key:t})=>t===e):wt.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},P(a.title))}(t,e)),a.map(e=>n.a.createElement(Ee.a,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},Object(m.mb)(e)?n.a.createElement(fe.a,{avatarSize:"small",userId:e}):n.a.createElement(Oe.a,{avatarSize:"small",chatId:e}))),!c&&r>0&&n.a.createElement(Xt,{count:r,itemName:"chat",onClick:s}))}return 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"},b&&n.a.createElement(Yt.a,{id:"settingsFoldersEdit",size:l.ub,animationData:b,play:g&&String(e.folderId),noLoop:!0,onLoad:E})),"create"===e.mode&&n.a.createElement("p",{className:"settings-item-description mb-3",dir:P.isRtl?"rtl":void 0},P("FilterIncludeInfo")),n.a.createElement(ge.a,{className:"mb-0",label:P("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:a}=e;t({type:"setTitle",payload:a.value.trim()})},error:e.error&&e.error===Jt?Jt:void 0})),n.a.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===ea&&n.a.createElement("p",{className:"settings-item-description color-danger mb-2",dir:P.isRtl?"rtl":void 0},e.error),n.a.createElement("h4",{className:"settings-item-header mb-3",dir:P.isRtl?"rtl":void 0},P("FilterInclude")),n.a.createElement(Ee.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:a},P("FilterAddChats")),M("included")),n.a.createElement("div",{className:"settings-item no-border pt-3"},n.a.createElement("h4",{className:"settings-item-header mb-3",dir:P.isRtl?"rtl":void 0},P("FilterExclude")),n.a.createElement(Ee.a,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:c},P("FilterAddChats")),M("excluded"))),n.a.createElement(qt,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:a}=e.folder;a?y.length||Object.keys(k).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?i({id:e.folderId,folderUpdate:e.folder}):d({folder:e.folder}),setTimeout(()=>{r()},500)):t({type:"setError",payload:ea}):t({type:"setError",payload:Jt})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))})),aa=a(46);a(186),a(270);var na=Object(n.h)(({mode:e,chatIds:t,selectedIds:a,selectedChatTypes:c,filterValue:r,onSelectedIdsChange:s,onSelectedChatTypesChange:l,onFilterChange:o,onLoadMore:i})=>{const d=Object(n.q)(null),u="included"===e?St:wt,h=a.length+c.length>10,b=a.length>=100;Object(n.n)(()=>{setTimeout(()=>{requestAnimationFrame(()=>{d.current.focus()})},500)},[]);const p=Object(n.m)(e=>{const t=[...a];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),s(t)},[a,s]),g=Object(n.m)(e=>{const t=[...c];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),l(t)},[c,l]),v=Object(n.m)(e=>{const{value:t}=e.currentTarget;o(t)},[o]),E=Object(F.a)();const[f,O]=Object(ue.a)(i,t,Boolean(r));return n.a.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},n.a.createElement("div",{className:"picker-header custom-scroll"},c.map((function(e){const t=u.find(({key:t})=>e===t);if(t)return n.a.createElement(at.a,{icon:t.icon,title:E(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),a.map((e,t)=>n.a.createElement(at.a,{chatOrUserId:e,isMinimized:h&&t<a.length-5,canClose:!0,onClick:p,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(ge.a,{ref:d,value:r,onChange:v,placeholder:E("Search")})),n.a.createElement(ve.a,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:f,onLoadMore:O},(!f||!f.length||f.includes(t[0]))&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h4",{key:"header1",className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("FilterChatTypes")),u.map((function(e){return n.a.createElement(Ee.a,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>g(e.key),ripple:!0},n.a.createElement("i",{className:"icon-"+e.icon}),n.a.createElement("h3",{className:"chat-type",dir:"auto"},E(e.title)),n.a.createElement(aa.a,{label:"",checked:c.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:E.isRtl?"rtl":void 0},E("FilterChats"))),f&&f.length?f.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:()=>p(e),ripple:!0,disabled:!t&&b},Object(m.mb)(e)?n.a.createElement(fe.a,{userId:e}):n.a.createElement(Oe.a,{chatId:e,withChatType:!0}),n.a.createElement(aa.a,{label:"",checked:t,round:!0}))})):f&&!f.length?n.a.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):n.a.createElement(be.a,{key:"loading"})))});var ca=Object(n.h)(Object(c.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(u.l)(t,["loadMoreChats"]))(({mode:e,state:t,dispatch:a,chatsById:c,listIds:r,orderedPinnedIds:s,archivedListIds:l,archivedPinnedIds:o,loadMoreChats:i})=>{const{chatFilter:d}=t,{selectedChatIds:u,selectedChatTypes:h}=Ft(t,e,!0),b=Object(F.a)(),p=Object(n.p)(()=>{const e=r?Object(m.Bb)(c,r,s,"all"):void 0,t=l?Object(m.Bb)(c,l,o,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[c,r,s,l,o]),g=Object(n.p)(()=>{if(p)return p.filter(e=>!d||Object(me.a)(Object(m.k)(b,e),d)||u.includes(e.id)).map(({id:e})=>e)},[p,d,b,u]),v=Object(n.m)(e=>{a({type:"setChatFilter",payload:e})},[a]),E=Object(n.m)(n=>{a("included"===e?{type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:n}}:{type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:n}})},[e,t,a]),f=Object(n.m)(t=>{const n={};t.forEach(e=>{n[e]=!0}),a("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:u,...n}}:{type:"setExcludeFilters",payload:{excludedChatIds:u,...n}})},[e,u,a]);return g?n.a.createElement(na,{mode:e,chatIds:g,selectedIds:u,selectedChatTypes:h,filterValue:d,onSelectedIdsChange:E,onSelectedChatTypesChange:f,onFilterChange:v,onLoadMore:i}):n.a.createElement(be.a,null)}));a(271);var ra=Object(n.h)(({currentScreen:e,state:t,dispatch:a,onScreenSelect:c,onReset:r})=>{const l=Object(n.m)(()=>{e!==s.m.FoldersCreateFolder&&e!==s.m.FoldersEditFolder||setTimeout(()=>{a({type:"reset"})},200),e!==s.m.FoldersIncludedChats&&e!==s.m.FoldersExcludedChats?r():"create"===t.mode?c(s.m.FoldersCreateFolder):c(s.m.FoldersEditFolder)},[t.mode,a,e,r,c]),o=Object(n.m)(()=>{a({type:"reset"}),c(s.m.FoldersCreateFolder)},[c,a]),i=Object(n.m)(e=>{a({type:"editFolder",payload:e}),c(s.m.FoldersEditFolder)},[a,c]),d=Object(n.m)(()=>{a({type:"editIncludeFilters"}),c(s.m.FoldersIncludedChats)},[a,c]),m=Object(n.m)(()=>{a({type:"editExcludeFilters"}),c(s.m.FoldersExcludedChats)},[a,c]);switch(e){case s.m.Folders:return n.a.createElement(Qt,{onCreateFolder:o,onEditFolder:i});case s.m.FoldersCreateFolder:case s.m.FoldersEditFolder:return n.a.createElement(ta,{state:t,dispatch:a,onAddIncludedChats:d,onAddExcludedChats:m,onReset:l});case s.m.FoldersIncludedChats:return n.a.createElement(ca,{mode:"included",state:t,dispatch:a});case s.m.FoldersExcludedChats:return n.a.createElement(ca,{mode:"excluded",state:t,dispatch:a});default:return}}),sa=a(106);a(272);var la=Object(n.h)(({options:e,range:t,label:a,value:c,disabled:r,onChange:s})=>{const l=Object(F.a)(),o=Object(n.m)(e=>{s(Number(e.currentTarget.value))},[s]),i=Object(V.a)("RangeSlider",r&&"disabled"),d=Object(n.p)(()=>{if(e)return c/(e.length-1)*100;if(t){const e=(t.max-t.min)/(t.step||1);return(c-t.min)/e*100}return 0},[c,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:l.isRtl?"rtl":void 0},n.a.createElement("span",{className:"label",dir:"auto"},a),t&&n.a.createElement("span",{className:"value",dir:"auto"},c)),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:c,step:h,type:"range",onChange:o}),e&&n.a.createElement("div",{className:"slider-options"},e.map((e,t)=>n.a.createElement("div",{className:Object(V.a)("slider-option no-selection",t===c&&"active"),onClick:()=>s(t)},e)))))}),oa=a(126),ia=a(113),da=a(49);var ma=Object(n.h)(({size:e=l.Ab,stickerSet:t,observeIntersection:a})=>{const c=Object(n.q)(null),s=Object(sa.b)(c,a),o="stickerSet"+t.id,i=Object(v.a)(o,!s,r.ApiMediaFormat.Lottie),{shouldRenderFullMedia:d,transitionClassNames:m}=Object(ia.a)(i,"slow");return n.a.createElement("div",{ref:c,className:"sticker-set-cover"},!d&&Object(da.c)(t.title,2),d&&i&&n.a.createElement(Yt.a,{id:o,size:e,animationData:i,className:m}))});var ua=Object(n.h)(({stickerSet:e,observeIntersection:t})=>{const a=Object(n.q)(null),c=Object(sa.b)(a,t),r=Object(v.a)(e.hasThumbnail&&"stickerSet"+e.id,!c),{shouldRenderFullMedia:s,transitionClassNames:l}=Object(ia.a)(r,"slow");return n.a.createElement("div",{ref:a,className:"sticker-set-cover"},!s&&Object(da.c)(e.title,2),s&&n.a.createElement("img",{src:r,className:l,alt:""}))});a(273);var ha=Object(n.h)(({sticker:e,size:t,observeIntersection:a,noAnimate:c,title:s,className:l,onClick:o,clickArg:i,onUnfaveClick:d})=>{const m=Object(n.q)(null),u="sticker"+e.id,h="sticker-button-"+e.id,b=Object(sa.b)(m,a),p=e.thumbnail?e.thumbnail.dataUri:void 0,g=Object(v.a)(u+"?size=m",!b,r.ApiMediaFormat.BlobUrl),E=b&&!c,f=Object(v.a)(e.isAnimated&&u,!E,r.ApiMediaFormat.Lottie),[O,j,C]=Object(xe.a)(Boolean(f)),y=O&&E,{shouldRenderThumb:k,shouldRenderFullMedia:N,transitionClassNames:I}=Object(ia.a)(g||y,"slow");Object(n.n)(()=>{E||C()},[C,E]);const S=Object(V.a)("StickerButton",e.isAnimated&&"animated",h,l),w=k&&p?`background-image: url('${p}');`:"";return n.a.createElement("div",{ref:m,className:S,title:s||e&&e.emoji,style:w,"data-sticker-id":e.id,onClick:function(){o&&o(i)}},N&&!y&&n.a.createElement("img",{src:g,className:I}),E&&f&&n.a.createElement(Yt.a,{id:u,animationData:f,play:!0,size:t,isLowPriority:!0,onLoad:j}),d&&n.a.createElement(R.a,{className:"sticker-unfave-button",color:"dark",round:!0,onClick:function(t){t.stopPropagation(),t.preventDefault(),d(e)}},n.a.createElement("i",{className:"icon-close"})))});a(274);var ba=Object(n.h)(({stickerSet:e,observeIntersection:t,onClick:a})=>{const c=Object(F.a)();if(!e||!e.stickers)return;const r=e.stickers&&e.stickers[0];return e.hasThumbnail||!r?n.a.createElement(Ee.a,{narrow:!0,className:"SettingsStickerSet",inactive:!r,onClick:()=>r&&a(r)},n.a.createElement(R.a,{ariaLabel:e.title,color:"translucent",isRtl:c.isRtl},e.isAnimated?n.a.createElement(ma,{size:l.vb,stickerSet:e,observeIntersection:t}):n.a.createElement(ua,{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"},c("StickerPack.StickerCount",e.count,"i")))):n.a.createElement(Ee.a,{narrow:!0,className:"SettingsStickerSet",onClick:()=>a(r)},n.a.createElement(ha,{sticker:r,size:l.vb,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"},c("StickerPack.StickerCount",e.count,"i"))))}),pa=a(161);const ga=["Solid and Steady","Nice and Fast","Lots of Stuff"];var va=Object(n.h)(Object(c.h)(e=>({...Object(u.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(u.l)(t,["setSettingOption","loadStickerSets","loadAddedStickers"]))(({onScreenSelect:e,stickerSetIds:t,stickerSetsById:a,messageTextSize:c,animationLevel:r,messageSendKeyCombo:l,shouldAutoDownloadMediaFromContacts:i,shouldAutoDownloadMediaInPrivateChats:d,shouldAutoDownloadMediaInGroups:m,shouldAutoDownloadMediaInChannels:u,shouldAutoPlayGifs:h,shouldAutoPlayVideos:b,shouldSuggestStickers:p,shouldLoopStickers:g,setSettingOption:v,loadStickerSets:E,loadAddedStickers:f})=>{const O=Object(n.q)(null),{observe:j}=Object(sa.a)({rootRef:O}),[C,y,k]=Object(xe.a)(),[N,I]=Object(n.r)(),S=Object(F.a)(),w=o.m?void 0:[{value:"enter",label:S("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:S(o.f?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];Object(n.n)(()=>{E()},[E]),Object(n.n)(()=>{t&&t.length&&f()},[t,f]);const P=Object(n.m)(e=>{ga.forEach((t,a)=>{document.body.classList.toggle("animation-level-"+a,e===a)}),v({animationLevel:e})},[v]),M=Object(n.m)(e=>{document.documentElement.style.setProperty("--message-text-size",e+"px"),v({messageTextSize:e})},[v]),L=Object(n.m)(e=>{I(e),y()},[y]),A=t&&t.map(e=>!!(a&&a[e]&&a[e].installedDate)&&a[e]).filter(Boolean);return 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:S.isRtl?"rtl":void 0},S("SETTINGS")),n.a.createElement(la,{label:S("TextSize"),range:{min:12,max:20},value:c,onChange:M}),n.a.createElement(Ee.a,{icon:"photo",onClick:()=>e(s.m.GeneralChatBackground)},S("ChatBackground"))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},"Animation Level"),n.a.createElement("p",{className:"settings-item-description",dir:S.isRtl?"rtl":void 0},"Choose the desired animations amount."),n.a.createElement(la,{options:ga,value:r,onChange:P})),w&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("VoiceOver.Keyboard")),n.a.createElement(oa.a,{name:"keyboard-send-settings",options:w,onChange:e=>v({messageSendKeyCombo:e}),selected:l})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("AutoDownloadMedia")),n.a.createElement(aa.a,{label:S("Contacts"),checked:i,onCheck:e=>v({shouldAutoDownloadMediaFromContacts:e})}),n.a.createElement(aa.a,{label:S("AutodownloadPrivateChats"),checked:d,onCheck:e=>v({shouldAutoDownloadMediaInPrivateChats:e})}),n.a.createElement(aa.a,{label:S("AutodownloadGroupChats"),checked:m,onCheck:e=>v({shouldAutoDownloadMediaInGroups:e})}),n.a.createElement(aa.a,{label:S("FilterChannels"),checked:u,onCheck:e=>v({shouldAutoDownloadMediaInChannels:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("AutoplayMedia")),n.a.createElement(aa.a,{label:S("GifsTab2"),checked:h,onCheck:e=>v({shouldAutoPlayGifs:e})}),n.a.createElement(aa.a,{label:S("DataAndStorage.Autoplay.Videos"),checked:b,onCheck:e=>v({shouldAutoPlayVideos:e})})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:S.isRtl?"rtl":void 0},S("AccDescrStickers")),n.a.createElement(aa.a,{label:S("SuggestStickers"),checked:p,onCheck:e=>v({shouldSuggestStickers:e})}),n.a.createElement(aa.a,{label:S("LoopAnimatedStickers"),checked:g,onCheck:e=>v({shouldLoopStickers:e})}),n.a.createElement("div",{className:"mt-4",ref:O},A&&A.map(e=>n.a.createElement(ba,{key:e.id,stickerSet:e,observeIntersection:j,onClick:L}))),N&&n.a.createElement(pa.a,{isOpen:C,fromSticker:N,onClose:k})))}));let Ea;function fa(e="*",t,a=!1){Ea||(Ea=document.createElement("input"),Ea.setAttribute("type","file")),Ea.setAttribute("accept",e),a?Ea.removeAttribute("multiple"):Ea.setAttribute("multiple","multiple"),Ea.onchange=null,Ea.value="",Ea.onchange=t,Ea.click()}var Oa=a(13);function ja(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function Ca(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 ya([e,t,a]){e/=255,t/=255,a/=255;let n,c,r=Math.max(e,t,a),s=Math.min(e,t,a),l=r,o=r-s;if(c=0==r?0:o/r,r==s)n=0;else{switch(r){case e:n=(t-a)/o+(t<a?6:0);break;case t:n=(a-e)/o+2;break;case a:n=(e-t)/o+4}n/=6}return[n,c,l]}function ka([e,t,a]){let n,c,r,s=Math.floor(6*e),l=6*e-s,o=a*(1-t),i=a*(1-l*t),d=a*(1-(1-l)*t);switch(s%6){case 0:n=a,c=d,r=o;break;case 1:n=i,c=a,r=o;break;case 2:n=o,c=a,r=d;break;case 3:n=o,c=i,r=a;break;case 4:n=d,c=o,r=a;break;case 5:n=a,c=o,r=i}return[Math.round(255*n),Math.round(255*c),Math.round(255*r)]}function Na(e){let[t,a,n]=ya(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 Ia=a(11),Sa=a(162);a(275);var wa=Object(n.h)(({wallpaper:e,theme:t,isSelected:a,onClick:c})=>{const{slug:r,document:o}=e,i="wallpaper"+o.id,d=o.previewBlobUrl,m=Object(v.a)(i+"?size=m"),u=Object(Sa.a)(o.thumbnail&&o.thumbnail.dataUri,Boolean(m),!0),{shouldRenderThumb:h,shouldRenderFullMedia:b,transitionClassNames:p}=Object(ia.a)(m||d,"slow"),[g,f]=Object(n.r)(!1),{mediaData:j,downloadProgress:C}=Object(E.a)(i,!g),y=!1===Object(O.a)(g),{shouldRender:k,transitionClassNames:N}=Object(K.a)(g&&!j||r===s.n,void 0,y,"slow"),I=Object(n.q)();I.current=t;const S=Object(n.m)(()=>{(async()=>{const e=await Object(Oa.e)(j);await Ia.d(l.m,I.current,e),c(r)})()},[j,c,r]);Object(n.n)(()=>{j&&S()},[j,S]);const w=Object(n.m)(()=>{j?S():f(e=>!e)},[j,S]),P=Object(V.a)("WallpaperTile",a&&"selected");return n.a.createElement("div",{className:P,onClick:w},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 "+p,alt:""}),k&&n.a.createElement("div",{className:Object(V.a)("spinner-container",N)},n.a.createElement(z.a,{progress:C,onClick:w}))))});a(276);const Pa=Object(_.h)(e=>e(),6e4,!0);var Ma=Object(n.h)(Object(c.h)(e=>{const t=Object(d.Bb)(e),{background:a,isBlurred:n}=e.settings.themes[t]||{},{loadedWallpapers:c}=e.settings;return{background:a,isBlurred:n,loadedWallpapers:c,theme:t}},(e,t)=>Object(u.l)(t,["loadWallpapers","uploadWallpaper","setThemeSettings"]))(({onScreenSelect:e,background:t,isBlurred:a,loadedWallpapers:c,theme:r,loadWallpapers:o,uploadWallpaper:i,setThemeSettings:d})=>{const m=Object(n.q)();m.current=r,Object(n.n)(()=>{Pa(()=>{o()})},[o]);const u=Object(n.m)(e=>{const{files:t}=e.target;t&&t.length>0&&i(t[0])},[i]),h=Object(n.m)(()=>{fa("image/jpeg",u,!0)},[u]),b=Object(n.m)(()=>{e(s.m.GeneralChatBackgroundColor)},[e]),p=Object(n.m)(()=>{d({theme:r,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===r?l.o:l.t})},[d,r]),g=Object(n.m)(e=>{d({theme:m.current,background:e});const t=c&&c.find(t=>t.slug===e);t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let a,n,c,r,s=-4,l=[0,0,0],o=0;const i=document.createElement("canvas"),d=i.getContext&&i.getContext("2d");if(!d)return t;const m=await Object(Oa.g)(e);c=m.naturalHeight||m.offsetHeight||m.height,n=m.naturalWidth||m.offsetWidth||m.width,i.height=c,i.width=n,d.drawImage(m,0,0);try{a=d.getImageData(0,0,n,c)}catch(e){return t}for(r=a.data.length;(s+=20)<r;)++o,l[0]+=a.data[s],l[1]+=a.data[s+1],l[2]+=a.data[s+2];return l[0]=Math.floor(l[0]/o),l[1]=Math.floor(l[1]/o),l[2]=Math.floor(l[2]/o),l}(t.document.thumbnail.dataUri).then(e=>{const t=Na(e),a="#"+Ca(e);d({theme:m.current,backgroundColor:a,patternColor:t})})},[c,d]),v=Object(n.m)(e=>{d({theme:m.current,isBlurred:e.target.checked})},[d]),E=Object(F.a)(),f=c&&c[0]&&c[0].slug===s.n;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:h},E("UploadImage")),n.a.createElement(Ee.a,{icon:"colorize",className:"mb-0",onClick:b},E("SetColor")),n.a.createElement(Ee.a,{icon:"favorite",onClick:p},E("ThemeResetToDefaults")),n.a.createElement(aa.a,{label:E("BackgroundBlurred"),checked:Boolean(a),onChange:v})),c?n.a.createElement("div",{className:"settings-wallpapers"},c.map(e=>n.a.createElement(wa,{wallpaper:e,theme:r,isSelected:t===e.slug,onClick:g}))):n.a.createElement(be.a,null))}));a(277);const Fa=ya(ja("e6ebee")),La=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Aa(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 Ta({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 Ra=Object(n.h)(Object(c.h)(e=>{const t=Object(d.Bb)(e),{backgroundColor:a}=e.settings.themes[t]||{};return{backgroundColor:a,theme:t}},(e,t)=>Object(u.l)(t,["setThemeSettings"]))(({theme:e,backgroundColor:t,setThemeSettings:a})=>{const c=Object(n.q)();c.current=e;const r=Object(n.q)(null),s=Object(n.q)(null),l=Object(n.q)(null),o=Object(n.q)(!0),[i,d]=Object(n.r)(function(e){return e&&e.startsWith("#")?ya(ja(e.replace("#",""))):Fa}(t)),m=Object(n.q)(i);Object(n.n)(()=>{m.current=i},[i]);const[b,p,g]=Object(xe.a)(),[v,E]=Object(n.r)(""),[f,O]=Object(n.r)(""),j=Object(n.q)(),C=Object(n.q)();Object(n.n)(()=>{const e={offsetLeft:s.current.offsetLeft,...Object(u.l)(s.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:l.current.offsetLeft,...Object(u.l)(l.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+r.current.scrollTop),e.height-1)],{huePosition:n}=Aa(m.current,j.current);d(Ta({colorPosition:a,huePosition:n},j.current)),p()}function n(e){const{colorPosition:a}=Aa(m.current,j.current),n=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);d(Ta({colorPosition:a,huePosition:n},j.current)),p()}j.current={colorRect:e,hueRect:t},Object(h.b)(s.current,{onCapture:a,onDrag:a,onRelease:g,onClick:g,withCursor:!0}),Object(h.b)(l.current,{onCapture:n,onDrag:n,onRelease:g,onClick:g,withCursor:!0})},[p,g]);const{colorPosition:y=[0,0],huePosition:k=0}=j.current?Aa(i,j.current):{},N=Ca(ka(i)),I=i[0],S=Ca(ka([I,1,1]));Object(n.n)(()=>{const e=ka(i),t="#"+Ca(e);if(E(e.join(", ")),O(t),!o.current){const n=Na(e);a({theme:c.current,background:void 0,backgroundColor:t,patternColor:n})}o.current=!1},[i,a]),Object(n.n)(()=>{!function(e,t,a,n){let c,r,s;a.current&&n.current?(c=n.current.colorRect.width,r=n.current.colorRect.height,s=a.current):(c=e.offsetWidth,r=e.offsetHeight,s=e.getContext("2d"),e.width=c,e.height=r,a.current=s);const l=s.createImageData(c,r),o=l.data,i=ka([t,1,1]);let d=0;for(let e=0;e<r;e++){const t=1-e/(r-1),a=[255*t,255*t,255*t],n=[i[0]*t,i[1]*t,i[2]*t];for(let e=0;e<c;e++){const t=e/(c-1);o[d++]=a[0]+(n[0]-a[0])*t,o[d++]=a[1]+(n[1]-a[1])*t,o[d++]=a[2]+(n[2]-a[2])*t,o[d++]=255}}s.putImageData(l,0,0)}(s.current.firstChild,I,C,j)},[I]),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),c=n.data;let r=0;for(let e=0;e<t;e++){const a=ka([e/(t-1),1,1]);c[r++]=a[0],c[r++]=a[1],c[r++]=a[2],c[r++]=255}a.putImageData(n,0,0)}(l.current.firstChild)},[]);const w=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()));d(ya(e))}e.currentTarget.value=t},[]),P=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}$/)&&d(ya(ja(t.replace("#","")))),e.currentTarget.value=t},[]),M=Object(n.m)(e=>{d(ya(ja(e.currentTarget.dataset.color.replace("#",""))))},[]),F=Object(V.a)("SettingsGeneralBackgroundColor settings-content custom-scroll",b&&"is-dragging");return n.a.createElement("div",{ref:r,className:F},n.a.createElement("div",{className:"settings-item pt-3"},n.a.createElement("div",{ref:s,className:"color-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translate(${y[0]}px, ${y[1]}px); background-color: #${N};`})),n.a.createElement("div",{ref:l,className:"hue-picker"},n.a.createElement("canvas",null),n.a.createElement("div",{className:"handle",style:`transform: translateX(${k}px); background-color: #${S};`})),n.a.createElement("div",{className:"tools"},n.a.createElement(ge.a,{value:f,label:"HEX",onChange:P}),n.a.createElement(ge.a,{value:v,label:"RGB",onChange:w}))),n.a.createElement("div",{className:"predefined-colors"},La.map(e=>n.a.createElement("div",{className:e==="#"+N?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:M}))))}));var Da=Object(n.h)(Object(c.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(u.l)(t,["loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings"]))(({hasPrivateChatsNotifications:e,hasPrivateChatsMessagePreview:t,hasGroupNotifications:a,hasGroupMessagePreview:c,hasBroadcastNotifications:r,hasBroadcastMessagePreview:s,hasContactJoinedNotifications:l,loadNotificationSettings:o,updateContactSignUpNotification:i,updateNotificationSettings:d})=>{Object(n.n)(()=>{o()},[o]);const m=Object(n.m)((n,l,o)=>{const i="contact"===l?!e:!("group"===l?a:r),m="contact"===l?t:"group"===l?c:s;d({peerType:l,..."silent"===o&&{isSilent:!n.target.checked,shouldShowPreviews:m},..."showPreviews"===o&&{shouldShowPreviews:n.target.checked,isSilent:i}})},[s,r,c,a,t,e,d]),u=Object(n.m)(e=>{i({isSilent:!e.target.checked})},[i]),h=Object(F.a)();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},h("AutodownloadPrivateChats")),n.a.createElement(aa.a,{label:h("NotificationsForPrivateChats"),subLabel:h(e?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:e,onChange:e=>{m(e,"contact","silent")}}),n.a.createElement(aa.a,{label:h("MessagePreview"),subLabel:h(t?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:t,onChange:e=>{m(e,"contact","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0},h("FilterGroups")),n.a.createElement(aa.a,{label:h("NotificationsForGroups"),subLabel:h(a?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:a,onChange:e=>{m(e,"group","silent")}}),n.a.createElement(aa.a,{label:h("MessagePreview"),subLabel:h(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{m(e,"group","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0},h("FilterChannels")),n.a.createElement(aa.a,{label:h("NotificationsForChannels"),subLabel:h(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:e=>{m(e,"broadcast","silent")}}),n.a.createElement(aa.a,{label:h("MessagePreview"),subLabel:h(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{m(e,"broadcast","showPreviews")}})),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0},h("PhoneOther")),n.a.createElement(aa.a,{label:h("ContactJoined"),checked:l,onChange:u})))}));var Ba=Object(n.h)(Object(c.h)(e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:a,canChangeSensitive:n},privacy:c},blocked:r,activeSessions:s}=e;return{hasPassword:t,blockedCount:r.totalCount,sessionsCount:s.length,isSensitiveEnabled:a,canChangeSensitive:n,visibilityPrivacyPhoneNumber:c.phoneNumber&&c.phoneNumber.visibility,visibilityPrivacyLastSeen:c.lastSeen&&c.lastSeen.visibility,visibilityPrivacyProfilePhoto:c.profilePhoto&&c.profilePhoto.visibility,visibilityPrivacyForwarding:c.forwards&&c.forwards.visibility,visibilityPrivacyGroupChats:c.chatInvite&&c.chatInvite.visibility}},(e,t)=>Object(u.l)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings","loadContentSettings","updateContentSettings"]))(({onScreenSelect:e,hasPassword:t,blockedCount:a,sessionsCount:c,isSensitiveEnabled:r,canChangeSensitive:l,visibilityPrivacyPhoneNumber:o,visibilityPrivacyLastSeen:i,visibilityPrivacyProfilePhoto:d,visibilityPrivacyForwarding:m,visibilityPrivacyGroupChats:u,loadPrivacySettings:h,loadBlockedContacts:b,loadAuthorizations:p,loadContentSettings:g,updateContentSettings:v})=>{Object(n.n)(()=>{b(),p(),h(),g()},[b,p,h,g]);const E=Object(F.a)();function f(e){switch(e){case"everybody":return E("P2PEverybody");case"contacts":return E("P2PContacts");case"nobody":return E("P2PNobody")}}return 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:()=>e(s.m.PrivacyBlockedUsers)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("BlockedUsers")),a>0&&n.a.createElement("span",{className:"subtitle",dir:"auto"},E("Users",a)))),n.a.createElement(Ee.a,{icon:"lock",narrow:!0,onClick:()=>e(t?s.m.TwoFaEnabled:s.m.TwoFaDisabled)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("TwoStepVerification")),n.a.createElement("span",{className:"subtitle",dir:"auto"},E(t?"PasswordOn":"PasswordOff")))),n.a.createElement(Ee.a,{icon:"active-sessions",narrow:!0,onClick:()=>e(s.m.PrivacyActiveSessions)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("SessionsTitle")),c>0&&n.a.createElement("span",{className:"subtitle",dir:"auto"},1===c?"1 session":c+" sessions")))),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:E.isRtl?"rtl":void 0},E("PrivacyTitle")),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>e(s.m.PrivacyPhoneNumber)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("PrivacyPhoneTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(o)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>e(s.m.PrivacyLastSeen)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("LastSeenTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(i)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>e(s.m.PrivacyProfilePhoto)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("PrivacyProfilePhotoTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(d)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>e(s.m.PrivacyForwarding)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("PrivacyForwardsTitle")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(m)))),n.a.createElement(Ee.a,{narrow:!0,onClick:()=>e(s.m.PrivacyGroupChats)},n.a.createElement("div",{className:"multiline-menu-item"},n.a.createElement("span",{className:"title"},E("WhoCanAddMe")),n.a.createElement("span",{className:"subtitle",dir:"auto"},f(u))))),l&&n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header",dir:E.isRtl?"rtl":void 0},E("lng_settings_sensitive_title")),n.a.createElement(aa.a,{label:E("lng_settings_sensitive_disable_filtering"),subLabel:E("lng_settings_sensitive_about"),checked:Boolean(r),disabled:!l,onCheck:v})))})),xa=a(14);var Ua=Object(n.h)(Object(c.h)(e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language}),(e,t)=>Object(u.l)(t,["loadLanguages","setSettingOption"]))(({languages:e,language:t,loadLanguages:a,setSettingOption:c})=>{const[r,s]=Object(n.r)(t),[l,o,i]=Object(xe.a)();Object(n.n)(()=>{a()},[a]);const d=Object(n.m)(e=>{s(e),o(),Object(xa.c)(e,()=>{i(),c({language:e})})},[o,i,c]),m=Object(n.p)(()=>e?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)}(e):void 0,[e]);return n.a.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},m?n.a.createElement(oa.a,{name:"keyboard-send-settings",options:m,selected:r,loadingOption:l?r:void 0,onChange:d}):n.a.createElement(be.a,null))}));function Ga(e){switch(e){case s.m.PrivacyPhoneNumber:case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case s.m.PrivacyLastSeen:case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyLastSeenDeniedContacts:return"lastSeen";case s.m.PrivacyProfilePhoto:case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case s.m.PrivacyForwarding:case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyForwardingDeniedContacts:return"forwards";case s.m.PrivacyGroupChats:case s.m.PrivacyGroupChatsAllowedContacts:case s.m.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}var qa=Object(n.h)(Object(c.h)((e,{screen:t})=>{let a;const{chats:{byId:n},settings:{privacy:c}}=e;switch(t){case s.m.PrivacyPhoneNumber:a=c.phoneNumber;break;case s.m.PrivacyLastSeen:a=c.lastSeen;break;case s.m.PrivacyProfilePhoto:a=c.profilePhoto;break;case s.m.PrivacyForwarding:a=c.forwards;break;case s.m.PrivacyGroupChats:a=c.chatInvite}return a?{...a,chatsById:n}:{}},(e,t)=>Object(u.l)(t,["setPrivacyVisibility"]))(({screen:e,onScreenSelect:t,visibility:a,allowUserIds:c,allowChatIds:r,blockUserIds:l,blockChatIds:o,chatsById:i,setPrivacyVisibility:d})=>{const m=Object(F.a)(),u=Object(n.p)(()=>{switch(e){case s.m.PrivacyProfilePhoto:case s.m.PrivacyGroupChats:return[{value:"everybody",label:m("P2PEverybody")},{value:"contacts",label:m("P2PContacts")}];default:return[{value:"everybody",label:m("P2PEverybody")},{value:"contacts",label:m("P2PContacts")},{value:"nobody",label:m("P2PNobody")}]}},[m,e]),h={shouldShowDenied:"nobody"!==a,shouldShowAllowed:"everybody"!==a},b=Ga(e),p=Object(n.p)(()=>{switch(e){case s.m.PrivacyPhoneNumber:return m("PrivacyPhoneTitle");case s.m.PrivacyLastSeen:return m("LastSeenTitle");case s.m.PrivacyProfilePhoto:return m("PrivacyProfilePhotoTitle");case s.m.PrivacyForwarding:return m("PrivacyForwardsTitle");case s.m.PrivacyGroupChats:return m("WhoCanAddMe");default:return}},[m,e]),g=Object(n.p)(()=>{switch(e){case s.m.PrivacyLastSeen:return m("CustomHelp");default:return}},[m,e]),v=(()=>{switch(e){case s.m.PrivacyPhoneNumber:return s.m.PrivacyPhoneNumberAllowedContacts;case s.m.PrivacyLastSeen:return s.m.PrivacyLastSeenAllowedContacts;case s.m.PrivacyProfilePhoto:return s.m.PrivacyProfilePhotoAllowedContacts;case s.m.PrivacyForwarding:return s.m.PrivacyForwardingAllowedContacts;default:return s.m.PrivacyGroupChatsAllowedContacts}})(),E=(()=>{switch(e){case s.m.PrivacyPhoneNumber:return s.m.PrivacyPhoneNumberDeniedContacts;case s.m.PrivacyLastSeen:return s.m.PrivacyLastSeenDeniedContacts;case s.m.PrivacyProfilePhoto:return s.m.PrivacyProfilePhotoDeniedContacts;case s.m.PrivacyForwarding:return s.m.PrivacyForwardingDeniedContacts;default:return s.m.PrivacyGroupChatsDeniedContacts}})(),f=Object(n.p)(()=>c&&r&&i?r.reduce((e,t)=>e+(i[t]?i[t].membersCount:0),c.length):0,[r,c,i]),O=Object(n.p)(()=>l&&o&&i?o.reduce((e,t)=>e+(i[t]?i[t].membersCount:0),l.length):0,[o,l,i]),j=Object(n.m)(e=>{d({privacyKey:b,visibility:e})},[b,d]);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:m.isRtl?"rtl":void 0},p),n.a.createElement(oa.a,{name:"visibility-"+b,options:u,onChange:j,selected:a}),g&&n.a.createElement("p",{className:"settings-item-description-larger",dir:m.isRtl?"rtl":void 0},g)),n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:m.isRtl?"rtl":void 0},m("PrivacyExceptions")),h.shouldShowAllowed&&n.a.createElement(Ee.a,{narrow:!0,icon:"add-user",onClick:()=>{t(v)}},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"},m("AlwaysShareWith")),n.a.createElement("span",{className:"subtitle"},m("EditAdminAddUsers")))),h.shouldShowDenied&&n.a.createElement(Ee.a,{narrow:!0,icon:"delete-user",onClick:()=>{t(E)}},n.a.createElement("div",{className:"multiline-menu-item full-size"},O>0&&n.a.createElement("span",{className:"date",dir:"auto"},"−",O),n.a.createElement("span",{className:"title"},m("NeverShareWith")),n.a.createElement("span",{className:"subtitle"},m("EditAdminAddUsers"))))))}));function za(e){return[e.region,e.country].filter(Boolean).join(", ")}function Ha(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}var $a=Object(n.h)(Object(c.h)(e=>({activeSessions:e.activeSessions}),(e,t)=>Object(u.l)(t,["loadAuthorizations","terminateAuthorization","terminateAllAuthorizations"]))(({activeSessions:e,loadAuthorizations:t,terminateAuthorization:a,terminateAllAuthorizations:c})=>{const[r,s,l]=Object(xe.a)();Object(n.n)(()=>{t()},[t]);const o=Object(n.m)(e=>{a({hash:e})},[a]),i=Object(n.m)(()=>{l(),c()},[l,c]),d=Object(n.p)(()=>e.find(e=>e.isCurrent),[e]),m=Object(n.p)(()=>e.filter(e=>!e.isCurrent),[e]),u=Object(F.a)();function h(e){return n.a.createElement(Ee.a,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{o(e.hash)}}]},n.a.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},n.a.createElement("span",{className:"date"},Object(D.g)(u,1e3*e.dateActive)),n.a.createElement("span",{className:"title"},e.appName),n.a.createElement("span",{className:"subtitle black tight"},Ha(e)),n.a.createElement("span",{className:"subtitle"},e.ip," - ",za(e))))}return n.a.createElement("div",{className:"settings-content custom-scroll"},d&&(p=d,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:u.isRtl?"rtl":void 0},u("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"},p.appName),n.a.createElement("span",{className:"subtitle black tight"},Ha(p)),n.a.createElement("span",{className:"subtitle"},p.ip," - ",za(p)))),n.a.createElement(Ee.a,{className:"destructive mb-0",icon:"stop",ripple:!0,narrow:!0,onClick:s},u("TerminateAllSessions")))),m&&(b=m,n.a.createElement("div",{className:"settings-item"},n.a.createElement("h4",{className:"settings-item-header mb-4",dir:u.isRtl?"rtl":void 0},"Other Sessions"),b.map(h))),m&&n.a.createElement(we.a,{isOpen:r,onClose:l,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:i,confirmIsDestructive:!0}));var b,p}));var _a=Object(n.h)(Object(c.h)(e=>{const{chats:{byId:t},users:{byId:a},blocked:{ids:n}}=e;return{chatsByIds:t,usersByIds:a,blockedIds:n}},(e,t)=>Object(u.l)(t,["unblockContact"]))(({chatsByIds:e,usersByIds:t,blockedIds:a,unblockContact:c})=>{const r=Object(n.m)(e=>{c({contactId:e})},[c]),s=Object(F.a)();return 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:s.isRtl?"rtl":void 0},s("BlockedUsersInfo"))),n.a.createElement("div",{className:"chat-list custom-scroll"},a&&a.length?n.a.createElement("div",{className:"scroll-container"},a.map((a,c)=>function(a,c,o){const i=Object(m.mb)(a),d=i?t[a]:void 0,u=i?void 0:e[a],h=Object(V.a)("Chat chat-item-clickable blocked-list-item",i?"private":"group");return n.a.createElement(Ee.a,{key:a,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{r(a)}}],style:`top: ${(o+c)*l.i}px;`},n.a.createElement(x.a,{size:"medium",user:d,chat:u}),n.a.createElement("div",{className:"contact-info",dir:"auto"},n.a.createElement("h3",{dir:"auto"},Object(B.a)((i?Object(m.ab)(d):Object(m.k)(s,u))||"")),d&&d.phoneNumber&&n.a.createElement("div",{className:"contact-phone",dir:"auto"},Object(xt.c)(d.phoneNumber)),d&&!d.phoneNumber&&d.username&&n.a.createElement("div",{className:"contact-username",dir:"auto"},"@",d.username)))}(a,c,0))):a&&!a.length?n.a.createElement("div",{className:"no-results",dir:"auto"},"List is empty"):n.a.createElement(be.a,{key:"loading"}))),n.a.createElement(qt,{isShown:!0,onClick:()=>{},className:"not-implemented",ariaLabel:"Add a blocked user"},n.a.createElement("i",{className:"icon-add"})))})),Va=a(128);var Wa=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(d.c)(e,"🔐")}))(({animatedEmoji:e,onScreenSelect:t})=>{const a=Object(F.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Va.a,{sticker:e}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},Object(B.a)(a("EnabledPasswordText"),["br"]))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(Ee.a,{icon:"edit",onClick:()=>t(s.m.TwoFaChangePasswordCurrent)},a("ChangePassword")),n.a.createElement(Ee.a,{icon:"password-off",onClick:()=>t(s.m.TwoFaTurnOff)},a("TurnPasswordOff")),n.a.createElement(Ee.a,{icon:"email",onClick:()=>t(s.m.TwoFaRecoveryEmailCurrentPassword)},a("SetRecoveryEmail"))))})),Ka=a(147),Ya=a(148);var Za=Object(n.h)(({error:e,isLoading:t,expectedPassword:a,placeholder:c="Current Password",hint:r,submitLabel:s,clearError:l,onSubmit:o})=>{const[i,d]=Object(n.r)(""),[m,u]=Object(n.r)(!1),h=Object(n.m)(e=>{a&&e!==a?d("Passwords Should Be Equal"):o(e)},[o,a]),b=Object(n.m)(()=>{l&&l(),d("")},[l]),p=Object(F.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Ka.a,{isBig:!0,isPasswordVisible:m})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(Ya.a,{error:i||e,hint:r,placeholder:c,submitLabel:s||p("Next"),clearError:b,isLoading:t,isPasswordVisible:m,onChangePasswordVisibility:u,onSubmit:h})))});var Qa=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(d.c)(e,"🔐")}))(({animatedEmoji:e,onStart:t})=>{const a=Object(F.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Va.a,{sticker:e}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},a("SetAdditionalPasswordInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(R.a,{onClick:t},a("EditAdminTransferSetPassword"))))}));const Xa=o.k?550:400;var Ja=Object(n.h)(Object(c.h)((e,{icon:t})=>({animatedEmoji:Object(d.c)(e,"email"===t?"💌":"💡")}))(({animatedEmoji:e,type:t="text",isLoading:a,error:c,placeholder:r,shouldConfirm:s,clearError:l,onSubmit:i})=>{const d=Object(n.q)(null),[m,u]=Object(n.r)(""),[h,b,p]=Object(xe.a)(!1);Object(n.n)(()=>{o.m||setTimeout(()=>{d.current.focus()},Xa)},[]);const g=Object(F.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Va.a,{sticker:e})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),d.current&&i(m)}},n.a.createElement(ge.a,{ref:d,value:m,inputMode:t,label:r,error:c,onChange:e=>{c&&l&&l(),u(e.target.value)}}),m?n.a.createElement(R.a,{type:"submit",isLoading:a,ripple:!0},g("Continue")):n.a.createElement(R.a,{isText:!0,isLoading:a,ripple:!0,onClick:s?b:()=>{i()}},g("YourEmailSkip"))),s&&n.a.createElement(pe.a,{className:"narrow",isOpen:h,title:g("YourEmailSkipWarning"),onClose:p},Object(B.a)(g("YourEmailSkipWarningText"),["br","simple_markdown"]),n.a.createElement("div",{className:"dialog-buttons"},n.a.createElement(R.a,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{p(),i()}},g("YourEmailSkip")),n.a.createElement(R.a,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:p},g("Cancel"))))))}));var en=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(d.c)(e,"🥳")}))(({animatedEmoji:e,onScreenSelect:t})=>{const a=Object(F.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Va.a,{sticker:e}),n.a.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},a("TwoStepVerificationPasswordSetInfo"))),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(R.a,{onClick:()=>{t(s.m.Privacy)}},a("TwoStepVerificationPasswordReturnSettings"))))}));const tn=o.k?550:400;var an=Object(n.h)(Object(c.h)(e=>({animatedEmoji:Object(d.c)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength}))(({animatedEmoji:e,codeLength:t,isLoading:a,error:c,clearError:r,onSubmit:s})=>{const l=Object(n.q)(null),[i,d]=Object(n.r)("");Object(n.n)(()=>{o.m||setTimeout(()=>{l.current.focus()},tn)},[]);const m=Object(F.a)();return n.a.createElement("div",{className:"settings-content two-fa custom-scroll"},n.a.createElement("div",{className:"settings-content-header"},n.a.createElement(Va.a,{sticker:e})),n.a.createElement("div",{className:"settings-item pt-0 no-border"},n.a.createElement(ge.a,{value:i,ref:l,inputMode:"decimal",label:m("YourEmailCode"),error:c,onChange:e=>{c&&r&&r();const a=e.target.value.slice(0,t);a.length===t&&s(a),d(a),e.target.value=a}}),a&&n.a.createElement(be.a,null)))}));var nn=Object(n.h)(Object(c.h)(e=>({...e.twoFaSettings}),(e,t)=>Object(u.l)(t,["updatePassword","updateRecoveryEmail","clearPassword","provideTwoFaEmailCode","checkPassword","clearTwoFaError"]))(({currentScreen:e,state:t,hint:a,isLoading:c,error:r,waitingEmailCodeLength:l,dispatch:o,onScreenSelect:i,updatePassword:d,checkPassword:m,clearTwoFaError:u,updateRecoveryEmail:h,provideTwoFaEmailCode:b,clearPassword:p})=>{Object(n.n)(()=>{l&&(e===s.m.TwoFaNewPasswordEmail?i(s.m.TwoFaNewPasswordEmailCode):e===s.m.TwoFaRecoveryEmail&&i(s.m.TwoFaRecoveryEmailCode))},[e,i,l]);const g=Object(n.m)(()=>{o({type:"reset"}),i(s.m.TwoFaNewPassword)},[o,i]),v=Object(n.m)(e=>{o({type:"setPassword",payload:e}),i(s.m.TwoFaNewPasswordConfirm)},[o,i]),E=Object(n.m)(()=>{i(s.m.TwoFaNewPasswordHint)},[i]),f=Object(n.m)(e=>{o({type:"setHint",payload:e}),i(s.m.TwoFaNewPasswordEmail)},[o,i]),O=Object(n.m)(e=>{o({type:"setEmail",payload:e}),d({...t,email:e,onSuccess:()=>{i(s.m.TwoFaCongratulations)}})},[o,i,t,d]),j=Object(n.m)(e=>{o({type:"setCurrentPassword",payload:e}),m({currentPassword:e,onSuccess:()=>{i(s.m.TwoFaChangePasswordNew)}})},[m,o,i]),C=Object(n.m)(e=>{o({type:"setPassword",payload:e}),i(s.m.TwoFaChangePasswordConfirm)},[o,i]),y=Object(n.m)(()=>{i(s.m.TwoFaChangePasswordHint)},[i]),k=Object(n.m)(e=>{o({type:"setHint",payload:e}),d({...t,hint:e,onSuccess:()=>{i(s.m.TwoFaCongratulations)}})},[o,i,t,d]),N=Object(n.m)(e=>{p({currentPassword:e,onSuccess:()=>{i(s.m.Privacy)}})},[p,i]),I=Object(n.m)(e=>{o({type:"setCurrentPassword",payload:e}),m({currentPassword:e,onSuccess:()=>{i(s.m.TwoFaRecoveryEmail)}})},[m,o,i]),S=Object(n.m)(e=>{o({type:"setEmail",payload:e}),h({...t,email:e,onSuccess:()=>{i(s.m.TwoFaCongratulations)}})},[o,i,t,h]),w=Object(n.m)(e=>{b({code:e})},[b]),P=Object(F.a)();switch(e){case s.m.TwoFaDisabled:return n.a.createElement(Qa,{onStart:g});case s.m.TwoFaNewPassword:return n.a.createElement(Za,{placeholder:P("EnterPassword"),submitLabel:P("Continue"),onSubmit:v});case s.m.TwoFaNewPasswordConfirm:return n.a.createElement(Za,{expectedPassword:t.password,placeholder:P("PleaseReEnterPassword"),submitLabel:P("Continue"),onSubmit:E});case s.m.TwoFaNewPasswordHint:return n.a.createElement(Ja,{icon:"hint",placeholder:P("PasswordHintPlaceholder"),onSubmit:f});case s.m.TwoFaNewPasswordEmail:return n.a.createElement(Ja,{icon:"email",type:"email",isLoading:c,error:r,clearError:u,placeholder:P("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:O});case s.m.TwoFaNewPasswordEmailCode:return n.a.createElement(an,{isLoading:c,error:r,clearError:u,onSubmit:w});case s.m.TwoFaCongratulations:return n.a.createElement(en,{onScreenSelect:i});case s.m.TwoFaEnabled:return n.a.createElement(Wa,{onScreenSelect:i});case s.m.TwoFaChangePasswordCurrent:return n.a.createElement(Za,{isLoading:c,error:r,clearError:u,hint:a,onSubmit:j});case s.m.TwoFaChangePasswordNew:return n.a.createElement(Za,{placeholder:P("PleaseEnterNewFirstPassword"),onSubmit:C});case s.m.TwoFaChangePasswordConfirm:return n.a.createElement(Za,{expectedPassword:t.password,placeholder:P("PleaseReEnterPassword"),onSubmit:y});case s.m.TwoFaChangePasswordHint:return n.a.createElement(Ja,{isLoading:c,error:r,clearError:u,icon:"hint",placeholder:P("PasswordHintPlaceholder"),onSubmit:k});case s.m.TwoFaTurnOff:return n.a.createElement(Za,{isLoading:c,error:r,clearError:u,hint:a,onSubmit:N});case s.m.TwoFaRecoveryEmailCurrentPassword:return n.a.createElement(Za,{isLoading:c,error:r,clearError:u,hint:a,onSubmit:I});case s.m.TwoFaRecoveryEmail:return n.a.createElement(Ja,{icon:"email",type:"email",placeholder:P("RecoveryEmailTitle"),onSubmit:S});case s.m.TwoFaRecoveryEmailCode:return n.a.createElement(an,{isLoading:c,error:r,clearError:u,onSubmit:w});default:return}}));var cn=Object(n.h)(({itemIds:e,selectedIds:t,filterValue:a,filterPlaceholder:c,notFoundText:r,searchInputId:s,isLoading:l,onSelectedIdsChange:o,onFilterChange:i,onLoadMore:d})=>{const u=Object(n.q)(null),h=t.length>10;Object(n.n)(()=>{setTimeout(()=>{requestAnimationFrame(()=>{u.current.focus()})},500)},[]);const b=Object(n.m)(e=>{const a=[...t];a.includes(e)?a.splice(a.indexOf(e),1):a.push(e),o(a),i("")},[t,o,i]),p=Object(n.m)(e=>{const{value:t}=e.currentTarget;i(t)},[i]),[g,v]=Object(ue.a)(d,e,Boolean(a)),E=Object(F.a)();return n.a.createElement("div",{className:"Picker"},n.a.createElement("div",{className:"picker-header custom-scroll",dir:E.isRtl?"rtl":void 0},t.map((e,a)=>n.a.createElement(at.a,{chatOrUserId:e,isMinimized:h&&a<t.length-5,canClose:!0,onClick:b,clickArg:e})),n.a.createElement(ge.a,{id:s,ref:u,value:a,onChange:p,placeholder:c||E("SelectChat")})),g&&g.length?n.a.createElement(ve.a,{className:"picker-list custom-scroll",items:g,onLoadMore:v},g.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable picker-list-item",onClick:()=>b(e),ripple:!0},n.a.createElement(aa.a,{label:"",checked:t.includes(e)}),Object(m.mb)(e)?n.a.createElement(fe.a,{userId:e}):n.a.createElement(Oe.a,{chatId:e})))):l||!g||g.length?n.a.createElement(be.a,null):n.a.createElement("p",{className:"no-results"},r||"Sorry, nothing found."))});function rn(e,t){const{privacy:a}=e.settings;switch(t){case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyPhoneNumberDeniedContacts:return a.phoneNumber;case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyLastSeenDeniedContacts:return a.lastSeen;case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:return a.profilePhoto;case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyForwardingDeniedContacts:return a.forwards;case s.m.PrivacyGroupChatsDeniedContacts:case s.m.PrivacyGroupChatsAllowedContacts:return a.chatInvite}}var sn=Object(n.h)(Object(c.h)((e,{screen:t})=>{const{chats:{byId:a,listIds:n,orderedPinnedIds:c},currentUserId:r}=e;return{currentUserId:r,chatsById:a,listIds:n.active,orderedPinnedIds:c.active,archivedPinnedIds:c.archived,archivedListIds:n.archived,settings:rn(e,t)}},(e,t)=>Object(u.l)(t,["setPrivacySettings"]))(({currentUserId:e,isAllowList:t,screen:a,settings:c,chatsById:r,listIds:l,orderedPinnedIds:o,archivedListIds:i,archivedPinnedIds:d,setPrivacySettings:u,onScreenSelect:h})=>{const b=Object(F.a)(),p=Object(n.p)(()=>c?t?[...c.allowUserIds,...c.allowChatIds]:[...c.blockUserIds,...c.blockChatIds]:[],[t,c]),[g,v]=Object(n.r)(""),[E,f]=Object(n.r)(!1),[O,j]=Object(n.r)(p),C=Object(n.p)(()=>{const e=l?Object(m.Bb)(r,l,o,"all"):void 0,t=i?Object(m.Bb)(r,i,d,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]},[r,l,o,i,d]),y=Object(n.p)(()=>{if(C)return C.filter(t=>(Object(m.mb)(t.id)&&t.id!==e||Object(m.lb)(t))&&(!g||Object(me.a)(Object(m.k)(b,t),g)||p.includes(t.id))).map(({id:e})=>e)},[C,e,b,g,p]),k=Object(n.m)(e=>{j(e),f(!0)},[]),N=Object(n.m)(()=>{u({privacyKey:Ga(a),isAllowList:Boolean(t),contactsIds:O}),h(s.m.Privacy)},[t,O,h,a,u]);return n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(cn,{itemIds:y||[],selectedIds:O,filterValue:g,filterPlaceholder:b(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:k,onFilterChange:v}),n.a.createElement(qt,{isShown:E,onClick:N,ariaLabel:b(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},n.a.createElement("i",{className:"icon-arrow-right"})))}));a(278);const ln=Object.keys(s.m).length/2;var on=Object(n.h)(({currentScreen:e,onScreenSelect:t,onReset:a})=>{const[c,r]=It(Tt,At),[l,i]=It(Dt,Rt),d=Object(n.m)(()=>{e!==s.m.FoldersCreateFolder&&e!==s.m.FoldersEditFolder||setTimeout(()=>{r({type:"reset"})},200),e!==s.m.FoldersIncludedChats&&e!==s.m.FoldersExcludedChats?a():"create"===c.mode?t(s.m.FoldersCreateFolder):t(s.m.FoldersEditFolder)},[c.mode,r,e,a,t]),m=Object(n.m)(()=>{r({type:"saveFilters"}),d()},[r,d]);function u(){return n.a.createElement(n.a.Fragment,null,n.a.createElement(Bt,{currentScreen:e,onReset:d,onSaveFilter:m,editedFolderId:c.folderId}),function(){switch(e){case s.m.Main:return n.a.createElement(Ut,{onScreenSelect:t});case s.m.EditProfile:return n.a.createElement(Wt,null);case s.m.General:return n.a.createElement(va,{onScreenSelect:t});case s.m.Notifications:return n.a.createElement(Da,null);case s.m.Privacy:return n.a.createElement(Ba,{onScreenSelect:t});case s.m.Language:return n.a.createElement(Ua,null);case s.m.GeneralChatBackground:return n.a.createElement(Ma,{onScreenSelect:t});case s.m.GeneralChatBackgroundColor:return n.a.createElement(Ra,{onScreenSelect:t});case s.m.PrivacyActiveSessions:return n.a.createElement($a,null);case s.m.PrivacyBlockedUsers:return n.a.createElement(_a,null);case s.m.PrivacyPhoneNumber:case s.m.PrivacyLastSeen:case s.m.PrivacyProfilePhoto:case s.m.PrivacyForwarding:case s.m.PrivacyGroupChats:return n.a.createElement(qa,{screen:e,onScreenSelect:t});case s.m.PrivacyPhoneNumberAllowedContacts:case s.m.PrivacyLastSeenAllowedContacts:case s.m.PrivacyProfilePhotoAllowedContacts:case s.m.PrivacyForwardingAllowedContacts:case s.m.PrivacyGroupChatsAllowedContacts:return n.a.createElement(sn,{isAllowList:!0,screen:e,onScreenSelect:t});case s.m.PrivacyPhoneNumberDeniedContacts:case s.m.PrivacyLastSeenDeniedContacts:case s.m.PrivacyProfilePhotoDeniedContacts:case s.m.PrivacyForwardingDeniedContacts:case s.m.PrivacyGroupChatsDeniedContacts:return n.a.createElement(sn,{screen:e,onScreenSelect:t});case s.m.Folders:case s.m.FoldersCreateFolder:case s.m.FoldersEditFolder:case s.m.FoldersIncludedChats:case s.m.FoldersExcludedChats:return n.a.createElement(ra,{currentScreen:e,state:c,dispatch:r,onScreenSelect:t,onReset:d});case s.m.TwoFaDisabled:case s.m.TwoFaNewPassword:case s.m.TwoFaNewPasswordConfirm:case s.m.TwoFaNewPasswordHint:case s.m.TwoFaNewPasswordEmail:case s.m.TwoFaNewPasswordEmailCode:case s.m.TwoFaCongratulations:case s.m.TwoFaEnabled:case s.m.TwoFaChangePasswordCurrent:case s.m.TwoFaChangePasswordNew:case s.m.TwoFaChangePasswordConfirm:case s.m.TwoFaChangePasswordHint:case s.m.TwoFaTurnOff:case s.m.TwoFaRecoveryEmailCurrentPassword:case s.m.TwoFaRecoveryEmail:case s.m.TwoFaRecoveryEmailCode:return n.a.createElement(nn,{currentScreen:e,state:l,dispatch:i,onScreenSelect:t});default:return}}())}return n.a.createElement(T.a,{id:"Settings",name:o.k?"slide-layers":"push-slide",activeKey:e,renderCount:ln},u)});const dn=Object(_.h)(e=>e(),6e4,!0);var mn=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users;return{usersById:a,contactIds:t,serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(u.l)(t,["loadContactList","openChat"]))(({filter:e,usersById:t,contactIds:a,loadContactList:c,openChat:r,serverTimeOffset:s})=>{Object(n.n)(()=>{dn(()=>{c()})});const l=Object(n.m)(e=>{r({id:e})},[r]),i=Object(n.p)(()=>{if(!a)return;const n=e?a.filter(a=>{const n=t[a];if(!n)return!1;const c=Object(m.ab)(n);return c&&Object(me.a)(c,e)}):a;return Object(m.Fb)(n,t,void 0,s)},[a,e,t,s]),[d,u]=Object(ue.a)(void 0,i,Boolean(e));return n.a.createElement(ve.a,{items:d,onLoadMore:u,className:"chat-list custom-scroll"},d&&d.length?d.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable",onClick:()=>l(e),ripple:!o.k},n.a.createElement(fe.a,{userId:e,forceShowSelf:!0,avatarSize:"large"}))):d&&!d.length?n.a.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},e.length?"No contacts matched your search.":"Contact list is empty."):n.a.createElement(be.a,{key:"loading"}))}));const un=Object(_.h)(e=>e(),6e4,!0);var hn=Object(n.h)(Object(c.h)(e=>{const{userIds:t}=e.contactList||{},{byId:a}=e.users,{byId:n}=e.chats,{currentUserId:c,serverTimeOffset:r}=e,{query:s,fetchingStatus:l,globalResults:o,localResults:i}=e.globalSearch,{userIds:d}=o||{},{userIds:m}=i||{};return{currentUserId:c,usersById:a,chatsById:n,localContactIds:t,searchQuery:s,isSearching:l&&l.chats,globalUserIds:d,localUserIds:m,serverTimeOffset:r}},(e,t)=>Object(u.l)(t,["loadContactList","setGlobalSearchQuery"]))(({isChannel:e,selectedMemberIds:t,onSelectedMemberIdsChange:a,onNextStep:c,onReset:r,currentUserId:s,usersById:l,chatsById:o,localContactIds:i,searchQuery:d,isSearching:h,localUserIds:b,globalUserIds:p,serverTimeOffset:g,loadContactList:v,setGlobalSearchQuery:E})=>{Object(n.n)(()=>{un(()=>{v()})});const f=Object(n.m)(e=>{E({query:e})},[E]),O=Object(n.p)(()=>{const e=i?Object(m.Eb)(i.filter(e=>e!==s),o,void 0,void 0,g):[];if(!d)return e;const a=e.filter(e=>{const t=l[e];if(!t)return!1;const a=Object(m.ab)(t);return a&&Object(me.a)(a,d)});return Object(m.Eb)(Object(u.o)([...a,...b||[],...p||[]]),o,!1,t,g)},[i,o,g,d,b,p,t,s,l]),j=Object(n.m)(()=>{(t.length||e)&&(E({query:""}),c())},[t.length,e,E,c]),C=Object(F.a)();return n.a.createElement("div",{className:"NewChat step-1"},n.a.createElement("div",{className:"left-header"},n.a.createElement(R.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,C("GroupAddMembers"))),n.a.createElement("div",{className:"NewChat-inner step-1"},n.a.createElement(cn,{itemIds:O,selectedIds:t,filterValue:d,filterPlaceholder:C("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:h,onSelectedIdsChange:a,onFilterChange:f}),n.a.createElement(qt,{isShown:Boolean(t.length||e),onClick:j,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},n.a.createElement("i",{className:"icon-arrow-right"}))))}));var bn=Object(n.h)(Object(c.h)(e=>{const{progress:t,error:a}=e.chatCreation||{};return{creationProgress:t,creationError:a}},(e,t)=>Object(u.l)(t,["createGroupChat","createChannel"]))(({isChannel:e,memberIds:t,onReset:a,creationProgress:c,creationError:r,createGroupChat:l,createChannel:o})=>{const i=Object(F.a)(),[d,m]=Object(n.r)(""),[u,h]=Object(n.r)(""),[b,p]=Object(n.r)(),[g,v]=Object(n.r)(),E=c===s.a.InProgress,f=Object(n.m)(e=>{const{value:t}=e.currentTarget,a=t.replace(/^\s+/,"");m(a),a!==t&&(e.currentTarget.value=a)},[]),O=Object(n.m)(e=>{h(e.currentTarget.value)},[]),j=Object(n.m)(()=>{d.length?t.length>199?v("Sorry, creating supergroups is not yet supported"):l({title:d,photo:b,memberIds:t}):v("Chat title can't be empty")},[d,t,l,b,"Chat title can't be empty","Sorry, creating supergroups is not yet supported"]),C=Object(n.m)(()=>{d.length?o({title:d,about:u,photo:b,memberIds:t}):v("Channel title can't be empty")},[d,o,u,b,t,"Channel title can't be empty"]);Object(n.n)(()=>{c===s.a.Complete&&a(!0)},[c,a]);const y=r||("Chat title can't be empty"!==g&&"Channel title can't be empty"!==g?g:void 0);return n.a.createElement("div",{className:"NewChat"},n.a.createElement("div",{className:"left-header"},n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>a(),ariaLabel:"Return to member selection"},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement("h3",null,i(e?"NewChannel":"NewGroup"))),n.a.createElement("div",{className:"NewChat-inner step-2"},n.a.createElement(Gt.a,{onChange:p,title:i("AddPhoto")}),n.a.createElement(ge.a,{value:d,onChange:f,label:i(e?"EnterChannelName":"GroupName"),error:"Chat title can't be empty"===g||"Channel title can't be empty"===g?g:void 0}),e&&n.a.createElement(n.a.Fragment,null,n.a.createElement(ge.a,{value:u,onChange:O,label:i("DescriptionOptionalPlaceholder")}),n.a.createElement("p",{className:"note"},i("DescriptionInfo"))),y&&n.a.createElement("p",{className:"error"},y),t.length>0&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"chat-members-heading"},i("GroupInfo.ParticipantCount",t.length,"i")),n.a.createElement("div",{className:"chat-members-list custom-scroll"},t.map(e=>n.a.createElement(Ee.a,{inactive:!0,className:"chat-item-clickable"},n.a.createElement(fe.a,{userId:e})))))),n.a.createElement(qt,{isShown:0!==d.length,onClick:e?C:j,disabled:E,ariaLabel:e?i("ChannelIntro.CreateChannel"):"Create Group"},E?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-arrow-right"})))}));a(279);const pn=Object.keys(s.d).length/2;var gn=Object(n.h)(({isChannel:e=!1,content:t,onContentChange:a,onReset:c})=>{const[r,l]=Object(n.r)([]),i=Object(n.m)(()=>{a(e?s.d.NewChannelStep2:s.d.NewGroupStep2)},[e,a]);return n.a.createElement(T.a,{id:"NewChat",name:o.k?"slide-layers":"push-slide",renderCount:pn,activeKey:t},()=>{switch(t){case s.d.NewChannelStep1:case s.d.NewGroupStep1:return n.a.createElement(hn,{isChannel:e,selectedMemberIds:r,onSelectedMemberIdsChange:l,onNextStep:i,onReset:c});case s.d.NewChannelStep2:case s.d.NewGroupStep2:return n.a.createElement(bn,{isChannel:e,memberIds:r,onReset:c});default:return}})}),vn=a(189);a(280);var En=Object(n.h)(({isActive:e,onReset:t})=>{const a=Object(F.a)();return n.a.createElement("div",{className:"ArchivedChats"},n.a.createElement("div",{className:"left-header"},n.a.createElement(R.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,a("ArchivedChats"))),n.a.createElement(vn.a,{folderType:"archived",noChatsText:"Archive is empty.",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},On=e=>{e.preventDefault()};function jn(e){fn[e.key]&&On(e)}function Cn(){document.addEventListener("wheel",On,{passive:!1}),window.ontouchmove=On,document.onkeydown=jn}function yn(){document.removeEventListener("wheel",On),window.ontouchmove=null,document.onkeydown=null}var kn=a(54),Nn=a(152);function In(e,t){return e?"lng_context_copy_selected":t?"lng_context_copy_text":"Copy"}var Sn=a(173),wn=a(53);a(281);var Pn=({isOpen:e,message:t,anchor:a,canSendNow:c,canReschedule:s,canReply:l,canEdit:o,canPin:i,canUnpin:d,canDelete:u,canForward:h,canFaveSticker:b,canUnfaveSticker:p,canCopy:g,canCopyLink:v,canSelect:E,onReply:f,onEdit:O,onPin:j,onUnpin:C,onForward:y,onDelete:k,onFaveSticker:N,onUnfaveSticker:I,onSelect:S,onSend:w,onReschedule:P,onClose:M,onCloseAnimationEnd:L,onCopyLink:A})=>{const T=function(e,t,a){const n=[],c=Object(m.O)(e),s=Object(m.G)(e),l=Object(m.D)(e,"inline"),o=s&&l&&Nn.a,i=window.getSelection();if(o&&n.push({label:"lng_context_copy_image",handler:()=>{kn.b(l,r.ApiMediaFormat.BlobUrl).then(Nn.b),t&&t()}}),c){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,o),handler:()=>{const a=e&&i?i.toString():c;Object(Nn.c)(a),t&&t()}})}return a&&n.push({label:"lng_context_copy_message_link",handler:()=>{a(),t&&t()}}),n}(t,M,v?A:void 0),R=Object(n.m)(()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`),[t.id]),D=Object(n.m)(()=>document.querySelector(".active > .MessageList"),[]),B=Object(n.m)(()=>document.querySelector(".MessageContextMenu .bubble"),[]),{positionX:x,positionY:U,style:G}=Object(Sn.a)(a,R,D,B,10,document.querySelector(".MiddleHeader").offsetHeight),z=Object(F.a)();return n.a.createElement(wn.a,{isOpen:e,positionX:x,positionY:U,style:G,className:"MessageContextMenu fluid",onClose:M,onCloseAnimationEnd:L},c&&n.a.createElement(q.a,{icon:"send-outline",onClick:w},z("MessageScheduleSend")),s&&n.a.createElement(q.a,{icon:"schedule",onClick:P},z("MessageScheduleEditTime")),l&&n.a.createElement(q.a,{icon:"reply",onClick:f},z("Reply")),o&&n.a.createElement(q.a,{icon:"edit",onClick:O},z("Edit")),b&&n.a.createElement(q.a,{icon:"favorite",onClick:N},z("AddToFavorites")),p&&n.a.createElement(q.a,{icon:"favorite",onClick:I},z("Stickers.RemoveFromFavorites")),g&&T.map(e=>n.a.createElement(q.a,{key:e.label,icon:"copy",onClick:e.handler},z(e.label))),i&&n.a.createElement(q.a,{icon:"pin",onClick:j},z("DialogPin")),d&&n.a.createElement(q.a,{icon:"unpin",onClick:C},z("DialogUnpin")),h&&n.a.createElement(q.a,{icon:"forward",onClick:y},z("Forward")),E&&n.a.createElement(q.a,{icon:"select",onClick:S},z("Common.Select")),u&&n.a.createElement(q.a,{destructive:!0,icon:"delete",onClick:k},z("Delete")))};var Mn=Object(n.h)(Object(c.h)((e,{message:t,messageListType:a})=>{const{threadId:n}=Object(d.y)(e)||{},{noOptions:c,canReply:r,canPin:s,canUnpin:l,canDelete:o,canEdit:i,canForward:m,canFaveSticker:u,canUnfaveSticker:h,canCopy:b,canCopyLink:p,canSelect:g}=n&&Object(d.b)(e,t,n)||{},v="pinned"===a,E="scheduled"===a;return{noOptions:c,canSendNow:E,canReschedule:E,canReply:!v&&!E&&r,canPin:!E&&s,canUnpin:!E&&l,canDelete:o,canEdit:!v&&i,canForward:!E&&m,canFaveSticker:!E&&u,canUnfaveSticker:!E&&h,canCopy:b,canCopyLink:!E&&p,canSelect:g}},(e,t)=>Object(u.l)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","loadMessageLink"]))(({isOpen:e,messageListType:t,message:a,album:c,anchor:r,onClose:s,onCloseAnimationEnd:l,noOptions:o,canSendNow:i,canReschedule:d,canReply:m,canPin:u,canUnpin:h,canDelete:b,canEdit:p,canForward:g,canFaveSticker:v,canUnfaveSticker:E,canCopy:f,canCopyLink:O,canSelect:j,setReplyingToId:C,setEditingId:y,pinMessage:k,openForwardMenu:N,faveSticker:I,unfaveSticker:S,toggleMessageSelection:w,sendScheduledMessages:P,rescheduleMessage:M,loadMessageLink:F})=>{const{transitionClassNames:L}=Object(K.a)(e,l,void 0,!1),[A,T]=Object(n.r)(!0),[R,B]=Object(n.r)(!1),[x,U]=Object(n.r)(!1),[G,q,z]=Object(xe.a)(),H=Object(n.m)(()=>{T(!1),B(!0)},[]),$=Object(n.m)(()=>{T(!1),s()},[s]),_=Object(n.m)(()=>{B(!1),s()},[s]),V=Object(n.m)(()=>{U(!1),s()},[s]),W=Object(n.m)(()=>{z(),s()},[z,s]),Y=Object(n.m)(()=>{C({messageId:a.id}),$()},[C,a.id,$]),Z=Object(n.m)(()=>{y({messageId:a.id}),$()},[y,a.id,$]),Q=Object(n.m)(()=>{T(!1),U(!0)},[]),X=Object(n.m)(()=>{k({messageId:a.id,isUnpin:!0}),$()},[k,a.id,$]),J=Object(n.m)(()=>{if($(),c&&c.messages){const e=c.messages.map(({id:e})=>e);N({fromChatId:a.chatId,messageIds:e})}else N({fromChatId:a.chatId,messageIds:[a.id]})},[N,a,$,c]),ee=Object(n.m)(()=>{$(),I({sticker:a.content.sticker})},[$,a.content.sticker,I]),te=Object(n.m)(()=>{$(),S({sticker:a.content.sticker})},[$,a.content.sticker,S]),ae=Object(n.m)(()=>{const e=c&&c.messages?{messageId:a.id,childMessageIds:c.messages.map(({id:e})=>e),withShift:!1}:{messageId:a.id,withShift:!1};w(e),$()},[$,a.id,w,c]),ne=Object(n.m)(()=>{P({chatId:a.chatId,id:a.id}),$()},[$,a.chatId,a.id,P]),ce=Object(n.m)(()=>{T(!1),q()},[q]),re=Object(n.m)(e=>{M({chatId:a.chatId,messageId:a.id,scheduledAt:Math.round(e.getTime()/1e3)})},[a.chatId,a.id,M]),se=Object(n.m)(()=>{F({messageId:a.id,chatId:a.chatId}),$()},[$,F,a.chatId,a.id]);if(Object(n.n)(()=>(Cn(),yn),[]),o)return void $();const le=new Date;return le.setFullYear(le.getFullYear()+1),n.a.createElement("div",{className:["ContextMenuContainer",L].join(" ")},n.a.createElement(Pn,{message:a,isOpen:A,anchor:r,canSendNow:i,canReschedule:d,canReply:m,canDelete:b,canPin:u,canUnpin:h,canEdit:p,canForward:g,canFaveSticker:v,canUnfaveSticker:E,canCopy:f,canCopyLink:O,canSelect:j,onReply:Y,onEdit:Z,onPin:Q,onUnpin:X,onForward:J,onDelete:H,onFaveSticker:ee,onUnfaveSticker:te,onSelect:ae,onSend:ne,onReschedule:ce,onClose:$,onCopyLink:se}),n.a.createElement(Re,{isOpen:R,isSchedule:"scheduled"===t,onClose:_,album:c,message:a}),n.a.createElement(De,{isOpen:x,messageId:a.id,chatId:a.chatId,onClose:V}),n.a.createElement(Ae,{isOpen:G,withTimePicker:!0,selectedAt:1e3*a.date,maxAt:Object(D.k)(le),isFutureMode:!0,onClose:W,onSubmit:re}))}));a(282);var Fn=Object(n.h)(Object(c.h)((e,{fromSticker:t})=>({stickerSet:Object(d.xb)(e,t.stickerSetId)}),(e,t)=>Object(u.l)(t,["loadStickers","toggleStickerSet","sendMessage"]))(({isOpen:e,fromSticker:t,stickerSet:a,onClose:c,loadStickers:r,toggleStickerSet:s,sendMessage:o})=>{const i=Object(n.q)(null),d=Object(F.a)(),{observe:m}=Object(sa.a)({rootRef:i,throttleMs:200,isDisabled:!e});Object(n.n)(()=>{if(e){const{stickerSetId:e,stickerSetAccessHash:a}=t;r({stickerSetId:e,stickerSetAccessHash:a})}},[e,t,r]);const u=Object(n.m)(e=>{e={...e,isPreloadedGlobally:!0},o({sticker:e}),c()},[c,o]),h=Object(n.m)(()=>{s({stickerSetId:t.stickerSetId}),c()},[t.stickerSetId,c,s]);return n.a.createElement(pe.a,{className:"StickerSetModal",isOpen:e,onClose:c,hasCloseButton:!0,title:a?a.title: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(ha,{sticker:e,size:l.yb,observeIntersection:m,onClick:u,clickArg:e}))),n.a.createElement("div",{className:"button-wrapper"},n.a.createElement(R.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(be.a,null))})),Ln=a(122);a(283);var An=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t);return!a||a.isRestricted?{}:{chat:a,isMuted:Object(m.Db)(a,Object(d.eb)(e),Object(d.db)(e)),isPrivate:Object(m.mb)(a.id),canDeleteChat:Object(m.c)(a)}},(e,t)=>Object(u.l)(t,["updateChatMutedState","enterMessageSelectMode"]))(({chatId:e,isOpen:t,anchor:a,isChannel:c,canSubscribe:r,canSearch:s,canMute:l,canSelect:i,canLeave:d,chat:m,isPrivate:u,isMuted:h,canDeleteChat:b,onSubscribeChannel:p,onSearchClick:g,onClose:v,onCloseAnimationEnd:E,updateChatMutedState:f,enterMessageSelectMode:O})=>{const[j,C]=Object(n.r)(!0),[y,k]=Object(n.r)(!1),{x:N,y:I}=a;Object(K.a)(t,E,void 0,!1);const S=Object(n.m)(()=>{C(!1),k(!0)},[]),w=Object(n.m)(()=>{C(!1),v()},[v]),P=Object(n.m)(()=>{k(!1),v()},[v]),M=Object(n.m)(()=>{f({chatId:e,isMuted:!h}),w()},[e,w,h,f]),L=Object(n.m)(()=>{p(),w()},[w,p]),A=Object(n.m)(()=>{g(),w()},[w,g]),T=Object(n.m)(()=>{O(),w()},[w,O]);Object(n.n)(()=>(Cn(),yn),[]);const R=Object(F.a)();return n.a.createElement(Ln.a,null,n.a.createElement("div",{className:"HeaderMenuContainer"},n.a.createElement(wn.a,{isOpen:j,positionX:"right",style:`left: ${N}px;top: ${I}px;`,onClose:w},o.k&&r&&n.a.createElement(q.a,{icon:c?"channel":"group",onClick:L},R(c?"Subscribe":"Join Group")),o.k&&s&&n.a.createElement(q.a,{icon:"search",onClick:A},R("Search")),l&&n.a.createElement(q.a,{icon:h?"unmute":"mute",onClick:M},R(h?"ChatsUnmute":"ChatsMute")),i&&n.a.createElement(q.a,{icon:"select",onClick:T},R("ReportSelectMessages")),d&&n.a.createElement(q.a,{destructive:!0,icon:"delete",onClick:S},R(u?"Delete":b?"GroupInfo.DeleteAndExit":c?"LeaveChannel":"Group.LeaveGroup"))),m&&n.a.createElement(Ve.a,{isOpen:y,onClose:P,chat:m})))})),Tn=a(153);a(284);const Rn=Object(_.a)(e=>e(),200,!1);var Dn=Object(n.h)(Object(c.h)(e=>{const t=Object(d.r)(e);if(!t)return{};const{query:a,results:n}=Object(d.A)(e)||{},{totalCount:c,foundIds:r}=n||{};return{chat:t,query:a,totalCount:c,foundIds:r,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}},(e,t)=>Object(u.l)(t,["setLocalTextSearchQuery","searchTextMessagesLocal","focusMessage","closeLocalTextSearch","openHistoryCalendar"]))(({isActive:e,chat:t,query:a,totalCount:c,foundIds:r,isHistoryCalendarOpen:s,setLocalTextSearchQuery:l,searchTextMessagesLocal:o,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&&r&&r.length?(i({chatId:t.id,messageId:r[r.length-1]}),b(0)):b(-1)},[t,i,r]),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()},[s]);const p=Object(n.m)(e=>{l({query:e}),e.length&&Rn(o)},[o,l]),g=Object(n.m)(()=>{if(t&&r){const e=h+1;i({chatId:t.id,messageId:r[r.length-1-e]}),b(e)}},[t,h,i,r]),v=Object(n.m)(()=>{if(t&&r){const e=h-1;i({chatId:t.id,messageId:r[r.length-1-e]}),b(e)}},[t,h,i,r]);return n.a.createElement("div",{id:"MobileSearch",className:e?"active":""},n.a.createElement("div",{className:"header"},n.a.createElement(R.a,{size:"smaller",round:!0,color:"translucent",onClick:d},n.a.createElement("i",{className:"icon-arrow-left"})),n.a.createElement(Tn.a,{ref:u,value:a,onChange:p})),n.a.createElement("div",{className:"footer"},n.a.createElement("div",{className:"counter"},a?r&&r.length?`${h+1} of ${c}`:r&&!r.length?"No results":"":n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",onClick:()=>m({selectedAt:Object(D.k)(Date.now())}),ariaLabel:"Search messages by date"},n.a.createElement("i",{className:"icon-calendar"}))),n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",onClick:g,disabled:!r||!r.length||h===r.length-1},n.a.createElement("i",{className:"icon-up"})),n.a.createElement(R.a,{round:!0,size:"smaller",color:"translucent",onClick:v,disabled:!r||!r.length||0===h},n.a.createElement("i",{className:"icon-down"}))))})),Bn=a(59),xn=a(190),Un=a(182),Gn=a(178),qn=a(184);function zn(e,t,a=0,n=!1,c=!1,r=!1){const s=e[r?"scrollLeft":"scrollTop"],l=s+e[r?"offsetWidth":"offsetHeight"],o="string"==typeof t?e.querySelectorAll(t):t,{length:i}=o,d=[];let m=!1;for(let e=0;e<i;e++){const t=o[e],i=t[r?"offsetLeft":"offsetTop"],u=i+t[r?"offsetWidth":"offsetHeight"];if(c?u>=s-a&&u<=l+a:i<=l+a&&u>=s-a)d.push(e),m=!0;else if(m&&!n)break}return{allElements:o,visibleIndexes:d}}var Hn=function(e,t,a=!1){const n=e[a?"scrollLeft":"scrollTop"],c=n+e[a?"offsetWidth":"offsetHeight"],r=t[a?"offsetLeft":"offsetTop"],s=r+t[a?"offsetWidth":"offsetHeight"];return r>n&&s<c},$n=a(124),_n=a(133);a(285);var Vn=Object(n.h)(({isOpen:e,filter:t,onClose:a,onInsertUserName:c,usersById:r,filteredChatMembers:s})=>{const l=Object(n.q)(null),{shouldRender:o,transitionClassNames:i}=Object(K.a)(e,void 0,void 0,!1),d=Object(n.m)(e=>{if(!s)return-1;const t=s.length;return Object(_n.a)(t,e)},[s]),[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=r&&r[e];a&&c(a,t)},[r,c]),p=Object(n.m)(e=>{if(s&&s.length&&m>-1){const t=s[m];t&&(e.preventDefault(),b(t.userId,!0))}},[s,m,b]);Object(n.n)(()=>e?Object(Ue.a)({onEsc:a,onUp:e=>h(-1,e),onDown:e=>h(1,e),onEnter:p,onTab:p}):void 0,[e,a,h,p]),Object(n.n)(()=>{s&&!s.length&&a()},[s,a]),Object(n.n)(()=>{u(0)},[t]),Object(n.n)(()=>{!function(e,t){const a=t.current;if(!a||e<0)return;const{visibleIndexes:n,allElements:c}=zn(a,".chat-item-clickable",8,!0,!0);if(!c.length||!c[e])return;const r=n[0];if(!n.includes(e)||e===r&&!Hn(a,c[r])){const t=e>n[n.length-1]?"start":"end";Object($n.a)(a,c[e],t,10)}}(m,l)},[m]);const g=Object(O.a)(s&&s.length?s:void 0,o),v=s&&!s.length?g:s;if(!o||v&&!v.length)return;const E=Object(V.a)("MentionTooltip composer-tooltip custom-scroll",i);return n.a.createElement("div",{className:E,ref:l},v&&v.map(({userId:e},t)=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>b(e),focus:m===t},n.a.createElement(fe.a,{userId:e,avatarSize:"small",withUsername:!0}))))}),Wn=a(183);a(286);var Kn=Object(n.h)(({attachments:e,caption:t,canSuggestMembers:a,groupChatMembers:c,currentUserId:r,usersById:s,recentEmojis:o,language:i,emojiKeywords:d,onCaptionUpdate:m,addRecentEmoji:u,loadEmojiKeywords:h,onSend:p,onFileAppend:g,onClear:v})=>{const E=Object(n.q)(null),f=Object(O.a)(e),j=e.length?e:f,C=Boolean(e.length),[y,k,N]=Object(xe.a)(),I=j&&j.every(e=>e.quick),S=Object(F.a)(),{isMentionTooltipOpen:w,mentionFilter:P,closeMentionTooltip:M,insertMention:L,mentionFilteredMembers:A}=Object(xn.a)(a&&C,t,m,l.w,c,r,s),{isEmojiTooltipOpen:T,closeEmojiTooltip:D,filteredEmojis:B,insertEmoji:x}=Object(Un.a)(C,t,o,l.w,m,d);Object(n.n)(()=>C?Object(b.a)(v):void 0,[C,v]);const U=Object(n.m)(()=>{C&&p()},[C,p]),G=Object(n.m)(e=>{e.preventDefault(),N();const{dataTransfer:{files:t}}=e;if(t&&t.length){const e=I?Array.from(t).filter(e=>e.type&&l.l.includes(e.type)):Array.from(t);g(e,!1)}},[I,g,N]);if(!j)return;const q=j.every(e=>e.mimeType.startsWith("image/")),z=j.every(e=>e.mimeType.startsWith("video/"));let H="";return H=S(q?"PreviewSender.SendPhoto":z?"PreviewSender.SendVideo":"PreviewSender.SendFile",j.length,"i"),n.a.createElement(pe.a,{isOpen:C,onClose:v,header:function(){if(j)return n.a.createElement("div",{className:"modal-header-condensed",dir:S.isRtl?"rtl":void 0},n.a.createElement(R.a,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:v},n.a.createElement("i",{className:"icon-close"})),n.a.createElement("div",{className:"modal-title"},H),n.a.createElement(R.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:U},S("Send")))}(),className:"AttachmentModal "+(y?"hovered":"")},n.a.createElement("div",{className:"drop-target",onDragEnter:k,onDrop:G,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),E.current&&window.clearTimeout(E.current)},onDragLeave:e=>{const{relatedTarget:t,target:a}=e;a.matches(".drop-target")&&!t&&(E.current=window.setTimeout(N,150)),a&&a.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),N())},"data-attach-description":S("Preview.Dragging.AddItems",10)},I?n.a.createElement("div",{className:"media-wrapper custom-scroll"},j.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"},j.map(e=>n.a.createElement(Gn.a,{name:e.filename,extension:Object(Bn.d)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}))),n.a.createElement("div",{className:"attachment-caption-wrapper"},n.a.createElement(Vn,{isOpen:w,onClose:M,filter:P,onInsertUserName:L,filteredChatMembers:A,usersById:s}),n.a.createElement(Wn.a,{isOpen:T,emojis:B,onClose:D,language:i,onEmojiSelect:x,addRecentEmoji:u,loadEmojiKeywords:h}),n.a.createElement(qn.a,{id:"caption-input-text",html:t,editableInputId:l.w,placeholder:S("Caption"),onUpdate:m,onSend:p,shouldSetFocus:C}))))}),Yn=a(137);a(287);var Zn=Object(n.h)(({isOpen:e,onSend:t,onClear:a})=>{const c=Object(n.q)(null),r=Object(n.q)(null),s=Object(n.q)(null),[l,o]=Object(n.r)(""),[i,d]=Object(n.r)([""]),[m,u]=Object(n.r)(!0),[h,p]=Object(n.r)(!1),[g,v]=Object(n.r)(!1),[E,f]=Object(n.r)(),[O,j]=Object(n.r)(),[C,y]=Object(n.r)(!1),k=Object(F.a)(),N=Object(n.m)(t=>{e&&t.current&&t.current.focus()},[e]);Object(n.n)(()=>e?Object(b.a)(a):void 0,[e,a]),Object(n.n)(()=>{e||(o(""),d([""]),u(!0),p(!1),v(!1),f(""),j(""),y(!1))},[e]),Object(n.n)(()=>N(c),[N,e]),Object(n.o)(()=>{const e=s.current;e&&E!==e.innerHTML&&(e.innerHTML=E)},[E]);const I=Object(n.m)((e=[])=>{d([...e,""]),requestAnimationFrame(()=>{const e=r.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=l.trim().substring(0,255),n=i.map(e=>e.trim().substring(0,100)).filter(e=>e.length);if(!a||n.length<2)return o(a),n.length?n.length<2?I(n):d(n):I(),void y(!0);if(g&&(!O||!n[Number(O)]))return void y(!0);const c={summary:{question:a,answers:n.map((e,t)=>({text:e.trim(),option:String(t),...String(t)===O&&{correct:!0}})),...!m&&{isPublic:!0},...h&&{multipleChoice:!0},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=E&&Object(Yn.a)(E.substring(0,200))||{};c.quiz={correctAnswers:[O],...e&&{solution:e},...t&&{solutionEntities:t}}}t(c)},[e,l,i,g,O,m,h,t,I,E]),w=Object(n.m)((e,t)=>{const a=[...i];a[e]=t,a[a.length-1].trim().length&&a.length<10?I(a):d(a)},[i,I]),P=Object(n.m)(e=>{const t=[...i];t.splice(e,1),d(t),requestAnimationFrame(()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)})},[i]),M=Object(n.m)(e=>{j(e)},[j]),L=Object(n.m)(e=>{u(e.target.checked)},[]),A=Object(n.m)(e=>{p(e.target.checked)},[]),T=Object(n.m)(e=>{v(e.target.checked)},[]),D=Object(n.m)(e=>{13===e.keyCode&&S()},[S]),B=Object(n.m)(()=>{if(C&&!l.trim().length)return k("lng_polls_choose_question")},[C,k,l]),x=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 U(){return i.map((e,t)=>n.a.createElement("div",{className:"option-wrapper"},n.a.createElement(ge.a,{label:t!==i.length-1||10===i.length?k("OptionHint"):k("CreatePoll.AddOption"),error:x(t),value:e,onChange:e=>w(t,e.currentTarget.value),onKeyPress:D}),t!==i.length-1&&n.a.createElement(R.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(R.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(R.a,{color:"primary",size:"smaller",className:"modal-action-button",onClick:S},k("Create"))),className:"PollModal"},n.a.createElement(ge.a,{ref:c,label:k("AskAQuestion"),value:l,error:B(),onChange:e=>o(e.currentTarget.value),onKeyPress:D}),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"options-list custom-scroll",ref:r},n.a.createElement("h3",{className:"options-header"},k("PollOptions")),C&&function(){const e=i.map(e=>e.trim()).filter(e=>e.length);return g&&(!O||!e[Number(O)])&&n.a.createElement("p",{className:"error"},k("lng_polls_choose_correct"))}(),g?n.a.createElement(oa.a,{name:"correctOption",options:U().map((e,t)=>({value:String(t),label:e,hidden:t===i.length-1})),onChange:M}):U()),n.a.createElement("div",{className:"options-divider"}),n.a.createElement("div",{className:"quiz-mode"},n.a.createElement(aa.a,{label:k("PollAnonymous"),checked:m,onChange:L}),n.a.createElement(aa.a,{label:k("PollMultiple"),checked:h,disabled:g,onChange:A}),n.a.createElement(aa.a,{label:k("PollQuiz"),checked:g,disabled:h,onChange:T}),g&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h3",{className:"options-header"},k("lng_polls_solution_title")),n.a.createElement("div",{ref:s,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>f(e.currentTarget.innerHTML)}),n.a.createElement("div",{className:"note"},k("CreatePoll.ExplanationInfo")))))});let Qn;function Xn(e,t,a=250,c=!1){const r=Object(n.q)(!1);Object(n.n)(()=>{Qn&&(clearTimeout(Qn),Qn=void 0),!e||o.m||c||(Qn=window.setTimeout(()=>{r.current||t()},2*a))},[c,e,a,t]);return[Object(n.m)(()=>{r.current=!0},[]),Object(n.m)(()=>{r.current=!1,Qn&&(clearTimeout(Qn),Qn=void 0),Qn=window.setTimeout(()=>{r.current||t()},a)},[a,t])]}var Jn=a(65),ec=a(141);a(288);var tc=Object(n.h)(({emoji:e,focus:t,onClick:a})=>{const c=Object(n.m)(t=>{t.preventDefault(),a(e.native,e.id)},[e,a]);return n.a.createElement("div",{className:"EmojiButton "+(t?"focus":""),onMouseDown:c,title:`:${e.names[0]}:`},o.d?e.native:n.a.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))});var ac=Object(n.h)(({category:e,index:t,allEmojis:a,observeIntersection:c,shouldRender:r,onEmojiSelect:s})=>{const l=Object(n.q)(null);Object(sa.c)(l,c);const{transitionClassNames:i}=Object(K.a)(r,void 0,void 0,"slow"),d=Object(F.a)(),m=o.k?Math.floor((y.a.get().width-8)/44):9,u=44*Math.ceil(e.emojis.length/m);return n.a.createElement("div",{ref:l,key:e.id,id:"emoji-category-"+t,className:"symbol-set"},n.a.createElement("p",{className:"symbol-set-name",dir:"auto"},d("recent"===e.id?"RecentStickers":"Emoji"+t)),n.a.createElement("div",{className:Object(V.a)("symbol-set-container",i),style:`height: ${u}px;`,dir:d.isRtl?"rtl":void 0},r&&e.emojis.map(e=>{const t=a[e],c="id"in t?t:t[1];return n.a.createElement(tc,{key:c.id,emoji:c,onClick:s})})))});a(289);const nc={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"},cc=[];let rc,sc,lc;var oc=Object(n.h)(Object(c.h)(e=>Object(u.l)(e,["recentEmojis"]))(({className:e,onEmojiSelect:t,recentEmojis:c})=>{const r=Object(n.q)(null),s=Object(n.q)(null),[i,d]=Object(n.r)(),[m,u]=Object(n.r)(),[h,b]=Object(n.r)(0),{observe:p}=Object(sa.a)({rootRef:r,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-",""));cc[a]=e.isIntersecting});const t=cc.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&b(t[Math.floor(t.length/2)].index)});Object(Ke.a)(s.current,!o.k),Object(n.n)(()=>{if(!i)return;const e=s.current;if(!e)return;const t=42*h-e.offsetWidth/2+21;Object(ec.a)(e,t)},[i,h]);const g=Object(F.a)(),v=Object(n.p)(()=>{if(!i)return He.a;const e=[...i];return c&&c.length&&e.unshift({id:"recent",name:g("RecentStickers"),emojis:c}),e},[i,g,c]);Object(n.n)(()=>{setTimeout(()=>{const e=()=>{d(lc.categories),u(lc.emojis)};lc?e():async function(){rc||(rc=a.e(1).then(a.t.bind(null,315,3)),sc=(await rc).default,lc=Object(Jn.b)(sc));return rc}().then(e)},200)},[]);const E=Object(n.m)(e=>{b(e);const t=document.getElementById("emoji-category-"+e);Object($n.a)(r.current,t,"start",50,800)},[]),f=Object(n.m)((e,a)=>{t(e,a)},[t]),O=Object(ot.a)([],l.T);const j=Object(V.a)("EmojiPicker",e);return m&&O?n.a.createElement("div",{className:j},n.a.createElement("div",{ref:s,className:"EmojiPicker-header",dir:g.isRtl?"rtl":""},v.map((function(e,t){const a=nc[e.id];return a&&n.a.createElement(R.a,{className:"symbol-set-button "+(t===h?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>E(t),ariaLabel:e.name},n.a.createElement("i",{className:a}))}))),n.a.createElement("div",{ref:r,className:"EmojiPicker-main no-selection no-scrollbar"},v.map((e,t)=>n.a.createElement(ac,{category:e,index:t,allEmojis:m,observeIntersection:p,shouldRender:h>=t-1&&h<=t+1,onEmojiSelect:f})))):n.a.createElement("div",{className:j},n.a.createElement(be.a,null))}));const ic=o.k?8:16;var dc=Object(n.h)(({stickerSet:e,loadAndPlay:t,index:a,observeIntersection:c,shouldRender:r,onStickerSelect:s,onStickerUnfave:i})=>{const d=Object(n.q)(null);Object(sa.c)(d,c);const{transitionClassNames:m}=Object(K.a)(r,void 0,void 0,"slow"),u=o.k?Math.floor((y.a.get().width-8)/(l.zb+ic)):5,h=Math.ceil(e.count/u)*(l.zb+ic);return n.a.createElement("div",{ref:d,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(V.a)("symbol-set-container",m),style:`height: ${h}px;`},r&&e.stickers&&e.stickers.map(a=>n.a.createElement(ha,{key:a.id,sticker:a,size:l.zb,observeIntersection:c,noAnimate:!t,onClick:s,clickArg:a,onUnfaveClick:"favorite"===e.id?i:void 0}))))});a(290);const mc=[];var uc=Object(n.h)(Object(c.h)(e=>{const{setsById:t,added:a,recent:n,favorite:c}=e.stickers;return{recentStickers:n.stickers,favoriteStickers:c.stickers,stickerSetsById:t,addedSetIds:a.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}},(e,t)=>Object(u.l)(t,["loadStickerSets","loadRecentStickers","loadFavoriteStickers","loadAddedStickers","addRecentSticker","unfaveSticker"]))(({className:e,loadAndPlay:t,canSendStickers:a,recentStickers:c,favoriteStickers:r,addedSetIds:s,stickerSetsById:o,shouldPlay:i,onStickerSelect:d,loadStickerSets:m,loadRecentStickers:u,loadFavoriteStickers:h,loadAddedStickers:b,addRecentSticker:p,unfaveSticker:g})=>{const v=Object(n.q)(null),E=Object(n.q)(null),[f,O]=Object(n.r)(0),{observe:j}=Object(sa.a)({rootRef:v,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-",""));mc[a]=e.isIntersecting});const t=mc.map((e,t)=>({index:t,isIntersecting:e})).filter(({isIntersecting:e})=>e);t.length&&O(t[Math.floor(t.length/2)].index)}),{observe:C}=Object(sa.a)({rootRef:E}),y=Object(F.a)(),k=Boolean(s),N=Object(n.p)(()=>s?[{id:"recent",title:y("RecentStickers"),stickers:c,count:c.length},{id:"favorite",title:y("FavoriteStickers"),stickers:r,count:r.length},...s.map(e=>o[e]).filter(Boolean)]:He.a,[s,y,c,r,o]),I=Object(n.p)(()=>k&&0===N.filter(e=>e.stickers&&e.stickers.length).length,[N,k]);Object(n.n)(()=>{t&&(m(),u(),h())},[t,h,u,m]),Object(n.n)(()=>{s&&s.length&&b()},[s,b]),Object(Ke.a)(E.current),Object(n.n)(()=>{if(!k)return;const e=E.current;if(!e)return;const t=52*f-(e.offsetWidth/2-26);Object(ec.a)(e,t)},[k,f]);const S=Object(n.m)(e=>{O(e);const t=document.getElementById("sticker-set-"+e);Object($n.a)(v.current,t,"start",void 0,500)},[]),w=Object(n.m)(e=>{d(e),p({sticker:e})},[p,d]),P=Object(n.m)(e=>{g({sticker:e})},[g]),M=Object(ot.a)([],l.qb);const L=Object(V.a)("StickerPicker",e);return k&&M&&!I&&a?n.a.createElement("div",{className:L},n.a.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},N.map((function(e,t){const a=e.stickers&&e.stickers[0],c=Object(V.a)("symbol-set-button sticker-set-button",t===f&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!a?n.a.createElement(R.a,{key:e.id,className:c,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>S(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(ma,{stickerSet:e,observeIntersection:C}):n.a.createElement(ua,{stickerSet:e,observeIntersection:C})):n.a.createElement(ha,{key:e.id,sticker:a,size:l.Ab,title:e.title,className:c,observeIntersection:C,onClick:S,clickArg:t})}))),n.a.createElement("div",{ref:v,className:"StickerPicker-main no-scrollbar"},N.map((e,a)=>n.a.createElement(dc,{key:e.id,stickerSet:e,loadAndPlay:Boolean(i&&t),index:a,observeIntersection:j,shouldRender:f>=a-1&&f<=a+1,onStickerSelect:w,onStickerUnfave:P})))):n.a.createElement("div",{className:L},a?I?n.a.createElement("div",{className:"picker-disabled"},"You have no saved Stickers."):n.a.createElement(be.a,null):n.a.createElement("div",{className:"picker-disabled"},"Sending stickers is not allowed in this chat."))}));a(291);function hc(){return(hc=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 bc=Object(n.h)(({gif:e,observeIntersection:t,isDisabled:a,onClick:c})=>{const s=Object(n.q)(null),l=Object(n.q)(null),o=e.thumbnail&&!!e.thumbnail.dataUri,i="gif"+e.id,d=Object(sa.b)(s,t)&&!a,m=Object(v.a)(i+"?size=m",!d,r.ApiMediaFormat.BlobUrl),u=Object(Sa.a)(e.thumbnail&&e.thumbnail.dataUri,Boolean(m)),h=Object(v.a)(i,!d,r.ApiMediaFormat.BlobUrl),b=Boolean(d&&h),{transitionClassNames:p}=Object(ia.a)(o||m||h,"slow"),{isBuffered:g,bufferingHandlers:E}=Object(Y.a)(!0),f=d&&!g;Object(Q.a)(l,[b]);const O=Object(n.m)(()=>c({...e,blobUrl:h}),[c,e,h]),j=Object(V.a)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",p,i);return n.a.createElement("div",{ref:s,className:j,onClick:O},o&&n.a.createElement("canvas",{ref:u,className:"thumbnail"}),!o&&m&&n.a.createElement("img",{src:m,alt:"",className:"thumbnail"}),(b||m)&&n.a.createElement("video",hc({ref:l,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},E),n.a.createElement("source",{src:h})),f&&n.a.createElement(L.a,{color:m||o?"white":"black"}))});a(292);var pc=Object(n.h)(Object(c.h)(e=>({savedGifs:e.gifs.saved.gifs}),(e,t)=>Object(u.l)(t,["loadSavedGifs"]))(({className:e,loadAndPlay:t,canSendGifs:a,savedGifs:c,onGifSelect:r,loadSavedGifs:s})=>{const o=Object(n.q)(null),{observe:i}=Object(sa.a)({rootRef:o,debounceMs:300});Object(n.n)(()=>{t&&s()},[t,s]);const d=Object(ot.a)([],l.qb);return n.a.createElement("div",{ref:o,className:Object(V.a)("GifPicker no-scrollbar",e)},a?d&&c&&c.length?c.map(e=>n.a.createElement(bc,{key:e.id,gif:e,observeIntersection:i,isDisabled:!t,onClick:r})):d&&c?n.a.createElement("div",{className:"picker-disabled"},"No saved GIFs."):n.a.createElement(be.a,null):n.a.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))}));let gc;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(gc||(gc={}));const vc=Object.values(gc).filter(e=>"string"==typeof e),Ec={[gc.Emoji]:"icon-smile",[gc.Stickers]:"icon-stickers",[gc.GIFs]:"icon-gifs"};var fc=Object(n.h)(({activeTab:e,onSwitchTab:t,onRemoveSymbol:a,onSearchOpen:c})=>{const r=Object(F.a)();function s(a){return n.a.createElement(R.a,{className:"symbol-tab-button "+(e===a?"activated":""),onClick:()=>t(a),ariaLabel:vc[a],round:!0,faded:!0,color:"translucent"},n.a.createElement("i",{className:Ec[a]}))}const l=Object(n.m)(()=>{c(e===gc.Stickers?"stickers":"gifs")},[e,c]);return n.a.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0},e!==gc.Emoji&&n.a.createElement(R.a,{className:"symbol-search-button",ariaLabel:e===gc.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:l},n.a.createElement("i",{className:"icon-search"})),s(gc.Emoji),s(gc.Stickers),s(gc.GIFs),e===gc.Emoji&&n.a.createElement(R.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(293);let Oc=!1;var jc=Object(n.h)(({isOpen:e,allowedAttachmentOptions:t,onLoad:a,onClose:c,onEmojiSelect:r,onStickerSelect:s,onGifSelect:l,onRemoveSymbol:i,onSearchOpen:d,addRecentEmoji:m})=>{const[u,h]=Object(n.r)(0),[b,p]=Object(n.r)([]),[g,v]=Xn(e,c,void 0,o.k),{shouldRender:E,transitionClassNames:f}=Object(K.a)(e,c,!1,!1);!Oc&&e&&(Oc=!0),Object(n.n)(()=>{a()},[a]),Object(n.o)(()=>{if(o.k)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&Object(_.b)(()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout(()=>{document.body.classList.remove("enable-symbol-menu-transforms")},350)})}},[e]);const O=Object(n.q)(b);O.current=b,Object(n.n)(()=>{O.current.length&&(O.current.forEach(e=>{m({emoji:e})}),p([]))},[e,u,m]);const j=Object(n.m)((e,t)=>{p(e=>[...e,t]),r(e)},[r]),C=Object(n.m)(e=>{c(),d(e)},[c,d]),y=Object(F.a)(),{canSendStickers:k,canSendGifs:N}=t;function I(t,a){switch(u){case gc.Emoji:return n.a.createElement(oc,{className:"picker-tab",onEmojiSelect:j});case gc.Stickers:return n.a.createElement(uc,{className:"picker-tab",loadAndPlay:!!k&&(e&&(t||a)),canSendStickers:k,onStickerSelect:s});case gc.GIFs:return n.a.createElement(pc,{className:"picker-tab",loadAndPlay:!!N&&(e&&(t||a)),canSendGifs:N,onGifSelect:l})}}const S=n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Oc&&n.a.createElement(T.a,{name:"slide",activeKey:u,renderCount:vc.length},I)),o.k&&n.a.createElement(R.a,{round:!0,faded:!0,color:"translucent",ariaLabel:y("Close"),className:"symbol-close-button",size:"tiny",onClick:c},n.a.createElement("i",{className:"icon-close"})),n.a.createElement(fc,{activeTab:u,onSwitchTab:h,onRemoveSymbol:i,onSearchOpen:C}));if(o.k){if(!E)return;const e=Object(V.a)("SymbolMenu mobile-menu",f);return n.a.createElement(Ln.a,null,n.a.createElement("div",{className:e},S))}return n.a.createElement(wn.a,{isOpen:e,positionX:"left",positionY:"bottom",onClose:c,className:"SymbolMenu",onCloseAnimationEnd:c,onMouseEnter:o.m?void 0:g,onMouseLeave:o.m?void 0:v,noCloseOnBackdrop:!o.m},S)});a(294);var Cc=Object(n.h)(({isOpen:e,allowedAttachmentOptions:t,onFileSelect:a,onPollCreate:c,onClose:r})=>{const[s,i]=Xn(e,r),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)(()=>{fa(l.l,e=>d(e,!0))},[d]),u=Object(n.m)(()=>{fa("*",e=>d(e,!1))},[d]),h=Object(F.a)(),{canAttachMedia:b,canAttachPolls:p}=t;return n.a.createElement(wn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:r,className:"AttachMenu fluid",onCloseAnimationEnd:r,onMouseEnter:o.m?void 0:s,onMouseLeave:o.m?void 0:i,noCloseOnBackdrop:!o.m},!b&&n.a.createElement(q.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(q.a,{icon:"photo",onClick:m},h("AttachmentMenu.PhotoOrVideo")),n.a.createElement(q.a,{icon:"document",onClick:u},h("AttachDocument"))),p&&n.a.createElement(q.a,{icon:"poll",onClick:c},h("Poll")))});a(295);var yc=Object(n.h)(Object(c.h)(e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}},(e,t)=>Object(u.l)(t,["clearStickersForEmoji"]))(({isOpen:e,onStickerSelect:t,stickers:a,clearStickersForEmoji:c})=>{const r=Object(n.q)(null),{shouldRender:s,transitionClassNames:i}=Object(K.a)(e,void 0,void 0,!1),d=Object(O.a)(a,!0),m=a||d,{observe:u}=Object(sa.a)({rootRef:r,throttleMs:200});Object(n.n)(()=>e?Object(b.a)(c):void 0,[e,c]);const h=Object(V.a)("StickerTooltip composer-tooltip custom-scroll",i,!(m&&m.length)&&"hidden");return n.a.createElement("div",{ref:r,className:h,onMouseEnter:o.m?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:o.m?void 0:()=>{document.body.classList.remove("no-select")}},s&&m?m.map(e=>n.a.createElement(ha,{key:e.id,sticker:e,size:l.zb,observeIntersection:u,onClick:t,clickArg:e})):s?n.a.createElement(be.a,null):void 0)}));a(296);var kc=Object(n.h)(Object(c.h)((e,{messageId:t})=>{const{chatId:a}=Object(d.y)(e)||{};return a?{message:Object(d.k)(e,a,t)}:{}},(e,t)=>Object(u.l)(t,["clickInlineButton"]))(({isOpen:e,message:t,onClose:a,clickInlineButton:c})=>{const[r,s]=Xn(e,a);if(t&&t.keyboardButtons)return n.a.createElement(wn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:a,className:"KeyboardMenu",onCloseAnimationEnd:a,onMouseEnter:o.m?void 0:r,onMouseLeave:o.m?void 0:s,noCloseOnBackdrop:!o.m},n.a.createElement("div",{className:"content"},t.keyboardButtons.map(e=>n.a.createElement("div",{className:"row"},e.map(e=>n.a.createElement(R.a,{ripple:!0,disabled:"NOT_SUPPORTED"===e.type,onClick:()=>c({button:e})},e.text))))))}));a(297);var Nc=Object(n.h)(({isOpen:e,onSilentSend:t,onScheduleSend:a,onClose:c,onCloseAnimationEnd:r})=>{const[s,l]=Xn(e,c),i=Object(F.a)();return n.a.createElement(wn.a,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:c,onCloseAnimationEnd:r,onMouseEnter:o.m?void 0:s,onMouseLeave:o.m?void 0:l,noCloseOnBackdrop:!o.m},t&&n.a.createElement(q.a,{icon:"mute",onClick:t},i("SendWithoutSound")),a&&n.a.createElement(q.a,{icon:"schedule",onClick:a},i("ScheduleMessage")))}),Ic=a(138),Sc=a(164),wc=a(174);a(298);var Pc=Object(n.h)(({isOpen:e,language:t,emojis:a,onClose:c,onEmojiSelect:r,addRecentEmoji:s,loadEmojiKeywords:l})=>{const i=Object(n.q)(null),{shouldRender:d,transitionClassNames:m}=Object(K.a)(e,void 0,void 0,!1),u=Object(wc.a)(a.length?a:void 0,350)||[],[h,b]=Object(n.r)(-1);Object(n.n)(()=>{l({language:"en"}),"en"!==t&&l({language:t})},[l,t]),Object(n.n)(()=>{b(0)},[a]),Object(n.n)(()=>{!function(e,t){const a=t.current;if(!a)return;const{visibleIndexes:n,allElements:c}=zn(a,".EmojiButton",8,!0,!0,!0);if(!c.length||!c[e])return;const r=n[0];if(!n.includes(e)||e===r&&!Hn(a,c[r],!0)){const t="start"===(e>n[n.length-1]?"start":"end")?44*e:0;Object(ec.a)(a,t)}}(h,i)},[h]);const p=Object(n.m)(e=>{if(!a.length)return-1;const t=a.length;return Object(_n.a)(t,e)},[a]),g=Object(n.m)((e,t)=>{t.preventDefault(),b(t=>p(t+e))},[b,p]),v=Object(n.m)(e=>{if(a.length&&h>-1){const t=a[h];t&&(e.preventDefault(),r(t.native),s({emoji:t.id}))}},[s,a,r,h]);Object(n.n)(()=>e?Object(Ue.a)({onEsc:c,onLeft:e=>g(-1,e),onRight:e=>g(1,e),onEnter:v}):void 0,[g,v,e,c]);const E=Object(V.a)("EmojiTooltip composer-tooltip custom-scroll-x",m);return n.a.createElement("div",{ref:i,className:E,onMouseEnter:o.m?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:o.m?void 0:()=>{document.body.classList.remove("no-select")}},d&&u?u.map((e,t)=>n.a.createElement(tc,{key:e.id,emoji:e,focus:h===t,onClick:r})):d?n.a.createElement(be.a,null):void 0)}),Mc=a(171);a(299);var Fc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),n=a&&Object(d.m)(e,a.id);if(!a||!n)return{};const{query:c,results:r}=Object(d.A)(e)||{},{totalCount:s,foundIds:l}=r||{};return{chat:a,messagesById:n,query:c,totalCount:s,foundIds:l}},(e,t)=>Object(u.l)(t,["searchTextMessagesLocal","focusMessage"]))(({chatId:e,threadId:t,chat:a,messagesById:r,query:s,totalCount:l,foundIds:o,searchTextMessagesLocal:i,focusMessage:h})=>{const b=Object(F.a)(),p=Object(n.p)(()=>{if(!(s&&o&&o.length&&r))return He.a;const n=o.map(n=>{const s=r[n];if(!s)return;const l=s.senderId?Object(d.Hb)(Object(c.e)(),s.senderId):void 0;let o;if(a&&Object(m.kb)(a))o=a;else if(s.forwardInfo){const{isChannelPost:e,fromChatId:t}=s.forwardInfo;o=e&&t?Object(d.f)(Object(c.e)(),t):void 0}else o=s.senderId?Object(d.f)(Object(c.e)(),s.senderId):void 0;return{message:s,senderUser:l,senderChat:o,onClick:()=>h({chatId:e,threadId:t,messageId:n})}}).filter(Boolean);return Object(u.k)(n,({message:e})=>e.date,"desc")},[e,t,h,o,a,r,s]),g=Object(n.q)(null),v=Object(he.a)(g,!0,e=>{p&&p[e]&&p[e].onClick()},".ListItem-button",!0);return n.a.createElement(ve.a,{className:"RightSearch custom-scroll",items:p,preloadBackwards:0,onLoadMore:i,noFastList:!0,onKeyDown:v,ref:g},n.a.createElement("p",{className:"helper-text",dir:"auto"},s?0!==l&&p.length?1===l?"1 message found":(p.length&&(l||p.length))+" messages found":b("lng_search_no_results"):b("lng_dlg_search_for_messages")),p.map(({message:e,senderUser:t,senderChat:a,onClick:c})=>{const r=a?Object(m.k)(b,a):Object(m.ab)(t),l=Object(m.N)(b,e);return n.a.createElement(Ee.a,{className:"chat-item-clickable search-result-message m-0",onClick:c},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"},r&&Object(B.a)(r)),n.a.createElement(Mc.a,{message:e})),n.a.createElement("div",{className:"subtitle",dir:"auto"},Object(B.a)(l,["emoji","highlight"],{highlight:s}))))}))})),Lc=a(51);var Ac=Object(n.h)(Object(c.h)((e,{stickerSetId:t})=>({set:Object(d.xb)(e,t),shouldPlay:Object(d.wb)(e)}),(e,t)=>Object(u.l)(t,["loadStickers","toggleStickerSet"]))(({stickerSetId:e,observeIntersection:t,set:a,shouldPlay:c,loadStickers:r,toggleStickerSet:s,isSomeModalOpen:o,onModalToggle:i})=>{const d=Object(F.a)(),m=a&&Boolean(a.installedDate),u=Boolean(a&&a.stickers),[h,b,p]=Object(xe.a)();Object(Lc.a)(()=>{i(h)},[h,i]);const g=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&&g.length<5&&r({stickerSetId:e})},[u,g.length,r,e]);const v=Object(n.m)(()=>{s({stickerSetId:e})},[s,e]);if(!a)return;const E=g.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(R.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"},!E&&n.a.createElement(L.a,null),E&&g.map(e=>n.a.createElement(ha,{sticker:e,size:l.Bb,observeIntersection:t,noAnimate:!c||h||o,onClick:b}))),E&&n.a.createElement(pa.a,{isOpen:h,fromSticker:g[0],onClose:p}))}));a(300);const Tc=Object(_.h)(e=>e(),6e4,!0);var Rc=Object(n.h)(Object(c.h)(e=>{const t=Object(d.z)(e),{query:a,resultIds:n}=t||{},{featured:c}=e.stickers;return{query:a,featuredIds:c.setIds,resultIds:n}},(e,t)=>Object(u.l)(t,["loadFeaturedStickers"]))(({query:e,featuredIds:t,resultIds:a,loadFeaturedStickers:c})=>{const r=Object(n.q)(null),s=Object(F.a)(),[l,o]=Object(n.r)(!1),{observe:i}=Object(sa.a)({rootRef:r,throttleMs:200});return Object(n.n)(()=>{Tc(()=>{c()})}),n.a.createElement("div",{ref:r,className:"StickerSearch custom-scroll",dir:s.isRtl?"rtl":void 0},function(){if(void 0!==e)return!e&&t?t.map(e=>n.a.createElement(Ac,{key:e,stickerSetId:e,observeIntersection:i,isSomeModalOpen:l,onModalToggle:o})):a?a.length?a.map(e=>n.a.createElement(Ac,{key:e,stickerSetId:e,observeIntersection:i,isSomeModalOpen:l,onModalToggle:o})):n.a.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):n.a.createElement(be.a,null)}())}));a(301);var Dc=Object(n.h)(Object(c.h)(e=>{const t=Object(d.s)(e),{query:a,results:n}=t||{},{chatId:c}=Object(d.y)(e)||{},r=c?Object(d.f)(e,c):void 0;return{query:a,results:n,chat:r,isChatWithBot:r?Object(d.O)(e,r):void 0}},(e,t)=>Object(u.l)(t,["searchMoreGifs","sendMessage","setGifSearchQuery"]))(({query:e,results:t,chat:a,isChatWithBot:c,searchMoreGifs:r,sendMessage:s,setGifSearchQuery:l})=>{const i=Object(n.q)(null),{observe:d}=Object(sa.a)({rootRef:i,debounceMs:300}),{canSendGifs:u}=Object(m.b)(a,c),h=Object(n.m)(e=>{u&&s({gif:e}),o.m&&l({query:void 0})},[u,s,l]),b=Object(F.a)();const p=Boolean(void 0!==e&&t&&t.length);return n.a.createElement("div",{className:"GifSearch",dir:b.isRtl?"rtl":void 0},n.a.createElement(ve.a,{ref:i,className:Object(V.a)("gif-container custom-scroll",p&&"grid"),items:t,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:r},function(){if(void 0!==e)return t?t.length?t.map(e=>n.a.createElement(bc,{key:e.id,gif:e,observeIntersection:d,onClick:h})):n.a.createElement("p",{className:"helper-text",dir:"auto"},b("NoGIFsFound")):n.a.createElement(be.a,null)}()))}));a(302);var Bc=Object(n.h)(Object(c.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(u.l)(t,["loadPollOptionResults","openChat","closePollResults"]))(({chat:e,message:t,answer:a,answerVote:c,totalVoters:r,voters:s,offset:l,loadPollOptionResults:o,openChat:i,closePollResults:d})=>{const m=Object(O.a)(c.votersCount),[u,h]=Object(n.r)(!0),b=Boolean(s),{option:p,text:g}=a,v=Object(F.a)();Object(n.n)(()=>{b&&m===c.votersCount||o({chat:e,messageId:t.id,option:p,offset:l,limit:4,shouldResetVoters:!0})},[c.votersCount,b]);const E=Object(n.m)(()=>{h(!0),o({chat:e,messageId:t.id,option:p,offset:l,limit:50})},[e,o,t.id,l,p]);Object(n.n)(()=>{h(!1)},[s]);const f=Object(n.m)(e=>{i({id:e}),d()},[d,i]);return n.a.createElement("div",{className:"PollAnswerResults"},n.a.createElement("div",{className:"poll-voters"},s?s.map(e=>n.a.createElement(Ee.a,{key:e,className:"chat-item-clickable",onClick:()=>f(e)},n.a.createElement(fe.a,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}))):n.a.createElement(be.a,null),s&&function(){const e=c.votersCount-s.length;return c.votersCount>4&&e>0&&n.a.createElement(Xt,{count:e,itemName:"voter",isLoading:u,onClick:E})}()),n.a.createElement("div",{className:"answer-head",dir:v.isRtl?"rtl":void 0},n.a.createElement("span",{className:"answer-title",dir:"auto"},g),n.a.createElement("span",{className:"answer-percent",dir:v.isRtl?"auto":void 0},(j=c.votersCount,(C=r)>0?(j/C*100).toFixed():0),"%")));var j,C}));a(303);var xc=Object(n.h)(Object(c.h)(e=>{const{pollResults:{chatId:t,messageId:a},lastSyncTime:n}=e;if(!t||!a)return{};return{chat:Object(d.f)(e,t),message:Object(d.k)(e,t,a),lastSyncTime:n}})(({chat:e,message:t,lastSyncTime:a})=>{const c=Object(F.a)();if(!t||!e)return n.a.createElement(be.a,null);const{summary:r,results:s}=Object(m.H)(t);if(!s.results)return;const l=Object(u.c)(s.results,"option");return n.a.createElement("div",{className:"PollResults",dir:c.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"poll-question",dir:"auto"},r.question),n.a.createElement("div",{className:"poll-results-list custom-scroll"},a&&r.answers.map(a=>n.a.createElement(Bc,{key:`${t.id}-${a.option}`,chat:e,message:t,answer:a,answerVote:l[a.option],totalVoters:s.totalVoters})),!a&&n.a.createElement(be.a,null)))}));a(166);var Uc=Object(n.h)(Object(c.h)((e,{userId:t})=>{const a=Object(d.Hb)(e,t),n=Object(d.f)(e,t),{progress:c}=e.management;return{user:a,chat:n,progress:c,isMuted:Object(m.Db)(n,Object(d.eb)(e),Object(d.db)(e))}},(e,t)=>Object(u.l)(t,["updateContact","deleteUser","closeManagement","openChat","deleteHistory"]))(({userId:e,user:t,chat:a,progress:c,isMuted:r,updateContact:l,deleteUser:o,deleteHistory:i,closeManagement:d,openChat:m})=>{const[u,h,b]=Object(xe.a)(),[p,g]=Object(n.r)(!1),[v,E]=Object(n.r)(),f=Object(F.a)(),O=t&&t.firstName||"",j=t&&t.lastName||"",[C,y]=Object(n.r)(O),[k,N]=Object(n.r)(j),[I,S]=Object(n.r)(!r);Object(n.n)(()=>{S(!r)},[r]),Object(n.n)(()=>{g(!1),b()},[b,e]),Object(n.n)(()=>{y(O),N(j)},[O,j,t]),Object(n.n)(()=>{c===s.f.Complete&&(g(!1),E(void 0),b())},[b,c]);const w=Object(n.m)(e=>{y(e.target.value),g(!0)},[]),P=Object(n.m)(e=>{N(e.target.value),g(!0)},[]),M=Object(n.m)(e=>{S(e.target.checked),g(!0)},[]),A=Object(n.m)(()=>{const t=C.trim(),a=k.trim();t.length||E("Please provide first name"),l({userId:e,isMuted:!I,firstName:t,lastName:a})},[C,k,l,e,I]),T=Object(n.m)(()=>{i({chatId:a.id,shouldDeleteForAll:!1}),o({userId:e}),b(),d(),m({id:void 0})},[a.id,b,d,i,o,m,e]);if(!t)return;const R=c===s.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(fe.a,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),n.a.createElement(ge.a,{id:"user-first-name",label:f("UserInfo.FirstNamePlaceholder"),onChange:w,value:C,error:"Please provide first name"===v?v:void 0}),n.a.createElement(ge.a,{id:"user-last-name",label:f("UserInfo.LastNamePlaceholder"),onChange:P,value:k}),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(aa.a,{checked:I,label:f("Notifications"),subLabel:f(I?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:M}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:h},f("DeleteContact")))),n.a.createElement(qt,{isShown:p,onClick:A,disabled:R,ariaLabel:f("Save")},R?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(we.a,{isOpen:u,onClose:b,text:f("AreYouSureDeleteContact"),confirmLabel:f("DeleteContact"),confirmHandler:T,confirmIsDestructive:!0}))}));var Gc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{progress:n}=e.management,c=Boolean(a.fullInfo&&a.fullInfo.linkedChatId);return{chat:a,progress:n,isBasicGroup:Object(m.jb)(a),hasLinkedChannel:c,canChangeInfo:Object(m.p)(a,"changeInfo"),canBanUsers:Object(m.p)(a,"banUsers")}},(e,t)=>Object(u.l)(t,["togglePreHistoryHidden","updateChat","closeManagement","deleteHistory","leaveChannel","deleteChannel","openChat"]))(({chatId:e,chat:t,progress:a,isBasicGroup:c,hasLinkedChannel:l,canChangeInfo:o,canBanUsers:i,onScreenSelect:d,togglePreHistoryHidden:u,updateChat:h,deleteHistory:b,leaveChannel:p,deleteChannel:g,closeManagement:E,openChat:f})=>{const[O,j,C]=Object(xe.a)(),y=t.title,k=t.fullInfo&&t.fullInfo.about||"",[N,I]=Object(n.r)(!1),[S,w]=Object(n.r)(y),[P,M]=Object(n.r)(k),[A,T]=Object(n.r)(),[R,D]=Object(n.r)(),x=Object(m.e)(t),U=Object(v.a)(x,!1,r.ApiMediaFormat.BlobUrl),G=Object(F.a)();Object(n.n)(()=>{a===s.f.Complete&&(I(!1),D(void 0))},[a]);const q=Object(n.m)(()=>{d(s.g.ChatPrivacyType)},[d]),z=Object(n.m)(()=>{d(s.g.Discussion)},[d]),H=Object(n.m)(()=>{d(s.g.GroupPermissions)},[d]),$=Object(n.m)(()=>{d(s.g.ChatAdministrators)},[d]),_=Object(n.m)(e=>{T(e),I(!0)},[]),V=Object(n.m)(e=>{w(e.target.value),I(!0)},[]),W=Object(n.m)(e=>{M(e.target.value),I(!0)},[]),K=Object(n.m)(()=>{const t=S.trim(),a=P.trim();t.length?h({chatId:e,title:t,about:a,photo:A}):D("Group title can't be empty")},[P,e,A,S,h]),Y=Object(n.m)(()=>{d(s.g.GroupMembers)},[d]),Z=Object(n.m)(()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;u({chatId:t.id,isEnabled:!e})},[t,u]),Q=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]),X=t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,J=Object(n.m)(()=>{c?b({chatId:t.id,shouldDeleteForAll:!1}):t.isCreator?g({chatId:t.id}):p({chatId:t.id}),C(),E(),f({id:void 0})},[c,t.isCreator,t.id,C,E,b,p,g,f]);if(t.isRestricted)return;const ee=a===s.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(Gt.a,{currentAvatarBlobUrl:U,onChange:_,disabled:!o}),n.a.createElement(ge.a,{id:"group-title",label:G("GroupName"),onChange:V,value:S,error:"Group title can't be empty"===R?R:void 0,disabled:!o}),n.a.createElement(ge.a,{id:"group-about",className:"mb-2",label:G("DescriptionPlaceholder"),onChange:W,value:P,disabled:!o}),t.isCreator&&n.a.createElement(Ee.a,{icon:"lock",multiline:!0,ripple:!0,onClick:q},n.a.createElement("span",{className:"title"},G("GroupType")),n.a.createElement("span",{className:"subtitle"},t.username?G("TypePublic"):G("TypePrivate"))),l&&n.a.createElement(Ee.a,{icon:"message",multiline:!0,ripple:!0,onClick:z},n.a.createElement("span",{className:"title"},G("LinkedChannel")),n.a.createElement("span",{className:"subtitle"},G("DiscussionUnlink"))),n.a.createElement(Ee.a,{icon:"permissions",multiline:!0,ripple:!0,onClick:H,disabled:!i},n.a.createElement("span",{className:"title"},G("ChannelPermissions")),n.a.createElement("span",{className:"subtitle",dir:"auto"},Q,"/",8)),n.a.createElement(Ee.a,{icon:"admin",multiline:!0,ripple:!0,onClick:$},n.a.createElement("span",{className:"title"},G("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},Object(da.a)(X)))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"group",multiline:!0,ripple:!0,onClick:Y},n.a.createElement("span",{className:"title"},G("GroupMembers")),n.a.createElement("span",{className:"subtitle"},Object(da.a)(t.membersCount))),t.fullInfo&&n.a.createElement("div",{className:"ListItem narrow no-selection"},n.a.createElement(aa.a,{checked:!t.fullInfo.isPreHistoryHidden,label:G("ChatHistory"),onChange:Z,disabled:!i}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},G("DeleteMega")))),n.a.createElement(qt,{isShown:N,onClick:K,disabled:ee,ariaLabel:G("Save")},ee?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(we.a,{isOpen:O,onClose:C,textParts:Object(B.a)(c||!t.isCreator?G("AreYouSureDeleteAndExit"):G("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:c||!t.isCreator?G("DeleteMega"):G("DeleteGroupForAll"),confirmHandler:J,confirmIsDestructive:!0}))}));var qc=Object(n.h)(Object(c.h)((e,{chatId:t})=>({chat:Object(d.f)(e,t),currentUserId:e.currentUserId}),(e,t)=>Object(u.l)(t,["updateChatDefaultBannedRights"]))(({onScreenSelect:e,onChatMemberSelect:t,chat:a,currentUserId:c,updateChatDefaultBannedRights:r})=>{const[l,o]=Object(n.r)({}),[i,d]=Object(n.r)(!1),[m,u]=Object(n.r)(!1),h=Object(F.a)(),b=Object(n.m)(()=>{e(s.g.GroupRemovedUsers)},[e]),p=Object(n.m)(()=>{e(s.g.GroupUserPermissionsCreate)},[e]),g=Object(n.m)(a=>{t(a.userId,a.promotedByUserId===c),e(s.g.GroupUserPermissions)},[c,t,e]);Object(n.n)(()=>{o(a&&a.defaultBannedRights||{}),d(!1),setTimeout(()=>{u(!1)},250)},[a]);const v=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}o(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),d(!0)},[]),E=Object(n.m)(()=>{a&&(u(!0),r({chatId:a.id,bannedRights:l}))},[a,l,r]),f=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.kickedMembers?a.fullInfo.kickedMembers.length:0,[a]),O=Object(n.p)(()=>a&&a.fullInfo&&a.fullInfo.members?a.fullInfo.members.filter(({bannedRights:e})=>!!e):[],[a]),j=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 c=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(!c)return e;const r=h(c);return`${e}${e.length?", "+r:r}`},"")},[a,h]);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"},h("ChannelPermissionsHeader")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMessages",checked:!l.sendMessages,label:h("UserRestrictionsSend"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMedia",checked:!l.sendMedia,label:h("UserRestrictionsSendMedia"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendStickers",checked:!l.sendStickers&&!l.sendGifs,label:h("UserRestrictionsSendStickers"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendPolls",checked:!l.sendPolls,label:h("UserRestrictionsSendPolls"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"embedLinks",checked:!l.embedLinks,label:h("UserRestrictionsEmbedLinks"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"inviteUsers",checked:!l.inviteUsers,label:h("UserRestrictionsInviteUsers"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"pinMessages",checked:!l.pinMessages,label:h("UserRestrictionsPinMessages"),blocking:!0,onChange:v})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!l.changeInfo,label:h("UserRestrictionsChangeInfo"),blocking:!0,onChange:v}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete-user",multiline:!0,ripple:!0,narrow:!0,onClick:b},n.a.createElement("span",{className:"title"},h("ChannelBlockedUsers")),n.a.createElement("span",{className:"subtitle"},f))),n.a.createElement("div",{className:"section"},n.a.createElement("h3",{className:"section-heading",dir:"auto"},h("PrivacyExceptions")),n.a.createElement(Ee.a,{icon:"add-user",ripple:!0,onClick:p},h("ChannelAddException")),O.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable exceptions-member",ripple:!0,onClick:()=>g(e)},n.a.createElement(fe.a,{userId:e.userId,status:j(e)}))))),n.a.createElement(qt,{isShown:i,onClick:E,ariaLabel:h("Save"),disabled:m},m?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var zc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{byId:n}=e.users;return{chat:a,usersById:n}},(e,t)=>Object(u.l)(t,["updateChatMemberBannedRights"]))(({chat:e,usersById:t,updateChatMemberBannedRights:a})=>{const c=Object(F.a)(),r=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[],[e]),s=Object(n.m)(e=>{if(!e.kickedByUserId)return;const a=t[e.kickedByUserId];return a?c("UserRemovedBy",Object(m.ab)(a)):void 0},[c,t]),l=Object(n.m)(t=>{if(e)return[{title:c("Unblock"),icon:"delete",destructive:!0,handler:()=>a({chatId:e.id,userId:t.userId,bannedRights:{}})}]},[c,e,a]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",dir:c.isRtl?"rtl":void 0},n.a.createElement("p",{className:"text-muted"},c("NoBlockedGroup2")),r.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:l(e)},n.a.createElement(fe.a,{userId:e.userId,status:s(e)}))))))}));var Hc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{progress:n}=e.management;return{chat:a,progress:n,isSignaturesShown:Boolean(a&&a.isSignaturesShown),canChangeInfo:Object(m.p)(a,"changeInfo")}},(e,t)=>Object(u.l)(t,["toggleSignatures","updateChat","closeManagement","leaveChannel","deleteChannel","openChat"]))(({chatId:e,chat:t,progress:a,isSignaturesShown:c,canChangeInfo:l,onScreenSelect:o,updateChat:i,toggleSignatures:d,closeManagement:u,leaveChannel:h,deleteChannel:b,openChat:p})=>{const g=t&&t.title||"",E=t&&t.fullInfo&&t.fullInfo.about||"",f=t&&t.fullInfo&&t.fullInfo.linkedChatId,[O,j,C]=Object(xe.a)(),[y,k]=Object(n.r)(!1),[N,I]=Object(n.r)(g),[S,w]=Object(n.r)(E),[P,M]=Object(n.r)(),[A,T]=Object(n.r)(),R=t&&Object(m.e)(t),D=Object(v.a)(R,!1,r.ApiMediaFormat.BlobUrl),B=Object(F.a)();Object(n.n)(()=>{a===s.f.Complete&&(k(!1),T(void 0))},[a]);const x=t&&t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,U=Object(n.m)(()=>{o(s.g.ChatPrivacyType)},[o]),G=Object(n.m)(()=>{o(s.g.Discussion)},[o]),q=Object(n.m)(()=>{o(s.g.ChatAdministrators)},[o]),z=Object(n.m)(e=>{M(e),k(!0)},[]),H=Object(n.m)(e=>{I(e.target.value),k(!0)},[]),$=Object(n.m)(e=>{w(e.target.value),k(!0)},[]),_=Object(n.m)(()=>{const t=N.trim(),a=S.trim();t.length?i({chatId:e,title:t,about:a,photo:P}):T("Channel title can't be empty")},[S,e,P,N,i]),V=Object(n.m)(()=>{d({chatId:e,isEnabled:!c})},[e,c,d]),W=Object(n.m)(()=>{o(s.g.ChannelSubscribers)},[o]),K=Object(n.m)(()=>{t.isCreator?b({chatId:t.id}):h({chatId:t.id}),C(),u(),p({id:void 0})},[t.isCreator,t.id,C,u,h,b,p]);if(t.isRestricted)return;const Y=a===s.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(Gt.a,{currentAvatarBlobUrl:D,onChange:z,disabled:!l}),n.a.createElement(ge.a,{id:"channel-title",label:B("EnterChannelName"),onChange:H,value:N,error:"Channel title can't be empty"===A?A:void 0,disabled:!l}),n.a.createElement(ge.a,{id:"channel-about",className:"mb-2",label:B("DescriptionPlaceholder"),onChange:$,value:S,disabled:!l}),t.isCreator&&n.a.createElement(Ee.a,{icon:"lock",ripple:!0,multiline:!0,onClick:U},n.a.createElement("span",{className:"title"},B("ChannelType")),n.a.createElement("span",{className:"subtitle"},t.username?B("TypePublic"):B("TypePrivate"))),n.a.createElement(Ee.a,{icon:"message",multiline:!0,ripple:!0,onClick:G,disabled:!l},n.a.createElement("span",{className:"title"},B("Discussion")),n.a.createElement("span",{className:"subtitle"},B(f?"DiscussionUnlink":"Add"))),n.a.createElement(Ee.a,{icon:"admin",multiline:!0,ripple:!0,onClick:q},n.a.createElement("span",{className:"title"},B("ChannelAdministrators")),n.a.createElement("span",{className:"subtitle"},x)),n.a.createElement("div",{className:"ListItem no-selection narrow"},n.a.createElement(aa.a,{checked:c,label:B("ChannelSignMessages"),onChange:V}))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"group",multiline:!0,ripple:!0,onClick:W},n.a.createElement("span",{className:"title",dir:"auto"},B("ChannelSubscribers")),n.a.createElement("span",{className:"subtitle",dir:"auto"},B("Subscribers",t.membersCount,"i")))),n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},t.isCreator?B("ChannelDelete"):B("LeaveChannel")))),n.a.createElement(qt,{isShown:y,onClick:_,disabled:Y,ariaLabel:B("Save")},Y?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(we.a,{isOpen:O,onClose:C,text:t.isCreator?B("ChannelDeleteAlert"):B("ChannelLeaveAlert"),confirmLabel:t.isCreator?B("ChannelDelete"):B("LeaveChannel"),confirmHandler:K,confirmIsDestructive:!0}))})),$c=a(57);var _c=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{isUsernameAvailable:n}=Object(d.Z)(e,t);return{chat:a,isChannel:Object(m.kb)(a),progress:e.management.progress,isUsernameAvailable:n}},(e,t)=>Object(u.l)(t,["checkPublicLink","updatePublicLink","updatePrivateLink"]))(({chat:e,isChannel:t,progress:a,isUsernameAvailable:c,checkPublicLink:r,updatePublicLink:l,updatePrivateLink:o})=>{const i=Boolean(e.username),d=e.fullInfo&&e.fullInfo.inviteLink,[m,u]=Object(n.r)(i?"public":"private"),[h,b]=Object(n.r)(),[p,g,v]=Object(xe.a)(),E="public"===m&&h&&c||"private"===m&&i;Object(n.n)(()=>{m&&!d&&o()},[m,d,o]);const f=Object(n.m)(e=>{u(e)},[]),O=Object(n.m)(()=>{l({username:"public"===m?h:""})},[m,l,h]),j=Object(n.m)(()=>{v(),o()},[v,o]),C=Object(F.a)(),y=t?"Channel":"Mega",k=t?"Channel":"Group",N=[{value:"private",label:C(y+"Private"),subLabel:C(y+"PrivateInfo")},{value:"public",label:C(y+"Public"),subLabel:C(y+"PublicInfo")}],I=a===s.f.InProgress;return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",dir:C.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading"},C(k+"Type")),n.a.createElement(oa.a,{selected:m,name:"channel-type",options:N,onChange:f})),"private"===m?n.a.createElement("div",{className:"section",dir:C.isRtl?"rtl":void 0},d?n.a.createElement(n.a.Fragment,null,n.a.createElement($c.a,{url:d,className:"group-link",text:d}),n.a.createElement("p",{className:"section-info",dir:C.isRtl?"rtl":void 0},C(y+"PrivateLinkHelp")),n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:g},C("RevokeLink")),n.a.createElement(we.a,{isOpen:p,onClose:v,text:C("RevokeAlert"),confirmLabel:C("RevokeButton"),confirmHandler:j,confirmIsDestructive:!0})):n.a.createElement(be.a,null)):n.a.createElement("div",{className:"section no-border"},n.a.createElement(_t,{asLink:!0,currentUsername:e.username,isLoading:I,isUsernameAvailable:c,checkUsername:r,onChange:b}),n.a.createElement("p",{className:"section-info",dir:"auto"},C(k+".Username.CreatePublicLinkHelp")))),n.a.createElement(qt,{isShown:E,disabled:I,ariaLabel:C("Save"),onClick:O},I?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})))}));var Vc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{forDiscussionIds:n,byId:c}=e.chats;return{chat:a,chatsByIds:c,forDiscussionIds:n,linkedChat:a&&a.fullInfo&&a.fullInfo.linkedChatId?Object(d.f)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&Object(m.kb)(a)}},(e,t)=>Object(u.l)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"]))(({chat:e,chatId:t,chatsByIds:a,linkedChat:c,forDiscussionIds:r,isChannel:o,onScreenSelect:i,loadGroupsForDiscussion:d,linkDiscussionGroup:m,unlinkDiscussionGroup:u})=>{const[h,b]=Object(n.r)(),[p,g]=Object(n.r)(),[v,E]=Object(n.r)(!1),f=Object(n.m)(()=>E(!0),[]),[O,j,C]=Object(xe.a)(),[y,k,N]=Object(xe.a)(),I=Object(F.a)(),S=c&&c.id;Object(n.n)(()=>{d()},[d]),Object(n.n)(()=>{p||Object(Kt.a)("DiscussionGroups").then(g)},[p]);const w=Object(n.m)(()=>{C(),u({channelId:o?t:S}),o||i(s.g.Initial)},[C,u,o,t,S,i]),P=Object(n.m)(()=>{N(),m({channelId:t,chatId:h})},[N,m,t,h]);function M(){const e=a[h];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 L(){const t=a[h];if(t)return t.hasPrivateLink?Object(B.a)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):Object(B.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"},p&&n.a.createElement(Yt.a,{id:"discussionGroupsDucks",size:l.tb,animationData:p,play:v,noLoop:!0,onLoad:f})),c&&n.a.createElement("div",null,n.a.createElement(Ee.a,{className:"chat-item-clickable",inactive:!0},n.a.createElement(Oe.a,{chatId:c.id})),n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:j},I(o?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),n.a.createElement(we.a,{isOpen:O,onClose:C,header:n.a.createElement("div",{className:"modal-header"},n.a.createElement(x.a,{size:"tiny",chat:c}),n.a.createElement("div",{className:"modal-title"},I(o?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:Object(B.a)(I(o?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",c.title),["br","simple_markdown"]),confirmLabel:I(o?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:w,confirmIsDestructive:!0})),!c&&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")),r?r.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{b(e),k()}},n.a.createElement(Oe.a,{chatId:e}))):n.a.createElement(tt.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(we.a,{isOpen:y,onClose:N,header:M(),textParts:L(),confirmLabel:I("DiscussionLinkGroup"),confirmHandler:P,isButtonsInOneRow:!0})))))}));var Wc=Object(n.h)(Object(c.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(d.f)(e,t);return{chat:n,isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(u.l)(t,["updateChatMemberBannedRights"]))(({chat:e,selectedChatMemberId:t,onScreenSelect:a,updateChatMemberBannedRights:c,isFormFullyDisabled:r})=>{const[l,o]=Object(n.r)({}),[i,d]=Object(n.r)(!1),[m,u]=Object(n.r)(!1),[h,b,p]=Object(xe.a)(),g=Object(F.a)(),v=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&&!v&&a(s.g.GroupPermissions)},[e,a,v,t]),Object(n.n)(()=>{o(v&&v.bannedRights||e&&e.defaultBannedRights||{}),d(!1),u(!1)},[e,v]);const E=Object(n.m)(e=>{const{name:t}=e.target;function a(e){return!e||void 0}o(e=>({...e,[t]:a(e[t]),..."sendStickers"===t&&{sendGifs:a(e[t])}})),d(!0)},[]),f=Object(n.m)(()=>{e&&t&&(u(!0),c({chatId:e.id,userId:t,bannedRights:l}))},[e,t,l,c]),O=Object(n.m)(()=>{e&&t&&c({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})},[e,t,c]),j=Object(n.m)(t=>!!r||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t],[e,r]);if(v)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(fe.a,{userId:v.userId})),n.a.createElement("h3",{className:"section-heading mt-4",dir:"auto"},g("UserRestrictionsCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMessages",checked:!l.sendMessages,label:g("UserRestrictionsSend"),blocking:!0,disabled:j("sendMessages"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendMedia",checked:!l.sendMedia,label:g("UserRestrictionsSendMedia"),blocking:!0,disabled:j("sendMedia"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendStickers",checked:!l.sendStickers&&!l.sendGifs,label:g("UserRestrictionsSendStickers"),blocking:!0,disabled:j("sendStickers"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"sendPolls",checked:!l.sendPolls,label:g("UserRestrictionsSendPolls"),blocking:!0,disabled:j("sendPolls"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"embedLinks",checked:!l.embedLinks,label:g("UserRestrictionsEmbedLinks"),blocking:!0,disabled:j("embedLinks"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"inviteUsers",checked:!l.inviteUsers,label:g("UserRestrictionsInviteUsers"),blocking:!0,disabled:j("inviteUsers"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"pinMessages",checked:!l.pinMessages,label:g("UserRestrictionsPinMessages"),blocking:!0,disabled:j("pinMessages"),onChange:E})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!l.changeInfo,label:g("UserRestrictionsChangeInfo"),blocking:!0,disabled:j("changeInfo"),onChange:E}))),!r&&n.a.createElement("div",{className:"section"},n.a.createElement(Ee.a,{icon:"delete-user",ripple:!0,destructive:!0,onClick:b},g("UserRestrictionsBlock")))),n.a.createElement(qt,{isShown:i,onClick:f,ariaLabel:g("Save"),disabled:m},m?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(we.a,{isOpen:h,onClose:p,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:O,confirmIsDestructive:!0}))}));var Kc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{byId:n}=e.users;return{chat:a,currentUserId:e.currentUserId,isChannel:Object(m.kb)(a),usersById:n}})(({chat:e,isChannel:t,currentUserId:a,usersById:c,onScreenSelect:r,onChatMemberSelect:l})=>{const o=Object(F.a)();const i=Object(n.p)(()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),d=Object(n.m)(e=>{l(e.userId,e.promotedByUserId===a),r(s.g.ChatAdminRights)},[a,l,r]),u=Object(n.m)(e=>{if(e.isOwner)return o("ChannelCreator");const t=e.promotedByUserId?c[e.promotedByUserId]:void 0;return t?o("EditAdminPromotedBy",Object(m.ab)(t)):o("ChannelAdmin")},[o,c]);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,ripple:!0,onClick:function(){r(s.g.GroupRecentActions)}},n.a.createElement("span",{className:"title"},o("EventLog")),n.a.createElement("span",{className:"subtitle"},o(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),n.a.createElement("div",{className:"section",dir:o.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."),i.map(e=>n.a.createElement(Ee.a,{key:e.userId,className:"chat-item-clickable",ripple:!0,onClick:()=>d(e)},n.a.createElement(fe.a,{userId:e.userId,status:u(e),forceShowSelf:!0}))))))}));var Yc=Object(n.h)(Object(c.h)((e,{chatId:t})=>({chat:Object(d.f)(e,t)}))(({chat:e})=>{const t=Object(F.a)(),a=Object(n.p)(()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort((e,t)=>e.isOwner?-1:t.isOwner?1:0):[],[e]),c=Object(n.m)(e=>e.isOwner?t("ChannelCreator"):t("ChannelAdmin"),[t]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section not-implemented",dir:t.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(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogAllEvents"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterNewAdmins"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterNewMembers"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterChannelInfo"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterDeletedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterEditedMessages"),onChange:void 0})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogFilterLeavingMembers"),onChange:void 0}))),n.a.createElement("div",{className:"section not-implemented",dir:t.isRtl?"rtl":void 0},n.a.createElement("h3",{className:"section-heading",dir:"auto"},t("Channel.Management.Title")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!0,label:t("EventLogAllAdmins"),onChange:void 0})),a.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(aa.a,{label:"",checked:!0}),n.a.createElement(fe.a,{userId:e.userId,status:c(e),forceShowSelf:!0}))))))}));var Zc=Object(n.h)(Object(c.h)((e,{chatId:t,isPromotedByCurrentUser:a})=>{const n=Object(d.f)(e,t),{byId:c}=e.users,{currentUserId:r}=e;return{chat:n,usersById:c,currentUserId:r,isChannel:Object(m.kb)(n),isFormFullyDisabled:!(n.isCreator||a)}},(e,t)=>Object(u.l)(t,["updateChatAdmin"]))(({selectedChatMemberId:e,onScreenSelect:t,chat:a,usersById:c,currentUserId:r,isChannel:l,isFormFullyDisabled:o,updateChatAdmin:i})=>{const[d,u]=Object(n.r)({}),[h,b]=Object(n.r)(!1),[p,g]=Object(n.r)(!1),[v,E,f]=Object(xe.a)(),[O,j]=Object(n.r)(""),C=Object(F.a)(),y=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&&!y&&t(s.g.ChatAdministrators)},[a,t,y,e]),Object(n.n)(()=>{u(y&&y.adminRights||{}),j((y&&y.customTitle||"").substr(0,16)),b(!1),g(!1)},[y]);const k=Object(n.m)(e=>{const{name:t}=e.target;u(e=>{return{...e,[t]:(a=e[t],!a||void 0)};var a}),b(!0)},[]),N=Object(n.m)(()=>{e&&(g(!0),i({chatId:a.id,userId:e,adminRights:d,customTitle:O}))},[a,e,d,O,i]),I=Object(n.m)(()=>{e&&(i({chatId:a.id,userId:e,adminRights:{}}),f())},[a.id,f,e,i]),S=Object(n.m)(e=>!Object(m.jb)(a)&&(!(!o&&a.adminRights)||!a.adminRights[e]),[a,o]),w=Object(n.p)(()=>{if(!y)return;if(y.isOwner)return C("ChannelCreator");const e=y.promotedByUserId?c[y.promotedByUserId]:void 0;return e?C("EditAdminPromotedBy",Object(m.ab)(e)):C("ChannelAdmin")},[y,c,C]),P=Object(n.m)(e=>{const{value:t}=e.target;j(t),b(!0)},[]);if(y)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(fe.a,{userId:y.userId,status:w,forceShowSelf:!0})),n.a.createElement("h3",{className:"section-heading mt-4",dir:"auto"},C("EditAdminWhatCanDo")),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"changeInfo",checked:!!d.changeInfo,label:C(l?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:S("changeInfo"),onChange:k})),l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"postMessages",checked:!!d.postMessages,label:C("EditAdminPostMessages"),blocking:!0,disabled:S("postMessages"),onChange:k})),l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"editMessages",checked:!!d.editMessages,label:C("EditAdminEditMessages"),blocking:!0,disabled:S("editMessages"),onChange:k})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"deleteMessages",checked:!!d.deleteMessages,label:C(l?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:S("deleteMessages"),onChange:k})),!l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"banUsers",checked:!!d.banUsers,label:C("EditAdminBanUsers"),blocking:!0,disabled:S("banUsers"),onChange:k})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"inviteUsers",checked:!!d.inviteUsers,label:C("EditAdminAddUsers"),blocking:!0,disabled:S("inviteUsers"),onChange:k})),!l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"pinMessages",checked:!!d.pinMessages,label:C("EditAdminPinMessages"),blocking:!0,disabled:S("pinMessages"),onChange:k})),n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"addAdmins",checked:!!d.addAdmins,label:C("EditAdminAddAdmins"),blocking:!0,disabled:S("addAdmins"),onChange:k})),!l&&n.a.createElement("div",{className:"ListItem no-selection"},n.a.createElement(aa.a,{name:"anonymous",checked:!!d.anonymous,label:C("EditAdminSendAnonymously"),blocking:!0,disabled:S("anonymous"),onChange:k})),o&&n.a.createElement("p",{className:"section-info mb-4",dir:"auto"},C("Channel.EditAdmin.CannotEdit")),!l&&n.a.createElement(ge.a,{id:"admin-title",label:C("EditAdminRank"),onChange:P,value:O,disabled:o,maxLength:16}),r!==e&&!o&&n.a.createElement(Ee.a,{icon:"delete",ripple:!0,destructive:!0,onClick:E},C("EditAdminRemoveAdmin")))),n.a.createElement(qt,{isShown:h,onClick:N,ariaLabel:C("Save"),disabled:p},p?n.a.createElement(L.a,{color:"white"}):n.a.createElement("i",{className:"icon-check"})),n.a.createElement(we.a,{isOpen:v,onClose:f,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:I,confirmIsDestructive:!0}))}));var Qc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(m.kb)(a),serverTimeOffset:e.serverTimeOffset}},(e,t)=>Object(u.l)(t,["openUserInfo"]))(({members:e,usersById:t,isChannel:a,openUserInfo:c,serverTimeOffset:r})=>{const s=Object(n.p)(()=>{if(e&&t)return Object(m.Fb)(e.map(({userId:e})=>e),t,void 0,r)},[e,r,t]),l=Object(n.m)(e=>{c({id:e})},[c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},s?s.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>l(e)},n.a.createElement(fe.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(tt.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var Xc=Object(n.h)(Object(c.h)((e,{chatId:t})=>{const a=Object(d.f)(e,t),{byId:n}=e.users;return{members:a&&a.fullInfo&&a.fullInfo.members,usersById:n,isChannel:a&&Object(m.kb)(a),serverTimeOffset:e.serverTimeOffset}})(({usersById:e,members:t,isChannel:a,onScreenSelect:c,onChatMemberSelect:r,serverTimeOffset:l})=>{const o=Object(n.p)(()=>{if(t&&e)return Object(m.Fb)(t.filter(e=>!e.isOwner).map(({userId:e})=>e),e,void 0,l)},[t,l,e]),i=Object(n.m)(e=>{r(e),c(s.g.GroupUserPermissions)},[r,c]);return n.a.createElement("div",{className:"Management"},n.a.createElement("div",{className:"custom-scroll"},n.a.createElement("div",{className:"section",teactFastList:!0},o?o.map((e,t)=>n.a.createElement(Ee.a,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>i(e)},n.a.createElement(fe.a,{userId:e,forceShowSelf:!0}))):n.a.createElement(tt.a,{teactOrderKey:0,key:"nothing-found",text:a?"No subscribers found":"No members found"}))))}));var Jc=Object(n.h)(Object(c.h)(e=>({managementType:Object(d.u)(e)}))(({chatId:e,currentScreen:t,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:r,onChatMemberSelect:l,managementType:o})=>{switch(t){case s.g.Initial:switch(o){case"user":return n.a.createElement(Uc,{key:e,userId:e});case"group":return n.a.createElement(Gc,{key:e,chatId:e,onScreenSelect:r});case"channel":return n.a.createElement(Hc,{key:e,chatId:e,onScreenSelect:r})}break;case s.g.ChatPrivacyType:return n.a.createElement(_c,{chatId:e});case s.g.Discussion:return n.a.createElement(Vc,{chatId:e,onScreenSelect:r});case s.g.GroupPermissions:return n.a.createElement(qc,{chatId:e,onScreenSelect:r,onChatMemberSelect:l});case s.g.GroupRemovedUsers:return n.a.createElement(zc,{chatId:e});case s.g.GroupUserPermissionsCreate:return n.a.createElement(Xc,{chatId:e,onChatMemberSelect:l,onScreenSelect:r});case s.g.GroupUserPermissions:return n.a.createElement(Wc,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:r});case s.g.ChatAdministrators:return n.a.createElement(Kc,{chatId:e,onScreenSelect:r,onChatMemberSelect:l});case s.g.GroupRecentActions:return n.a.createElement(Yc,{chatId:e});case s.g.ChatAdminRights:return n.a.createElement(Zc,{chatId:e,selectedChatMemberId:a,isPromotedByCurrentUser:c,onScreenSelect:r});case s.g.ChannelSubscribers:case s.g.GroupMembers:return n.a.createElement(Qc,{chatId:e})}}));const er={USD:"$",EUR:"€",GBP:"£",JPY:"¥",RUB:"₽",UAH:"₴",INR:"₹",AED:"د.إ"};function tr(e){return e&&er[e]||""}const ar=/^4[0-9]{12}(?:[0-9]{1,3})?$/,nr=/^5[1-5][0-9]{11,14}$/,cr=/^2[2-7][0-9]{11,14}$/;let rr;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(rr||(rr={}));const sr={[rr.Default]:"",[rr.Visa]:"visa",[rr.Mastercard]:"mastercard"};function lr(e){return e=e.replace(/\s/g,""),ar.test(e)?rr.Visa:nr.test(e)||cr.test(e)?rr.Mastercard:rr.Default}var or=a(60);const ir={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},dr=(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:mr(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:mr(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function mr(e){const t=xt.a.find(({id:t})=>t===e);return t?t.name:""}function ur(e,t=400){Object(n.n)(()=>{o.m||setTimeout(()=>{Object(_.b)(()=>{e.current&&e.current.focus()})},t)},[e,t])}var hr=Object(n.h)(e=>{const{id:t,value:a,label:c,hasArrow:r,error:s,ref:l,placeholder:o,onChange:i,children:d}=e,m=s||c,u=Object(V.a)("input-group",a&&"touched",s&&"error",m&&"with-label",r&&"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:o||c,ref:l},d),m&&t&&n.a.createElement("label",{htmlFor:t},m))});a(304);var br=Object(n.h)(({state:e,needEmail:t,needPhone:a,needName:c,needAddress:r,dispatch:s})=>{const l=Object(n.q)(null),o=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(F.a)();ur(l);const m=Object(n.m)(e=>{s({type:"changeAddress1",payload:e.target.value})},[s]),u=Object(n.m)(e=>{s({type:"changeAddress2",payload:e.target.value})},[s]),h=Object(n.m)(e=>{s({type:"changeCity",payload:e.target.value})},[s]),b=Object(n.m)(e=>{s({type:"changeState",payload:e.target.value})},[s]),p=Object(n.m)(e=>{s({type:"changeCountry",payload:e.target.value})},[s]),g=Object(n.m)(e=>{s({type:"changePostCode",payload:e.target.value})},[s]),v=Object(n.m)(e=>{s({type:"changeFullName",payload:e.target.value})},[s]),E=Object(n.m)(e=>{s({type:"changeEmail",payload:e.target.value})},[s]),f=Object(n.m)(e=>{let{value:t}=e.target;t="+"+t.replace(/\D/g,""),o.current&&(o.current.value=t),s({type:"changePhone",payload:t})},[s]),O=Object(n.m)(e=>{s({type:"changeSaveInfo",payload:e.target.value})},[s]),{formErrors:j}=e;return n.a.createElement("div",{className:"ShippingInfo"},n.a.createElement("form",null,r?n.a.createElement("div",null,n.a.createElement("h5",null,d("PaymentShippingAddress")),n.a.createElement(ge.a,{ref:l,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:j.streetLine1}),n.a.createElement(ge.a,{label:"Address2 (Street)",onChange:u,value:e.streetLine2,inputMode:"text",error:j.streetLine2}),n.a.createElement(ge.a,{label:"City",onChange:h,value:e.city,inputMode:"text",error:j.city}),n.a.createElement(ge.a,{label:"State",onChange:b,value:e.state,inputMode:"text",error:j.state}),n.a.createElement(hr,{label:"Country",placeholder:"Country",onChange:p,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:j.countryIso2,ref:i},xt.a.map(({name:e,id:t})=>n.a.createElement("option",{value:t,className:"county-item"},e))),n.a.createElement(ge.a,{label:"Post Code",onChange:g,value:e.postCode,inputMode:"text",error:j.postCode})):void 0,c||t||a?n.a.createElement("h5",null,d("PaymentShippingReceiver")):void 0,c&&n.a.createElement(ge.a,{label:"Full name",onChange:v,value:e.fullName,inputMode:"text",error:j.fullName}),t&&n.a.createElement(ge.a,{label:"Email",onChange:E,value:e.email,inputMode:"email",error:j.email}),a&&n.a.createElement(ge.a,{label:"Phone number",onChange:f,value:e.phone,inputMode:"tel",error:j.phone,ref:o}),n.a.createElement(aa.a,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:O})))});a(305);var pr=Object(n.h)(({state:e,shippingOptions:t,currency:a,dispatch:c})=>{Object(n.n)(()=>{t&&!e.shipping&&c({type:"changeShipping",payload:t[0].id})},[t,e.shipping,c]);const r=Object(n.m)(e=>{c({type:"changeShipping",payload:e})},[c]),s=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(oa.a,{name:"shipping-options",options:s,onChange:r,selected:e.shipping})))});a(306);function gr(e,t,a,c=!1){return n.a.createElement("div",{className:"price-info-item "+(c?"price-info-item-main":"")},n.a.createElement("div",{className:"title"},e),n.a.createElement("div",{className:"value"},`${a||""} ${(t/100).toFixed(2)}`))}function vr(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 Er=Object(n.h)(({invoiceContent:e,prices:t,shippingPrices:a,checkoutInfo:c,currency:r,totalPrice:s})=>{const{photoUrl:l,title:o,text:i}=e||{},{paymentMethod:d,paymentProvider:m,shippingAddress:u,name:h,phone:b,shippingMethod:p}=c||{};return n.a.createElement("div",{className:"Checkout"},n.a.createElement("div",{className:"description has-image"},l&&n.a.createElement("img",{src:l,alt:""}),n.a.createElement("div",{className:"text"},n.a.createElement("h5",null,o),n.a.createElement("p",null,i))),n.a.createElement("div",{className:"price-info"},t&&t.map(e=>gr(e.label,e.amount,r,!1)),a&&a.map(e=>gr(e.label,e.amount,r,!1)),void 0!==s&&gr("Total",s,r,!0)),n.a.createElement("div",{className:"invoice-info"},d&&vr("icon-card",d,"Payment method"),m&&vr("stripe-provider",m,"Payment provider"),u&&vr("icon-location",u,"Shipping address"),h&&vr("icon-user",h,"Name"),b&&vr("icon-phone",b,"Phone number"),p&&vr("icon-truck",p,"Shipping method")))});var fr=Object(n.h)(({value:e,error:t,onChange:a})=>{const c=Object(n.q)(null),r=Object(n.m)(t=>{if("Backspace"===t.key&&"/"===e.charAt(e.length-1)){const t=e.slice(0,e.length-1);c.current&&(c.current.value=t)}},[e]),s=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(ge.a,{label:"Expiry date",ref:c,onChange:s,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}),Or=(a(307),a.p+"mastercard.4216118edafe23cc2dec7b8807ba4622.svg"),jr=a.p+"visa.e5a7c336e1deb4b92a636e2e053878c4.svg";var Cr=Object(n.h)(({value:e,error:t,onChange:a})=>{const c=Object(n.q)(null);ur(c);const[r,s]=Object(n.r)(rr.Default);Object(n.n)(()=>{const t=lr(e);s(t)},[]);const l=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=lr(e.target.value);s(n),a(t),c.current&&(c.current.value=t)},[a,c]),o=function(e){switch(e){case rr.Mastercard:return n.a.createElement("img",{src:Or,alt:""});case rr.Visa:return n.a.createElement("img",{src:jr,alt:""});default:return}}(r);return n.a.createElement("div",{className:"CardInput"},n.a.createElement("span",{className:"left-addon"},o),n.a.createElement(ge.a,{ref:c,label:"Card number",onChange:l,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))});a(308);var yr=Object(n.h)(({state:e,canSaveCredentials:t,needCardholderName:a,needCountry:c,needZip:r,dispatch:s})=>{const l=Object(n.q)(null);Object(n.n)(()=>{l.current&&l.current.value!==e.billingCountry&&(l.current.value=e.billingCountry)},[e.billingCountry]);const o=Object(n.m)(e=>{s({type:"changeCardNumber",payload:e})},[s]),i=Object(n.m)(e=>{s({type:"changeCardholder",payload:e.target.value.toUpperCase()})},[s]),d=Object(n.m)(e=>{s({type:"changeExpiryDate",payload:e})},[s]),m=Object(n.m)(e=>{s({type:"changeCvvCode",payload:e.target.value})},[s]),u=Object(n.m)(e=>{s({type:"changeBillingCountry",payload:e.target.value})},[s]),h=Object(n.m)(e=>{s({type:"changeBillingZip",payload:e.target.value})},[s]),b=Object(n.m)(e=>{s({type:"changeSaveCredentials",payload:e.target.value})},[s]),p=Object(F.a)(),{formErrors:g={}}=e;return n.a.createElement("div",{className:"PaymentInfo"},n.a.createElement("form",null,n.a.createElement("h5",null,p("PaymentCardTitle")),n.a.createElement(Cr,{onChange:o,value:e.cardNumber,error:g.cardNumber}),a&&n.a.createElement(ge.a,{label:"Name on card",onChange:i,value:e.cardholder,inputMode:"text",error:g.cardholder}),n.a.createElement("section",{className:"inline-inputs"},n.a.createElement(fr,{value:e.expiry,onChange:d,error:g.expiry}),n.a.createElement(ge.a,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:g.cvv})),c||r?n.a.createElement("h5",null,p("PaymentBillingAddress")):void 0,c&&n.a.createElement(hr,{label:"Country",placeholder:"Country",onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,ref:l},xt.a.map(({name:e})=>n.a.createElement("option",{value:e,className:"county-item"},e))),r&&n.a.createElement(ge.a,{label:"Post Code",onChange:h,value:e.billingZip,inputMode:"text",error:g.billingZip}),t&&n.a.createElement(aa.a,{label:p("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:b})))});a(187);var kr=Object(n.h)(Object(c.h)(e=>{const{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:c,invoice:r,invoiceContent:s,nativeProvider:l,nativeParams:o,passwordMissing:i,error:d}=e.payment,m=Boolean(r&&(!l||"stripe"!==l)),{needCardholderName:u,needCountry:h,needZip:b}=o||{},{nameRequested:p,phoneRequested:g,emailRequested:v,shippingAddressRequested:E,flexible:f,phoneToProvider:O,emailToProvider:j,currency:C,prices:y}=r||{};return{step:t,shippingOptions:a,savedInfo:n,canSaveCredentials:c,nativeProvider:l,passwordMissing:i,nameRequested:p,shippingAddressRequested:E,phoneRequested:g,emailRequested:v,flexible:f,phoneToProvider:O,emailToProvider:j,currency:C,prices:y,isProviderError:m,invoiceContent:s,needCardholderName:u,needCountry:h,needZip:b,error:d,globalDialogs:e.dialogs}},(e,t)=>Object(u.l)(t,["validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError"]))(({isOpen:e,onClose:t,step:a,shippingOptions:c,savedInfo:r,canSaveCredentials:l,nameRequested:o,shippingAddressRequested:i,phoneRequested:d,emailRequested:m,phoneToProvider:u,emailToProvider:h,currency:b,passwordMissing:p,isProviderError:g,invoiceContent:v,nativeProvider:E,prices:f,needCardholderName:O,needCountry:j,needZip:C,error:y,globalDialogs:k,validateRequestedInfo:N,sendPaymentForm:I,setPaymentStep:S,sendCredentialsInfo:w,clearPaymentError:P})=>{const[M,A]=It(dr,ir),D=tr(b),[B,x]=Object(n.r)(!1),U=Object(F.a)();Object(n.n)(()=>{(a||y||k)&&x(!1)},[a,y,k]),Object(n.n)(()=>{if(y&&y.field)A({type:"setFormErrors",payload:{[y.field]:y.fieldError}});else if(k&&k.length){const e=Object(or.a)(k);A({type:"setFormErrors",payload:{...e}})}},[y,k,A]),Object(n.n)(()=>{if(r){const{name:e,phone:t,email:a,shippingAddress:n}=r;A({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?"+"+t:t,email:a,...n||{}}})}},[r,A]);const G=Object(n.m)(()=>{P()},[P]),q=Object(n.p)(()=>a!==s.i.Checkout?0:function(e=[],t,a){const n=t?Ir(t,a):[];let c=0;const r=e.concat(n||[]);return c=r.reduce((e,t)=>e+t.amount,c),c}(f,c,M.shipping),[a,M.shipping,f,c]),z=Object(n.p)(()=>{if(a===s.i.Checkout)return function(e,t,a){const n=`${function(e){const t=lr(e);return sr[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,c=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:s}=e,l=t?Nr(t,e.shipping):void 0,o=l?l.title:void 0;return{paymentMethod:n,paymentProvider:a,shippingAddress:c,name:s,phone:r,shippingMethod:o}}(M,c,E||"")},[a,M,c,E]);const H=Object(n.m)(()=>{const{saveInfo:e}=M,t=function(e){const{streetLine1:t,streetLine2:a,city:n,state:c,countryIso2:r,postCode:s,fullName:l,phone:o,email:i}=e;return{name:l,phone:o,email:i,shippingAddress:{streetLine1:t,streetLine2:a,city:n,state:c,countryIso2:r,postCode:s}}}(M);N({requestInfo:t,saveInfo:e})},[N,M]),$=Object(n.m)(()=>{const e=function(e){const{cardNumber:t,cardholder:a,expiry:n,cvv:c,billingCountry:r,billingZip:s}=e,[l,o]=n.split("/");return{data:{cardNumber:t,cardholder:a,expiryMonth:l,expiryYear:o,cvv:c,country:r,zip:s}}}(M);w({credentials:e})},[w,M]),_=Object(n.m)(()=>{I({shippingOptionId:M.shipping,saveCredentials:M.saveCredentials})},[I,M]),V=Object(n.m)(e=>{S({step:e})},[S]),W=Object(n.m)(()=>{switch(x(!0),a){case s.i.ShippingInfo:return H();case s.i.Shipping:return V(s.i.PaymentInfo);case s.i.PaymentInfo:return $();case s.i.Checkout:return _();default:return()=>{}}},[a,H,V,$,_]),K=Object(n.p)(()=>{switch(a){case s.i.ShippingInfo:return U("PaymentShippingInfo");case s.i.Shipping:return U("PaymentShippingMethod");case s.i.PaymentInfo:return U("PaymentCardInfo");case s.i.Checkout:return U("PaymentCheckout");default:return""}},[a,U]),Y=Object(n.p)(()=>{switch(a){case s.i.Checkout:return U("Checkout.PayPrice",`${D}${(q/100).toFixed(2)}`);default:return U("Next")}},[a,U,D,q]);return g?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(R.a,{isText:!0,onClick:t},U("OK"))):n.a.createElement(pe.a,{className:"PaymentModal",isOpen:e,onClose:t},n.a.createElement("div",{className:"header",dir:U.isRtl?"rtl":void 0},n.a.createElement(R.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 s.i.ShippingInfo:return n.a.createElement(br,{state:M,dispatch:A,needAddress:Boolean(i),needEmail:Boolean(m||h),needPhone:Boolean(d||u),needName:Boolean(o)});case s.i.Shipping:return n.a.createElement(pr,{state:M,dispatch:A,shippingOptions:c||[],currency:D});case s.i.PaymentInfo:return n.a.createElement(yr,{state:M,dispatch:A,canSaveCredentials:Boolean(!p&&l),needCardholderName:O,needCountry:j,needZip:C});case s.i.Checkout:return n.a.createElement(Er,{prices:f,shippingPrices:M.shipping&&c?Ir(c,M.shipping):void 0,totalPrice:q,invoiceContent:v,checkoutInfo:z,currency:D});default:return}}(a))):n.a.createElement("div",{className:"empty-content"},n.a.createElement(L.a,{color:"gray"})),n.a.createElement("div",{className:"footer"},n.a.createElement(R.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(R.a,{isText:!0,onClick:P},U("OK")))}())}));function Nr(e,t){return e.find(({id:e})=>e===t)}function Ir(e,t){const a=Nr(e,t);return a?a.prices:void 0}var Sr=Object(n.h)(Object(c.h)(e=>{const{receipt:t}=e.payment,{currency:a,prices:n,info:c,totalAmount:r,credentialsTitle:s,shippingPrices:l,shippingMethod:o,photoUrl:i,text:d,title:m}=t||{};return{currency:a,prices:n,info:c,totalAmount:r,credentialsTitle:s,shippingPrices:l,shippingMethod:o,photoUrl:i,text:d,title:m}})(({isOpen:e,onClose:t,prices:a,shippingPrices:c,totalAmount:r,currency:s,info:l,photoUrl:o,text:i,title:d,credentialsTitle:m,shippingMethod:u})=>{const h=Object(F.a)(),b=tr(s),p=Object(n.p)(()=>function(e,t,a){if(!t)return{paymentMethod:e};const{shippingAddress:n}=t,c=n&&n.streetLine1?`${n.streetLine1}, ${n.city}, ${n.countryIso2}`:void 0,{phone:r,name:s}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:c,name:s,phone:r,shippingMethod:a}}(m,l,u),[l,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(R.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(Er,{prices:a,shippingPrices:c,totalPrice:r,invoiceContent:{photoUrl:o,text:i,title:d},checkoutInfo:p,currency:b}))))}))},,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(7),c=a(54);const r={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 s(e){const t=r[e].replace(window.location.origin,"");return c.b("file"+t,n.ApiMediaFormat.Lottie)}},,,,,function(e,t,a){"use strict";var n=a(0),c=a(8),r=a(1),s=a(13),l=a(26),o=a(23),i=a(109),d=a(17);a(150);const m={type:"blob",quality:.8,format:"jpeg",circle:!1};let u,h,b;var p=Object(n.h)(({file:e,onChange:t,onClose:c})=>{const[p,g]=Object(n.r)(!1);Object(n.n)(()=>{e&&(p?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 c=await Object(s.a)(e);await b.bind({url:c})}catch(e){r.p&&console.error(e)}}(e):async function(){return h||(h=Promise.all([a.e(6),a.e(8)]).then(a.bind(null,317)),u=(await h).default),h}().then(()=>g(!0)))},[e,p]);const v=Object(l.a)();return n.a.createElement(i.a,{isOpen:Boolean(e),onClose:c,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},p?n.a.createElement("div",{id:"avatar-crop"}):n.a.createElement(d.a,null),n.a.createElement(o.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(s.b)(e,"avatar.jpg");t(a)},ariaLabel:v("CropImage")},n.a.createElement("i",{className:"icon-check"})))});a(151);t.a=Object(n.h)(({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:a,onChange:r})=>{const[s,l]=Object(n.r)(),[o,i]=Object(n.r)(a);Object(n.n)(()=>{i(a)},[a]);const d=Object(c.a)(o&&"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]&&(l(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),n.a.createElement("i",{className:"icon-camera-add"}),o&&n.a.createElement("img",{src:o,alt:"Avatar"})),n.a.createElement(p,{file:s,onClose:function(){l(void 0)},onChange:function(e){l(void 0),r(e),o&&URL.revokeObjectURL(o),i(URL.createObjectURL(e))}}))})},,,,,,,,,function(e,t,a){},,,,,,,,function(e,t,a){"use strict";var n=a(0),c=a(1),r=a(5),s=a(125),l=a(115);a(139);const o=[0,50],i=[0,20],d=[20,0],m=r.k?c.sb:c.rb;t.a=Object(n.h)(({isPasswordVisible:e,isBig:t})=>{const[a,r]=Object(n.r)(),[u,h]=Object(n.r)(),[b,p]=Object(n.r)(!1),[g,v]=Object(n.r)(!1);Object(n.n)(()=>{a?setTimeout(()=>v(!0),2e3):Object(s.a)("MonkeyClose").then(r)},[a]),Object(n.n)(()=>{u||Object(s.a)("MonkeyPeek").then(h)},[u]);const E=Object(n.m)(()=>p(!0),[]);return n.a.createElement("div",{id:"monkey",className:t?"big":""},!b&&n.a.createElement("div",{className:"monkey-preview"}),a&&n.a.createElement(l.a,{id:"closeMonkey",size:t?c.Cb:m,className:g?"hidden":"shown",animationData:a,playSegment:o,noLoop:!0,onLoad:E}),u&&n.a.createElement(l.a,{id:"peekMonkey",size:t?c.Cb:m,className:g?"shown":"hidden",animationData:u,playSegment:e?i:d,noLoop:!0}))})},function(e,t,a){"use strict";var n=a(0),c=a(1),r=a(5),s=a(8),l=a(26),o=a(23);const i=r.k?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:p,onSubmit:g})=>{const v=Object(n.q)(null),E=Object(l.a)(),[f,O]=Object(n.r)(""),[j,C]=Object(n.r)(!1);return Object(n.n)(()=>{r.m||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||j&&g(f)},autoComplete:"off"},n.a.createElement("div",{className:Object(s.a)("input-group password-input",f&&"touched",a&&"error"),dir:E.isRtl?"rtl":void 0},n.a.createElement("input",{ref:v,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:f||"",autoComplete:"current-password",onChange:function(e){a&&h();const{target:t}=e;O(t.value),C(t.value.length>=c.Y),p&&p(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"}))),j&&n.a.createElement(o.a,{type:"submit",ripple:!0,isLoading:e},u))})},,function(e,t,a){},function(e,t,a){},,,,,,,,,,,,,,,function(e,t,a){},,,,,,,,,,,,,,,,,,,,function(e,t,a){},function(e,t,a){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){},function(e,t,a){}])]);
|
||
//# sourceMappingURL=3.41197bdddd2827d6c797.js.map
|