mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-15 02:37:17 +01:00
2 lines
272 KiB
JavaScript
2 lines
272 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[701],{9701:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>Ba,AttachMenu:()=>Xs,AttachmentModal:()=>gs,BotCommandMenu:()=>Hs,BotCommandTooltip:()=>Ys,CalendarModal:()=>De,ChatFolderModal:()=>Da,ContactList:()=>ka,ContextMenuContainer:()=>Ka,CustomSendMenu:()=>Vs,DeleteMessageModal:()=>Oe,Dialogs:()=>we,DropArea:()=>Ks.Z,EmojiTooltip:()=>Qs,ForwardPicker:()=>Ie,GifSearch:()=>hr,HeaderMenuContainer:()=>Qa,HistoryCalendar:()=>Ue,InlineBotTooltip:()=>or,LeftSearch:()=>Rt,Management:()=>Rr,MediaViewer:()=>de,MentionTooltip:()=>Zs,MessageSelectToolbar:()=>Ye,MobileSearch:()=>ns,NewChat:()=>La,NewChatStep1:()=>Ta,NewChatStep2:()=>Fa,Notifications:()=>ke,PaymentModal:()=>oo,PinMessageModal:()=>xe,PollModal:()=>ps,PollResults:()=>Pr,ReceiptModal:()=>co,RightSearch:()=>ir,SafeLinkModal:()=>Fe,Settings:()=>wa,StickerSearch:()=>ur,StickerSetModal:()=>qa,StickerTooltip:()=>js,SymbolMenu:()=>zs,TextFormatter:()=>qs.Z,UnpinAllMessagesModal:()=>Ge});var a=n(4050),s=n(5116),r=n(6137),o=n(1713),l=n(3716),i=n(7361),c=n(3858),d=n(4399),m=n(8085),u=n(2858),h=n(782),Z=n(1174),P=n(3989),g=n(396),v=n(5326),p=n(6202),E=n(2566),C=n(2937),f=n(7204),b=n(8674),I=n(935);function y(e,t){const n=document.createElement("div");n.classList.add("ghost");const a=new Image;if("string"==typeof e?a.src=e:e instanceof HTMLVideoElement?a.src=e.poster:a.src=e.src,n.appendChild(a),t===o.bZ.ProfileAvatar||t===o.bZ.SettingsAvatar){n.classList.add("ProfileInfo"),t===o.bZ.SettingsAvatar&&n.classList.add("self");const e=document.querySelector(t===o.bZ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&n.appendChild(e.cloneNode(!0))}return n}function S(e,t){const n=document.querySelector(".active > .MessageList");let a=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(a+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),a>n.scrollTop&&a+t.offsetHeight<n.scrollTop+n.offsetHeight}function w(e,t){Object.assign(e.style,t)}function N(e,t){let n,a;switch(e){case o.bZ.Album:case o.bZ.ScheduledAlbum:n=`.active > .MessageList #album-media-${t.id}`,a=".full-media";break;case o.bZ.SharedMedia:n=`#shared-media${t.id}`,a="img";break;case o.bZ.SearchResult:n=`#search-media${t.id}`,a="img";break;case o.bZ.MiddleHeaderAvatar:n=".MiddleHeader .ChatInfo .Avatar",a="img.avatar-media";break;case o.bZ.SettingsAvatar:n="#Settings .ProfileInfo .active .ProfilePhoto",a="img.avatar-media";break;case o.bZ.ProfileAvatar:n="#RightColumn .ProfileInfo .active .ProfilePhoto",a="img.avatar-media";break;case o.bZ.ScheduledInline:case o.bZ.Inline:default:n=`.active > .MessageList #message${t.id}`,a=".message-content .full-media, .message-content .thumbnail"}const s=document.querySelector(n),r=s&&s.querySelectorAll(a);return{container:s,mediaEl:null==r?void 0:r[r.length-1]}}function k(e,t){switch(t){case o.bZ.Album:case o.bZ.ScheduledAlbum:case o.bZ.Inline:case o.bZ.ScheduledInline:e.classList.add("rounded-corners");break;case o.bZ.SharedMedia:case o.bZ.SettingsAvatar:case o.bZ.ProfileAvatar:case o.bZ.SearchResult:e.firstChild.style.objectFit="cover";break;case o.bZ.MiddleHeaderAvatar:e.classList.add("circle")}}var M=n(9107),T=n(6590),F=n(9204),A=n(126),L=n(2255),R=n(231),B=n(790),$=n(2340),D=n(172);const U=(0,s.c$)(((e,{chatId:t,messageId:n,isAvatar:a})=>{if(a&&t)return{sender:(0,u.YC)(t)?(0,m.dy)(e,t):(0,m.Z1)(e,t)};if(!n||!t)return{};const s=(0,m.hj)(e,t,n);return{message:s,sender:s&&(0,m.Ur)(e,s)}}),((e,t)=>(0,h.ei)(t,["closeMediaViewer","focusMessage"])))((({chatId:e,messageId:t,sender:n,isAvatar:s,message:r,closeMediaViewer:o,focusMessage:l})=>{const i=(0,a.I4)((()=>{o(),l({chatId:e,messageId:t})}),[e,l,t,o]),c=(0,M.Z)();if(!n||!r&&!s)return;const d=(0,u.OU)(c,n);return a.ZP.createElement("div",{className:"SenderInfo",onClick:i},(0,u.YC)(n.id)?a.ZP.createElement(D.Z,{key:n.id,size:"medium",user:n}):a.ZP.createElement(D.Z,{key:n.id,size:"medium",chat:n}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},d&&(0,$.Z)(d)),a.ZP.createElement("div",{className:"date",dir:"auto"},s?c("lng_mediaview_profile_photo"):(0,B.ZK)(c,1e3*r.date,!0))))}));var O=n(3106),x=n(8964),G=n(9196);const J=(0,a.X$)((0,s.c$)(((e,{message:t})=>({isDownloading:!!t&&(0,m.te)(e,t)})),((e,t)=>(0,h.ei)(t,["downloadMessageMedia","cancelMessageMediaDownload"])))((({mediaData:e,isVideo:t,isZoomed:n,message:s,fileName:r,isAvatar:o,isDownloading:l,onCloseMediaViewer:c,onForward:d,onZoomToggle:m,downloadMessageMedia:h,cancelMessageMediaDownload:Z})=>{const{loadProgress:P}=(0,E.Z)(s&&(0,u.Ti)(s,"download"),!l),g=(0,a.I4)((()=>{l?Z({message:s}):h({message:s})}),[Z,h,l,s]),v=(0,M.Z)(),p=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]);return i.wB?a.ZP.createElement("div",{className:"MediaViewerActions-mobile"},a.ZP.createElement(O.Z,{trigger:p,positionX:"right"},!o&&a.ZP.createElement(x.Z,{icon:"forward",onClick:d},v("Forward")),t?a.ZP.createElement(x.Z,{icon:l?"close":"download",onClick:g},l?`${Math.round(100*P)}% Downloading...`:"Download"):a.ZP.createElement(x.Z,{icon:"download",href:e,download:r},v("AccActionDownload"))),l&&a.ZP.createElement(G.Z,{progress:P,size:"s",noCross:!0})):a.ZP.createElement("div",{className:"MediaViewerActions"},!o&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:v("Forward"),onClick:d},a.ZP.createElement("i",{className:"icon-forward"}))),t?a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:v("AccActionDownload"),onClick:g},l?a.ZP.createElement(G.Z,{progress:P,size:"s",onClick:g}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(R.Z,{href:e,download:r,round:!0,size:"smaller",color:"translucent-white",ariaLabel:v("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:n?"Zoom Out":"Zoom In",onClick:m},a.ZP.createElement("i",{className:n?"icon-zoom-out":"icon-zoom-in"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:v("Close"),onClick:c},a.ZP.createElement("i",{className:"icon-close"})))})));var z=n(9118),X=n(6752);const _=({text:e="",isHidden:t,isForVideo:n,onClick:s})=>{const[r,o]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;o(t>2*d.Gw)};t();const n=(0,z.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const l=(0,X.Z)("MediaViewerFooter",n&&"is-for-video",t&&"is-hidden");return a.ZP.createElement("div",{className:l,onClick:function(t){e&&t.stopPropagation()}},e&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:i.wB?void 0:s},a.ZP.createElement("p",{className:"media-text custom-scroll "+(r?"multiline":""),dir:"auto"},e)))};var Y=n(1212),H=n(2019);const j=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var V=n(6898),K=n(4753);const q=["bytes","kB","MB","GB","TB","PB"],W=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${q[t]}`},Q=e=>{e.stopPropagation()},ee=({bufferedProgress:e,currentTime:t,duration:n,fileSize:s,isForceVisible:r,isForceMobileVersion:o,isPlayed:l,isFullscreenSupported:c,isFullscreen:d,onChangeFullscreen:m,onPlayPause:u,onSeek:h})=>{const[P,g]=(0,a.eJ)(!0),v=(0,a.sO)(null),p=(0,a.sO)(!1);(0,a.d4)((()=>{r&&g(r)}),[r]),(0,a.d4)((()=>{let e;return r||(i.wB?g(!1):e=window.setTimeout((()=>{g(!1)}),800)),()=>{e&&window.clearTimeout(e)}}),[r]),(0,a.d4)((()=>((P||r)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[r,P]);const E=(0,M.Z)(),C=(0,a.I4)((e=>{if(p.current&&v.current){const{width:t,left:a}=v.current.getBoundingClientRect(),s=e instanceof MouseEvent?e.clientX:e.targetTouches[0].clientX;h(Math.max(Math.min(n*((s-a)/t),n),0))}}),[n,h]),f=(0,a.I4)((e=>{p.current=!0,C(e)}),[C]),b=(0,a.I4)((()=>{p.current=!1}),[]);var I,y;if((0,a.d4)((()=>{if(v.current&&P)return(0,Z.s)(v.current,{onCapture:f,onRelease:b,onClick:b,onDrag:C})}),[P,f,C,b]),P||r)return a.ZP.createElement("div",{className:"VideoPlayerControls "+(o?"mobile":""),onClick:Q},function(e,t,n,s){const r=e/t*100,o=100*n;return a.ZP.createElement("div",{className:"player-seekline",ref:s},a.ZP.createElement("div",{className:"player-seekline-track"},a.ZP.createElement("div",{className:"player-seekline-buffered",style:`width: ${o||0}%`}),a.ZP.createElement("div",{className:"player-seekline-played",style:`width: ${r||0}%`})))}(t,n,e,v),a.ZP.createElement(R.Z,{ariaLabel:E("AccActionPlay"),size:"tiny",ripple:!i.wB,color:"translucent-white",className:"play",onClick:u},a.ZP.createElement("i",{className:l?"icon-pause":"icon-play"})),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,B.k9)(e)} / ${(0,B.k9)(t)}`)}(t,n),e<1&&(I=e,y=s,a.ZP.createElement("div",{className:"player-file-size"},`${W(y*I)} / ${W(y)}`)),c&&a.ZP.createElement(R.Z,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",onClick:m},a.ZP.createElement("i",{className:d?"icon-smallscreen":"icon-fullscreen"})))};function te(){return(te=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}const ne=(0,a.X$)((({url:e,isGif:t,posterData:n,posterSize:s,loadProgress:r,fileSize:o,isMediaViewerOpen:l,noPlay:c,onClose:d})=>{const m=(0,a.sO)(null),[u,h]=(0,a.eJ)(!i.$b||!i.cj),[Z,P]=(0,a.eJ)(0),[g,v]=(0,a.eJ)(!0),[p,E,C]=function(e,t){const[n,s]=(0,a.eJ)(Boolean(j&&document[j]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(j&&document[j]))},a=()=>{s(!0)},r=()=>{s(!1),t(!1)},o=e.current;return document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),o&&(o.addEventListener("webkitbeginfullscreen",a,!1),o.addEventListener("webkitendfullscreen",r,!1)),()=>{document.removeEventListener("fullscreenchange",n,!1),document.removeEventListener("webkitfullscreenchange",n,!1),document.removeEventListener("mozfullscreenchange",n,!1),o&&(o.removeEventListener("webkitbeginfullscreen",a,!1),o.removeEventListener("webkitendfullscreen",r,!1))}}),[]),j||"iOS"===i.Lt?[n,()=>{e.current&&(j||"iOS"===i.Lt)&&(e.current.requestFullscreen?e.current.requestFullscreen():e.current.webkitRequestFullscreen?e.current.webkitRequestFullscreen():e.current.webkitEnterFullscreen?e.current.webkitEnterFullscreen():e.current.mozRequestFullScreen&&e.current.mozRequestFullScreen(),s(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),s(!1))}]:[!1]}(m,h),{isBuffered:f,bufferedProgress:b,bufferingHandlers:I}=(0,H.Z)(),{shouldRender:y,transitionClassNames:S}=(0,Y.Z)(!f,void 0,void 0,"slow"),{shouldRender:w,transitionClassNames:N}=(0,Y.Z)(i.cj&&!u&&!y,void 0,void 0,"slow");(0,a.d4)((()=>{c||!l?m.current.pause():e&&!i.$b&&(0,K.Z)(m.current)}),[c,l,e]),(0,a.d4)((()=>{m.current.currentTime===m.current.duration?(P(0),h(!1)):P(m.current.currentTime)}),[Z]);const k=(0,a.I4)((e=>{e.stopPropagation(),u?(m.current.pause(),h(!1)):((0,K.Z)(m.current),h(!0),i.wB&&v(!1))}),[u]);(0,V.Z)(m,[]);const M=(0,a.I4)((()=>{v(!0)}),[]),T=(0,a.I4)((()=>{v(!1)}),[]),F=(0,a.I4)((e=>{P(e.currentTarget.currentTime)}),[]),A=(0,a.I4)((()=>{P(0),h(!1),v(!0)}),[]),L=(0,a.I4)((()=>{p&&C?C():!p&&E&&E()}),[C,p,E]),B=(0,a.I4)((e=>{m.current.currentTime=e}),[]),$=(0,a.I4)((e=>{e.stopPropagation(),v(!g),g||(m.current.pause(),h(!1))}),[g]);(0,a.d4)((()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[k]);const D=s&&`width: ${s.width}px; height: ${s.height}px`,U=`background-image: url(${n})`;return a.ZP.createElement("div",{className:"VideoPlayer",onClick:!t&&i.wB?$:void 0,onMouseOver:t||i.$b?void 0:M,onMouseOut:t||i.$b?void 0:T},a.ZP.createElement("div",{style:D},a.ZP.createElement("video",te({ref:m,autoPlay:i.$b,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:U,onPlay:i.cj?()=>h(!0):void 0,onEnded:A,onClick:i.wB?void 0:k,onDoubleClick:L},I,{onTimeUpdate:F}),e&&a.ZP.createElement("source",{src:e}))),w&&a.ZP.createElement(R.Z,{round:!0,className:`play-button ${N}`,onClick:k},a.ZP.createElement("i",{className:"icon-play"})),y&&a.ZP.createElement("div",{className:["spinner-container",S].join(" ")},!f&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(G.Z,{size:"xl",progress:f?1:r,square:!0,onClick:d})),!t&&!y&&a.ZP.createElement(ee,{isPlayed:u,bufferedProgress:b,currentTime:Z,isFullscreenSupported:Boolean(E),isFullscreen:p,fileSize:o,duration:m.current?m.current.duration:0,isForceVisible:g,isForceMobileVersion:s&&s.width<400,onSeek:B,onChangeFullscreen:L,onPlayPause:k}))})),ae=(0,a.X$)((({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:n}=(0,Y.Z)(e),s=(0,f.Z)(e),r=(0,a.sO)(null),[o,l]=(0,a.eJ)(1),c=(0,a.sO)(!1);(0,a.d4)((()=>{e&&!s&&l(1.5)}),[e,s]);const d=(0,a.I4)((()=>{c.current=!0}),[]),m=(0,a.I4)((()=>{c.current=!1,1===o&&t(o,!c.current)}),[t,o]);(0,a.d4)((()=>{t(o,!c.current)}),[o,t]);const u=(0,M.Z)(),h=(0,X.Z)("ZoomControls",n);return a.ZP.createElement("div",{className:h},a.ZP.createElement(R.Z,{disabled:1===o,size:"tiny",color:"translucent-white",ariaLabel:u("ZoomOut"),className:"zoom-out",ripple:!i.wB,onClick:()=>{r.current&&l(Math.max(1,o-.5))}},a.ZP.createElement("i",{className:"icon-zoom-out"})),a.ZP.createElement(R.Z,{disabled:3===o,size:"tiny",color:"translucent-white",ariaLabel:"Zoom In",className:"zoom-in",ripple:!i.wB,onClick:()=>{r.current&&l(Math.min(3,o+.5))}},a.ZP.createElement("i",{className:"icon-zoom-in"})),a.ZP.createElement("div",{className:"seekline"},a.ZP.createElement("div",{className:"seekline-track"},a.ZP.createElement("div",{className:"seekline-played",style:`width: ${50*(o-1)}%`}),a.ZP.createElement("input",{ref:r,min:1,max:3,step:"0.5",value:o,type:"range",className:"seekline-input",onChange:e=>{l(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown:d,onMouseUp:m}))))})),se=[1,0,0,1,0,0],re={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5},oe=150,le=(0,a.X$)((({children:e,className:t,noWrap:n,canPan:s,zoomLevel:r,panDeltaX:o,panDeltaY:l,onPan:i})=>{const c=re[r]||r,[d,m]=(0,a.eJ)(!1),[u,Z]=(0,a.eJ)({dx:o,dy:l,x:0,y:0}),[P,g]=(0,a.eJ)(se),v=(0,a.sO)(null),p=(0,a.sO)(null);return(0,a.d4)((()=>{const e=c||P[0],t=o||P[4],n=l||P[5],a=[...P];P[0]!==e&&(a[0]=e||a[0],a[3]=e||a[3]),P[4]!==t&&(a[4]=t),P[5]!==n&&(a[5]=n),(0,h.et)(P,a)||g(function(e,t,n){const a=n&&n.querySelector(".active img");if(!n||!a)return t;const s=n.getBoundingClientRect(),r=a.getBoundingClientRect(),o=r.width/e*t[0],l=r.height/e*t[3],i=(s.width-o)/2+t[4],c=(s.height-l)/2+t[5];return s.width&&s.width-oe<i?t[4]-=i+s.width-oe:o&&o+i<oe&&(t[4]-=o+i-oe),s.height&&s.height-oe<c?t[5]-=c+s.height-oe:l&&l+c<oe&&(t[5]-=l+c-oe),t}(P[0],a,v.current))}),[o,l,c]),(0,a.d4)((()=>{s||g(se)}),[s]),(0,a.d4)((()=>{p.current&&(p.current.style.transform=`matrix(${P.toString()})`)}),[n,P]),n?e:a.ZP.createElement("div",{ref:v,className:`pan-wrapper ${t||""}`,onMouseDown:e=>{if(!s)return;e.stopPropagation(),e.preventDefault();const t={dx:P[4],dy:P[5],x:e.pageX,y:e.pageY};Z(t),m(!0),v.current&&v.current.classList.add("move")},onMouseUp:()=>{m(!1),v.current&&v.current.classList.remove("move"),i&&i(P[4],P[5])},onMouseMove:e=>{if(d){const t=function(e,t){const n=[...P],a=u.x-e,s=u.y-t;return n[4]=u.dx-a,n[5]=u.dy-s,n}(e.pageX,e.pageY);g(t),p.current&&(p.current.style.transform=`matrix(${P.toString()})`)}}},a.ZP.createElement("div",{ref:p,className:"pan-container"},e))})),ie=350;function ce(e,t,n){return e?a.ZP.createElement("img",{src:e,alt:"",style:t?`width: ${t.width}px`:"",draggable:Boolean(n)}):a.ZP.createElement("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:""},a.ZP.createElement(F.Z,{color:"white"}))}const de=(0,a.X$)((0,s.c$)((e=>{const{chatId:t,threadId:n,messageId:a,avatarOwnerId:s,profilePhotoIndex:r,origin:l}=e.mediaViewer,{animationLevel:i}=e.settings.byKey;if(l===o.bZ.SearchResult){if(!t||!a)return{animationLevel:i};const n=(0,m.hj)(e,t,a);return n?{chatId:t,messageId:a,senderId:n.senderId,origin:l,message:n,animationLevel:i}:{animationLevel:i}}if(s)return{messageId:-1,senderId:s,avatarOwner:(0,m.dy)(e,s)||(0,m.Z1)(e,s),profilePhotoIndex:r||0,animationLevel:i,origin:l};if(!(t&&n&&a))return{animationLevel:i};let c,d,u;if(c=l&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(l)?(0,m.Tm)(e,t,a):(0,m.hj)(e,t,a),!c)return{animationLevel:i};if(d=l&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(l)?(0,m.Fn)(e,t):(0,m.Zw)(e,t),l===o.bZ.Inline||l===o.bZ.Album)u=(0,m.qC)(e,t,n)||(0,m.gb)(e,t,n);else if(l===o.bZ.SharedMedia){const t=(0,m.we)(e),{foundIds:n}=t&&t.resultsByType&&t.resultsByType.media||{};u=n}return{chatId:t,threadId:n,messageId:a,senderId:c.senderId,origin:l,message:c,chatMessages:d,collectionIds:u,animationLevel:i}}),((e,t)=>(0,h.ei)(t,["openMediaViewer","closeMediaViewer","openForwardMenu","focusMessage"])))((({chatId:e,threadId:t,messageId:n,senderId:s,origin:m,avatarOwner:h,profilePhotoIndex:F,message:B,chatMessages:$,collectionIds:D,openMediaViewer:O,closeMediaViewer:x,openForwardMenu:G,focusMessage:z,animationLevel:X})=>{const Y=Boolean(h||n),H=m===o.bZ.SharedMedia,j=m===o.bZ.SearchResult,V=B?(0,u.O$)(B):void 0,K=B?(0,u.b7)(B):void 0,q=B?(0,u.F$)(B):void 0,W=B?(0,u.Cg)(B):void 0,Q=!!B&&(0,u.rl)(B),ee=!!B&&(0,u.hC)(B),te=Boolean(K||W||ee),se=Boolean(!te&&(V||q||Q)),{isGif:re}=K||W||{},oe=Boolean(h),de=Boolean(q||W),me=(0,a.Ye)((()=>de&&n?[n]:(0,u.N0)($||{},D||[],H)),[de,n,$,D,H]),ue=n?me.indexOf(n):-1,he=0===ue||-1===ue,Ze=ue===me.length-1||-1===ue,Pe=(0,a.sO)(),ge=(0,f.Z)(s);!Y||ge&&ge===s&&Pe.current||(Pe.current=ue);const ve=X>=1?"mv-slide":"none",pe=2===X?"slide-fade":"none",Ee=2===X,[Ce,fe]=(0,a.eJ)(!1),[be,Ie]=(0,a.eJ)(!1),[ye,Se]=(0,a.eJ)(!1),[we,Ne]=(0,a.eJ)(1),[ke,Me]=(0,a.eJ)({x:0,y:0});function Te(e){if(oe&&void 0!==F){const{photos:t}=h;return t&&t[F]?`photo${t[F].id}?size=c`:(0,u.RT)(h,e?"big":"normal")}return B&&(0,u.Ti)(B,e?"viewerFull":"viewerPreview")}const Fe=(0,p.Z)(B&&(H||j)&&(0,u.Ti)(B,"pictogram"),void 0,r.IU.BlobUrl,void 0,Ee&&ie),Ae=Te(),Le=(0,p.Z)(Ae,void 0,r.IU.BlobUrl,void 0,Ee&&ie),{mediaData:Re,loadProgress:Be}=(0,E.Z)(Te(!0),void 0,B&&(0,u.kG)(B,"viewerFull"),void 0,Ee&&ie),$e=V||K?(V||K).blobUrl:void 0;let De=!te&&($e||Re)||Le||Fe;const Ue=(0,C.Z)(!De&&B&&(0,u.DH)(B));De||m===o.bZ.SearchResult||(De=Ue);const Oe=B?(0,u.c0)(B):void 0,xe=B?(0,u.ep)(B):oe?`avatar${h.id}-${F}.jpg`:void 0;let Ge;B?Q||ee?Ge=(0,u.aE)(B).mediaSize:V||q?Ge=(0,u.bV)(V||q):(K||W)&&(Ge=(0,u.jC)(K||W)):Ge=d.vY,(0,a.d4)((()=>{i.wB&&document.body.classList.toggle("is-media-viewer-open",Y)}),[Y]);const Je=(0,v.Z)();(0,a.d4)((()=>{const e=window.matchMedia(d.L6);return"function"==typeof e.addEventListener?e.addEventListener("change",Je):"function"==typeof e.addListener&&e.addListener(Je),()=>{"function"==typeof e.removeEventListener?e.removeEventListener("change",Je):"function"==typeof e.removeListener&&e.removeListener(Je)}}),[Je]);const ze=(0,f.Z)(B),Xe=(0,f.Z)(m),_e=(0,f.Z)(h),Ye=(0,f.Z)(De);(0,a.d4)((()=>{if(Ee&&Y&&!ze&&!_e){(0,b.YW)(ie+l.fK);const e=B?(0,I.X)(B):void 0;!function(e,t,n,a,s,r){const{mediaEl:i}=N(t,r);if(!i)return;const{width:m}=c.Z.get(),{width:u,height:h}=(0,d.fM)(e,s),{width:Z,height:P}=(0,d.jg)(u,h,a.width,a.height),g=(m-Z)/2,v=function(e){const t=window.matchMedia(d.L6);let n=4.125;return e&&(n+=t.matches?.875:3.375),n*d.Gw}(e)+(h-P)/2;let{top:p,left:E,width:C,height:f}=i.getBoundingClientRect();if([o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,r){if(e===t){const o=Math.max(s,r)*(e/t);a-=(o-s)/2,n-=(o-r)/2,s=o,r=o}else if(e>t){const n=s;a-=((s=r*(e/t))-n)/2}else if(t>e){const a=r;n-=((r=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:r}}(Z,P,p,E,C,f);p=e.top,E=e.left,C=e.width,f=e.height}const b=E+C/2-(g+Z/2),I=p+f/2-(v+P/2),S=C/Z,M=f/P,T=y(n||i);w(T,{top:`${v}px`,left:`${g}px`,width:`${Z}px`,height:`${P}px`,transform:`translate3d(${b}px, ${I}px, 0) scale(${S}, ${M})`}),k(T,t),document.body.classList.add("ghost-animating"),requestAnimationFrame((()=>{document.body.appendChild(T),requestAnimationFrame((()=>{T.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(T),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")}))}),200+l.fK)}))}))}(Boolean(e),m,De,Ge,te,B)}Ee&&!Y&&(ze||_e)&&((0,b.YW)(ie+l.fK),function(e,t,n){const{container:a,mediaEl:s}=N(e,n);if(!s)return;const r=document.getElementById("MediaViewer").querySelector(".active .media-viewer-content img, .active .media-viewer-content video");if(!r||!s)return;const{top:i,left:d,width:m,height:u}=r.getBoundingClientRect(),{top:h,left:Z,width:P,height:g}=s.getBoundingClientRect();let v=h;if(!function(e){if("none"===e.style.display)return!1;const t=e.getBoundingClientRect(),{height:n}=c.Z.get();return t.top<=n&&t.top+t.height>=0}(a)){const{height:e}=c.Z.get();v=h<i?-g:e}const p=d+m/2-(Z+P/2),E=i+u/2-(v+g/2);let C=m/P,f=u/g;const b=[o.bZ.Inline,o.bZ.ScheduledInline].includes(e)&&!S(a,s)||[o.bZ.Album,o.bZ.ScheduledAlbum].includes(e)&&!S(a,s);[o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(e)&&(C>f?C=f:f>C&&(f=C));const I=document.getElementsByClassName("ghost")[0],M=I||y(t||s,e);I||w(M,{top:`${v}px`,left:`${Z}px`,width:`${P}px`,height:`${g}px`,transform:`translate3d(${p}px, ${E}px, 0) scale(${C}, ${f})`}),requestAnimationFrame((()=>{if(I){const{top:e,left:t,width:n,height:a}=I.getBoundingClientRect();w(M,{transition:"none",top:`${v}px`,left:`${Z}px`,transformOrigin:"top left",transform:`translate3d(${t-Z}px, ${e-v}px, 0) scale(${n/P}, ${a/g})`,width:`${P}px`,height:`${g}px`})}document.body.classList.add("ghost-animating"),I||document.body.appendChild(M),requestAnimationFrame((()=>{I&&(I.style.transition=""),M.style.transform="",b&&(M.style.opacity="0"),k(M,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(M)&&document.body.removeChild(M),document.body.classList.remove("ghost-animating")}))}),200+l.fK)}))}))}(Xe,Ye,ze||void 0))}),[Ee,Y,m,Xe,B,ze,_e,De,Ye,Ge,te]),(0,a.d4)((()=>{let e;return ye?Ie(!0):e=window.setTimeout((()=>{Ie(!1)}),ie),()=>{e&&window.clearTimeout(e)}}),[ye]);const He=()=>{Se(!1),Ne(1),Me({x:0,y:0})},je=(0,a.I4)((()=>{Se(!ye),Ne(ye?1:1.5),ye&&Me({x:0,y:0})}),[ye]),Ve=(0,a.I4)(((e,t=!1)=>{Ne(e),1===e&&t&&He()}),[]),Ke=(0,a.I4)((()=>{x(),He()}),[x]),qe=(0,a.I4)((()=>{Ke(),z({chatId:e,threadId:t,messageId:n})}),[Ke,e,t,z,n]),We=(0,a.I4)((()=>{G({fromChatId:e,messageIds:[n]}),He()}),[G,e,n]);(0,a.d4)((()=>Y?(0,P.Z)((()=>{ye?He():Ke()})):void 0),[Ke,Y,ye]),(0,a.d4)((()=>{te&&!re&&(0,g.Es)()}),[re,te]),(0,a.d4)((()=>{if(Y)return c.Z.disableRefresh(),()=>{c.Z.enableRefresh()}}),[Y]);const Qe=(0,a.I4)(((e,t)=>{let n=me.indexOf(e);return(-1===t&&n>0||1===t&&n<me.length-1)&&(n+=t),me[n]}),[me]),et=(0,a.I4)((()=>{he||O({chatId:e,threadId:t,messageId:n?Qe(n,-1):void 0,origin:m})}),[e,t,Qe,he,n,O,m]),tt=(0,a.I4)((()=>{Ze||O({chatId:e,threadId:t,messageId:n?Qe(n,1):void 0,origin:m})}),[e,t,Qe,Ze,n,O,m]);(0,a.d4)((()=>{const e=e=>{switch(e.key){case"Left":case"ArrowLeft":et();break;case"Right":case"ArrowRight":tt()}};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}})),(0,a.d4)((()=>{const e=document.querySelector(".slide-container > .active, .slide-container > .to");if(!e)return;const t=re&&!i.cj;return(0,Z.s)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:()=>{ye||i.$b||Ke()},onSwipe:i.$b?(e,t)=>(t===Z.e.Right?et():t===Z.e.Left?tt():e.target&&e.target.closest(".MediaViewerFooter")||Ke(),!0):void 0})}),[Ke,Ce,re,se,ye,tt,et]);const nt=(0,a.I4)(((e,t)=>{Me({x:e,y:t})}),[]),at=(0,a.I4)((()=>{i.$b&&(se||re)&&fe(!Ce)}),[Ce,re,se]),st=(0,M.Z)();function rt(t){if(oe)return a.ZP.createElement("div",{key:e,className:"media-viewer-content"},ce(Re||Le,(0,d.PA)(d.vY,!1),!i.wB&&!ye));if(B){const e=(0,I.X)(B),s=Boolean(e);return a.ZP.createElement("div",{key:n,className:"media-viewer-content "+(s?"has-footer":""),onClick:at},se&&ce($e||Re||Le||Fe,B&&(0,d.PA)(Ge,s),!i.wB&&!ye),te&&a.ZP.createElement(ne,{key:n,url:$e||Re,isGif:re,posterData:De,posterSize:B&&(0,d.PA)(Ge,s,!0),loadProgress:Be,fileSize:Oe,isMediaViewerOpen:Y,noPlay:!t,onClose:Ke}),e&&a.ZP.createElement(_,{text:e,onClick:qe,isHidden:Ce&&(!te||re),isForVideo:te&&!re}))}}function ot(){return oe?a.ZP.createElement(U,{key:h.id,chatId:h.id,isAvatar:!0}):a.ZP.createElement(U,{key:n,chatId:e,messageId:n})}return(0,T.ZP)(Y,x,O,{chatId:e,threadId:t,messageId:n,origin:m,avatarOwnerId:h&&h.id}),a.ZP.createElement(A.Z,{id:"MediaViewer",className:ye?"zoomed":"",isOpen:Y},(()=>a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"media-viewer-head",dir:st.isRtl?"rtl":void 0},i.wB&&a.ZP.createElement(R.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:st("Close"),onClick:Ke},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(L.Z,{activeKey:Pe.current,name:pe},ot),a.ZP.createElement(J,{mediaData:Re||Le,isVideo:te,isZoomed:ye,message:B,fileName:xe,onCloseMediaViewer:Ke,onForward:We,onZoomToggle:je,isAvatar:oe})),a.ZP.createElement(le,{noWrap:!be,canPan:ye,panDeltaX:ke.x,panDeltaY:ke.y,zoomLevel:we,onPan:nt},a.ZP.createElement(L.Z,{className:"slide-container",activeKey:ue,name:ve},rt)),!he&&a.ZP.createElement("button",{type:"button",className:`navigation prev ${te&&!re&&"inline"}`,"aria-label":st("AccDescrPrevious"),dir:st.isRtl?"rtl":void 0,onClick:et}),!Ze&&a.ZP.createElement("button",{type:"button",className:`navigation next ${te&&!re&&"inline"}`,"aria-label":st("Next"),dir:st.isRtl?"rtl":void 0,onClick:tt}),a.ZP.createElement(ae,{isShown:ye,onChangeZoom:Ve}))))})));var me=n(5765),ue=n(7407),he=n(2313),Ze=n(2515),Pe=n(4288),ge=n(3103),ve=n(7687),pe=n(1273),Ee=n(1876),Ce=n(8799),fe=n(6058);const be=(0,a.X$)((({isOpen:e,currentUserId:t,chatOrUserIds:n,filterRef:s,filter:r,filterPlaceholder:o,onFilterChange:l,onClose:i,loadMore:c,onSelectChatOrUser:d})=>{const m=(0,M.Z)(),[h,Z]=(0,ue.Z)(c,n,Boolean(r));(0,Ze.Z)(s,e,(()=>{l("")}));const P=(0,a.sO)(null),g=(0,a.I4)((e=>{l(e.currentTarget.value)}),[l]),v=(0,he.Z)(P,e,(e=>{h&&h.length>0&&d(h[-1===e?0:e])}),".ListItem-button",!0),p=a.ZP.createElement("div",{className:"modal-header",dir:m.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:m("Close"),onClick:i},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(ve.Z,{ref:s,value:r,onChange:g,onKeyDown:v,placeholder:o}));return a.ZP.createElement(ge.Z,{isOpen:e,onClose:i,className:"ChatOrUserPicker",header:p},null!=h&&h.length?a.ZP.createElement(pe.Z,{className:"picker-list custom-scroll",items:h,onLoadMore:Z,noScrollRestore:Boolean(r),ref:P,onKeyDown:v},h.map((e=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>d(e)},(0,u.YC)(e)?a.ZP.createElement(fe.Z,{status:e===t?m("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Ce.Z,{chatId:e}))))):h&&!h.length?a.ZP.createElement("p",{className:"no-results"},m("lng_blocked_list_not_found")):a.ZP.createElement(Pe.Z,null))})),Ie=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t,listIds:n,orderedPinnedIds:a},currentUserId:s}=e;return{chatsById:t,pinnedIds:a.active,activeListIds:n.active,archivedListIds:n.archived,currentUserId:s}}),((e,t)=>(0,h.ei)(t,["setForwardChatId","exitForwardMode","loadMoreChats"])))((({chatsById:e,pinnedIds:t,activeListIds:n,archivedListIds:s,currentUserId:o,isOpen:l,setForwardChatId:i,exitForwardMode:c,loadMoreChats:d})=>{const m=(0,M.Z)(),[Z,P]=(0,a.eJ)(""),g=(0,a.sO)(null),v=(0,a.Ye)((()=>{const a=[...n||[],...s||[]];let l=t||[];return o&&(l=(0,h.Tw)([o,...l])),(0,u.ih)([...a.filter((t=>{const n=e[t];return!n||!!(0,u.Qm)(n,r._f)&&(!Z||(0,me.Z)((0,u.U)(m,e[t],void 0,t===o),Z))}))],e,void 0,l)}),[n,s,e,o,Z,m,t]),p=(0,a.I4)((e=>{i({id:e})}),[i]);return a.ZP.createElement(be,{currentUserId:o,isOpen:l,chatOrUserIds:v,filterRef:g,filterPlaceholder:m("ForwardTo"),filter:Z,onFilterChange:P,loadMore:d,onSelectChatOrUser:p,onClose:c})})));var ye=n(1947);function Se(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const we=(0,a.X$)((0,s.c$)((e=>(0,h.ei)(e,["dialogs"])),((e,t)=>(0,h.ei)(t,["dismissDialog","acceptInviteConfirmation"])))((({dialogs:e,dismissDialog:t,acceptInviteConfirmation:n})=>{const s=(0,M.Z)();if(e.length)return a.ZP.createElement("div",{id:"Dialogs"},e.map((e=>{return"hash"in e?(e=>{const{hash:r,title:o,participantsCount:l,isChannel:i}=e,c=s(i?"Subscribers":"Members",l,"i"),d=s(i?"ChannelJoin":"JoinGroup");return a.ZP.createElement(ge.Z,{isOpen:!0,onClose:t,className:"error",title:o},void 0!==l&&a.ZP.createElement("p",null,c),a.ZP.createElement(R.Z,{isText:!0,className:"confirm-dialog-button",onClick:()=>{n({hash:r}),t()}},d),a.ZP.createElement(R.Z,{isText:!0,className:"confirm-dialog-button",onClick:t},s("Cancel")))})(e):(r=e,a.ZP.createElement(ge.Z,{isOpen:!0,onClose:t,className:"error",title:Se(r)},r.hasErrorKey?(0,ye.ZP)(r):(0,$.Z)(r.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(R.Z,{isText:!0,onClick:t},s("OK")))));var r})))})));var Ne=n(6937);const ke=(0,a.X$)((0,s.c$)((e=>(0,h.ei)(e,["notifications"])),((e,t)=>(0,h.ei)(t,["dismissNotification"])))((({notifications:e,dismissNotification:t})=>{if(e.length)return a.ZP.createElement("div",{id:"Notifications"},e.map((({message:e,localId:n})=>a.ZP.createElement(Ne.Z,{message:(0,$.Z)(e,["emoji","br","links","simple_markdown"]),onDismiss:()=>t({localId:n})}))))})));var Me=n(8360),Te=n(7551);const Fe=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,h.ei)(t,["toggleSafeLinkModal"])))((({url:e,toggleSafeLinkModal:t})=>{const n=(0,M.Z)(),s=(0,a.I4)((()=>{window.open(e),t({url:void 0})}),[t,e]),r=(0,a.I4)((()=>{t({url:void 0})}),[t]),o=(0,Me.Z)(e);return a.ZP.createElement(Te.Z,{isOpen:Boolean(e),onClose:r,title:n("OpenUrlTitle"),textParts:(0,$.Z)(n("OpenUrlAlert2",o),["links"]),confirmLabel:n("OpenUrlTitle"),confirmHandler:s})})));var Ae=n(706);const Le=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function Re(e,t,n,a,s){const r=new Date(e,t,n,0,0,0,0),o=a&&new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0),l=s&&new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0);return!!(l&&r>l)||!!(o&&r<o)}function Be(e){return String(e).padStart(2,"0")}function $e(e,t,n){return`${e}-${t+1}-${n}`}const De=(0,a.X$)((({selectedAt:e,maxAt:t,isFutureMode:n,isPastMode:s,isOpen:r,withTimePicker:o,submitButtonLabel:l,secondButtonLabel:i,onClose:c,onSubmit:d,onSecondButtonClick:m})=>{const u=(0,M.Z)(),h=new Date,Z=(0,a.Ye)((()=>e?new Date(e):new Date),[e]),P=t?new Date(t):void 0,g=(0,f.Z)(r),[v,p,E]=(0,Ae.Z)(!1),[C,b]=(0,a.eJ)(Z),[I,y]=(0,a.eJ)(new Date(C.getFullYear(),C.getMonth(),1)),[S,w]=(0,a.eJ)(Be(Z.getHours())),[N,k]=(0,a.eJ)(Be(Z.getMinutes())),T=$e(C.getFullYear(),C.getMonth(),C.getDate()),F=I.getFullYear(),A=I.getMonth();(0,a.d4)((()=>{!g&&r&&(b(Z),y(new Date(Z.getFullYear(),Z.getMonth(),1)))}),[Z,r,g]),(0,a.d4)((()=>{n&&!v&&C.getTime()<Z.getTime()&&(b(Z),w(Be(Z.getHours())),k(Be(Z.getMinutes())))}),[Z,v,n,C]);const L=s&&F>=h.getFullYear()&&A>=h.getMonth()||P&&F>=P.getFullYear()&&A>=P.getMonth(),$=n&&F<=h.getFullYear()&&A<=h.getMonth(),{prevMonthGrid:D,currentMonthGrid:U,nextMonthGrid:O}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],r=new Date;r.setDate(1),r.setMonth(t),r.setFullYear(e);const o=r.getDay(),l=new Date(e,t,0).getDate();for(let e=1;e<o;e++)n.push(l-o+e+1);for(;r.getMonth()===t;){const e=r.getDate();a.push(e),r.setDate(e+1)}const i=(a.length+n.length)%7;if(i>0)for(let e=1;e<=7-i;e++)s.push(e);return{prevMonthGrid:n,currentMonthGrid:a,nextMonthGrid:s}}(F,A)),[A,F]),x=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return w(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(C.getTime());a.setHours(n),b(a);const s=Be(n);w(s),e.target.value=s}),[C]),G=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return k(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),59)),a=new Date(C.getTime());a.setMinutes(n),b(a);const s=Be(n);k(s),e.target.value=s}),[C]);return a.ZP.createElement(ge.Z,{isOpen:r,onClose:c,className:"CalendarModal"},a.ZP.createElement("div",{className:"container"},a.ZP.createElement("div",{className:"month-selector"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:c},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h4",null,u(`lng_month${A+1}`)," ",F),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:$,onClick:$?void 0:function(){y((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))}},a.ZP.createElement("i",{className:"icon-previous"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:L,onClick:L?void 0:function(){y((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))}},a.ZP.createElement("i",{className:"icon-next"})))),a.ZP.createElement("div",{className:"calendar-wrapper"},a.ZP.createElement("div",{className:"calendar-grid"},Le.map((e=>a.ZP.createElement("div",{className:"day-button faded weekday"},a.ZP.createElement("span",null,u(e))))),D.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))),U.map((e=>a.ZP.createElement("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void b((e=>{const n=new Date(e);return n.setDate(t),n.setMonth(A),n.setFullYear(F),n}));var t},className:(0,X.Z)("day-button",Re(F,A,e,n?h:void 0,s?h:P)?"disabled":e?"clickable":"",T===$e(F,A,e)&&"selected")},!!e&&a.ZP.createElement("span",null,e)))),O.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),o&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:S,onChange:x,onFocus:p,onBlur:E}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:N,onChange:G,onFocus:p,onBlur:E})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{onClick:function(){d(C)}},o?function(e,t){const n=(0,B.xH)(t,e.code);return n===(0,B.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,B.mr)(t,e)):e("Conversation.ScheduleMessage.SendOn",[n,(0,B.mr)(t,e)])}(u,C):l),i&&a.ZP.createElement(R.Z,{onClick:m,isText:!0},i)))})),Ue=(0,a.X$)((0,s.c$)((e=>({selectedAt:e.historyCalendarSelectedAt})),((e,t)=>(0,h.ei)(t,["searchMessagesByDate","closeHistoryCalendar"])))((({isOpen:e,selectedAt:t,searchMessagesByDate:n,closeHistoryCalendar:s})=>{const r=(0,a.I4)((e=>{n({timestamp:e.valueOf()/1e3}),s()}),[s,n]),o=(0,M.Z)();return a.ZP.createElement(De,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:o("JumpToDate"),onClose:s,onSubmit:r})}))),Oe=(0,a.X$)((0,s.c$)(((e,{message:t,isSchedule:n})=>{const{threadId:a}=(0,m.Bt)(e)||{},{canDeleteForAll:s}=a&&(0,m._k)(e,t,a)||{},r=(0,m.Z1)(e,t.chatId);return{canDeleteForAll:!n&&s,contactName:r&&(0,u.YC)(r.id)?(0,u.Vl)((0,m.dy)(e,(0,u.zX)(r))):void 0,willDeleteForCurrentUserOnly:r&&(0,u.G9)(r)&&!s,willDeleteForAll:r&&(0,u.ZV)(r)}}),((e,t)=>(0,h.ei)(t,["deleteMessages","deleteScheduledMessages"])))((({isOpen:e,isSchedule:t,message:n,album:s,canDeleteForAll:r,contactName:o,willDeleteForCurrentUserOnly:l,willDeleteForAll:i,onClose:c,deleteMessages:d,deleteScheduledMessages:m})=>{const u=(0,a.I4)((()=>{const e=null!=s&&s.messages?s.messages.map((({id:e})=>e)):[n.id];d({messageIds:e,shouldDeleteForAll:!0}),c()}),[d,n.id,c,s]),h=(0,a.I4)((()=>{const e=null!=s&&s.messages?s.messages.map((({id:e})=>e)):[n.id];t?m({messageIds:e}):d({messageIds:e,shouldDeleteForAll:!1}),c()}),[s,n.id,t,c,m,d]),Z=(0,M.Z)();return a.ZP.createElement(ge.Z,{isOpen:e,onClose:c,onEnter:e&&!r?h:void 0,className:"delete",title:Z("DeleteSingleMessagesTitle")},a.ZP.createElement("p",null,Z("AreYouSureDeleteSingleMessage")),l&&a.ZP.createElement("p",null,Z("lng_delete_for_me_chat_hint",1,"i")),i&&a.ZP.createElement("p",null,Z("lng_delete_for_everyone_hint",1,"i")),r&&a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:u},o&&(0,$.Z)(Z("Conversation.DeleteMessagesFor",o)),!o&&Z("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},Z(r?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},Z("Cancel")))}))),xe=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,u.YC)(t),a=(0,m.FM)(e,t),s=(0,m.Z1)(e,t),r=!!s&&(0,u.eA)(s),o=!!s&&(0,u.G9)(s),l=!!s&&(0,u.ZV)(s);return{isPrivateChat:n,isChatWithSelf:a,isChannel:r,isGroup:o,isSuperGroup:l,canPinForAll:n&&!a||l||o,contactName:s&&(0,u.YC)(s.id)?(0,u.Vl)((0,m.dy)(e,(0,u.zX)(s))):void 0}}),((e,t)=>(0,h.ei)(t,["pinMessage"])))((({isOpen:e,messageId:t,chatId:n,isChannel:s,isGroup:r,isSuperGroup:o,canPinForAll:l,contactName:i,onClose:c,pinMessage:d})=>{const m=(0,a.I4)((()=>{d({chatId:n,messageId:t,isUnpin:!1}),c()}),[d,n,t,c]),u=(0,a.I4)((()=>{d({chatId:n,messageId:t,isUnpin:!1,isOneSide:!0,isSilent:!0}),c()}),[n,t,c,d]),h=(0,M.Z)();return a.ZP.createElement(ge.Z,{isOpen:e,onClose:c,className:"pin",title:h("PinMessageAlertTitle")},a.ZP.createElement("p",null,h(s?"PinMessageAlertChannel":r||o?"PinMessageAlert":"PinMessageAlertChat")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:u},h("DialogPin")),l&&a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},i?(0,$.Z)(h("Conversation.PinMessagesFor",i)):h("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},h("Cancel")))}))),Ge=(0,a.X$)((({isOpen:e,pinnedMessagesCount:t=0,onClose:n,onUnpin:s})=>{const r=(0,M.Z)();return a.ZP.createElement(ge.Z,{isOpen:e,onClose:n,className:"unpin-all",title:r("Chat.PanelUnpinAllMessages")},a.ZP.createElement("p",null,r("Chat.UnpinAllMessagesConfirmation",t,"i")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:s},r("DialogUnpin")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:n},r("Cancel")))}));var Je=n(517);const ze=(0,a.X$)((0,s.c$)(((e,{isSchedule:t})=>{const{messageIds:n}=e.selectedMessages||{},{canDeleteForAll:a}=(0,m.xl)(e),s=(0,m.jr)(e);return{selectedMessageIds:n,canDeleteForAll:!t&&a,contactName:s&&(0,u.YC)(s.id)?(0,u.Vl)((0,m.dy)(e,(0,u.zX)(s))):void 0,willDeleteForCurrentUserOnly:s&&(0,u.G9)(s)&&!a,willDeleteForAll:s&&(0,u.ZV)(s)}}),((e,t)=>(0,h.ei)(t,["deleteMessages","deleteScheduledMessages","exitMessageSelectMode"])))((({isOpen:e,isSchedule:t,selectedMessageIds:n,canDeleteForAll:s,contactName:r,willDeleteForCurrentUserOnly:o,willDeleteForAll:l,onClose:i,deleteMessages:c,deleteScheduledMessages:d,exitMessageSelectMode:m})=>{const u=(0,f.Z)(e),h=(0,a.I4)((()=>{i(),c({messageIds:n,shouldDeleteForAll:!0})}),[c,n,i]),Z=(0,a.I4)((()=>{t?d({messageIds:n}):c({messageIds:n,shouldDeleteForAll:!1}),i()}),[t,i,d,n,c]),P=(0,M.Z)();if((0,a.d4)((()=>{!e&&u&&m()}),[m,e,u]),n)return a.ZP.createElement(ge.Z,{isOpen:e,onClose:i,onEnter:s?void 0:Z,className:"delete",title:P("Conversation.DeleteManyMessages")},a.ZP.createElement("p",null,P("AreYouSureDeleteFewMessages")),o&&a.ZP.createElement("p",null,"This will delete them just for you, not for other participants in the chat."),l&&a.ZP.createElement("p",null,"This will delete them for everyone in this chat."),s&&a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:h},r?(0,$.Z)(P("ChatList.DeleteForEveryone",r)):P("Conversation.DeleteMessagesForEveryone")),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:Z},P(s?"ChatList.DeleteForCurrentUser":"Delete")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:i},P("Cancel")))})));var Xe=n(4434);const _e=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,h.ei)(t,["reportMessages","exitMessageSelectMode"])))((({isOpen:e,messageIds:t,reportMessages:n,exitMessageSelectMode:s,onClose:r})=>{const[o,l]=(0,a.eJ)("spam"),[i,c]=(0,a.eJ)(""),d=()=>{n({messageIds:t,reason:o,description:i}),s(),r()},m=(0,a.I4)((e=>{l(e)}),[]),u=(0,a.I4)((e=>{c(e.target.value)}),[]),h=(0,M.Z)(),Z=[{value:"spam",label:h("lng_report_reason_spam")},{value:"violence",label:h("lng_report_reason_violence")},{value:"pornography",label:h("lng_report_reason_pornography")},{value:"childAbuse",label:h("lng_report_reason_child_abuse")},{value:"copyright",label:h("ReportPeer.ReasonCopyright")},{value:"other",label:h("lng_report_reason_other")}];if(t)return a.ZP.createElement(ge.Z,{isOpen:e,onClose:r,onEnter:e?d:void 0,className:"report",title:h("lng_report_message_title")},a.ZP.createElement(Xe.Z,{name:"report-message",options:Z,onChange:m,selected:o}),a.ZP.createElement(ve.Z,{label:h("lng_report_reason_description"),value:i,onChange:u}),a.ZP.createElement(R.Z,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:d},h("lng_report_button")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},h("Cancel")))}))),Ye=(0,a.X$)((0,s.c$)((e=>{const{type:t}=(0,m.Bt)(e)||{},{canDelete:n}=(0,m.xl)(e),a=(0,m.nB)(e),s=(0,m.Nu)(e),{messageIds:r}=e.selectedMessages||{};return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,m.D7)(e),canDeleteMessages:n,canReportMessages:a,canDownloadMessages:s,selectedMessageIds:r}}),((e,t)=>(0,h.ei)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages","downloadSelectedMessages"])))((({canPost:e,isActive:t,messageListType:n,isSchedule:s,selectedMessagesCount:r,canDeleteMessages:o,canReportMessages:l,canDownloadMessages:i,selectedMessageIds:c,exitMessageSelectMode:d,openForwardMenuForSelectedMessages:m,downloadSelectedMessages:u})=>{const[h,Z,P]=(0,Ae.Z)(),[g,v,p]=(0,Ae.Z)();(0,a.d4)((()=>!t||h||g?void 0:(0,Je.Z)({onBackspace:Z,onDelete:Z,onEsc:d})),[t,h,g,Z,d]);const E=(0,a.I4)((()=>{u(),d()}),[u,d]),C=(0,f.Z)(r||void 0,!0),b=t?r:C,I=(0,M.Z)(),y=I("VoiceOver.Chat.MessagesSelected",b,"i"),S=(0,X.Z)("MessageSelectToolbar",e&&"with-composer",t&&"shown"),w=(e,t,n,s,r)=>a.ZP.createElement("div",{role:"button",tabIndex:0,className:(0,X.Z)("item",s&&"disabled",r&&"destructive"),onClick:s?void 0:n,title:t},a.ZP.createElement("i",{className:`icon-${e}`}));return a.ZP.createElement("div",{className:S},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(R.Z,{color:"translucent",round:!0,onClick:d,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:y},y),!!r&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==n&&w("forward",I("Chat.ForwardActionHeader"),m),l&&w("flag",I("Conversation.ReportMessages"),v),i&&w("download",I("lng_media_download"),E),w("delete",I("EditAdminGroupDeleteMessages"),Z,!o,!0))),a.ZP.createElement(ze,{isOpen:h,isSchedule:s,onClose:P}),a.ZP.createElement(_e,{isOpen:g,onClose:p,messageIds:c}))})));var He=n(3133),je=n(735),Ve=n(1470);const Ke=e=>{const t=(0,a.sO)(null),n=(0,a.I4)((n=>{"Enter"===n.key&&t.current===document.activeElement&&e()}),[e]);return(0,a.d4)((()=>(window.addEventListener("keydown",n,!1),()=>window.removeEventListener("keydown",n))),[n]),t};var qe=n(329),We=n(742);const Qe=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),a=n&&(0,u.zX)(n);return{chat:n,privateChatUser:a?(0,m.dy)(e,a):void 0,isPinned:(0,m.ep)(e,t),isMuted:n?(0,u.i4)(n,(0,m.dZ)(e),(0,m.NJ)(e)):void 0}}))((({chatId:e,chat:t,privateChatUser:n,isPinned:s,isMuted:r,withUsername:o,onClick:l})=>{const[i,c,d]=(0,Ae.Z)(),[m,h,Z]=(0,Ae.Z)(),P=(0,Ve.Z)({chat:t,privateChatUser:n,isPinned:s,isMuted:r,handleDelete:c,handleChatFolderChange:h},!0),g=()=>{l(e)},v=Ke(g);if(t)return a.ZP.createElement(Ee.Z,{className:"chat-item-clickable search-result",onClick:g,contextActions:P,buttonRef:v},(0,u.YC)(e)?a.ZP.createElement(fe.Z,{userId:e,withUsername:o,avatarSize:"large"}):a.ZP.createElement(Ce.Z,{chatId:e,withUsername:o,avatarSize:"large"}),a.ZP.createElement(qe.Z,{isOpen:i,onClose:d,chat:t}),a.ZP.createElement(We.Z,{isOpen:m,onClose:Z,chatId:e}))})));var et=n(8781);const tt=(0,z.P2)((e=>e()),6e4,!0),nt=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.topPeers,n=e.users.byId,{recentlyFoundChatIds:a}=e.globalSearch;return{topUserIds:t,usersById:n,recentlyFoundChatIds:a}}),((e,t)=>(0,h.ei)(t,["loadTopUsers","loadContactList","openChat","addRecentlyFoundChatId","clearRecentlyFoundChats"])))((({topUserIds:e,usersById:t,recentlyFoundChatIds:n,onReset:s,loadTopUsers:r,loadContactList:o,openChat:l,addRecentlyFoundChatId:i,clearRecentlyFoundChats:c})=>{const d=(0,a.sO)(null);(0,a.d4)((()=>{tt((()=>{r(),o()}))}),[r,o]),(0,et.Z)(d.current,!e);const m=(0,a.I4)((e=>{l({id:e,shouldReplaceHistory:!0}),s(),setTimeout((()=>{i({id:e})}),250)}),[l,i,s]),h=(0,M.Z)();return a.ZP.createElement("div",{className:"RecentContacts custom-scroll"},e&&a.ZP.createElement("div",{className:"top-peers-section",dir:h.isRtl?"rtl":void 0},a.ZP.createElement("div",{ref:d,className:"top-peers no-selection"},e.map((e=>a.ZP.createElement("div",{className:"top-peer-item",onClick:()=>m(e),dir:h.isRtl?"rtl":void 0},a.ZP.createElement(D.Z,{user:t[e]}),a.ZP.createElement("div",{className:"top-peer-name"},(0,$.Z)((0,u.Vl)(t[e])||" "))))))),n&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:h.isRtl?"rtl":void 0},h("Recent"),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:c,isRtl:h.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),n.map((e=>a.ZP.createElement(Qe,{chatId:e,onClick:m})))))})));var at=n(9411),st=n(8033);const rt=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t);if(!n)return{};const a=(0,u.zX)(n);return{chat:n,lastSyncTime:e.lastSyncTime,...a&&{privateChatUser:(0,m.dy)(e,a)}}}),((e,t)=>(0,h.ei)(t,["focusMessage"])))((({message:e,searchQuery:t,chatId:n,chat:s,privateChatUser:r,focusMessage:o,lastSyncTime:l})=>{const c=(0,u.DH)(e),d=(0,p.Z)((0,u.Ti)(e,"micro")),m=Boolean((0,u.Y5)(e)),h=(0,a.I4)((()=>{o({chatId:n,messageId:e.id})}),[n,o,e.id]),Z=(0,M.Z)(),P=Ke(h);if(s)return a.ZP.createElement(Ee.Z,{className:"ChatMessage chat-item-clickable",ripple:!i.wB,onClick:h,buttonRef:P},a.ZP.createElement(D.Z,{chat:s,user:r,withOnlineStatus:!0,isSavedMessages:null==r?void 0:r.isSelf,lastSyncTime:l}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},(0,$.Z)((0,u.U)(Z,s,r))),s.isVerified&&a.ZP.createElement(at.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(st.Z,{className:"date"},(0,B.VX)(Z,1e3*e.date)))),a.ZP.createElement("div",{className:"subtitle"},a.ZP.createElement("div",{className:"message",dir:"auto"},function(e,t,n,s,r){return n?a.ZP.createElement("span",{className:"media-preview"},a.ZP.createElement("img",{src:n,alt:"",className:r?"round":void 0}),(0,u.b7)(t)&&a.ZP.createElement("i",{className:"icon-play"}),(0,$.Z)((0,u.MK)(e,t,!0),["emoji","highlight"],{highlight:s})):(0,$.Z)((0,u.MK)(e,t))}(Z,e,d||c,t,m)))))}))),ot=(0,a.X$)((({searchDate:e,onSelect:t})=>{const n=(0,a.Ye)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,B.xH)(t)}]}const t=[],n=new Date,a=n.getFullYear(),s=n.getTime()>new Date(`${a}-${e}`).getTime()?a:a-1;for(let n=0;n<8;n++){const a=new Date(`${s-n}-${e}`);t.push({date:a,text:(0,B.xH)(a)})}return t}(e)),[e]);return a.ZP.createElement("section",{className:"DateSuggest custom-scroll custom-scroll-x"},n.map((({date:e,text:n})=>a.ZP.createElement("div",{onClick:()=>t(e),className:"date-item",key:n},a.ZP.createElement("i",{className:"icon-calendar"}),a.ZP.createElement("span",null,n)))))}));var lt=n(7262),it=n(9187);const ct=(0,z.P2)((e=>e()),500,!0),dt=(0,a.X$)((0,s.c$)((e=>{var t;const{byId:n}=e.chats,{byId:a}=e.users,{userIds:s}=e.contactList||{};if(!s)return{chatsById:n,usersById:a};const{currentUserId:r,messages:o,lastSyncTime:l}=e,{fetchingStatus:i,globalResults:c,localResults:d,resultsByType:m}=e.globalSearch,{chatIds:u,userIds:h}=c||{},{chatIds:Z,userIds:P}=d||{},{byChatId:g}=o;return{currentUserId:r,localContactIds:s,localChatIds:Z,localUserIds:P,globalChatIds:u,globalUserIds:h,foundIds:null==m||null===(t=m.text)||void 0===t?void 0:t.foundIds,globalMessagesByChatId:g,chatsById:n,usersById:a,fetchingStatus:i,lastSyncTime:l}}),((e,t)=>(0,h.ei)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"])))((({searchQuery:e,searchDate:t,dateSearchQuery:n,currentUserId:s,localContactIds:r,localChatIds:l,localUserIds:c,globalChatIds:d,globalUserIds:m,foundIds:Z,globalMessagesByChatId:P,chatsById:g,usersById:v,fetchingStatus:p,lastSyncTime:E,onReset:C,onSearchDateSelect:f,openChat:b,addRecentlyFoundChatId:I,searchMessagesGlobal:y,setGlobalSearchChatId:S})=>{const w=(0,M.Z)(),[N,k]=(0,a.eJ)(!1),[T,F]=(0,a.eJ)(!1),A=(0,a.I4)((({direction:t})=>{E&&t===o.Uq.Backwards&&ct((()=>{y({type:"text",query:e})}))}),[E,y,e]),L=(0,a.I4)((e=>{b({id:e,shouldReplaceHistory:!0}),e!==s&&I({id:e}),i.wB||C()}),[s,b,I,C]),R=(0,a.I4)((e=>{S({id:e})}),[S]),B=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return je.D;const t=r?r.filter((t=>{const n=v[t];if(!n)return!1;const a=(0,u.Js)(n);return a&&(0,me.Z)(a,e)||(0,me.Z)(n.username,e)})):[];return[...s&&(0,me.Z)(w("SavedMessages"),e)?[s]:[],...(0,u.ih)((0,h.Tw)([...t,...l||[],...c||[]]),g)]}),[e,r,s,w,l,c,g,v]),$=(0,a.Ye)((()=>!e||e.length<4||!d||!m?je.D:(0,u.ih)((0,h.Tw)([...d,...m]),g,!0)),[g,d,m,e]),D=(0,a.Ye)((()=>(e||t)&&Z&&0!==Z.length?Z.map((e=>{var t;const[n,a]=e.split("_");return null==P||null===(t=P[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):je.D),[Z,P,e,t]),U=(0,a.I4)((()=>{k(!N)}),[N]),O=(0,a.I4)((()=>{F(!T)}),[T]),x=p&&!p.chats&&!p.messages&&!B.length&&!$.length&&!D.length;return e||t?a.ZP.createElement(pe.Z,{className:"LeftSearch custom-scroll",items:D,onLoadMore:A,noScrollRestoreOnTop:!0,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(ot,{searchDate:n,onSelect:f})),x&&a.ZP.createElement(lt.Z,{text:w("ChatList.Search.NoResults"),description:w("ChatList.Search.NoResultsDescription")}),!!B.length&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:w.isRtl?"rtl":void 0},B.map((e=>a.ZP.createElement(it.Z,{chatOrUserId:e,onClick:R,clickArg:e})))),!!B.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},B.length>3&&a.ZP.createElement(st.Z,{onClick:U},w(N?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionDialogs")),B.map(((e,t)=>{if(N||!(t>=3))return a.ZP.createElement(Qe,{chatId:e,onClick:L})}))),!!$.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},$.length>3&&a.ZP.createElement(st.Z,{onClick:O},w(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionGlobal")),$.map(((e,t)=>{if(T||!(t>=3))return a.ZP.createElement(Qe,{chatId:e,withUsername:!0,onClick:L})}))),!!D.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},w("SearchMessages")),D.map((function(t){const n=(0,u.MK)(w,t),s=g[t.chatId];if(n&&s)return a.ZP.createElement(rt,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(nt,{onReset:C})}))),mt=(0,z.P2)((e=>e()),500,!0),ut=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:r,resultsByType:o}=e.globalSearch,{foundIds:l}=(null==o?void 0:o.text)||{};return{currentUserId:n,foundIds:l,globalMessagesByChatId:a,chatsById:t,fetchingStatus:r,lastSyncTime:s}}),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal"])))((({searchQuery:e,currentUserId:t,dateSearchQuery:n,foundIds:s,globalMessagesByChatId:r,chatsById:l,fetchingStatus:i,lastSyncTime:c,searchMessagesGlobal:d,onSearchDateSelect:m})=>{const h=(0,M.Z)(),Z=(0,a.I4)((({direction:n})=>{c&&n===o.Uq.Backwards&&mt((()=>{d({type:"text",query:e,chatId:t})}))}),[t,c,d,e]),P=(0,a.Ye)((()=>s&&0!==s.length?s.map((e=>{var t;const[n,a]=e.split("_");return null==r||null===(t=r[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):je.D),[s,r]),g=i&&!i.chats&&!i.messages&&!P.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(pe.Z,{className:"search-content custom-scroll chat-list",items:P,onLoadMore:Z,noFastList:!0},n&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar"},a.ZP.createElement(ot,{searchDate:n,onSelect:m})),g&&a.ZP.createElement(lt.Z,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),!!P.length&&P.map((function(t){const n=(0,u.MK)(h,t),s=l[t.chatId];if(n&&s)return a.ZP.createElement(rt,{chatId:t.chatId,message:t,searchQuery:e})}))))})));function ht(e){return(t,n)=>{var a;const{byId:s}=t.chats,{byId:r}=t.users,{fetchingStatus:o,resultsByType:l,chatId:i}=t.globalSearch,c="audio"!==e?e:null!=n&&n.isVoice?"voice":"audio",{byChatId:d}=t.messages,u=null==l||null===(a=l[c])||void 0===a?void 0:a.foundIds,h=t.activeDownloads.byChatId;return{theme:(0,m.Pu)(t),isLoading:void 0===u||!!o&&Boolean(o.chats||o.messages),chatsById:s,usersById:r,globalMessagesByChatId:d,foundIds:u,searchChatId:i,activeDownloads:h,lastSyncTime:t.lastSyncTime}}}var Zt=n(7891),Pt=n(3709);const gt="media",vt=(0,z.P2)((e=>e()),500,!0),pt=(0,a.X$)((0,s.c$)(ht(gt),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","openMediaViewer"])))((({searchQuery:e,searchChatId:t,isLoading:n,globalMessagesByChatId:s,foundIds:r,lastSyncTime:i,searchMessagesGlobal:c,openMediaViewer:d})=>{const m=(0,M.Z)(),u=(0,a.I4)((({direction:n})=>{i&&n===o.Uq.Backwards&&vt((()=>{c({type:gt,query:e,chatId:t})}))}),[i,c,e,t]),h=(0,a.Ye)((()=>r&&s?r.map((e=>{var t;const[n,a]=e.split("_");return null===(t=s[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):je.D),[s,r]),Z=(0,a.I4)(((e,t)=>{d({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[d]),P=(0,Zt.Z)([e],l.Y)&&!n,g=P&&r&&r.length>0&&!e,v=P&&r&&r.length>0&&e,p=(0,X.Z)("search-content custom-scroll",v&&"chat-list");return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(pe.Z,{className:p,items:h,itemSelector:e?".ListItem":".Media",onLoadMore:u,noFastList:!0},!P&&a.ZP.createElement(Pe.Z,null),P&&(!r||0===r.length)&&a.ZP.createElement(lt.Z,{text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),g&&a.ZP.createElement("div",{className:"media-list",dir:m.isRtl?"rtl":void 0},h.map((e=>a.ZP.createElement(Pt.Z,{key:e.id,idPrefix:"search-media",message:e,onClick:Z})))),v&&h.map((e=>a.ZP.createElement(rt,{key:e.id,chatId:e.chatId,message:e})))))})));var Et=n(91),Ct=n(5418);const ft="links",bt=(0,z.P2)((e=>e()),500,!0),It=(0,a.X$)((0,s.c$)(ht(ft),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","focusMessage"])))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:s,usersById:r,globalMessagesByChatId:i,foundIds:c,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:u})=>{const h=(0,M.Z)(),Z=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&bt((()=>{m({type:ft,query:e,chatId:t})}))}),[d,m,e,t]),P=(0,a.Ye)((()=>c&&i?c.map((e=>{var t;const[n,a]=e.split("_");return null===(t=i[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):je.D),[i,c]),g=(0,a.I4)(((e,t)=>{u({chatId:t,messageId:e})}),[u]),v=(0,Zt.Z)([e],l.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(pe.Z,{className:"search-content documents-list custom-scroll",items:P,onLoadMore:Z,noFastList:!0},!v&&a.ZP.createElement(Pe.Z,null),v&&(!c||0===c.length)&&a.ZP.createElement(lt.Z,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),v&&c&&c.length>0&&P.map(((e,t)=>{const n=0===t||(0,B.kj)(e.date)!==(0,B.kj)(P[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",dir:h.isRtl?"rtl":void 0,key:e.id},n&&a.ZP.createElement("p",{className:"section-heading",dir:h.isRtl?"rtl":void 0},(0,B.np)(h,new Date(1e3*e.date))),a.ZP.createElement(Ct.Z,{key:e.id,message:e,senderTitle:(0,Et.F)(h,e,s,r),onMessageClick:g}))}))))})));var yt=n(2535);const St="documents",wt=(0,z.P2)((e=>e()),500,!0),Nt=(0,a.X$)((0,s.c$)(ht(St),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","focusMessage"])))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:s,usersById:r,globalMessagesByChatId:i,foundIds:c,activeDownloads:d,lastSyncTime:m,searchMessagesGlobal:h,focusMessage:Z})=>{const P=(0,M.Z)(),g=(0,a.I4)((({direction:n})=>{m&&n===o.Uq.Backwards&&wt((()=>{h({type:St,query:e,chatId:t})}))}),[m,h,e,t]),v=(0,a.Ye)((()=>c&&i?c.map((e=>{var t;const[n,a]=e.split("_"),s=null===(t=i[n])||void 0===t?void 0:t.byId[Number(a)];return s&&(0,u.aE)(s)?s:void 0})).filter(Boolean):je.D),[i,c]),p=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),E=(0,Zt.Z)([e],l.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(pe.Z,{className:"search-content documents-list custom-scroll",items:v,onLoadMore:g,noFastList:!0},!E&&a.ZP.createElement(Pe.Z,null),E&&(!c||0===c.length)&&a.ZP.createElement(lt.Z,{text:P("ChatList.Search.NoResults"),description:P("ChatList.Search.NoResultsDescription")}),E&&c&&c.length>0&&v.map(((e,t)=>{var n;const o=0===t||(0,B.kj)(e.date)!==(0,B.kj)(v[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},o&&a.ZP.createElement("p",{className:"section-heading"},(0,B.np)(P,new Date(1e3*e.date))),a.ZP.createElement(yt.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,Et.F)(P,e,s,r),className:"scroll-item",onDateClick:p,isDownloading:null===(n=d[e.chatId])||void 0===n?void 0:n.includes(e.id)}))}))))})));var kt=n(4752);const Mt=(0,z.P2)((e=>e()),500,!0),Tt=(0,a.X$)((0,s.c$)(ht("audio"),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"])))((({theme:e,isVoice:t,searchQuery:n,searchChatId:s,isLoading:r,chatsById:i,usersById:c,globalMessagesByChatId:d,foundIds:m,lastSyncTime:u,activeDownloads:h,searchMessagesGlobal:Z,focusMessage:P,openAudioPlayer:g})=>{const v=(0,M.Z)(),p=t?"voice":"audio",E=(0,a.I4)((({direction:e})=>{u&&e===o.Uq.Backwards&&Mt((()=>{Z({type:p,query:n,chatId:s})}))}),[p,u,Z,n,s]),C=(0,a.Ye)((()=>m&&d?m.map((e=>{var t;const[n,a]=e.split("_");return null===(t=d[n])||void 0===t?void 0:t.byId[Number(a)]})).filter(Boolean):je.D),[d,m]),f=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),b=(0,a.I4)(((e,t)=>{g({chatId:t,messageId:e,origin:o.Cr.Search})}),[g]),I=(0,Zt.Z)([n],l.Y)&&!r;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(pe.Z,{className:"search-content documents-list custom-scroll",items:C,onLoadMore:E,noFastList:!0},!I&&a.ZP.createElement(Pe.Z,null),I&&(!m||0===m.length)&&a.ZP.createElement(lt.Z,{text:v("ChatList.Search.NoResults"),description:v("ChatList.Search.NoResultsDescription")}),I&&m&&m.length>0&&C.map(((t,n)=>{var s;const r=0===n||(0,B.kj)(t.date)!==(0,B.kj)(C[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:t.id},r&&a.ZP.createElement("p",{className:"section-heading",dir:v.isRtl?"rtl":void 0},(0,B.np)(v,new Date(1e3*t.date))),a.ZP.createElement(kt.Z,{key:t.id,theme:e,message:t,origin:o.Cr.Search,senderTitle:(0,Et.F)(v,t,i,c),date:t.date,lastSyncTime:u,className:"scroll-item",onPlay:b,onDateClick:f,isDownloading:null===(s=h[t.chatId])||void 0===s?void 0:s.includes(t.id)}))}))))}))),Ft=[{type:o.nJ.ChatList,title:"SearchAllChatsShort"},{type:o.nJ.Media,title:"SharedMediaTab2"},{type:o.nJ.Links,title:"SharedLinksTab2"},{type:o.nJ.Files,title:"SharedFilesTab2"},{type:o.nJ.Music,title:"SharedMusicTab2"},{type:o.nJ.Voice,title:"SharedVoiceTab2"}],At=[{type:o.nJ.ChatList,title:"All Messages"},...Ft.slice(1)],Lt=Object.keys(o.nJ).length/2,Rt=(0,a.X$)((0,s.c$)((e=>{const{currentContent:t,chatId:n}=e.globalSearch;return{currentContent:t,chatId:n}}),((e,t)=>(0,h.ei)(t,["setGlobalSearchContent","setGlobalSearchDate"])))((({searchQuery:e,searchDate:t,isActive:n,currentContent:s=o.nJ.ChatList,chatId:r,setGlobalSearchContent:l,setGlobalSearchDate:i,onReset:c})=>{const d=(0,M.Z)(),[m,u]=(0,a.eJ)(s),h=(0,a.Ye)((()=>(0,B.xk)(e)),[e]),Z=(0,a.I4)((e=>{const t=Ft[e];l({content:t.type}),u(e)}),[l]),P=(0,a.I4)((e=>{i({date:e.getTime()/1e3})}),[i]);(0,T.ZP)(n,c,void 0,void 0,!0);const g=(0,a.sO)(null),v=(0,he.Z)(g,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:g,onKeyDown:v},a.ZP.createElement(He.Z,{activeTab:m,tabs:r?At:Ft,onSwitchTab:Z}),a.ZP.createElement(L.Z,{name:d.isRtl?"slide-reversed":"slide",renderCount:Lt,activeKey:s},(()=>{switch(s){case o.nJ.ChatList:return r?a.ZP.createElement(ut,{searchQuery:e,dateSearchQuery:h,onReset:c,onSearchDateSelect:P}):a.ZP.createElement(dt,{searchQuery:e,searchDate:t,dateSearchQuery:h,onReset:c,onSearchDateSelect:P});case o.nJ.Media:return a.ZP.createElement(pt,{searchQuery:e});case o.nJ.Links:return a.ZP.createElement(It,{searchQuery:e});case o.nJ.Files:return a.ZP.createElement(Nt,{searchQuery:e});case o.nJ.Music:return a.ZP.createElement(Tt,{key:"audio",searchQuery:e});case o.nJ.Voice:return a.ZP.createElement(Tt,{key:"voice",isVoice:!0,searchQuery:e});default:return}})))})));var Bt=n(1090);const $t={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 $t;default:return e}},Ut=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,h.ei)(t,["signOut","deleteChatFolder"])))((({currentScreen:e,editedFolderId:t,onReset:n,onSaveFilter:s,signOut:r,deleteChatFolder:l,onScreenSelect:c})=>{const[d,m]=(0,a.eJ)(!1),[u,h]=(0,a.eJ)(!1),Z=(0,a.I4)((()=>{m(!0)}),[]),P=(0,a.I4)((()=>{m(!1)}),[]),g=(0,a.I4)((()=>{h(!0)}),[]),v=(0,a.I4)((()=>{h(!1)}),[]),p=(0,a.I4)((()=>{P(),r()}),[P,r]),E=(0,a.I4)((()=>{v(),l({id:t}),n()}),[t,v,l,n]),C=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(R.Z,{round:!0,ripple:!i.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]),f=(0,M.Z)();return a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:n,ariaLabel:f("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case o.MT.EditProfile:return a.ZP.createElement("h3",null,f("lng_settings_information"));case o.MT.General:return a.ZP.createElement("h3",null,f("General"));case o.MT.Notifications:return a.ZP.createElement("h3",null,f("Notifications"));case o.MT.DataStorage:return a.ZP.createElement("h3",null,f("DataSettings"));case o.MT.Privacy:return a.ZP.createElement("h3",null,f("PrivacySettings"));case o.MT.Language:return a.ZP.createElement("h3",null,f("Language"));case o.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,f("ChatBackground"));case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,f("SetColor"));case o.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,f("PrivacyPhone"));case o.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,f("PrivacyLastSeen"));case o.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,f("Privacy.ProfilePhoto"));case o.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,f("PrivacyForwards"));case o.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,f("AutodownloadGroupChats"));case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement("h3",null,f("AlwaysShareWith"));case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement("h3",null,f("NeverShareWith"));case o.MT.PrivacyActiveSessions:return a.ZP.createElement("h3",null,f("SessionsTitle"));case o.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,f("BlockedUsers"));case o.MT.TwoFaDisabled:case o.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,f("TwoStepVerification"));case o.MT.TwoFaNewPassword:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,f("PleaseEnterCurrentPassword"));case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,f("PleaseReEnterPassword"));case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,f("PasswordHint"));case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,f("RecoveryEmailTitle"));case o.MT.TwoFaNewPasswordEmailCode:case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement("h3",null,"Recovery Email Code");case o.MT.TwoFaCongratulations:return a.ZP.createElement("h3",null,f("TwoStepVerificationPasswordSet"));case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,f("PleaseEnterCurrentPassword"));case o.MT.Folders:return a.ZP.createElement("h3",null,f("Filters"));case o.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,f("FilterNew"));case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,f("FilterEdit")),t&&a.ZP.createElement(O.Z,{className:"settings-more-menu",trigger:C,positionX:"right"},a.ZP.createElement(x.Z,{icon:"delete",destructive:!0,onClick:g},f("Delete"))));case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},e===o.MT.FoldersIncludedChats||e===o.MT.FoldersIncludedChatsFromChatList?a.ZP.createElement("h3",null,f("FilterInclude")):a.ZP.createElement("h3",null,f("FilterExclude")),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:s,ariaLabel:f("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,f("SETTINGS")),a.ZP.createElement(R.Z,{round:!0,ripple:!i.wB,size:"smaller",color:"translucent",onClick:()=>c(o.MT.EditProfile),ariaLabel:f("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(O.Z,{className:"settings-more-menu",trigger:C,positionX:"right"},a.ZP.createElement(x.Z,{icon:"logout",onClick:Z},f("LogOutTitle"))))}}(),a.ZP.createElement(Te.Z,{isOpen:d,onClose:P,text:f("lng_sure_logout"),confirmLabel:f("AccountSettings.Logout"),confirmHandler:p,confirmIsDestructive:!0}),a.ZP.createElement(Te.Z,{isOpen:u,onClose:v,text:f("FilterDeleteAlert"),confirmLabel:f("Delete"),confirmHandler:E,confirmIsDestructive:!0}))})));var Ot=n(787),xt=n(180);const Gt=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t,lastSyncTime:n}=e;return{currentUser:t?(0,m.dy)(e,t):void 0,lastSyncTime:n}}),((e,t)=>(0,h.ei)(t,["loadProfilePhotos"])))((({isActive:e,onScreenSelect:t,onReset:n,loadProfilePhotos:s,currentUser:r,lastSyncTime:l})=>{const i=(0,M.Z)(),c=null==r?void 0:r.id;return(0,a.d4)((()=>{c&&l&&s({profileId:c})}),[l,c,s]),(0,T.ZP)(e,n,t,o.MT.Main),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-main-menu"},r&&a.ZP.createElement(Ot.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement(xt.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Ee.Z,{icon:"settings",onClick:()=>t(o.MT.General)},i("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Ee.Z,{icon:"unmute",onClick:()=>t(o.MT.Notifications)},i("Notifications")),a.ZP.createElement(Ee.Z,{icon:"lock",onClick:()=>t(o.MT.Privacy)},i("PrivacySettings")),a.ZP.createElement(Ee.Z,{icon:"data",onClick:()=>t(o.MT.DataStorage)},i("DataSettings")),a.ZP.createElement(Ee.Z,{icon:"folder",onClick:()=>t(o.MT.Folders)},i("Filters")),a.ZP.createElement(Ee.Z,{icon:"language",onClick:()=>t(o.MT.Language)},i("Language"))))})));var Jt=n(710),zt=n(1151);const Xt="https://t.me/",_t=/https:\/\/t\.me\/?/i,Yt=/^([a-zA-Z0-9_]+)$/,Ht=(0,z.Ds)((e=>e()),250,!1),jt=(0,a.X$)((({currentUsername:e,asLink:t,isLoading:n,isUsernameAvailable:s,checkUsername:r,onChange:o})=>{const[l,i]=(0,a.eJ)(e||""),c=(0,M.Z)(),d=t?"SetUrl":"Username",m=c(t?"SetUrlPlaceholder":"Username"),[u,h]=(0,a.Ye)((()=>l.length?l.length<5?[void 0,`${m} is too short`]:l.length>32?[void 0,`${m} is too long`]:Yt.test(l)?void 0===s?[]:[s?c(`${d}Available`,"Username"):void 0,!1===s?c(`${d}InUse`):void 0]:[void 0,`${m} contains invalid characters`]:[]),[l,s,c,d,m]);(0,a.d4)((()=>{i(e||"")}),[t,e]);const Z=(0,a.I4)((e=>{const n=e.target.value.trim().replace(_t,"");i(n),e.target.value=`${t?Xt:""}${n}`;const a=function(e){return e.length>=5&&e.length<=32&&Yt.test(e)}(n);a&&Ht((()=>{r({username:n})})),o&&o(!!a&&n)}),[t,r,o]);return a.ZP.createElement(ve.Z,{value:`${t?Xt:""}${l}`,onChange:Z,label:m,error:h,success:u,readOnly:n})})),Vt=(0,z.P2)((e=>e()),6e4,!0),Kt="Please provide your first name",qt="Bio can' be longer than 70 characters",Wt=(0,a.X$)((0,s.c$)((e=>{const{currentUserId:t}=e,{progress:n,isUsernameAvailable:a}=e.profileEdit||{},s=t?(0,m.dy)(e,t):void 0;if(!s)return{progress:n,isUsernameAvailable:a};const{firstName:r,lastName:o,username:l,fullInfo:i}=s,{bio:c}=i||{};return{currentAvatarHash:(0,u.RT)(s),currentFirstName:r,currentLastName:o,currentBio:c,currentUsername:l,progress:n,isUsernameAvailable:a}}),((e,t)=>(0,h.ei)(t,["loadCurrentUser","updateProfile","checkUsername"])))((({isActive:e,onScreenSelect:t,onReset:n,currentAvatarHash:s,currentFirstName:l,currentLastName:i,currentBio:c,currentUsername:d,progress:m,isUsernameAvailable:u,loadCurrentUser:h,updateProfile:Z,checkUsername:P})=>{const g=(0,M.Z)(),[v,E]=(0,a.eJ)(!1),[C,f]=(0,a.eJ)(!1),[b,I]=(0,a.eJ)(),[y,S]=(0,a.eJ)(),[w,N]=(0,a.eJ)(l||""),[k,A]=(0,a.eJ)(i||""),[L,R]=(0,a.eJ)(c||""),[B,D]=(0,a.eJ)(d||""),U=(0,p.Z)(s,!1,r.IU.BlobUrl),O=m===o.rN.InProgress,x=!1===B,G=(0,a.Ye)((()=>!x&&(Boolean(y)||C||!0===u)),[y,C,x,u]);(0,T.ZP)(e,n,t,o.MT.EditProfile),(0,a.d4)((()=>{Vt((()=>{h()}))}),[h]),(0,a.d4)((()=>{S(void 0)}),[U]),(0,a.d4)((()=>{N(l||""),A(i||""),R(c||"")}),[l,i,c]),(0,a.d4)((()=>{D(d||"")}),[d]),(0,a.d4)((()=>{m===o.rN.Complete&&(f(!1),E(!1),I(void 0))}),[m]);const J=(0,a.I4)((e=>{S(e)}),[]),z=(0,a.I4)((e=>{N(e.target.value),f(!0)}),[]),X=(0,a.I4)((e=>{A(e.target.value),f(!0)}),[]),_=(0,a.I4)((e=>{R(e.target.value),f(!0)}),[]),Y=(0,a.I4)((e=>{D(e),E(!0)}),[]),H=(0,a.I4)((()=>{const e=w.trim(),t=k.trim(),n=L.trim();e.length?n.length>70?I(qt):Z({photo:y,...C&&{firstName:e,lastName:t,bio:n},...v&&{username:B}}):I(Kt)}),[y,w,k,L,C,B,v,Z]);return a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-edit-profile"},a.ZP.createElement(Jt.Z,{currentAvatarBlobUrl:U,onChange:J,title:"Edit your profile photo",disabled:O}),a.ZP.createElement(ve.Z,{value:w,onChange:z,label:g("FirstName"),disabled:O,error:b===Kt?b:void 0}),a.ZP.createElement(ve.Z,{value:k,onChange:X,label:g("LastName"),disabled:O}),a.ZP.createElement(ve.Z,{value:L,onChange:_,label:g("UserBio"),disabled:O,error:b===qt?b:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,$.Z)(g("lng_settings_about_bio"),["br","simple_markdown"]))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0},g("Username")),a.ZP.createElement(jt,{currentUsername:B||"",isLoading:O,isUsernameAvailable:u,checkUsername:P,onChange:Y}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,$.Z)(g("UsernameHelp"),["br","simple_markdown"])),B&&a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},g("lng_username_link"),a.ZP.createElement("br",null),a.ZP.createElement("span",{className:"username-link"},"https://t.me/",B)))),a.ZP.createElement(zt.Z,{isShown:G,onClick:H,disabled:O,ariaLabel:"Save changes"},O?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var Qt=n(4605),en=n(8051);const tn=(0,a.X$)((0,s.c$)((e=>(0,h.ei)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","canAutoPlayGifs","canAutoPlayVideos","autoLoadFileMaxSizeMb"])),((e,t)=>(0,h.ei)(t,["setSettingOption"])))((({isActive:e,onScreenSelect:t,onReset:n,canAutoLoadPhotoFromContacts:s,canAutoLoadPhotoInPrivateChats:r,canAutoLoadPhotoInGroups:i,canAutoLoadPhotoInChannels:c,canAutoLoadVideoFromContacts:d,canAutoLoadVideoInPrivateChats:m,canAutoLoadVideoInGroups:u,canAutoLoadVideoInChannels:h,canAutoLoadFileFromContacts:Z,canAutoLoadFileInPrivateChats:P,canAutoLoadFileInGroups:g,canAutoLoadFileInChannels:v,canAutoPlayGifs:p,canAutoPlayVideos:E,autoLoadFileMaxSizeMb:C,setSettingOption:f})=>{const b=(0,M.Z)();(0,T.ZP)(e,n,t,o.MT.General);const I=(0,a.I4)((e=>b("AutodownloadSizeLimitUpTo",b("FileSize.MB",String(l.by[e]),"i"))),[b]),y=(0,a.I4)((e=>{f({autoLoadFileMaxSizeMb:l.by[e]})}),[f]);function S(e,t,n,s,r,o){return a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},e),a.ZP.createElement(Qt.Z,{label:b("AutoDownloadSettings.Contacts"),checked:n,onCheck:e=>f({[`canAutoLoad${t}FromContacts`]:e})}),a.ZP.createElement(Qt.Z,{label:b("AutoDownloadSettings.PrivateChats"),checked:s,onCheck:e=>f({[`canAutoLoad${t}InPrivateChats`]:e})}),a.ZP.createElement(Qt.Z,{label:b("AutoDownloadSettings.GroupChats"),checked:r,onCheck:e=>f({[`canAutoLoad${t}InGroups`]:e})}),a.ZP.createElement(Qt.Z,{label:b("AutoDownloadSettings.Channels"),checked:o,onCheck:e=>f({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&function(){const e=l.by.indexOf(C);return a.ZP.createElement("div",{className:"pt-5"},a.ZP.createElement(en.Z,{label:b("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:I,onChange:y}))}())}return a.ZP.createElement("div",{className:"settings-content custom-scroll"},S(b("AutoDownloadPhotosTitle"),"Photo",s,r,i,c),S(b("AutoDownloadVideosTitle"),"Video",d,m,u,h),S("Auto-download files","File",Z,P,g,v),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0},b("AutoplayMedia")),a.ZP.createElement(Qt.Z,{label:b("GifsTab2"),checked:p,onCheck:e=>f({canAutoPlayGifs:e})}),a.ZP.createElement(Qt.Z,{label:b("DataAndStorage.Autoplay.Videos"),checked:E,onCheck:e=>f({canAutoPlayVideos:e})})))})));var nn=n(7324),an=n(7799);const sn=(0,z.P2)((e=>e()),6e4,!0),rn=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t},users:{byId:n}}=e,{orderedIds:a,byId:s,recommended:r}=e.chatFolders;return{chatsById:t,usersById:n,orderedFolderIds:a,foldersById:s,recommendedChatFolders:r,notifySettings:(0,m.dZ)(e),notifyExceptions:(0,m.NJ)(e)}}),((e,t)=>(0,h.ei)(t,["loadRecommendedChatFolders","addChatFolder","showDialog"])))((({onCreateFolder:e,onEditFolder:t,isActive:n,onScreenSelect:s,onReset:r,chatsById:i,usersById:c,orderedFolderIds:d,foldersById:m,recommendedChatFolders:h,notifySettings:Z,notifyExceptions:P,loadRecommendedChatFolders:g,addChatFolder:v,showDialog:p})=>{const[E,C]=(0,a.eJ)(),[f,b]=(0,a.eJ)(!1),I=(0,a.I4)((()=>b(!0)),[]);(0,a.d4)((()=>{E||(0,nn.Z)("FoldersAll").then(C)}),[E]),(0,a.d4)((()=>{sn((()=>{g()}))}),[g]);const y=(0,a.I4)((()=>{Object.keys(m).length>=10?p({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):e()}),[m,p,e]),S=(0,M.Z)();(0,T.ZP)(n,r,s,o.MT.Folders);const w=(0,a.Ye)((()=>{if(!d)return;const e=Object.keys(i);return d.map((t=>{const n=m[t];return{id:n.id,title:n.title,subtitle:(0,u.SB)(S,i,c,n,e,Z,P)}}))}),[d,i,m,c,Z,P,S]),N=(0,a.I4)((e=>{Object.keys(m).length>=10?p({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):v({folder:e})}),[m,v,p]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},E&&a.ZP.createElement(an.Z,{id:"settingsFoldersMain",size:l.ku,animationData:E,play:f,noLoop:!0,onLoad:I})),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},S("CreateNewFilterInfo")),a.ZP.createElement(R.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:y,isRtl:S.isRtl},a.ZP.createElement("i",{className:"icon-add"}),S("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:S.isRtl?"rtl":void 0},S("Filters")),null!=w&&w.length?w.map((e=>a.ZP.createElement(Ee.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>t(m[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):w&&!w.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(Pe.Z,null)),h&&!!h.length&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:S.isRtl?"rtl":void 0},S("FilterRecommended")),h.map((e=>a.ZP.createElement(Ee.Z,{className:"mb-2",narrow:!0,onClick:()=>N(e)},a.ZP.createElement("div",{className:"settings-folders-recommended-item"},a.ZP.createElement("div",{className:"multiline-item"},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.description)),a.ZP.createElement(R.Z,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:S.isRtl},S("Add"))))))))})));var on=n(3455);const ln=({count:e,itemName:t,itemPluralName:n,isLoading:s,onClick:r})=>{const o=(0,M.Z)();return a.ZP.createElement(R.Z,{className:"ShowMoreButton",color:"translucent",size:"smaller",isText:!0,isLoading:s,isRtl:o.isRtl,onClick:r},a.ZP.createElement("i",{className:"icon-down"}),"Show ",e," more ",e>1?n||`${t}s`:t)},cn="Please provide a title for this folder.",dn="ChatList.Filter.Error.Empty",mn=(0,a.X$)((0,s.c$)((e=>{const{listIds:t}=e.chats;return{loadedActiveChatIds:t.active,loadedArchivedChatIds:t.archived}}),((e,t)=>(0,h.ei)(t,["editChatFolder","addChatFolder","loadMoreChats"])))((({state:e,dispatch:t,onAddIncludedChats:n,onAddExcludedChats:s,isActive:r,onScreenSelect:i,onReset:c,onBack:d,loadedActiveChatIds:m,loadedArchivedChatIds:Z,editChatFolder:P,addChatFolder:g,loadMoreChats:v})=>{const[p,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(!1),b=(0,a.I4)((()=>f(!0)),[]),[I,y]=(0,a.eJ)(!1),[S,w]=(0,a.eJ)(!1),{selectedChatIds:N,selectedChatTypes:k}=(0,on.vb)(e,"included"),{selectedChatIds:A,selectedChatTypes:L}=(0,on.vb)(e,"excluded");(0,a.d4)((()=>{p||(0,nn.Z)("FoldersNew").then(E)}),[p]),(0,a.d4)((()=>{y(!1),w(!1)}),[e.folderId]);const[R,B]=(0,a.Ye)((()=>{const e=new Set([...m||[],...Z||[]]),t=(0,h.eL)(N,e),n=(0,h.eL)(A,e);return[I?t:t.slice(0,5-k.length),S?n:n.slice(0,5-L.length)]}),[A,N,k,L,S,I,m,Z]);(0,a.d4)((()=>{(R.length<N.length||B.length<A.length)&&v({listType:"active"})}),[v,A.length,N.length,B.length,R.length]);const $=(0,M.Z)();function D(e){const t="included"===e?k:L,n="included"===e?R:B,s="included"===e?I:S,r=("included"===e?N:A).length-t.length-n.length,o="included"===e?()=>y(!0):()=>w(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?on.fi.find((({key:t})=>t===e)):on.Yy.find((({key:t})=>t===e));if(n)return a.ZP.createElement(Ee.Z,{key:n.key,className:"settings-folders-list-item mb-1",icon:n.icon,narrow:!0,inactive:!0},$(n.title))}(t,e))),n.map((e=>a.ZP.createElement(Ee.Z,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0},(0,u.YC)(e)?a.ZP.createElement(fe.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Ce.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(ln,{count:r,itemName:"chat",onClick:o}))}return(0,T.ZP)(r,d,i,"edit"===e.mode?o.MT.FoldersEditFolder:o.MT.FoldersCreateFolder),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement("div",{className:"settings-content-icon"},p&&a.ZP.createElement(an.Z,{id:"settingsFoldersEdit",size:l.ku,animationData:p,play:C&&String(e.folderId),noLoop:!0,onLoad:b})),"create"===e.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:$.isRtl?"rtl":void 0},$("FilterIncludeInfo")),a.ZP.createElement(ve.Z,{className:"mb-0",label:$("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:n}=e;t({type:"setTitle",payload:n.value.trim()})},error:e.error&&e.error===cn?cn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===dn&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:$.isRtl?"rtl":void 0},$(e.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:$.isRtl?"rtl":void 0},$("FilterInclude")),a.ZP.createElement(Ee.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:n},$("FilterAddChats")),D("included")),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:$.isRtl?"rtl":void 0},$("FilterExclude")),a.ZP.createElement(Ee.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},$("FilterAddChats")),D("excluded"))),a.ZP.createElement(zt.Z,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:n}=e.folder;n?N.length||Object.keys(k).length?(t({type:"setIsLoading",payload:!0}),"edit"===e.mode?P({id:e.folderId,folderUpdate:e.folder}):g({folder:e.folder}),setTimeout((()=>{c()}),500)):t({type:"setError",payload:dn}):t({type:"setError",payload:cn})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),un=(0,a.X$)((({mode:e,chatIds:t,selectedIds:n,selectedChatTypes:s,filterValue:r,onSelectedIdsChange:o,onSelectedChatTypesChange:l,onFilterChange:i,onLoadMore:c})=>{const d=(0,a.sO)(null),m="included"===e?on.fi:on.Yy,h=n.length+s.length>10,Z=n.length>=100;(0,a.d4)((()=>{setTimeout((()=>{requestAnimationFrame((()=>{d.current.focus()}))}),500)}),[]);const P=(0,a.I4)((e=>{const t=[...n];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),o(t)}),[n,o]),g=(0,a.I4)((e=>{const t=[...s];t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),l(t)}),[s,l]),v=(0,a.I4)((e=>{const{value:t}=e.currentTarget;i(t)}),[i]),p=(0,M.Z)(),[E,C]=(0,ue.Z)(c,t,Boolean(r));return a.ZP.createElement("div",{className:"Picker SettingsFoldersChatsPicker"},a.ZP.createElement("div",{className:"picker-header custom-scroll"},s.map((function(e){const t=m.find((({key:t})=>e===t));if(t)return a.ZP.createElement(it.Z,{icon:t.icon,title:p(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(it.Z,{chatOrUserId:e,isMinimized:h&&t<n.length-5,canClose:!0,onClick:P,clickArg:e}))),Z?a.ZP.createElement("p",{className:"max-items-reached",dir:"auto"},"Sorry, you can't add more than 100 chats."):a.ZP.createElement(ve.Z,{ref:d,value:r,onChange:v,placeholder:p("Search")})),a.ZP.createElement(pe.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:E,onLoadMore:C},(!E||!E.length||E.includes(t[0]))&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h4",{key:"header1",className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("FilterChatTypes")),m.map((function(e){return a.ZP.createElement(Ee.Z,{key:e.key,className:"chat-item-clickable picker-list-item chat-type-item",onClick:()=>g(e.key),ripple:!0},a.ZP.createElement("i",{className:`icon-${e.icon}`}),a.ZP.createElement("h3",{className:"chat-type",dir:"auto"},p(e.title)),a.ZP.createElement(Qt.Z,{label:"",checked:s.includes(e.key),round:!0}))})),a.ZP.createElement("div",{key:"divider",className:"picker-list-divider"}),a.ZP.createElement("h4",{key:"header2",className:"settings-item-header",dir:p.isRtl?"rtl":void 0},p("FilterChats"))),null!=E&&E.length?E.map((function(e){const t=n.includes(e);return a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable picker-list-item chat-item",onClick:()=>P(e),ripple:!0,disabled:!t&&Z},(0,u.YC)(e)?a.ZP.createElement(fe.Z,{userId:e}):a.ZP.createElement(Ce.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(Qt.Z,{label:"",checked:t,round:!0}))})):E&&!E.length?a.ZP.createElement("p",{className:"no-results",key:"no-results"},"Sorry, nothing found."):a.ZP.createElement(Pe.Z,{key:"loading"})))})),hn=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t,listIds:n,orderedPinnedIds:a}}=e;return{chatsById:t,listIds:n.active,orderedPinnedIds:a.active,archivedPinnedIds:a.archived,archivedListIds:n.archived}}),((e,t)=>(0,h.ei)(t,["loadMoreChats"])))((({isActive:e,onScreenSelect:t,onReset:n,mode:s,state:r,dispatch:l,chatsById:i,listIds:c,orderedPinnedIds:d,archivedListIds:m,archivedPinnedIds:h,loadMoreChats:Z})=>{const{chatFilter:P}=r,{selectedChatIds:g,selectedChatTypes:v}=(0,on.vb)(r,s,!0),p=(0,M.Z)(),E=(0,a.Ye)((()=>{const e=c?(0,u.O)(i,c,d,"all"):void 0,t=m?(0,u.O)(i,m,h,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]}),[i,c,d,m,h]),C=(0,a.Ye)((()=>{if(E)return E.filter((e=>!P||(0,me.Z)((0,u.U)(p,e),P)||g.includes(e.id))).map((({id:e})=>e))}),[E,P,p,g]),f=(0,a.I4)((e=>{l({type:"setChatFilter",payload:e})}),[l]),b=(0,a.I4)((e=>{l("included"===s?{type:"setIncludeFilters",payload:{...r.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...r.excludeFilters,excludedChatIds:e}})}),[s,r,l]),I=(0,a.I4)((e=>{const t={};e.forEach((e=>{t[e]=!0})),l("included"===s?{type:"setIncludeFilters",payload:{includedChatIds:g,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:g,...t}})}),[s,g,l]);return(0,T.ZP)(e,n,t,"included"===s?o.MT.FoldersIncludedChats:o.MT.FoldersExcludedChats),C?a.ZP.createElement(un,{mode:s,chatIds:C,selectedIds:g,selectedChatTypes:v,filterValue:P,onSelectedIdsChange:b,onSelectedChatTypesChange:I,onFilterChange:f,onLoadMore:Z}):a.ZP.createElement(Pe.Z,null)}))),Zn=(0,a.X$)((({currentScreen:e,shownScreen:t,state:n,dispatch:s,isActive:r,onScreenSelect:l,onReset:i})=>{const c=(0,a.I4)((()=>{e!==o.MT.FoldersCreateFolder&&e!==o.MT.FoldersEditFolder&&e!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),e!==o.MT.FoldersIncludedChats&&e!==o.MT.FoldersExcludedChats?i():"create"===n.mode?l(o.MT.FoldersCreateFolder):l(o.MT.FoldersEditFolder)}),[n.mode,s,e,i,l]),d=(0,a.I4)((()=>{s({type:"reset"}),l(o.MT.FoldersCreateFolder)}),[l,s]),m=(0,a.I4)((e=>{s({type:"editFolder",payload:e}),l(o.MT.FoldersEditFolder)}),[s,l]),u=(0,a.I4)((()=>{s({type:"editIncludeFilters"}),l(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersIncludedChatsFromChatList:o.MT.FoldersIncludedChats)}),[e,s,l]),h=(0,a.I4)((()=>{s({type:"editExcludeFilters"}),l(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersExcludedChatsFromChatList:o.MT.FoldersExcludedChats)}),[e,s,l]);switch(e){case o.MT.Folders:return a.ZP.createElement(rn,{onCreateFolder:d,onEditFolder:m,onScreenSelect:l,isActive:r||[o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onReset:i});case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(mn,{state:n,dispatch:s,onAddIncludedChats:u,onAddExcludedChats:h,onReset:c,onScreenSelect:l,isActive:r||[o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onBack:i});case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(hn,{mode:"included",state:n,dispatch:s,onReset:c,onScreenSelect:l,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(hn,{mode:"excluded",state:n,dispatch:s,onReset:c,onScreenSelect:l,isActive:r});default:return}}));var Pn=n(663),gn=n(3657),vn=n(692),pn=n(2155);const En=(0,a.X$)((({size:e=l.DC,stickerSet:t,observeIntersection:n})=>{const s=(0,a.sO)(null),o=(0,gn.Op)(s,n),i=`stickerSet${t.id}`,c=(0,p.Z)(i,!o,r.IU.Lottie),d=(0,vn.Z)(c),m=(0,a.Ye)((()=>{if(!c)return(0,pn.Xv)(t.title,2)}),[c,t.title]);return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},m,c&&a.ZP.createElement(an.Z,{id:i,size:e,animationData:c,className:d}))})),Cn=(0,a.X$)((({stickerSet:e,observeIntersection:t})=>{const n=(0,a.sO)(null),s=(0,gn.Op)(n,t),r=(0,p.Z)(e.hasThumbnail&&`stickerSet${e.id}`,!s),o=(0,vn.Z)(r),l=(0,a.Ye)((()=>{if(!r)return(0,pn.Xv)(e.title,2)}),[r,e.title]);return a.ZP.createElement("div",{ref:n,className:"sticker-set-cover"},l,a.ZP.createElement("img",{src:r,className:o,alt:""}))}));var fn=n(3547);const bn=(0,a.X$)((({stickerSet:e,observeIntersection:t,onClick:n})=>{var s;const r=(0,M.Z)();if(!e||!e.stickers)return;const o=null===(s=e.stickers)||void 0===s?void 0:s[0];return e.hasThumbnail||!o?a.ZP.createElement(Ee.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!o,onClick:()=>o&&n(o)},a.ZP.createElement(R.Z,{ariaLabel:e.title,color:"translucent",isRtl:r.isRtl},e.isAnimated?a.ZP.createElement(En,{size:l.Mw,stickerSet:e,observeIntersection:t}):a.ZP.createElement(Cn,{stickerSet:e,observeIntersection:t})),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i")))):a.ZP.createElement(Ee.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>n(o)},a.ZP.createElement(fn.Z,{sticker:o,size:l.Mw,title:e.title,observeIntersection:t}),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},r("StickerPack.StickerCount",e.count,"i"))))}));var In=n(4851);const yn=["Solid and Steady","Nice and Fast","Lots of Stuff"],Sn=[{label:"12-hour",value:"12h"},{label:"24-hour",value:"24h"}],wn=(0,a.X$)((0,s.c$)((e=>({...(0,h.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive","timeFormat"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById})),((e,t)=>(0,h.ei)(t,["setSettingOption","loadStickerSets","loadAddedStickers"])))((({isActive:e,onScreenSelect:t,onReset:n,stickerSetIds:s,stickerSetsById:r,messageTextSize:l,animationLevel:c,messageSendKeyCombo:d,shouldSuggestStickers:m,shouldLoopStickers:u,timeFormat:h,setSettingOption:Z,loadStickerSets:P,loadAddedStickers:g})=>{const v=(0,a.sO)(null),{observe:p}=(0,gn.S1)({rootRef:v}),[E,C,f]=(0,Ae.Z)(),[b,I]=(0,a.eJ)(),y=(0,M.Z)(),S=i.$b?void 0:[{value:"enter",label:y("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:y(i.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];(0,a.d4)((()=>{P()}),[P]),(0,a.d4)((()=>{null!=s&&s.length&&g()}),[s,g]);const w=(0,a.I4)((e=>{yn.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),Z({animationLevel:e})}),[Z]),N=(0,a.I4)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,i.cj?16:15)}px`),document.documentElement.style.setProperty("--message-meta-height",`${Math.floor(1.3125*e)}px`),document.documentElement.style.setProperty("--message-text-size",`${e}px`),document.documentElement.setAttribute("data-message-text-size",e.toString()),Z({messageTextSize:e})}),[Z]),k=(0,a.I4)((e=>{Z({timeFormat:e}),Z({wasTimeFormatSetManually:!0}),(0,Pn.qf)(e)}),[Z]),F=(0,a.I4)((e=>{I(e),C()}),[C]),A=s&&s.map((e=>{var t;return!(null==r||null===(t=r[e])||void 0===t||!t.installedDate)&&r[e]})).filter(Boolean);return(0,T.ZP)(e,n,t,o.MT.General),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("SETTINGS")),a.ZP.createElement(en.Z,{label:y("TextSize"),min:12,max:20,value:l,onChange:N}),a.ZP.createElement(Ee.Z,{icon:"photo",onClick:()=>t(o.MT.GeneralChatBackground)},y("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},"Time Format"),a.ZP.createElement(Xe.Z,{name:"timeformat",options:Sn,selected:h,onChange:k})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:y.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(en.Z,{options:yn,value:c,onChange:w})),S&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("VoiceOver.Keyboard")),a.ZP.createElement(Xe.Z,{name:"keyboard-send-settings",options:S,onChange:e=>Z({messageSendKeyCombo:e}),selected:d})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:y.isRtl?"rtl":void 0},y("AccDescrStickers")),a.ZP.createElement(Qt.Z,{label:y("SuggestStickers"),checked:m,onCheck:e=>Z({shouldSuggestStickers:e})}),a.ZP.createElement(Qt.Z,{label:y("LoopAnimatedStickers"),checked:u,onCheck:e=>Z({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:v},A&&A.map((e=>a.ZP.createElement(bn,{key:e.id,stickerSet:e,observeIntersection:p,onClick:F})))),b&&a.ZP.createElement(In.Z,{isOpen:E,fromSticker:b,onClose:f})))})));let Nn;function kn(e="*",t,n=!1){Nn||(Nn=document.createElement("input"),Nn.setAttribute("type","file")),Nn.setAttribute("accept",e),n?Nn.removeAttribute("multiple"):Nn.setAttribute("multiple","multiple"),Nn.onchange=null,Nn.value="",Nn.onchange=t,Nn.click()}var Mn=n(1394);function Tn(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function Fn(e){const t=e[0].toString(16),n=e[1].toString(16),a=e[2].toString(16);return(1==t.length?"0"+t:t)+(1==n.length?"0"+n:n)+(1==a.length?"0"+a:a)}function An([e,t,n]){e/=255,t/=255,n/=255;let a,s,r=Math.max(e,t,n),o=Math.min(e,t,n),l=r,i=r-o;if(s=0==r?0:i/r,r==o)a=0;else{switch(r){case e:a=(t-n)/i+(t<n?6:0);break;case t:a=(n-e)/i+2;break;case n:a=(e-t)/i+4}a/=6}return[a,s,l]}function Ln([e,t,n]){let a,s,r,o=Math.floor(6*e),l=6*e-o,i=n*(1-t),c=n*(1-l*t),d=n*(1-(1-l)*t);switch(o%6){case 0:a=n,s=d,r=i;break;case 1:a=c,s=n,r=i;break;case 2:a=i,s=n,r=d;break;case 3:a=i,s=c,r=n;break;case 4:a=d,s=i,r=n;break;case 5:a=n,s=i,r=c}return[Math.round(255*a),Math.round(255*s),Math.round(255*r)]}function Rn(e){let[t,n,a]=An(e);return n=Math.min(1,n+.05+.1*(1-n)),a=a>.5?Math.max(0,.65*a):Math.max(0,Math.min(1,1-.65*a)),`hsla(${360*t}, ${100*n}%, ${100*a}%, .4)`}var Bn=n(9524),$n=n(5866);const Dn=(0,a.X$)((({wallpaper:e,theme:t,isSelected:n,onClick:s})=>{var r;const{slug:i,document:c}=e,d=`wallpaper${c.id}`,m=c.previewBlobUrl,u=(0,p.Z)(`${d}?size=m`),h=(0,$n.Z)(null===(r=c.thumbnail)||void 0===r?void 0:r.dataUri,Boolean(u),!0),{transitionClassNames:Z}=(0,Y.Z)(Boolean(u||m),void 0,void 0,"slow"),[P,g]=(0,a.eJ)(!1),{mediaData:v,loadProgress:C}=(0,E.Z)(d,!P),b=!1===(0,f.Z)(P),{shouldRender:I,transitionClassNames:y}=(0,Y.Z)(P&&!v||i===o.mp,void 0,b,"slow"),S=(0,a.sO)();S.current=t;const w=(0,a.I4)((()=>{(async()=>{const e=await(0,Mn.gm)(v);await Bn.save(l.fo,S.current,e),s(i)})()}),[v,s,i]);(0,a.d4)((()=>{v&&w()}),[v,w]);const N=(0,a.I4)((()=>{v?w():g((e=>!e))}),[v,w]),k=(0,X.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:k,onClick:N},a.ZP.createElement("div",{className:"media-inner"},a.ZP.createElement("canvas",{ref:h,className:"thumbnail"}),a.ZP.createElement("img",{src:u||m,className:(0,X.Z)("full-media",Z),alt:""}),I&&a.ZP.createElement("div",{className:(0,X.Z)("spinner-container",y)},a.ZP.createElement(G.Z,{progress:C,onClick:N}))))})),Un=(0,z.P2)((e=>e()),6e4,!0),On=(0,a.X$)((0,s.c$)((e=>{const t=(0,m.Pu)(e),{background:n,isBlurred:a}=e.settings.themes[t]||{},{loadedWallpapers:s}=e.settings;return{background:n,isBlurred:a,loadedWallpapers:s,theme:t}}),((e,t)=>(0,h.ei)(t,["loadWallpapers","uploadWallpaper","setThemeSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,background:s,isBlurred:r,loadedWallpapers:i,theme:c,loadWallpapers:d,uploadWallpaper:m,setThemeSettings:u})=>{const h=(0,a.sO)();h.current=c,(0,a.d4)((()=>{Un((()=>{d()}))}),[d]);const Z=(0,a.I4)((e=>{const{files:t}=e.target;t&&t.length>0&&m(t[0])}),[m]),P=(0,a.I4)((()=>{kn("image/jpeg",Z,!0)}),[Z]),g=(0,a.I4)((()=>{t(o.MT.GeneralChatBackgroundColor)}),[t]),v=(0,a.I4)((()=>{u({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?l.Vv:l.g})}),[u,c]),p=(0,a.I4)((e=>{u({theme:h.current,background:e});const t=i&&i.find((t=>t.slug===e));null!=t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let n,a,s,r,o=-4,l=[0,0,0],i=0;const c=document.createElement("canvas"),d=c.getContext&&c.getContext("2d");if(!d)return t;const m=await(0,Mn.pt)(e);s=m.naturalHeight||m.offsetHeight||m.height,a=m.naturalWidth||m.offsetWidth||m.width,c.height=s,c.width=a,d.drawImage(m,0,0);try{n=d.getImageData(0,0,a,s)}catch(e){return t}for(r=n.data.length;(o+=20)<r;)++i,l[0]+=n.data[o],l[1]+=n.data[o+1],l[2]+=n.data[o+2];return l[0]=Math.floor(l[0]/i),l[1]=Math.floor(l[1]/i),l[2]=Math.floor(l[2]/i),l}(t.document.thumbnail.dataUri).then((e=>{const t=Rn(e),n=`#${Fn(e)}`;u({theme:h.current,backgroundColor:n,patternColor:t})}))}),[i,u]),E=(0,a.I4)((e=>{u({theme:h.current,isBlurred:e.target.checked})}),[u]),C=(0,M.Z)();(0,T.ZP)(e,n,t,o.MT.GeneralChatBackground);const f=(null==i?void 0:i[0])&&i[0].slug===o.mp;return a.ZP.createElement("div",{className:"SettingsGeneralBackground settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Ee.Z,{icon:"camera-add",className:"mb-0",disabled:f,onClick:P},C("UploadImage")),a.ZP.createElement(Ee.Z,{icon:"colorize",className:"mb-0",onClick:g},C("SetColor")),a.ZP.createElement(Ee.Z,{icon:"favorite",onClick:v},C("ThemeResetToDefaults")),a.ZP.createElement(Qt.Z,{label:C("BackgroundBlurred"),checked:Boolean(r),onChange:E})),i?a.ZP.createElement("div",{className:"settings-wallpapers"},i.map((e=>a.ZP.createElement(Dn,{wallpaper:e,theme:c,isSelected:s===e.slug,onClick:p})))):a.ZP.createElement(Pe.Z,null))}))),xn=An(Tn("e6ebee")),Gn=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Jn(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 zn({colorPosition:e,huePosition:t},n){return[t/(n.hueRect.width-1),e[0]/(n.colorRect.width-1),1-e[1]/(n.colorRect.height-1)]}const Xn=(0,a.X$)((0,s.c$)((e=>{const t=(0,m.Pu)(e),{backgroundColor:n}=e.settings.themes[t]||{};return{backgroundColor:n,theme:t}}),((e,t)=>(0,h.ei)(t,["setThemeSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,theme:s,backgroundColor:r,setThemeSettings:l})=>{const i=(0,a.sO)();i.current=s;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=(0,a.sO)(null),u=(0,a.sO)(!0),[P,g]=(0,a.eJ)(function(e){return e&&e.startsWith("#")?An(Tn(e.replace("#",""))):xn}(r)),v=(0,a.sO)(P);(0,a.d4)((()=>{v.current=P}),[P]);const[p,E,C]=(0,Ae.Z)(),[f,b]=(0,a.eJ)(""),[I,y]=(0,a.eJ)(""),S=(0,a.sO)(),w=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:d.current.offsetLeft,...(0,h.ei)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...(0,h.ei)(m.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+c.current.scrollTop),e.height-1)],{huePosition:a}=Jn(v.current,S.current);return g(zn({colorPosition:n,huePosition:a},S.current)),E(),!0}function a(e){const{colorPosition:n}=Jn(v.current,S.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return g(zn({colorPosition:n,huePosition:a},S.current)),E(),!0}S.current={colorRect:e,hueRect:t},(0,Z.s)(d.current,{onCapture:n,onDrag:n,onRelease:C,onClick:C,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,Z.s)(m.current,{onCapture:a,onDrag:a,onRelease:C,onClick:C,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[E,C]);const{colorPosition:N=[0,0],huePosition:k=0}=S.current?Jn(P,S.current):{},M=Fn(Ln(P)),F=P[0],A=Fn(Ln([F,1,1]));(0,a.d4)((()=>{const e=Ln(P),t=`#${Fn(e)}`;if(b(e.join(", ")),y(t),!u.current){const n=Rn(e);l({theme:i.current,background:void 0,backgroundColor:t,patternColor:n})}u.current=!1}),[P,l]),(0,a.d4)((()=>{!function(e,t,n,a){let s,r,o;n.current&&a.current?(s=a.current.colorRect.width,r=a.current.colorRect.height,o=n.current):(s=e.offsetWidth,r=e.offsetHeight,o=e.getContext("2d"),e.width=s,e.height=r,n.current=o);const l=o.createImageData(s,r),i=l.data,c=Ln([t,1,1]);let d=0;for(let e=0;e<r;e++){const t=1-e/(r-1),n=[255*t,255*t,255*t],a=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);i[d++]=n[0]+(a[0]-n[0])*t,i[d++]=n[1]+(a[1]-n[1])*t,i[d++]=n[2]+(a[2]-n[2])*t,i[d++]=255}}o.putImageData(l,0,0)}(d.current.firstChild,F,w,S)}),[F]),(0,a.d4)((()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const n=e.getContext("2d"),a=n.createImageData(t,1),s=a.data;let r=0;for(let e=0;e<t;e++){const n=Ln([e/(t-1),1,1]);s[r++]=n[0],s[r++]=n[1],s[r++]=n[2],s[r++]=255}n.putImageData(a,0,0)}(m.current.firstChild)}),[]);const L=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^\d, ]/g,"").slice(0,13);if(t.match(/^\d{1,3},\s?\d{1,3},\s?\d{1,3}$/)){const e=t.split(",").map((e=>Number(e.trim())));g(An(e))}e.currentTarget.value=t}),[]),R=(0,a.I4)((e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&g(An(Tn(t.replace("#","")))),e.currentTarget.value=t}),[]),B=(0,a.I4)((e=>{g(An(Tn(e.currentTarget.dataset.color.replace("#",""))))}),[]),$=(0,X.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",p&&"is-dragging");return(0,T.ZP)(e,n,t,o.MT.GeneralChatBackgroundColor),a.ZP.createElement("div",{ref:c,className:$},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("div",{ref:d,className:"color-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translate(${N[0]}px, ${N[1]}px); background-color: #${M};`})),a.ZP.createElement("div",{ref:m,className:"hue-picker"},a.ZP.createElement("canvas",null),a.ZP.createElement("div",{className:"handle",style:`transform: translateX(${k}px); background-color: #${A};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(ve.Z,{value:I,label:"HEX",onChange:R}),a.ZP.createElement(ve.Z,{value:f,label:"RGB",onChange:L}))),a.ZP.createElement("div",{className:"predefined-colors"},Gn.map((e=>a.ZP.createElement("div",{className:e===`#${M}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:B})))))}))),_n=(0,a.X$)((0,s.c$)((e=>({hasPrivateChatsNotifications:Boolean(e.settings.byKey.hasPrivateChatsNotifications),hasPrivateChatsMessagePreview:Boolean(e.settings.byKey.hasPrivateChatsMessagePreview),hasGroupNotifications:Boolean(e.settings.byKey.hasGroupNotifications),hasGroupMessagePreview:Boolean(e.settings.byKey.hasGroupMessagePreview),hasBroadcastNotifications:Boolean(e.settings.byKey.hasBroadcastNotifications),hasBroadcastMessagePreview:Boolean(e.settings.byKey.hasBroadcastMessagePreview),hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})),((e,t)=>(0,h.ei)(t,["loadNotificationSettings","updateContactSignUpNotification","updateNotificationSettings","updateWebNotificationSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,hasPrivateChatsNotifications:s,hasPrivateChatsMessagePreview:r,hasGroupNotifications:l,hasGroupMessagePreview:i,hasBroadcastNotifications:c,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,hasPushNotifications:u,hasWebNotifications:h,notificationSoundVolume:Z,loadNotificationSettings:P,updateContactSignUpNotification:g,updateNotificationSettings:v,updateWebNotificationSettings:p})=>{(0,a.d4)((()=>{P()}),[P]);const E=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!s:!("group"===t?l:c),o="contact"===t?r:"group"===t?i:d;v({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:o},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[d,c,i,l,r,s,v]),C=(0,a.I4)((e=>{g({isSilent:!e.target.checked})}),[g]),f=(0,M.Z)();return(0,T.ZP)(e,n,t,o.MT.Notifications),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(Qt.Z,{label:"Web notifications",subLabel:f(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:e=>{p({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(Qt.Z,{label:"Offline notifications",disabled:!h,subLabel:f(u?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:u,onChange:e=>{p({hasPushNotifications:e.target.checked})}}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(en.Z,{label:"Sound",disabled:!h,min:0,max:10,value:Z,onChange:e=>{p({notificationSoundVolume:e})}}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("AutodownloadPrivateChats")),a.ZP.createElement(Qt.Z,{label:f("NotificationsForPrivateChats"),subLabel:f(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{E(e,"contact","silent")}}),a.ZP.createElement(Qt.Z,{label:f("MessagePreview"),disabled:!s,subLabel:f(r?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:r,onChange:e=>{E(e,"contact","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("FilterGroups")),a.ZP.createElement(Qt.Z,{label:f("NotificationsForGroups"),subLabel:f(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{E(e,"group","silent")}}),a.ZP.createElement(Qt.Z,{label:f("MessagePreview"),disabled:!l,subLabel:f(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{E(e,"group","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("FilterChannels")),a.ZP.createElement(Qt.Z,{label:f("NotificationsForChannels"),subLabel:f(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{E(e,"broadcast","silent")}}),a.ZP.createElement(Qt.Z,{label:f("MessagePreview"),disabled:!c,subLabel:f(d?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:d,onChange:e=>{E(e,"broadcast","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("PhoneOther")),a.ZP.createElement(Qt.Z,{label:f("ContactJoined"),checked:m,onChange:C})))}))),Yn=(0,a.X$)((0,s.c$)((e=>{var t,n,a,s,r;const{settings:{byKey:{hasPassword:o,isSensitiveEnabled:l,canChangeSensitive:i},privacy:c},blocked:d,activeSessions:m}=e;return{hasPassword:o,blockedCount:d.totalCount,sessionsCount:m.length,isSensitiveEnabled:l,canChangeSensitive:i,visibilityPrivacyPhoneNumber:null===(t=c.phoneNumber)||void 0===t?void 0:t.visibility,visibilityPrivacyLastSeen:null===(n=c.lastSeen)||void 0===n?void 0:n.visibility,visibilityPrivacyProfilePhoto:null===(a=c.profilePhoto)||void 0===a?void 0:a.visibility,visibilityPrivacyForwarding:null===(s=c.forwards)||void 0===s?void 0:s.visibility,visibilityPrivacyGroupChats:null===(r=c.chatInvite)||void 0===r?void 0:r.visibility}}),((e,t)=>(0,h.ei)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings","loadContentSettings","updateContentSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,hasPassword:s,blockedCount:r,sessionsCount:l,isSensitiveEnabled:i,canChangeSensitive:c,visibilityPrivacyPhoneNumber:d,visibilityPrivacyLastSeen:m,visibilityPrivacyProfilePhoto:u,visibilityPrivacyForwarding:h,visibilityPrivacyGroupChats:Z,loadPrivacySettings:P,loadBlockedContacts:g,loadAuthorizations:v,loadContentSettings:p,updateContentSettings:E})=>{(0,a.d4)((()=>{g(),v(),P(),p()}),[g,v,P,p]);const C=(0,M.Z)();function f(e){switch(e){case"everybody":return C("P2PEverybody");case"contacts":return C("P2PContacts");case"nobody":return C("P2PNobody")}}return(0,T.ZP)(e,n,t,o.MT.Privacy),a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement(Ee.Z,{icon:"delete-user",narrow:!0,onClick:()=>t(o.MT.PrivacyBlockedUsers)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("BlockedUsers")),r>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C("Users",r)))),a.ZP.createElement(Ee.Z,{icon:"lock",narrow:!0,onClick:()=>t(s?o.MT.TwoFaEnabled:o.MT.TwoFaDisabled)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C(s?"PasswordOn":"PasswordOff")))),a.ZP.createElement(Ee.Z,{icon:"active-sessions",narrow:!0,onClick:()=>t(o.MT.PrivacyActiveSessions)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("SessionsTitle")),l>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},1===l?"1 session":`${l} sessions`)))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:C.isRtl?"rtl":void 0},C("PrivacyTitle")),a.ZP.createElement(Ee.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyPhoneNumber)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f(d)))),a.ZP.createElement(Ee.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyLastSeen)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f(m)))),a.ZP.createElement(Ee.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyProfilePhoto)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f(u)))),a.ZP.createElement(Ee.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyForwarding)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f(h)))),a.ZP.createElement(Ee.Z,{narrow:!0,className:"no-icon",onClick:()=>t(o.MT.PrivacyGroupChats)},a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("span",{className:"title"},C("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f(Z))))),c&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("lng_settings_sensitive_title")),a.ZP.createElement(Qt.Z,{label:C("lng_settings_sensitive_disable_filtering"),subLabel:C("lng_settings_sensitive_about"),checked:Boolean(i),disabled:!c,onCheck:E})))}))),Hn=(0,a.X$)((0,s.c$)((e=>({languages:e.settings.byKey.languages,language:e.settings.byKey.language})),((e,t)=>(0,h.ei)(t,["loadLanguages","setSettingOption"])))((({isActive:e,onScreenSelect:t,onReset:n,languages:s,language:r,loadLanguages:l,setSettingOption:i})=>{const[c,d]=(0,a.eJ)(r),[m,u,h]=(0,Ae.Z)();(0,a.d4)((()=>{l()}),[l]);const Z=(0,a.I4)((e=>{d(e),u(),(0,Pn.m0)(e,(()=>{h(),i({language:e})}))}),[u,h,i]),P=(0,a.Ye)((()=>s?function(e){const t=(window.navigator.language||"en").toLowerCase(),n=t.substr(0,2);return e.map((({langCode:e,nativeName:t,name:n})=>({value:e,label:t,subLabel:n}))).sort((e=>!t||e.value!==t&&e.value!==n?0:-1))}(s):void 0),[s]);return(0,T.ZP)(e,n,t,o.MT.Language),a.ZP.createElement("div",{className:"settings-content settings-item settings-language custom-scroll"},P?a.ZP.createElement(Xe.Z,{name:"keyboard-send-settings",options:P,selected:c,loadingOption:m?c:void 0,onChange:Z}):a.ZP.createElement(Pe.Z,null))})));function jn(e){switch(e){case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case o.MT.PrivacyLastSeen:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return"lastSeen";case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case o.MT.PrivacyForwarding:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return"forwards";case o.MT.PrivacyGroupChats:case o.MT.PrivacyGroupChatsAllowedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return"chatInvite"}}const Vn=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{let n;const{chats:{byId:a},settings:{privacy:s}}=e;switch(t){case o.MT.PrivacyPhoneNumber:n=s.phoneNumber;break;case o.MT.PrivacyLastSeen:n=s.lastSeen;break;case o.MT.PrivacyProfilePhoto:n=s.profilePhoto;break;case o.MT.PrivacyForwarding:n=s.forwards;break;case o.MT.PrivacyGroupChats:n=s.chatInvite}return n?{...n,chatsById:a}:{}}),((e,t)=>(0,h.ei)(t,["setPrivacyVisibility"])))((({screen:e,isActive:t,onScreenSelect:n,onReset:s,visibility:r,allowUserIds:l,allowChatIds:i,blockUserIds:c,blockChatIds:d,chatsById:m,setPrivacyVisibility:u})=>{const h=(0,M.Z)(),Z=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyGroupChats:return[{value:"everybody",label:h("P2PEverybody")},{value:"contacts",label:h("P2PContacts")}];default:return[{value:"everybody",label:h("P2PEverybody")},{value:"contacts",label:h("P2PContacts")},{value:"nobody",label:h("P2PNobody")}]}}),[h,e]),P={shouldShowDenied:"nobody"!==r,shouldShowAllowed:"everybody"!==r},g=jn(e),v=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyPhoneNumber:return h("PrivacyPhoneTitle");case o.MT.PrivacyLastSeen:return h("LastSeenTitle");case o.MT.PrivacyProfilePhoto:return h("PrivacyProfilePhotoTitle");case o.MT.PrivacyForwarding:return h("PrivacyForwardsTitle");case o.MT.PrivacyGroupChats:return h("WhoCanAddMe");default:return}}),[h,e]);(0,T.ZP)(t,s,n,e);const p=(0,a.Ye)((()=>{switch(e){case o.MT.PrivacyLastSeen:return h("CustomHelp");default:return}}),[h,e]),E=(()=>{switch(e){case o.MT.PrivacyPhoneNumber:return o.MT.PrivacyPhoneNumberAllowedContacts;case o.MT.PrivacyLastSeen:return o.MT.PrivacyLastSeenAllowedContacts;case o.MT.PrivacyProfilePhoto:return o.MT.PrivacyProfilePhotoAllowedContacts;case o.MT.PrivacyForwarding:return o.MT.PrivacyForwardingAllowedContacts;default:return o.MT.PrivacyGroupChatsAllowedContacts}})(),C=(()=>{switch(e){case o.MT.PrivacyPhoneNumber:return o.MT.PrivacyPhoneNumberDeniedContacts;case o.MT.PrivacyLastSeen:return o.MT.PrivacyLastSeenDeniedContacts;case o.MT.PrivacyProfilePhoto:return o.MT.PrivacyProfilePhotoDeniedContacts;case o.MT.PrivacyForwarding:return o.MT.PrivacyForwardingDeniedContacts;default:return o.MT.PrivacyGroupChatsDeniedContacts}})(),f=(0,a.Ye)((()=>l&&i&&m?i.reduce(((e,t)=>e+(m[t]?m[t].membersCount:0)),l.length):0),[i,l,m]),b=(0,a.Ye)((()=>c&&d&&m?d.reduce(((e,t)=>e+(m[t]?m[t].membersCount:0)),c.length):0),[d,c,m]),I=(0,a.I4)((e=>{u({privacyKey:g,visibility:e})}),[g,u]);return a.ZP.createElement("div",{className:"settings-content custom-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:h.isRtl?"rtl":void 0},v),a.ZP.createElement(Xe.Z,{name:`visibility-${g}`,options:Z,onChange:I,selected:r}),p&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:h.isRtl?"rtl":void 0},p)),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:h.isRtl?"rtl":void 0},h("PrivacyExceptions")),P.shouldShowAllowed&&a.ZP.createElement(Ee.Z,{narrow:!0,icon:"add-user",onClick:()=>{n(E)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},f>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",f),a.ZP.createElement("span",{className:"title"},h("AlwaysShareWith")),a.ZP.createElement("span",{className:"subtitle"},h("EditAdminAddUsers")))),P.shouldShowDenied&&a.ZP.createElement(Ee.Z,{narrow:!0,icon:"delete-user",onClick:()=>{n(C)}},a.ZP.createElement("div",{className:"multiline-menu-item full-size"},b>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"−",b),a.ZP.createElement("span",{className:"title"},h("NeverShareWith")),a.ZP.createElement("span",{className:"subtitle"},h("EditAdminAddUsers"))))))})));function Kn(e){return[e.region,e.country].filter(Boolean).join(", ")}function qn(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const Wn=(0,a.X$)((0,s.c$)((e=>({activeSessions:e.activeSessions})),((e,t)=>(0,h.ei)(t,["loadAuthorizations","terminateAuthorization","terminateAllAuthorizations"])))((({isActive:e,onScreenSelect:t,onReset:n,activeSessions:s,loadAuthorizations:r,terminateAuthorization:l,terminateAllAuthorizations:i})=>{const[c,d,m]=(0,Ae.Z)();(0,a.d4)((()=>{r()}),[r]);const u=(0,a.I4)((e=>{l({hash:e})}),[l]),h=(0,a.I4)((()=>{m(),i()}),[m,i]),Z=(0,a.Ye)((()=>s.find((e=>e.isCurrent))),[s]),P=(0,a.Ye)((()=>s.filter((e=>!e.isCurrent))),[s]),g=(0,M.Z)();return(0,T.ZP)(e,n,t,o.MT.PrivacyActiveSessions),a.ZP.createElement("div",{className:"settings-content custom-scroll"},Z&&(p=Z,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:g.isRtl?"rtl":void 0},g("AuthSessions.CurrentSession")),a.ZP.createElement(Ee.Z,{narrow:!0,inactive:!0,className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item",dir:"auto"},a.ZP.createElement("span",{className:"title",dir:"auto"},p.appName),a.ZP.createElement("span",{className:"subtitle black tight"},qn(p)),a.ZP.createElement("span",{className:"subtitle"},p.ip," - ",Kn(p)))),a.ZP.createElement(Ee.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d},g("TerminateAllSessions")))),P&&(v=P,a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:g.isRtl?"rtl":void 0},g("OtherSessions")),v.map((function(e){return a.ZP.createElement(Ee.Z,{key:e.hash,ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",handler:()=>{u(e.hash)}}],className:"no-icon"},a.ZP.createElement("div",{className:"multiline-menu-item full-size",dir:"auto"},a.ZP.createElement("span",{className:"date"},(0,B.VX)(g,1e3*e.dateActive)),a.ZP.createElement("span",{className:"title"},e.appName),a.ZP.createElement("span",{className:"subtitle black tight"},qn(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",Kn(e))))})))),P&&a.ZP.createElement(Te.Z,{isOpen:c,onClose:m,text:"Are you sure you want to terminate all other sessions?",confirmLabel:"Terminate All Other Sessions",confirmHandler:h,confirmIsDestructive:!0}));var v,p})));var Qn=n(6272);const ea=(0,a.X$)((0,s.c$)((e=>{const{users:{byId:t},blocked:{ids:n},contactList:a,currentUserId:s}=e;return{usersById:t,blockedIds:n,contactIds:null==a?void 0:a.userIds,localContactIds:e.userSearch.localUserIds,currentUserId:s}}),((e,t)=>(0,h.ei)(t,["loadContactList","setUserSearchQuery","blockContact"])))((({usersById:e,blockedIds:t,contactIds:n,localContactIds:s,currentUserId:r,isOpen:o,onClose:l,loadContactList:i,setUserSearchQuery:c,blockContact:d})=>{const m=(0,M.Z)(),[Z,P]=(0,a.eJ)(""),g=(0,a.sO)(null);(0,a.d4)((()=>{c({query:Z})}),[Z,c]);const v=(0,a.Ye)((()=>{const a=(n||[]).concat(s||[]).filter((e=>!t.includes(e)&&e!==r));return(0,h.Tw)(a).reduce(((t,n)=>{var a;return(!Z||!e[n]||(0,me.Z)((0,u.Js)(e[n])||"",Z)||null!==(a=e[n])&&void 0!==a&&a.username.toLowerCase().includes(Z))&&t.push(n),t}),[]).sort(((t,n)=>{const a=(0,u.Js)(e[t])||"",s=(0,u.Js)(e[n])||"";return a.localeCompare(s)}))}),[t,n,r,Z,s,e]),p=(0,a.I4)((t=>{const{id:n,accessHash:a}=e[t]||{};n&&a&&(d({contactId:n,accessHash:a}),l())}),[d,l,e]);return a.ZP.createElement(be,{isOpen:o,chatOrUserIds:v,filterRef:g,filterPlaceholder:m("BlockedUsers.BlockUser"),filter:Z,onFilterChange:P,loadMore:i,onSelectChatOrUser:p,onClose:l})}))),ta=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a},countryList:{phoneCodes:s}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a,phoneCodeList:s}}),((e,t)=>(0,h.ei)(t,["unblockContact"])))((({isActive:e,onScreenSelect:t,onReset:n,chatsByIds:s,usersByIds:r,blockedIds:i,phoneCodeList:c,unblockContact:d})=>{const m=(0,M.Z)(),[h,Z,P]=(0,Ae.Z)(),g=(0,a.I4)((e=>{d({contactId:e})}),[d]);return(0,T.ZP)(e,n,t,o.MT.PrivacyBlockedUsers),a.ZP.createElement("div",{className:"settings-fab-wrapper"},a.ZP.createElement("div",{className:"settings-content infinite-scroll"},a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("p",{className:"settings-item-description-larger mt-0 mb-2",dir:m.isRtl?"rtl":void 0},m("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},null!=i&&i.length?a.ZP.createElement("div",{className:"scroll-container"},i.map(((e,t)=>function(e,t,n){const o=(0,u.YC)(e),i=o?r[e]:void 0,d=o?void 0:s[e],h=(0,X.Z)("Chat chat-item-clickable blocked-list-item small-icon",o?"private":"group");return a.ZP.createElement(Ee.Z,{key:e,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{g(e)}}],style:`top: ${(0+t)*l.rS}px;`},a.ZP.createElement(D.Z,{size:"medium",user:i,chat:d}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,$.Z)((o?(0,u.Js)(i):(0,u.U)(m,d))||"")),(null==i?void 0:i.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,Qn.WZ)(c,i.phoneNumber)),i&&!i.phoneNumber&&i.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",i.username)))}(e,t)))):i&&!i.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},m("NoBlocked")):a.ZP.createElement(Pe.Z,{key:"loading"}))),a.ZP.createElement(zt.Z,{isShown:!0,onClick:Z,ariaLabel:m("BlockContact")},a.ZP.createElement("i",{className:"icon-add"})),a.ZP.createElement(ea,{isOpen:h,onClose:P}))})));var na=n(7854);const aa=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,m.zB)(e,"🔐")})))((({isActive:e,onReset:t,animatedEmoji:n,onScreenSelect:s})=>{const r=(0,M.Z)();return(0,T.ZP)(e,t,s,o.MT.TwoFaEnabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(na.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,$.Z)(r("EnabledPasswordText"),["br"]))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Ee.Z,{icon:"edit",onClick:()=>s(o.MT.TwoFaChangePasswordCurrent)},r("ChangePassword")),a.ZP.createElement(Ee.Z,{icon:"password-off",onClick:()=>s(o.MT.TwoFaTurnOff)},r("TurnPasswordOff")),a.ZP.createElement(Ee.Z,{icon:"email",onClick:()=>s(o.MT.TwoFaRecoveryEmailCurrentPassword)},r("SetRecoveryEmail"))))})));var sa=n(3490),ra=n(9364);const oa=(0,a.X$)((({screen:e,isActive:t,onScreenSelect:n,onReset:s,error:r,isLoading:o,expectedPassword:l,placeholder:i="Current Password",hint:c,submitLabel:d,clearError:m,onSubmit:u})=>{const[h,Z]=(0,a.eJ)(""),[P,g]=(0,a.eJ)(!1),v=(0,a.I4)((e=>{l&&e!==l?Z("Passwords Should Be Equal"):u(e)}),[u,l]),p=(0,a.I4)((()=>{m&&m(),Z("")}),[m]),E=(0,M.Z)();return(0,T.ZP)(t,s,n,e),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(sa.Z,{isBig:!0,isPasswordVisible:P})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(ra.Z,{error:h||r,hint:c,placeholder:i,submitLabel:d||E("Next"),clearError:p,isLoading:o,isPasswordVisible:P,onChangePasswordVisibility:g,onSubmit:v})))})),la=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,m.zB)(e,"🔐")})))((({isActive:e,onScreenSelect:t,onReset:n,animatedEmoji:s,onStart:r})=>{const l=(0,M.Z)();return(0,T.ZP)(e,n,t,o.MT.TwoFaDisabled),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(na.Z,{sticker:s,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},l("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:r},l("EditAdminTransferSetPassword"))))}))),ia=i.wB?550:400,ca=(0,a.X$)((0,s.c$)(((e,{icon:t})=>({animatedEmoji:(0,m.zB)(e,"email"===t?"💌":"💡")})))((({animatedEmoji:e,type:t="text",isLoading:n,error:s,placeholder:r,shouldConfirm:o,clearError:l,onSubmit:c,isActive:d,onScreenSelect:m,onReset:u,screen:h})=>{const Z=(0,a.sO)(null),[P,g]=(0,a.eJ)(""),[v,p,E]=(0,Ae.Z)(!1);(0,a.d4)((()=>{i.$b||setTimeout((()=>{Z.current.focus()}),ia)}),[]);const C=(0,M.Z)();return(0,T.ZP)(d,u,m,h),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(na.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement("form",{action:"",onSubmit:e=>{e.preventDefault(),Z.current&&c(P)}},a.ZP.createElement(ve.Z,{ref:Z,value:P,inputMode:t,label:r,error:s,onChange:e=>{s&&l&&l(),g(e.target.value)}}),P?a.ZP.createElement(R.Z,{type:"submit",isLoading:n,ripple:!0},C("Continue")):a.ZP.createElement(R.Z,{isText:!0,isLoading:n,ripple:!0,onClick:o?p:()=>{c()}},C("YourEmailSkip"))),o&&a.ZP.createElement(ge.Z,{className:"narrow",isOpen:v,title:C("YourEmailSkipWarning"),onClose:E},(0,$.Z)(C("YourEmailSkipWarningText"),["br","simple_markdown"]),a.ZP.createElement("div",{className:"dialog-buttons"},a.ZP.createElement(R.Z,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:()=>{E(),c()}},C("YourEmailSkip")),a.ZP.createElement(R.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:E},C("Cancel"))))))}))),da=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,m.zB)(e,"🥳")})))((({isActive:e,onReset:t,animatedEmoji:n,onScreenSelect:s})=>{const r=(0,M.Z)();return(0,T.ZP)(e,t,s,o.MT.TwoFaCongratulations),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(na.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},r("TwoStepVerificationPasswordSetInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:()=>{s(o.MT.Privacy)}},r("TwoStepVerificationPasswordReturnSettings"))))}))),ma=i.wB?550:400,ua=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,m.zB)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength})))((({animatedEmoji:e,codeLength:t,isLoading:n,error:s,clearError:r,onSubmit:o,isActive:l,onScreenSelect:c,onReset:d,screen:m})=>{const u=(0,a.sO)(null),[h,Z]=(0,a.eJ)("");(0,a.d4)((()=>{i.$b||setTimeout((()=>{u.current.focus()}),ma)}),[]);const P=(0,M.Z)();return(0,T.ZP)(l,d,c,m),a.ZP.createElement("div",{className:"settings-content two-fa custom-scroll"},a.ZP.createElement("div",{className:"settings-content-header"},a.ZP.createElement(na.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(ve.Z,{value:h,ref:u,inputMode:"decimal",label:P("YourEmailCode"),error:s,onChange:e=>{s&&r&&r();const n=e.target.value.slice(0,t);n.length===t&&o(n),Z(n),e.target.value=n}}),n&&a.ZP.createElement(Pe.Z,null)))}))),ha=(0,a.X$)((0,s.c$)((e=>({...e.twoFaSettings})),((e,t)=>(0,h.ei)(t,["updatePassword","updateRecoveryEmail","clearPassword","provideTwoFaEmailCode","checkPassword","clearTwoFaError"])))((({currentScreen:e,shownScreen:t,state:n,hint:s,isLoading:r,error:l,waitingEmailCodeLength:i,dispatch:c,isActive:d,onScreenSelect:m,onReset:u,updatePassword:h,checkPassword:Z,clearTwoFaError:P,updateRecoveryEmail:g,provideTwoFaEmailCode:v,clearPassword:p})=>{(0,a.d4)((()=>{i&&(e===o.MT.TwoFaNewPasswordEmail?m(o.MT.TwoFaNewPasswordEmailCode):e===o.MT.TwoFaRecoveryEmail&&m(o.MT.TwoFaRecoveryEmailCode))}),[e,m,i]);const E=(0,a.I4)((()=>{c({type:"reset"}),m(o.MT.TwoFaNewPassword)}),[c,m]),C=(0,a.I4)((e=>{c({type:"setPassword",payload:e}),m(o.MT.TwoFaNewPasswordConfirm)}),[c,m]),f=(0,a.I4)((()=>{m(o.MT.TwoFaNewPasswordHint)}),[m]),b=(0,a.I4)((e=>{c({type:"setHint",payload:e}),m(o.MT.TwoFaNewPasswordEmail)}),[c,m]),I=(0,a.I4)((e=>{c({type:"setEmail",payload:e}),h({...n,email:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,h]),y=(0,a.I4)((e=>{c({type:"setCurrentPassword",payload:e}),Z({currentPassword:e,onSuccess:()=>{m(o.MT.TwoFaChangePasswordNew)}})}),[Z,c,m]),S=(0,a.I4)((e=>{c({type:"setPassword",payload:e}),m(o.MT.TwoFaChangePasswordConfirm)}),[c,m]),w=(0,a.I4)((()=>{m(o.MT.TwoFaChangePasswordHint)}),[m]),N=(0,a.I4)((e=>{c({type:"setHint",payload:e}),h({...n,hint:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,h]),k=(0,a.I4)((e=>{p({currentPassword:e,onSuccess:()=>{m(o.MT.Privacy)}})}),[p,m]),T=(0,a.I4)((e=>{c({type:"setCurrentPassword",payload:e}),Z({currentPassword:e,onSuccess:()=>{m(o.MT.TwoFaRecoveryEmail)}})}),[Z,c,m]),F=(0,a.I4)((e=>{c({type:"setEmail",payload:e}),g({...n,email:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,g]),A=(0,a.I4)((e=>{v({code:e})}),[v]),L=(0,M.Z)();switch(e){case o.MT.TwoFaDisabled:return a.ZP.createElement(la,{onStart:E,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaNewPassword:return a.ZP.createElement(oa,{screen:e,placeholder:L("PleaseEnterPassword"),submitLabel:L("Continue"),onSubmit:C,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement(oa,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),submitLabel:L("Continue"),onSubmit:f,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaNewPasswordHint:return a.ZP.createElement(ca,{icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:b,screen:e,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaNewPasswordEmail:return a.ZP.createElement(ca,{icon:"email",type:"email",isLoading:r,error:l,clearError:P,placeholder:L("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:I,screen:e,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(ua,{isLoading:r,error:l,clearError:P,onSubmit:A,screen:e,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u});case o.MT.TwoFaCongratulations:return a.ZP.createElement(da,{onScreenSelect:m,isActive:d,onReset:u});case o.MT.TwoFaEnabled:return a.ZP.createElement(aa,{onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordCurrent,o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaTurnOff,o.MT.TwoFaRecoveryEmailCurrentPassword,o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaChangePasswordCurrent:return a.ZP.createElement(oa,{screen:e,isLoading:r,error:l,clearError:P,hint:s,onSubmit:y,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaChangePasswordNew:return a.ZP.createElement(oa,{screen:e,placeholder:L("PleaseEnterNewFirstPassword"),onSubmit:S,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement(oa,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),onSubmit:w,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(ca,{isLoading:r,error:l,clearError:P,icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:N,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u,screen:e});case o.MT.TwoFaTurnOff:return a.ZP.createElement(oa,{isLoading:r,error:l,clearError:P,hint:s,onSubmit:k,onScreenSelect:m,isActive:d,onReset:u,screen:e});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(oa,{screen:e,isLoading:r,error:l,clearError:P,hint:s,onSubmit:T,onScreenSelect:m,isActive:d||[o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement(ca,{screen:e,icon:"email",type:"email",placeholder:L("RecoveryEmailTitle"),onSubmit:F,onScreenSelect:m,isActive:d||[o.MT.TwoFaRecoveryEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(ua,{screen:e,isLoading:r,error:l,clearError:P,onSubmit:A,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u});default:return}})));var Za=n(1820);function Pa(e,t){const{privacy:n}=e.settings;switch(t){case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return n.forwards;case o.MT.PrivacyGroupChatsDeniedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const ga=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=e;return{currentUserId:r,chatsById:n,listIds:a.active,orderedPinnedIds:s.active,archivedPinnedIds:s.archived,archivedListIds:a.archived,settings:Pa(e,t)}}),((e,t)=>(0,h.ei)(t,["setPrivacySettings"])))((({currentUserId:e,isAllowList:t,screen:n,settings:s,chatsById:r,listIds:l,orderedPinnedIds:i,archivedListIds:c,archivedPinnedIds:d,setPrivacySettings:m,isActive:h,onScreenSelect:Z,onReset:P})=>{const g=(0,M.Z)(),v=(0,a.Ye)((()=>s?t?[...s.allowUserIds,...s.allowChatIds]:[...s.blockUserIds,...s.blockChatIds]:[]),[t,s]),[p,E]=(0,a.eJ)(""),[C,f]=(0,a.eJ)(!1),[b,I]=(0,a.eJ)(v),y=(0,a.Ye)((()=>{const e=l?(0,u.O)(r,l,i,"all"):void 0,t=c?(0,u.O)(r,c,d,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]}),[r,l,i,c,d]),S=(0,a.Ye)((()=>{if(y)return y.filter((t=>((0,u.YC)(t.id)&&t.id!==e||(0,u.Bf)(t))&&(!p||(0,me.Z)((0,u.U)(g,t),p)||v.includes(t.id)))).map((({id:e})=>e))}),[y,e,g,p,v]),w=(0,a.I4)((e=>{I(e),f(!0)}),[]),N=(0,a.I4)((()=>{m({privacyKey:jn(n),isAllowList:Boolean(t),contactsIds:b}),Z(o.MT.Privacy)}),[t,b,Z,n,m]);return(0,T.ZP)(h,P,Z,n),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Za.Z,{itemIds:S||[],selectedIds:b,filterValue:p,filterPlaceholder:g(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:w,onFilterChange:E}),a.ZP.createElement(zt.Z,{isShown:C,onClick:N,ariaLabel:g(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),va=Object.keys(o.MT).length/2,pa=[o.MT.TwoFaDisabled,o.MT.TwoFaNewPassword,o.MT.TwoFaNewPasswordConfirm,o.MT.TwoFaNewPasswordHint,o.MT.TwoFaNewPasswordEmail,o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations,o.MT.TwoFaEnabled,o.MT.TwoFaChangePasswordCurrent,o.MT.TwoFaChangePasswordNew,o.MT.TwoFaChangePasswordConfirm,o.MT.TwoFaChangePasswordHint,o.MT.TwoFaTurnOff,o.MT.TwoFaRecoveryEmailCurrentPassword,o.MT.TwoFaRecoveryEmail,o.MT.TwoFaRecoveryEmailCode],Ea=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],Ca=[o.MT.PrivacyBlockedUsers,o.MT.PrivacyActiveSessions],fa=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],ba=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],Ia=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],ya=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],Sa=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],wa=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:s,onScreenSelect:r,onReset:l,shouldSkipTransition:c})=>{const[d,m]=(0,Bt.Z)(Dt,$t),u=(0,a.I4)((()=>{t!==o.MT.FoldersCreateFolder&&t!==o.MT.FoldersEditFolder&&t!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),t!==o.MT.FoldersIncludedChats&&t!==o.MT.FoldersExcludedChats?l():"create"===n.mode?r(o.MT.FoldersCreateFolder):r(o.MT.FoldersEditFolder)}),[n.mode,s,t,l,r]),h=(0,a.I4)((()=>{s({type:"saveFilters"}),u()}),[s,u]);function Z(l,i,c){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Ut,{currentScreen:t,onReset:u,onSaveFilter:h,onScreenSelect:r,editedFolderId:n.folderId}),function(l,i){const c={[o.MT.PrivacyPhoneNumber]:fa.includes(i),[o.MT.PrivacyLastSeen]:ba.includes(i),[o.MT.PrivacyProfilePhoto]:Ia.includes(i),[o.MT.PrivacyForwarding]:ya.includes(i),[o.MT.PrivacyGroupChats]:Sa.includes(i)},h=pa.includes(i),Z=Ea.includes(i),P=Ca.includes(i)||h||Object.keys(c).includes(i.toString())||Object.values(c).find((e=>!0===e));switch(t){case o.MT.Main:return a.ZP.createElement(Gt,{onScreenSelect:r,isActive:e,onReset:u});case o.MT.EditProfile:return a.ZP.createElement(Wt,{onScreenSelect:r,isActive:e&&l,onReset:u});case o.MT.General:return a.ZP.createElement(wn,{onScreenSelect:r,isActive:l||i===o.MT.GeneralChatBackgroundColor||i===o.MT.GeneralChatBackground||P||Z,onReset:u});case o.MT.Notifications:return a.ZP.createElement(_n,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.DataStorage:return a.ZP.createElement(tn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.Privacy:return a.ZP.createElement(Yn,{onScreenSelect:r,isActive:l||P||h,onReset:u});case o.MT.Language:return a.ZP.createElement(Hn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.GeneralChatBackground:return a.ZP.createElement(On,{onScreenSelect:r,isActive:l||i===o.MT.GeneralChatBackgroundColor,onReset:u});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(Xn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.PrivacyActiveSessions:return a.ZP.createElement(Wn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(ta,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.PrivacyPhoneNumber:case o.MT.PrivacyLastSeen:case o.MT.PrivacyProfilePhoto:case o.MT.PrivacyForwarding:case o.MT.PrivacyGroupChats:return a.ZP.createElement(Vn,{screen:t,onScreenSelect:r,isActive:l||c[t],onReset:u});case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return a.ZP.createElement(ga,{isAllowList:!0,screen:t,onScreenSelect:r,isActive:l||c[t],onReset:u});case o.MT.PrivacyPhoneNumberDeniedContacts:case o.MT.PrivacyLastSeenDeniedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:case o.MT.PrivacyForwardingDeniedContacts:case o.MT.PrivacyGroupChatsDeniedContacts:return a.ZP.createElement(ga,{screen:t,onScreenSelect:r,isActive:l,onReset:u});case o.MT.Folders:case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(Zn,{currentScreen:t,shownScreen:i,state:n,dispatch:s,isActive:l,onScreenSelect:r,onReset:u});case o.MT.TwoFaDisabled:case o.MT.TwoFaNewPassword:case o.MT.TwoFaNewPasswordConfirm:case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaNewPasswordEmailCode:case o.MT.TwoFaCongratulations:case o.MT.TwoFaEnabled:case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:case o.MT.TwoFaChangePasswordHint:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:case o.MT.TwoFaRecoveryEmail:case o.MT.TwoFaRecoveryEmailCode:return a.ZP.createElement(ha,{currentScreen:t,state:d,dispatch:m,shownScreen:i,isActive:l,onScreenSelect:r,onReset:u});default:return}}(l,c))}return a.ZP.createElement(L.Z,{id:"Settings",name:c?"none":i.s0,activeKey:t,renderCount:va},Z)})),Na=(0,z.P2)((e=>e()),6e4,!0),ka=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.users;return{usersById:n,contactIds:t,serverTimeOffset:e.serverTimeOffset}}),((e,t)=>(0,h.ei)(t,["loadContactList","openChat"])))((({isActive:e,onReset:t,filter:n,usersById:s,contactIds:r,loadContactList:o,openChat:l,serverTimeOffset:c})=>{(0,a.d4)((()=>{Na((()=>{o()}))})),(0,T.ZP)(e,t);const d=(0,a.I4)((e=>{l({id:e,shouldReplaceHistory:!0})}),[l]),m=(0,a.Ye)((()=>{if(!r)return;const e=n?r.filter((e=>{const t=s[e];if(!t)return!1;const a=(0,u.Js)(t);return a&&(0,me.Z)(a,n)})):r;return(0,u.Z0)(e,s,void 0,c)}),[r,n,s,c]),[h,Z]=(0,ue.Z)(void 0,m,Boolean(n));return a.ZP.createElement(pe.Z,{items:h,onLoadMore:Z,className:"chat-list custom-scroll"},null!=h&&h.length?h.map((e=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable",onClick:()=>d(e),ripple:!i.wB},a.ZP.createElement(fe.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):h&&!h.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},n.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(Pe.Z,{key:"loading"}))}))),Ma=(0,z.P2)((e=>e()),6e4,!0),Ta=(0,a.X$)((0,s.c$)((e=>{const{userIds:t}=e.contactList||{},{byId:n}=e.users,{byId:a}=e.chats,{currentUserId:s}=e,{query:r,fetchingStatus:o,globalResults:l,localResults:i}=e.globalSearch,{userIds:c}=l||{},{userIds:d}=i||{};return{currentUserId:s,usersById:n,chatsById:a,localContactIds:t,searchQuery:r,isSearching:null==o?void 0:o.chats,globalUserIds:c,localUserIds:d}}),((e,t)=>(0,h.ei)(t,["loadContactList","setGlobalSearchQuery"])))((({isChannel:e,isActive:t,selectedMemberIds:n,onSelectedMemberIdsChange:s,onNextStep:r,onReset:o,currentUserId:l,usersById:i,chatsById:c,localContactIds:d,searchQuery:m,isSearching:Z,localUserIds:P,globalUserIds:g,loadContactList:v,setGlobalSearchQuery:p})=>{(0,a.d4)((()=>{Ma((()=>{v()}))}));const E=(0,M.Z)();(0,T.ZP)(t,o);const C=(0,a.I4)((e=>{p({query:e})}),[p]),f=(0,a.Ye)((()=>{const e=d?(0,u.ih)(d.filter((e=>e!==l)),c):[];if(!m)return e;const t=e.filter((e=>{const t=i[e];if(!t)return!1;const n=(0,u.Js)(t);return n&&(0,me.Z)(n,m)}));return(0,u.ih)((0,h.Tw)([...t,...P||[],...g||[]]).filter((e=>{const t=i[e];return!t||!(0,u.cS)(t)||t.canBeInvitedToGroup})),c,!1,n)}),[d,c,m,P,g,n,l,i]),b=(0,a.I4)((()=>{(n.length||e)&&(p({query:""}),r())}),[n.length,e,p,r]);return a.ZP.createElement("div",{className:"NewChat step-1"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:o,ariaLabel:"Return to Chat List"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,E("GroupAddMembers"))),a.ZP.createElement("div",{className:"NewChat-inner step-1"},a.ZP.createElement(Za.Z,{itemIds:f,selectedIds:n,filterValue:m,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:Z,onSelectedIdsChange:s,onFilterChange:C}),a.ZP.createElement(zt.Z,{isShown:Boolean(n.length||e),onClick:b,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info"},a.ZP.createElement("i",{className:"icon-arrow-right"}))))}))),Fa=(0,a.X$)((0,s.c$)((e=>{const{progress:t,error:n}=e.chatCreation||{};return{creationProgress:t,creationError:n}}),((e,t)=>(0,h.ei)(t,["createGroupChat","createChannel"])))((({isChannel:e,isActive:t,memberIds:n,onReset:s,creationProgress:r,creationError:l,createGroupChat:i,createChannel:c})=>{const d=(0,M.Z)();(0,T.ZP)(t,s);const[m,u]=(0,a.eJ)(""),[h,Z]=(0,a.eJ)(""),[P,g]=(0,a.eJ)(),[v,p]=(0,a.eJ)(),E="Chat title can't be empty",C="Channel title can't be empty",f="Sorry, creating supergroups is not yet supported",b=r===o.Nh.InProgress,I=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");u(n),n!==t&&(e.currentTarget.value=n)}),[]),y=(0,a.I4)((e=>{Z(e.currentTarget.value)}),[]),S=(0,a.I4)((()=>{m.length?n.length>199?p(f):i({title:m,photo:P,memberIds:n}):p(E)}),[m,n,i,P,E,f]),w=(0,a.I4)((()=>{m.length?c({title:m,about:h,photo:P,memberIds:n}):p(C)}),[m,c,h,P,n,C]);(0,a.d4)((()=>{r===o.Nh.Complete&&s(!0)}),[r,s]);const N=l||(v!==E&&v!==C?v:void 0);return a.ZP.createElement("div",{className:"NewChat"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>s(),ariaLabel:"Return to member selection"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,d(e?"NewChannel":"NewGroup"))),a.ZP.createElement("div",{className:"NewChat-inner step-2"},a.ZP.createElement(Jt.Z,{onChange:g,title:d("AddPhoto")}),a.ZP.createElement(ve.Z,{value:m,onChange:I,label:d(e?"EnterChannelName":"GroupName"),error:v===E||v===C?v:void 0}),e&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(ve.Z,{value:h,onChange:y,label:d("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},d("DescriptionInfo"))),N&&a.ZP.createElement("p",{className:"error"},N),n.length>0&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"chat-members-heading"},d("GroupInfo.ParticipantCount",n.length,"i")),a.ZP.createElement("div",{className:"chat-members-list custom-scroll"},n.map((e=>a.ZP.createElement(Ee.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(fe.Z,{userId:e}))))))),a.ZP.createElement(zt.Z,{isShown:0!==m.length,onClick:e?w:S,disabled:b,ariaLabel:e?d("ChannelIntro.CreateChannel"):"Create Group"},b?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),Aa=Object.keys(o.du).length/2,La=(0,a.X$)((({isActive:e,isChannel:t=!1,content:n,onContentChange:s,onReset:r})=>{const[l,c]=(0,a.eJ)([]),d=(0,a.I4)((()=>{s(t?o.du.NewChannelStep2:o.du.NewGroupStep2)}),[t,s]);return a.ZP.createElement(L.Z,{id:"NewChat",name:i.s0,renderCount:Aa,activeKey:n},(s=>{switch(n){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(Ta,{isChannel:t,isActive:e,selectedMemberIds:l,onSelectedMemberIdsChange:c,onNextStep:d,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(Fa,{isChannel:t,isActive:s&&e,memberIds:l,onReset:r});default:return}}))}));var Ra=n(9359);const Ba=(0,a.X$)((({isActive:e,onReset:t,onContentChange:n})=>{const s=(0,M.Z)();return(0,T.ZP)(e,t,n,o.du.Archived),a.ZP.createElement("div",{className:"ArchivedChats"},a.ZP.createElement("div",{className:"left-header"},a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:t,ariaLabel:"Return to chat list"},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement("h3",null,s("ArchivedChats"))),a.ZP.createElement(Ra.Z,{folderType:"archived",isActive:e}))}));var $a=n(1218);const Da=(0,a.X$)((0,s.c$)((e=>{const{byId:t,orderedIds:n}=e.chatFolders;return{foldersById:t,folderOrderedIds:n}}),((e,t)=>(0,h.ei)(t,["editChatFolders"])))((({isOpen:e,chatId:t,foldersById:n,folderOrderedIds:s,onClose:r,onCloseAnimationEnd:o,editChatFolders:l})=>{const i=(0,M.Z)(),c=(0,a.Ye)((()=>n?Object.keys(n).reduce(((e,a)=>{const{includedChatIds:s,pinnedChatIds:r}=n[Number(a)];return(s.includes(t)||null!=r&&r.includes(t))&&e.push(a),e}),[]):[]),[t,n]),[d,m]=(0,a.eJ)(c),u=(0,a.Ye)((()=>(null==s?void 0:s.map((e=>({label:n?n[e].title:"",value:String(e)}))))||[]),[s,n]),h=(0,a.I4)((()=>{const e=c.filter((e=>!d.includes(e))),n=d.filter((e=>!c.includes(e)));l({chatId:t,idsToRemove:e,idsToAdd:n}),r()}),[t,l,c,r,d]);if(n&&s)return a.ZP.createElement(ge.Z,{isOpen:e,onClose:r,onCloseAnimationEnd:o,onEnter:h,className:"delete",title:i("FilterAddTo")},a.ZP.createElement($a.Z,{options:u,selected:d,onChange:m,round:!0}),a.ZP.createElement(R.Z,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:h},i("FilterAddTo")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:r},i("Cancel")))})));var Ua=n(647),Oa=n(4319);function xa(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let Ga;const Ja={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},za=e=>{const t="deltaY"in e?e.deltaY:(e=>"changedTouches"in e?e.changedTouches[0].clientY:0)(e);(!Ga||!Ga.contains(e.target)||Ga.scrollTop<=0&&t<=0||Ga.scrollTop>=Ga.scrollHeight-Ga.offsetHeight&&t>=0)&&e.preventDefault()};function Xa(e){Ja[e.key]&&!function(e){if(!(e&&e instanceof HTMLElement))return!1;const t=e,n=t.tagName.toLowerCase();if("textarea"===n)return!0;if("input"!==n)return!1;const a=t.getAttribute("type");return!!a&&["text","password","number","email","tel","url","search","date","datetime","datetime-local","time","month","week"].indexOf(a.toLowerCase())>-1}(e.target)&&e.preventDefault()}function _a(e){Ga=e,document.addEventListener("wheel",za,{passive:!1}),document.addEventListener("touchmove",za,{passive:!1}),document.onkeydown=Xa}function Ya(){Ga=void 0,document.removeEventListener("wheel",za),document.removeEventListener("touchmove",za),document.onkeydown=null}var Ha=n(3394),ja=n(2328);const Va=({isOpen:e,message:t,anchor:n,canSendNow:s,canReschedule:o,canReply:l,canEdit:i,canPin:c,canUnpin:d,canDelete:m,canReport:h,canForward:Z,canFaveSticker:P,canUnfaveSticker:g,canCopy:v,canCopyLink:p,canSelect:E,canDownload:C,isDownloading:f,onReply:b,onEdit:I,onPin:y,onUnpin:S,onForward:w,onDelete:N,onReport:k,onFaveSticker:T,onUnfaveSticker:F,onSelect:A,onSend:L,onReschedule:R,onClose:B,onCloseAnimationEnd:$,onCopyLink:D,onDownload:U})=>{const O=(0,a.sO)(null),G=function(e,t,n){const a=[],s=(0,u.UD)(e),o=(0,u.O$)(e)||((0,u.Cg)(e)?void 0:(0,u.F$)(e)),l=(0,u.Ti)(e,"inline"),i=o&&(l||(0,u.BM)(e))&&Oa.yl,c=window.getSelection();if(i&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(l?Ua.he(l,r.IU.BlobUrl):o.blobUrl).then(Oa.VP),t&&t()}}),s){var d;const e=Boolean((null==c||null===(d=c.anchorNode)||void 0===d?void 0:d.parentNode)&&c.anchorNode.parentNode.closest(".Message .content-inner")&&""!==c.toString().replace(/(?:\r\n|\r|\n)/g,""));a.push({label:xa(e),handler:()=>{const n=e&&c?c.toString():s;(0,Oa.TE)(n),t&&t()}})}return n&&a.push({label:"lng_context_copy_message_link",handler:()=>{n(),t&&t()}}),a}(t,B,p?D:void 0),J=(0,a.I4)((()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`)),[t.id]),z=(0,a.I4)((()=>document.querySelector(".active > .MessageList")),[]),X=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),{positionX:_,positionY:Y,style:H,menuStyle:j,withScroll:V}=(0,Ha.Z)(n,J,z,X,10,document.querySelector(".MiddleHeader").offsetHeight);(0,a.d4)((()=>(_a(V?O.current:void 0),Ya)),[V]);const K=(0,M.Z)();return a.ZP.createElement(ja.Z,{ref:O,isOpen:e,positionX:_,positionY:Y,style:H,menuStyle:j,className:"MessageContextMenu fluid",onClose:B,onCloseAnimationEnd:$},s&&a.ZP.createElement(x.Z,{icon:"send-outline",onClick:L},K("MessageScheduleSend")),o&&a.ZP.createElement(x.Z,{icon:"schedule",onClick:R},K("MessageScheduleEditTime")),l&&a.ZP.createElement(x.Z,{icon:"reply",onClick:b},K("Reply")),i&&a.ZP.createElement(x.Z,{icon:"edit",onClick:I},K("Edit")),P&&a.ZP.createElement(x.Z,{icon:"favorite",onClick:T},K("AddToFavorites")),g&&a.ZP.createElement(x.Z,{icon:"favorite",onClick:F},K("Stickers.RemoveFromFavorites")),v&&G.map((e=>a.ZP.createElement(x.Z,{key:e.label,icon:"copy",onClick:e.handler},K(e.label)))),c&&a.ZP.createElement(x.Z,{icon:"pin",onClick:y},K("DialogPin")),d&&a.ZP.createElement(x.Z,{icon:"unpin",onClick:S},K("DialogUnpin")),C&&a.ZP.createElement(x.Z,{icon:"download",onClick:U},K(f?"lng_context_cancel_download":"lng_media_download")),Z&&a.ZP.createElement(x.Z,{icon:"forward",onClick:w},K("Forward")),E&&a.ZP.createElement(x.Z,{icon:"select",onClick:A},K("Common.Select")),h&&a.ZP.createElement(x.Z,{icon:"flag",onClick:k},K("lng_context_report_msg")),m&&a.ZP.createElement(x.Z,{destructive:!0,icon:"delete",onClick:N},K("Delete")))},Ka=(0,a.X$)((0,s.c$)(((e,{message:t,messageListType:n})=>{const{threadId:a}=(0,m.Bt)(e)||{},s=(0,m.xs)(e,t.chatId),{noOptions:r,canReply:o,canPin:l,canUnpin:i,canDelete:c,canReport:d,canEdit:u,canForward:h,canFaveSticker:Z,canUnfaveSticker:P,canCopy:g,canCopyLink:v,canSelect:p,canDownload:E}=a&&(0,m._k)(e,t,a)||{},C="pinned"===n,f="scheduled"===n;return{noOptions:r,canSendNow:f,canReschedule:f,canReply:!C&&!f&&o,canPin:!f&&l,canUnpin:!f&&i,canDelete:c,canReport:d,canEdit:!C&&u,canForward:!f&&h,canFaveSticker:!f&&Z,canUnfaveSticker:!f&&P,canCopy:g,canCopyLink:!f&&v,canSelect:p,canDownload:E,activeDownloads:s}}),((e,t)=>(0,h.ei)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage","downloadMessageMedia","cancelMessageMediaDownload"])))((({isOpen:e,messageListType:t,chatUsername:n,message:s,album:r,anchor:o,onClose:l,onCloseAnimationEnd:i,noOptions:c,canSendNow:d,canReschedule:m,canReply:u,canPin:h,canUnpin:Z,canDelete:P,canReport:g,canEdit:v,canForward:p,canFaveSticker:E,canUnfaveSticker:C,canCopy:f,canCopyLink:b,canSelect:I,canDownload:y,activeDownloads:S,setReplyingToId:w,setEditingId:N,pinMessage:k,openForwardMenu:M,faveSticker:T,unfaveSticker:F,toggleMessageSelection:A,sendScheduledMessages:L,rescheduleMessage:R,downloadMessageMedia:$,cancelMessageMediaDownload:D})=>{const{transitionClassNames:U}=(0,Y.Z)(e,i,void 0,!1),[O,x]=(0,a.eJ)(!0),[G,J]=(0,a.eJ)(!1),[z,X]=(0,a.eJ)(!1),[_,H]=(0,a.eJ)(!1),[j,V,K]=(0,Ae.Z)(),q=r?r.messages.some((e=>S.includes(e.id))):S.includes(s.id),W=(0,a.I4)((()=>{x(!1),J(!0)}),[]),Q=(0,a.I4)((()=>{x(!1),X(!0)}),[]),ee=(0,a.I4)((()=>{x(!1),l()}),[l]),te=(0,a.I4)((()=>{J(!1),l()}),[l]),ne=(0,a.I4)((()=>{X(!1),l()}),[l]),ae=(0,a.I4)((()=>{H(!1),l()}),[l]),se=(0,a.I4)((()=>{K(),l()}),[K,l]),re=(0,a.I4)((()=>{w({messageId:s.id}),ee()}),[w,s.id,ee]),oe=(0,a.I4)((()=>{N({messageId:s.id}),ee()}),[N,s.id,ee]),le=(0,a.I4)((()=>{x(!1),H(!0)}),[]),ie=(0,a.I4)((()=>{k({messageId:s.id,isUnpin:!0}),ee()}),[k,s.id,ee]),ce=(0,a.I4)((()=>{if(ee(),null!=r&&r.messages){const e=r.messages.map((({id:e})=>e));M({fromChatId:s.chatId,messageIds:e})}else M({fromChatId:s.chatId,messageIds:[s.id]})}),[M,s,ee,r]),de=(0,a.I4)((()=>{ee(),T({sticker:s.content.sticker})}),[ee,s.content.sticker,T]),me=(0,a.I4)((()=>{ee(),F({sticker:s.content.sticker})}),[ee,s.content.sticker,F]),ue=(0,a.I4)((()=>{const e=null!=r&&r.messages?{messageId:s.id,childMessageIds:r.messages.map((({id:e})=>e)),withShift:!1}:{messageId:s.id,withShift:!1};A(e),ee()}),[ee,s.id,A,r]),he=(0,a.I4)((()=>{L({chatId:s.chatId,id:s.id}),ee()}),[ee,s.chatId,s.id,L]),Ze=(0,a.I4)((()=>{x(!1),V()}),[V]),Pe=(0,a.I4)((e=>{R({chatId:s.chatId,messageId:s.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[s.chatId,s.id,R]),ge=(0,a.I4)((()=>{(0,Oa.TE)(`https://t.me/${n||`c/${s.chatId.replace("-","")}`}/${s.id}`),ee()}),[n,ee,s.chatId,s.id]),ve=(0,a.I4)((()=>{((null==r?void 0:r.messages)||[s]).forEach((e=>{q?D({message:e}):$({message:e})})),ee()}),[r,s,ee,q,D,$]),pe=(0,a.Ye)((()=>(r?r.messages:[s]).map((({id:e})=>e))),[r,s]);if(c)return void ee();const Ee=new Date;return Ee.setFullYear(Ee.getFullYear()+1),a.ZP.createElement("div",{className:["ContextMenuContainer",U].join(" ")},a.ZP.createElement(Va,{message:s,isOpen:O,anchor:o,canSendNow:d,canReschedule:m,canReply:u,canDelete:P,canReport:g,canPin:h,canUnpin:Z,canEdit:v,canForward:p,canFaveSticker:E,canUnfaveSticker:C,canCopy:f,canCopyLink:b,canSelect:I,canDownload:y,isDownloading:q,onReply:re,onEdit:oe,onPin:le,onUnpin:ie,onForward:ce,onDelete:W,onReport:Q,onFaveSticker:de,onUnfaveSticker:me,onSelect:ue,onSend:he,onReschedule:Ze,onClose:ee,onCopyLink:ge,onDownload:ve}),a.ZP.createElement(Oe,{isOpen:G,isSchedule:"scheduled"===t,onClose:te,album:r,message:s}),a.ZP.createElement(_e,{isOpen:z,onClose:ne,messageIds:pe}),a.ZP.createElement(xe,{isOpen:_,messageId:s.id,chatId:s.chatId,onClose:ae}),a.ZP.createElement(De,{isOpen:j,withTimePicker:!0,selectedAt:1e3*s.date,maxAt:(0,B._F)(Ee),isFutureMode:!0,onClose:se,onSubmit:Pe}))}))),qa=(0,a.X$)((0,s.c$)(((e,{fromSticker:t,stickerSetShortName:n})=>{const a=(0,m.Bt)(e),{chatId:s,threadId:r}=a||{},o=s&&(0,m.Z1)(e,s),l=o?(0,u.H5)(o):void 0;return{canSendStickers:Boolean(o&&r&&(0,u.Qm)(o,r)&&(null==l?void 0:l.canSendStickers)),stickerSet:t?(0,m.Ny)(e,t.stickerSetId):n?(0,m.E_)(e,n):void 0}}),((e,t)=>(0,h.ei)(t,["loadStickers","toggleStickerSet","sendMessage"])))((({isOpen:e,fromSticker:t,stickerSetShortName:n,stickerSet:s,canSendStickers:r,onClose:o,loadStickers:i,toggleStickerSet:c,sendMessage:d})=>{const m=(0,a.sO)(null),u=(0,M.Z)(),{observe:h}=(0,gn.S1)({rootRef:m,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>{if(e)if(t){const{stickerSetId:e,stickerSetAccessHash:n}=t;i({stickerSetId:e,stickerSetAccessHash:n})}else n&&i({stickerSetShortName:n})}),[e,t,i,n]);const Z=(0,a.I4)((e=>{e={...e,isPreloadedGlobally:!0},d({sticker:e}),o()}),[o,d]),P=(0,a.I4)((()=>{s&&(c({stickerSetId:s.id}),o())}),[o,s,c]);return a.ZP.createElement(ge.Z,{className:"StickerSetModal",isOpen:e,onClose:o,hasCloseButton:!0,title:s?(0,$.Z)(s.title,["emoji","links"]):u("AccDescrStickerSet")},null!=s&&s.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:m,className:"stickers custom-scroll"},s.stickers.map((e=>a.ZP.createElement(fn.Z,{sticker:e,size:l.yK,observeIntersection:h,onClick:r?Z:void 0,clickArg:e})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(R.Z,{size:"smaller",fluid:!0,color:s.installedDate?"danger":"primary",onClick:P},u(s.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",s.count,"i")))):a.ZP.createElement(Pe.Z,null))})));var Wa=n(2898);const Qa=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,m.Z1)(e,t);if(!a||a.isRestricted)return{};const s=(0,u.YC)(a.id),r=s?(0,m.dy)(e,t):void 0,o=r&&(0,u.kw)(r);return{chat:a,isMuted:(0,u.i4)(a,(0,m.dZ)(e),(0,m.NJ)(e)),isPrivate:s,canAddContact:o,canDeleteChat:(0,u.cc)(a),hasLinkedChat:Boolean(null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.linkedChatId)}}),((e,t)=>(0,h.ei)(t,["updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot","openLinkedChat","addContact"])))((({chatId:e,isOpen:t,withExtraActions:n,anchor:s,isChannel:r,canStartBot:o,canRestartBot:l,canSubscribe:c,canSearch:d,canMute:m,canLeave:u,chat:h,isPrivate:Z,isMuted:P,canDeleteChat:g,hasLinkedChat:v,canAddContact:p,onSubscribeChannel:E,onSearchClick:C,onClose:f,onCloseAnimationEnd:b,updateChatMutedState:I,enterMessageSelectMode:y,sendBotCommand:S,restartBot:w,openLinkedChat:N,addContact:k})=>{const[T,F]=(0,a.eJ)(!0),[A,L]=(0,a.eJ)(!1),{x:R,y:B}=s;(0,Y.Z)(t,b,void 0,!1);const $=(0,a.I4)((()=>{F(!1),L(!0)}),[]),D=(0,a.I4)((()=>{F(!1),f()}),[f]),U=(0,a.I4)((()=>{L(!1),f()}),[f]),O=(0,a.I4)((()=>{S({command:"/start"})}),[S]),G=(0,a.I4)((()=>{w({chatId:e})}),[e,w]),J=(0,a.I4)((()=>{I({chatId:e,isMuted:!P}),D()}),[e,D,P,I]),z=(0,a.I4)((()=>{N({id:e}),D()}),[e,D,N]),X=(0,a.I4)((()=>{k({userId:e}),D()}),[k,e,D]),_=(0,a.I4)((()=>{E(),D()}),[D,E]),H=(0,a.I4)((()=>{C(),D()}),[D,C]),j=(0,a.I4)((()=>{y(),D()}),[D,y]);(0,a.d4)((()=>(_a(),Ya)),[]);const V=(0,M.Z)();return a.ZP.createElement(Wa.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(ja.Z,{isOpen:T,positionX:"right",style:`left: ${R}px;top: ${B}px;`,onClose:D},n&&o&&a.ZP.createElement(x.Z,{icon:"bots",onClick:O},V("BotStart")),n&&l&&a.ZP.createElement(x.Z,{icon:"bots",onClick:G},V("BotRestart")),n&&c&&a.ZP.createElement(x.Z,{icon:r?"channel":"group",onClick:_},V(r?"ProfileJoinChannel":"ProfileJoinGroup")),p&&a.ZP.createElement(x.Z,{icon:"add-user",onClick:X},V("AddContact")),i.wB&&d&&a.ZP.createElement(x.Z,{icon:"search",onClick:H},V("Search")),m&&a.ZP.createElement(x.Z,{icon:P?"unmute":"mute",onClick:J},V(P?"ChatsUnmute":"ChatsMute")),v&&a.ZP.createElement(x.Z,{icon:r?"comments":"channel",onClick:z},V(r?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(x.Z,{icon:"select",onClick:j},V("ReportSelectMessages")),u&&a.ZP.createElement(x.Z,{destructive:!0,icon:"delete",onClick:$},V(Z?"DeleteChatUser":g?"GroupInfo.DeleteAndExit":r?"LeaveChannel":"Group.LeaveGroup"))),h&&a.ZP.createElement(qe.Z,{isOpen:A,onClose:U,chat:h})))})));var es=n(9589);const ts=(0,z.Ds)((e=>e()),200,!1),ns=(0,a.X$)((0,s.c$)((e=>{const t=(0,m.jr)(e);if(!t)return{};const{query:n,results:a}=(0,m.n5)(e)||{},{totalCount:s,foundIds:r}=a||{};return{chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:Boolean(e.historyCalendarSelectedAt)}}),((e,t)=>(0,h.ei)(t,["setLocalTextSearchQuery","searchTextMessagesLocal","focusMessage","closeLocalTextSearch","openHistoryCalendar"])))((({isActive:e,chat:t,query:n,totalCount:s,foundIds:r,isHistoryCalendarOpen:o,setLocalTextSearchQuery:l,searchTextMessagesLocal:i,focusMessage:c,closeLocalTextSearch:d,openHistoryCalendar:m})=>{const u=(0,a.sO)(null),[h,Z]=(0,a.eJ)(0);(0,a.d4)((()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),n=()=>{const{activeElement:n}=document;if(n&&n===u.current){const{pageTop:n,height:a}=e;t.style.transform=`translateY(${n}px)`,t.style.height=`${a}px`,document.documentElement.scrollTop=n}else t.style.transform="",t.style.height=""};return e.addEventListener("resize",n),()=>{e.removeEventListener("resize",n)}}),[]),(0,a.d4)((()=>{t&&r&&r.length?(c({chatId:t.id,messageId:r[r.length-1]}),Z(0)):Z(-1)}),[t,c,r]),(0,a.d4)((()=>{Array.from(document.querySelectorAll("input")).forEach((t=>{t.disabled=Boolean(e&&t!==u.current)})),Array.from(document.querySelectorAll("div[contenteditable]")).forEach((t=>{t.contentEditable=e?"false":"true"}))}),[e]),(0,a.d4)((()=>{e||u.current.blur()}),[e]),(0,a.bt)((()=>{document.querySelector("#MobileSearch input").blur()}),[o]);const P=(0,a.I4)((e=>{l({query:e}),e.length&&ts(i)}),[i,l]),g=(0,a.I4)((()=>{if(t&&r){const e=h+1;c({chatId:t.id,messageId:r[r.length-1-e]}),Z(e)}}),[t,h,c,r]),v=(0,a.I4)((()=>{if(t&&r){const e=h-1;c({chatId:t.id,messageId:r[r.length-1-e]}),Z(e)}}),[t,h,c,r]);return a.ZP.createElement("div",{id:"MobileSearch",className:e?"active":""},a.ZP.createElement("div",{className:"header"},a.ZP.createElement(R.Z,{size:"smaller",round:!0,color:"translucent",onClick:d},a.ZP.createElement("i",{className:"icon-arrow-left"})),a.ZP.createElement(es.Z,{ref:u,value:n,onChange:P})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},n?null!=r&&r.length?`${h+1} of ${s}`:r&&!r.length?"No results":"":a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:()=>m({selectedAt:(0,B._F)(Date.now())}),ariaLabel:"Search messages by date"},a.ZP.createElement("i",{className:"icon-calendar"}))),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:g,disabled:!r||!r.length||h===r.length-1},a.ZP.createElement("i",{className:"icon-up"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",onClick:v,disabled:!r||!r.length||0===h},a.ZP.createElement("i",{className:"icon-down"}))))})));var as=n(5376),ss=n(2365),rs=n(8353),os=n(7002),ls=n(3616);function is(e,t,n=0,a=!1,s=!1,r=!1){const o=e[r?"scrollLeft":"scrollTop"],l=o+e[r?"offsetWidth":"offsetHeight"],i="string"==typeof t?e.querySelectorAll(t):t,{length:c}=i,d=[];let m=!1;for(let e=0;e<c;e++){const t=i[e],c=t[r?"offsetLeft":"offsetTop"],u=c+t[r?"offsetWidth":"offsetHeight"];if(s?u>=o-n&&u<=l+n:c<=l+n&&u>=o-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:i,visibleIndexes:d}}const cs=function(e,t,n=!1){const a=e[n?"scrollLeft":"scrollTop"],s=a+e[n?"offsetWidth":"offsetHeight"],r=t[n?"offsetLeft":"offsetTop"],o=r+t[n?"offsetWidth":"offsetHeight"];return r>a&&o<s};var ds=n(539);function ms(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:r}=is(a,e,8,!0,!0);if(!r.length||!r[t])return;const o=s[0];if(!s.includes(t)||t===o&&!cs(a,r[o])){const e=t>s[s.length-1]?"start":"end";(0,ds.Z)(a,r[t],e,10)}}var us=n(3570);function hs({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:n,shouldRemoveSelectionOnReset:s,noArrowNavigation:r,items:o,shouldSelectOnTab:l,onSelect:i,onClose:c}){const[d,m]=(0,a.eJ)(-1),u=(0,a.I4)((e=>o?(0,us.Z)(o.length,e):-1),[o]),h=(0,a.I4)(((e,t)=>{t.preventDefault(),m((t=>u(t+e)))}),[m,u]),Z=(0,a.I4)((e=>{if(o&&o.length&&d>-1){const t=o[d];t&&(e.preventDefault(),i(t))}}),[o,i,d]),P=!o||d>o.length-1;return(0,a.d4)((()=>{n&&!P||m(s?-1:0)}),[P,s,n]),(0,a.d4)((()=>e?(0,Je.Z)({onEsc:c,onUp:r||t?void 0:e=>h(-1,e),onDown:r||t?void 0:e=>h(1,e),onLeft:r||!t?void 0:e=>h(-1,e),onRight:r||!t?void 0:e=>h(1,e),onTab:l?Z:void 0,onEnter:Z}):void 0),[r,h,Z,e,t,c,l]),d}const Zs=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,usersById:s,filteredUsers:r})=>{const o=(0,a.sO)(null),{shouldRender:l,transitionClassNames:i}=(0,Y.Z)(e,void 0,void 0,!1),c=(0,a.I4)(((e,t=!1)=>{const a=null==s?void 0:s[e];a&&n(a,t)}),[s,n]),d=(0,a.I4)((e=>{c(e.id,!0)}),[c]),m=hs({isActive:e,items:r,onSelect:d,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,a.d4)((()=>{ms(".chat-item-clickable",m,o)}),[m]),(0,a.d4)((()=>{r&&!r.length&&t()}),[r,t]);const u=(0,f.Z)(null!=r&&r.length?r:void 0,l),h=r&&!r.length?u:r;if(!l||h&&!h.length)return;const Z=(0,X.Z)("MentionTooltip composer-tooltip custom-scroll",i);return a.ZP.createElement("div",{className:Z,ref:o},null==h?void 0:h.map((({id:e},t)=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>c(e),focus:m===t},a.ZP.createElement(fe.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var Ps=n(9830);const gs=(0,a.X$)((({attachments:e,caption:t,isReady:n,currentUserId:s,groupChatMembers:r,usersById:o,recentEmojis:i,baseEmojiKeywords:c,emojiKeywords:d,addRecentEmoji:m,onCaptionUpdate:u,onSend:h,onFileAppend:Z,onClear:g})=>{const v=(0,a.sO)(null),p=(0,f.Z)(e),E=e.length?e:p,C=Boolean(e.length),[b,I,y]=(0,Ae.Z)(),S=Boolean(E&&E.every((e=>e.quick))),w=(0,M.Z)(),{isMentionTooltipOpen:N,closeMentionTooltip:k,insertMention:T,mentionFilteredUsers:F}=(0,ss.Z)(C,t,u,l.nY,r,void 0,s,o),{isEmojiTooltipOpen:A,closeEmojiTooltip:L,filteredEmojis:B,insertEmoji:$}=(0,rs.Z)(C,t,i,l.nY,u,c,d,!n);(0,a.d4)((()=>C?(0,P.Z)(g):void 0),[C,g]);const D=(0,a.I4)((()=>{C&&h()}),[C,h]),U=(0,a.I4)((e=>{e.preventDefault(),y();const{dataTransfer:{files:t}}=e;if(null!=t&&t.length){const e=S?Array.from(t).filter((e=>e.type&&l.dI.has(e.type))):Array.from(t);Z(e,S)}}),[S,Z,y]);if(!E)return;const O=E.every((e=>l.oG.has(e.mimeType))),x=E.every((e=>l.wG.has(e.mimeType))),G=E.every((e=>e.mimeType.startsWith("audio/")));let J="";return J=w(O?"PreviewSender.SendPhoto":x?"PreviewSender.SendVideo":G?"PreviewSender.SendAudio":"PreviewSender.SendFile",E.length,"i"),a.ZP.createElement(ge.Z,{isOpen:C,onClose:g,header:function(){if(E)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:w.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:g},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},J),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:D},w("Send")))}(),className:"AttachmentModal "+(b?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:I,onDrop:U,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),v.current&&window.clearTimeout(v.current)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(v.current=window.setTimeout(y,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),y())},"data-attach-description":w("Preview.Dragging.AddItems",10)},S?a.ZP.createElement("div",{className:"media-wrapper custom-scroll"},E.map((e=>e.mimeType.startsWith("image/")?a.ZP.createElement("img",{src:e.blobUrl,alt:""}):a.ZP.createElement("video",{src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0})))):a.ZP.createElement("div",{className:"document-wrapper custom-scroll"},E.map((e=>a.ZP.createElement(os.Z,{name:e.filename,extension:(0,as.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(Zs,{isOpen:N,onClose:k,onInsertUserName:T,filteredUsers:F,usersById:o}),a.ZP.createElement(Ps.Z,{isOpen:A,emojis:B,onClose:L,onEmojiSelect:$,addRecentEmoji:m}),a.ZP.createElement(ls.Z,{id:"caption-input-text",isAttachmentModalInput:!0,html:t,editableInputId:l.nY,placeholder:w("Caption"),onUpdate:u,onSend:h,shouldSetFocus:Boolean(e.length)}))))}));var vs=n(3099);const ps=(0,a.X$)((({isOpen:e,onSend:t,onClear:n})=>{const s=(0,a.sO)(null),r=(0,a.sO)(null),o=(0,a.sO)(null),[l,i]=(0,a.eJ)(""),[c,d]=(0,a.eJ)([""]),[m,u]=(0,a.eJ)(!0),[h,Z]=(0,a.eJ)(!1),[g,v]=(0,a.eJ)(!1),[p,E]=(0,a.eJ)(),[C,f]=(0,a.eJ)(),[b,I]=(0,a.eJ)(!1),y=(0,M.Z)(),S=(0,a.I4)((t=>{e&&t.current&&t.current.focus()}),[e]);(0,a.d4)((()=>e?(0,P.Z)(n):void 0),[e,n]),(0,a.d4)((()=>{e||(i(""),d([""]),u(!0),Z(!1),v(!1),E(""),f(""),I(!1))}),[e]),(0,a.d4)((()=>S(s)),[S,e]),(0,a.bt)((()=>{const e=o.current;e&&p!==e.innerHTML&&(e.innerHTML=p)}),[p]);const w=(0,a.I4)(((e=[])=>{d([...e,""]),requestAnimationFrame((()=>{const e=r.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),N=(0,a.I4)((()=>{if(I(!1),!e)return;const n=l.trim().substring(0,255),a=c.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!n||a.length<2)return i(n),a.length?a.length<2?w(a):d(a):w(),void I(!0);if(g&&(!C||!a[Number(C)]))return void I(!0);const s={summary:{question:n,answers:a.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===C&&{correct:!0}}))),...!m&&{isPublic:!0},...h&&{multipleChoice:!0},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=p&&(0,vs.Z)(p.substring(0,200))||{};s.quiz={correctAnswers:[C],...e&&{solution:e},...t&&{solutionEntities:t}}}t(s)}),[e,l,c,g,C,m,h,t,w,p]),k=(0,a.I4)(((e,t)=>{const n=[...c];n[e]=t,n[n.length-1].trim().length&&n.length<10?w(n):d(n)}),[c,w]),T=(0,a.I4)((e=>{const t=[...c];t.splice(e,1),d(t),requestAnimationFrame((()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)}))}),[c]),F=(0,a.I4)((e=>{f(e)}),[f]),A=(0,a.I4)((e=>{u(e.target.checked)}),[]),L=(0,a.I4)((e=>{Z(e.target.checked)}),[]),B=(0,a.I4)((e=>{v(e.target.checked)}),[]),$=(0,a.I4)((e=>{13===e.keyCode&&N()}),[N]),D=(0,a.I4)((()=>{if(b&&!l.trim().length)return y("lng_polls_choose_question")}),[b,y,l]),U=(0,a.I4)((e=>{const t=c.map((e=>e.trim())).filter((e=>e.length));if(b&&t.length<2&&!c[e].trim().length)return y("lng_polls_choose_answers")}),[b,y,c]);function O(){return c.map(((e,t)=>a.ZP.createElement("div",{className:"option-wrapper"},a.ZP.createElement(ve.Z,{label:t!==c.length-1||10===c.length?y("OptionHint"):y("CreatePoll.AddOption"),error:U(t),value:e,onChange:e=>k(t,e.currentTarget.value),onKeyPress:$}),t!==c.length-1&&a.ZP.createElement(R.Z,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:y("Delete"),onClick:()=>T(t)},a.ZP.createElement("i",{className:"icon-close"})))))}return a.ZP.createElement(ge.Z,{isOpen:e,onClose:n,header:a.ZP.createElement("div",{className:"modal-header-condensed"},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:n},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},y("NewPoll")),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:N},y("Create"))),className:"PollModal"},a.ZP.createElement(ve.Z,{ref:s,label:y("AskAQuestion"),value:l,error:D(),onChange:e=>i(e.currentTarget.value),onKeyPress:$}),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"options-list custom-scroll",ref:r},a.ZP.createElement("h3",{className:"options-header"},y("PollOptions")),b&&function(){const e=c.map((e=>e.trim())).filter((e=>e.length));return g&&(!C||!e[Number(C)])&&a.ZP.createElement("p",{className:"error"},y("lng_polls_choose_correct"))}(),g?a.ZP.createElement(Xe.Z,{name:"correctOption",options:O().map(((e,t)=>({value:String(t),label:e,hidden:t===c.length-1}))),onChange:F}):O()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},a.ZP.createElement(Qt.Z,{label:y("PollAnonymous"),checked:m,onChange:A}),a.ZP.createElement(Qt.Z,{label:y("PollMultiple"),checked:h,disabled:g,onChange:L}),a.ZP.createElement(Qt.Z,{label:y("PollQuiz"),checked:g,disabled:h,onChange:B}),g&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},y("lng_polls_solution_title")),a.ZP.createElement("div",{ref:o,className:"form-control",contentEditable:!0,dir:"auto",onChange:e=>E(e.currentTarget.innerHTML)}),a.ZP.createElement("div",{className:"note"},y("CreatePoll.ExplanationInfo")))))}));var Es=n(6503),Cs=n(4284),fs=n(1367);const bs=(0,a.X$)((({emoji:e,focus:t,onClick:n})=>{const s=(0,a.I4)((t=>{t.preventDefault(),n(e.native,e.id)}),[e,n]);return a.ZP.createElement("div",{className:"EmojiButton "+(t?"focus":""),onMouseDown:s,title:`:${e.names[0]}:`},i.op?e.native:a.ZP.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))})),Is=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:r,onEmojiSelect:o})=>{const l=(0,a.sO)(null);(0,gn._N)(l,s);const d=(0,vn.Z)(r),m=(0,M.Z)(),u=i.wB?Math.floor((c.Z.get().width-8)/44):9,h=44*Math.ceil(e.emojis.length/u);return a.ZP.createElement("div",{ref:l,key:e.id,id:`emoji-category-${t}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},m("recent"===e.id?"RecentStickers":`Emoji${t}`)),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",d),style:`height: ${h}px;`,dir:m.isRtl?"rtl":void 0},r&&e.emojis.map((e=>{const t=n[e];if(!t)return;const s="id"in t?t:t[1];return a.ZP.createElement(bs,{key:s.id,emoji:s,onClick:o})}))))})),ys={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"},Ss=[];let ws,Ns,ks;const Ms=(0,a.X$)((0,s.c$)((e=>(0,h.ei)(e,["recentEmojis"])))((({className:e,onEmojiSelect:t,recentEmojis:s})=>{const r=(0,a.sO)(null),o=(0,a.sO)(null),[c,d]=(0,a.eJ)(),[m,u]=(0,a.eJ)(),[h,Z]=(0,a.eJ)(0),{observe:P}=(0,gn.S1)({rootRef:r,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const n=Number(t.replace("emoji-category-",""));Ss[n]=e.isIntersecting}));const t=Ss.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,et.Z)(o.current,!i.wB),(0,a.d4)((()=>{if(!c)return;const e=o.current;if(!e)return;const t=42*h-e.offsetWidth/2+21;(0,fs.Z)(e,t)}),[c,h]);const g=(0,M.Z)(),v=(0,a.Ye)((()=>{if(!c)return je.D;const e=[...c];return null!=s&&s.length&&e.unshift({id:"recent",name:g("RecentStickers"),emojis:s}),e}),[c,g,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{d(ks.categories),u(ks.emojis)};ks?e():async function(){return ws||(ws=n.e(501).then(n.t.bind(n,7501,19)),Ns=(await ws).default,ks=(0,Cs.NM)(Ns)),ws}().then(e)}),200)}),[]);const p=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,ds.Z)(r.current,t,"start",50,800)}),[]),E=(0,a.I4)(((e,n)=>{t(e,n)}),[t]),C=(0,Zt.Z)([],l.kU),f=(0,X.Z)("EmojiPicker",e);return m&&C?a.ZP.createElement("div",{className:f},a.ZP.createElement("div",{ref:o,className:"EmojiPicker-header",dir:g.isRtl?"rtl":""},v.map((function(e,t){const n=ys[e.id];return n&&a.ZP.createElement(R.Z,{className:"symbol-set-button "+(t===h?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>p(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:r,className:(0,X.Z)("EmojiPicker-main no-selection",i.$b?"no-scrollbar":"custom-scroll")},v.map(((e,t)=>a.ZP.createElement(Is,{category:e,index:t,allEmojis:m,observeIntersection:P,shouldRender:h>=t-1&&h<=t+1,onEmojiSelect:E}))))):a.ZP.createElement("div",{className:f},a.ZP.createElement(Pe.Z,null))}))),Ts=i.wB?8:16,Fs=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,observeIntersection:s,shouldRender:r,onStickerSelect:o,onStickerUnfave:d})=>{const m=(0,a.sO)(null);(0,gn._N)(m,s);const u=(0,vn.Z)(r),h=i.wB?Math.floor((c.Z.get().width-8)/(l.Q+Ts)):5,Z=Math.ceil(e.count/h)*(l.Q+Ts);return a.ZP.createElement("div",{ref:m,key:e.id,id:`sticker-set-${n}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name"},e.title),a.ZP.createElement("div",{className:(0,X.Z)("symbol-set-container",u),style:`height: ${Z}px;`},r&&e.stickers&&e.stickers.map((n=>a.ZP.createElement(fn.Z,{key:n.id,sticker:n,size:l.Q,observeIntersection:s,noAnimate:!t,onClick:o,clickArg:n,onUnfaveClick:"favorite"===e.id?d:void 0})))))})),As=[],Ls=(0,a.X$)((0,s.c$)((e=>{const{setsById:t,added:n,recent:a,favorite:s}=e.stickers;return{recentStickers:a.stickers,favoriteStickers:s.stickers,stickerSetsById:t,addedSetIds:n.setIds,shouldPlay:e.settings.byKey.shouldLoopStickers}}),((e,t)=>(0,h.ei)(t,["loadStickerSets","loadRecentStickers","loadFavoriteStickers","loadAddedStickers","addRecentSticker","unfaveSticker"])))((({className:e,loadAndPlay:t,canSendStickers:n,recentStickers:s,favoriteStickers:r,addedSetIds:o,stickerSetsById:c,shouldPlay:d,onStickerSelect:m,loadStickerSets:u,loadRecentStickers:h,loadFavoriteStickers:Z,loadAddedStickers:P,addRecentSticker:g,unfaveSticker:v})=>{const p=(0,a.sO)(null),E=(0,a.sO)(null),[C,f]=(0,a.eJ)(0),{observe:b}=(0,gn.S1)({rootRef:p,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("sticker-set-"))return;const n=Number(t.replace("sticker-set-",""));As[n]=e.isIntersecting}));const t=As.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&f(t[Math.floor(t.length/2)].index)})),{observe:I}=(0,gn.S1)({rootRef:E}),y=(0,M.Z)(),S=Boolean(o),w=(0,a.Ye)((()=>o?[{id:"recent",title:y("RecentStickers"),stickers:s,count:s.length},{id:"favorite",title:y("FavoriteStickers"),stickers:r,count:r.length},...o.map((e=>c[e])).filter(Boolean)]:je.D),[o,y,s,r,c]),N=(0,a.Ye)((()=>S&&0===w.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[w,S]);(0,a.d4)((()=>{t&&(u(),h(),Z())}),[t,Z,h,u]),(0,a.d4)((()=>{null!=o&&o.length&&P()}),[o,P]),(0,et.Z)(E.current),(0,a.d4)((()=>{if(!S)return;const e=E.current;if(!e)return;const t=52*C-(e.offsetWidth/2-26);(0,fs.Z)(e,t)}),[S,C]);const k=(0,a.I4)((e=>{f(e);const t=document.getElementById(`sticker-set-${e}`);(0,ds.Z)(p.current,t,"start",void 0,500)}),[]),T=(0,a.I4)((e=>{m(e),g({sticker:e})}),[g,m]),F=(0,a.I4)((e=>{v({sticker:e})}),[v]),A=(0,Zt.Z)([],l.Y),L=(0,X.Z)("StickerPicker",e);return S&&A&&!N&&n?a.ZP.createElement("div",{className:L},a.ZP.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},w.map((function(e,t){var n;const s=null===(n=e.stickers)||void 0===n?void 0:n[0],r=(0,X.Z)("symbol-set-button sticker-set-button",t===C&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!s?a.ZP.createElement(R.Z,{key:e.id,className:r,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>k(t)},"recent"===e.id?a.ZP.createElement("i",{className:"icon-recent"}):"favorite"===e.id?a.ZP.createElement("i",{className:"icon-favorite"}):e.isAnimated?a.ZP.createElement(En,{stickerSet:e,observeIntersection:I}):a.ZP.createElement(Cn,{stickerSet:e,observeIntersection:I})):a.ZP.createElement(fn.Z,{key:e.id,sticker:s,size:l.DC,title:e.title,className:r,observeIntersection:I,onClick:k,clickArg:t})}))),a.ZP.createElement("div",{ref:p,className:(0,X.Z)("StickerPicker-main no-selection",i.$b?"no-scrollbar":"custom-scroll")},w.map(((e,n)=>a.ZP.createElement(Fs,{key:e.id,stickerSet:e,loadAndPlay:Boolean(d&&t),index:n,observeIntersection:b,shouldRender:C>=n-1&&C<=n+1,onStickerSelect:T,onStickerUnfave:F}))))):a.ZP.createElement("div",{className:L},n?N?a.ZP.createElement("div",{className:"picker-disabled"},y("NoStickers")):a.ZP.createElement(Pe.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},y("ErrorSendRestrictedStickersAll")))})));var Rs=n(386);function Bs(){return(Bs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}const $s=(0,a.X$)((({gif:e,observeIntersection:t,isDisabled:n,className:s,onClick:o})=>{var l,i;const c=(0,a.sO)(null),d=(0,a.sO)(null),m=Boolean(null===(l=e.thumbnail)||void 0===l?void 0:l.dataUri),u=`gif${e.id}`,h=(0,gn.Op)(c,t)&&!n,Z=(0,p.Z)(`${u}?size=m`,!h,r.IU.BlobUrl),P=(0,$n.Z)(null===(i=e.thumbnail)||void 0===i?void 0:i.dataUri,Boolean(Z)),g=(0,p.Z)(u,!h,r.IU.BlobUrl),v=Boolean(h&&g),{isBuffered:E,bufferingHandlers:C}=(0,H.Z)(!0),f=h&&!E,b=h&&E;(0,V.Z)(d,[v]);const I=(0,a.I4)((()=>o({...e,blobUrl:g})),[o,e,g]),y=(0,X.Z)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",u,s);return a.ZP.createElement("div",{ref:c,className:y,onMouseDown:Rs.b,onClick:I},m&&a.ZP.createElement("canvas",{ref:P,className:"thumbnail",style:b?"display: none;":void 0}),Z&&!b&&a.ZP.createElement("img",{src:Z,alt:"",className:"preview"}),v&&a.ZP.createElement("video",Bs({ref:d,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},C),a.ZP.createElement("source",{src:g})),f&&a.ZP.createElement(F.Z,{color:Z||m?"white":"black"}))})),Ds=(0,a.X$)((0,s.c$)((e=>({savedGifs:e.gifs.saved.gifs})),((e,t)=>(0,h.ei)(t,["loadSavedGifs"])))((({className:e,loadAndPlay:t,canSendGifs:n,savedGifs:s,onGifSelect:r,loadSavedGifs:o})=>{const c=(0,a.sO)(null),{observe:d}=(0,gn.S1)({rootRef:c,debounceMs:300});(0,a.d4)((()=>{t&&o()}),[t,o]);const m=(0,Zt.Z)([],l.Y);return a.ZP.createElement("div",{ref:c,className:(0,X.Z)("GifPicker",e,i.$b?"no-scrollbar":"custom-scroll")},n?m&&s&&s.length?s.map((e=>a.ZP.createElement($s,{key:e.id,gif:e,observeIntersection:d,isDisabled:!t,onClick:r}))):m&&s?a.ZP.createElement("div",{className:"picker-disabled"},"No saved GIFs."):a.ZP.createElement(Pe.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending GIFs is not allowed in this chat."))})));let Us;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(Us||(Us={}));const Os=Object.values(Us).filter((e=>"string"==typeof e)),xs={[Us.Emoji]:"icon-smile",[Us.Stickers]:"icon-stickers",[Us.GIFs]:"icon-gifs"},Gs=(0,a.X$)((({activeTab:e,onSwitchTab:t,onRemoveSymbol:n,onSearchOpen:s})=>{const r=(0,M.Z)();function o(n){return a.ZP.createElement(R.Z,{className:"symbol-tab-button "+(e===n?"activated":""),onClick:()=>t(n),ariaLabel:Os[n],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:xs[n]}))}const l=(0,a.I4)((()=>{s(e===Us.Stickers?"stickers":"gifs")}),[e,s]);return a.ZP.createElement("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0},e!==Us.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-search-button",ariaLabel:e===Us.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:l},a.ZP.createElement("i",{className:"icon-search"})),o(Us.Emoji),o(Us.Stickers),o(Us.GIFs),e===Us.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-delete-button",onClick:n,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:"icon-delete-left"})))}));let Js=!1;const zs=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((({isOpen:e,allowedAttachmentOptions:t,isLeftColumnShown:n,onLoad:s,onClose:r,onEmojiSelect:o,onStickerSelect:l,onGifSelect:c,onRemoveSymbol:d,onSearchOpen:m,addRecentEmoji:u})=>{const[h,Z]=(0,a.eJ)(0),[P,g]=(0,a.eJ)([]),[v,p]=(0,Es.Z)(e,r,void 0,i.wB),{shouldRender:E,transitionClassNames:C}=(0,Y.Z)(e,r,!1,!1);!Js&&e&&(Js=!0),(0,a.d4)((()=>{s()}),[s]),(0,a.bt)((()=>{if(i.wB)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&(0,z.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[e]);const f=(0,a.sO)(P);f.current=P,(0,a.d4)((()=>{f.current.length&&(f.current.forEach((e=>{u({emoji:e})})),g([]))}),[e,h,u]);const b=(0,a.I4)(((e,t)=>{g((e=>[...e,t])),o(e)}),[o]),I=(0,a.I4)((e=>{r(),m(e)}),[r,m]),y=(0,a.I4)((e=>{l(e,!0)}),[l]),S=(0,M.Z)(),{canSendStickers:w,canSendGifs:N}=t;function k(t,n){switch(h){case Us.Emoji:return a.ZP.createElement(Ms,{className:"picker-tab",onEmojiSelect:b});case Us.Stickers:return a.ZP.createElement(Ls,{className:"picker-tab",loadAndPlay:!!w&&e&&(t||n),canSendStickers:w,onStickerSelect:y});case Us.GIFs:return a.ZP.createElement(Ds,{className:"picker-tab",loadAndPlay:!!N&&e&&(t||n),canSendGifs:N,onGifSelect:c})}}const T=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Js&&a.ZP.createElement(L.Z,{name:"slide",activeKey:h,renderCount:Os.length},k)),i.wB&&a.ZP.createElement(R.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:S("Close"),className:"symbol-close-button",size:"tiny",onClick:r},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Gs,{activeTab:h,onSwitchTab:Z,onRemoveSymbol:d,onSearchOpen:I}));if(i.wB){if(!E)return;const e=(0,X.Z)("SymbolMenu mobile-menu",C,!n&&"middle-column-open");return a.ZP.createElement(Wa.Z,null,a.ZP.createElement("div",{className:e},T))}return a.ZP.createElement(ja.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SymbolMenu",onCloseAnimationEnd:r,onMouseEnter:i.$b?void 0:v,onMouseLeave:i.$b?void 0:p,noCloseOnBackdrop:!i.$b},T)}))),Xs=(0,a.X$)((({isOpen:e,allowedAttachmentOptions:t,onFileSelect:n,onPollCreate:s,onClose:r})=>{const[o,c]=(0,Es.Z)(e,r),d=(0,a.I4)(((e,t)=>{const{files:a}=e.target;a&&a.length>0&&n(Array.from(a),t)}),[n]),m=(0,a.I4)((()=>{kn(Array.from(l.dI).join(","),(e=>d(e,!0)))}),[d]),u=(0,a.I4)((()=>{kn("*",(e=>d(e,!1)))}),[d]),h=(0,M.Z)(),{canAttachMedia:Z,canAttachPolls:P}=t;return a.ZP.createElement(ja.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",onClose:r,className:"AttachMenu fluid",onCloseAnimationEnd:r,onMouseEnter:i.$b?void 0:o,onMouseLeave:i.$b?void 0:c,noCloseOnBackdrop:!i.$b},!Z&&a.ZP.createElement(x.Z,{className:"media-disabled",disabled:!0},"Posting media content is not allowed in this group."),Z&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(x.Z,{icon:"photo",onClick:m},h("AttachmentMenu.PhotoOrVideo")),a.ZP.createElement(x.Z,{icon:"document",onClick:u},h("AttachDocument"))),P&&a.ZP.createElement(x.Z,{icon:"poll",onClick:s},h("Poll")))})),_s=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:r})=>a.ZP.createElement(Ee.Z,{key:n.command,className:(0,X.Z)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:()=>r(n),focus:t},e&&a.ZP.createElement(D.Z,{size:"small",user:s}),a.ZP.createElement("div",{className:"content-inner"},a.ZP.createElement("span",{className:"title"},"/",n.command),a.ZP.createElement("span",{className:"subtitle"},(0,$.Z)(n.description)))))),Ys=(0,a.X$)((0,s.c$)((e=>({usersById:e.users.byId})),((e,t)=>(0,h.ei)(t,["sendBotCommand"])))((({usersById:e,isOpen:t,withUsername:n,botCommands:s,onClick:r,onClose:o,sendBotCommand:l})=>{const i=(0,a.sO)(null),{shouldRender:c,transitionClassNames:d}=(0,Y.Z)(t,void 0,void 0,!1),m=(0,a.I4)((({botId:t,command:a})=>{const s=e[t];l({command:`/${a}${n&&s?`@${s.username}`:""}`,botId:t}),r()}),[r,l,e,n]),u=hs({isActive:t,items:s,onSelect:m,onClose:o});(0,a.d4)((()=>{s&&!s.length&&o()}),[s,o]),(0,a.d4)((()=>{ms(".chat-item-clickable",u,i)}),[u]);const h=(0,f.Z)(s&&s.length?s:void 0,c),Z=s&&!s.length?h:s;if(!c||Z&&!Z.length)return;const P=(0,X.Z)("BotCommandTooltip composer-tooltip custom-scroll",d);return a.ZP.createElement("div",{className:P,ref:i},Z&&Z.map(((t,n)=>a.ZP.createElement(_s,{key:`${t.botId}_${t.command}`,botCommand:t,bot:e[t.botId],withAvatar:!0,onClick:m,focus:u===n}))))}))),Hs=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,h.ei)(t,["sendBotCommand"])))((({isOpen:e,botCommands:t,onClose:n,sendBotCommand:s})=>{const[r,o]=(0,Es.Z)(e,n,void 0,i.wB),l=(0,a.I4)((e=>{s({command:`/${e.command}`,botId:e.botId}),n()}),[n,s]);return a.ZP.createElement(ja.Z,{isOpen:e,positionX:"left",positionY:"bottom",onClose:n,className:"BotCommandMenu",onCloseAnimationEnd:n,onMouseEnter:i.$b?void 0:r,onMouseLeave:i.$b?void 0:o,noCloseOnBackdrop:!i.$b},t.map((e=>a.ZP.createElement(_s,{key:e.command,botCommand:e,onClick:l}))))}))),js=(0,a.X$)((0,s.c$)((e=>{const{stickers:t}=e.stickers.forEmoji;return{stickers:t}}),((e,t)=>(0,h.ei)(t,["clearStickersForEmoji"])))((({isOpen:e,onStickerSelect:t,stickers:n,clearStickersForEmoji:s})=>{const r=(0,a.sO)(null),{shouldRender:o,transitionClassNames:c}=(0,Y.Z)(e,void 0,void 0,!1),d=(0,f.Z)(n,!0),m=n||d,{observe:u}=(0,gn.S1)({rootRef:r,throttleMs:200});(0,a.d4)((()=>e?(0,P.Z)(s):void 0),[e,s]);const h=(0,X.Z)("StickerTooltip composer-tooltip custom-scroll",c,!(null!=m&&m.length)&&"hidden");return a.ZP.createElement("div",{ref:r,className:h,onMouseEnter:i.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:i.$b?void 0:()=>{document.body.classList.remove("no-select")}},o&&m?m.map((e=>a.ZP.createElement(fn.Z,{key:e.id,sticker:e,size:l.Q,observeIntersection:u,onClick:t,clickArg:e}))):o?a.ZP.createElement(Pe.Z,null):void 0)}))),Vs=(0,a.X$)((({isOpen:e,onSilentSend:t,onScheduleSend:n,onClose:s,onCloseAnimationEnd:r})=>{const[o,l]=(0,Es.Z)(e,s),c=(0,M.Z)();return a.ZP.createElement(ja.Z,{isOpen:e,autoClose:!0,positionX:"right",positionY:"bottom",className:"CustomSendMenu",onClose:s,onCloseAnimationEnd:r,onMouseEnter:i.$b?void 0:o,onMouseLeave:i.$b?void 0:l,noCloseOnBackdrop:!i.$b},t&&a.ZP.createElement(x.Z,{icon:"mute",onClick:t},c("SendWithoutSound")),n&&a.ZP.createElement(x.Z,{icon:"schedule",onClick:n},c("ScheduleMessage")))}));var Ks=n(2420),qs=n(3283),Ws=n(2678);const Qs=(0,a.X$)((({isOpen:e,emojis:t,onClose:n,onEmojiSelect:s,addRecentEmoji:r})=>{const o=(0,a.sO)(null),{shouldRender:l,transitionClassNames:c}=(0,Y.Z)(e,void 0,void 0,!1),d=(0,Ws.Z)(t.length?t:void 0,350)||[],m=(0,a.I4)((e=>{s(e.native),r({emoji:e.id})}),[r,s]),u=(0,a.I4)(((e,t)=>{s(e),r({emoji:t})}),[r,s]),h=hs({isActive:e,isHorizontal:!0,items:t,onSelect:m,onClose:n});(0,a.d4)((()=>{!function(e,t){const n=t.current;if(!n)return;const{visibleIndexes:a,allElements:s}=is(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!cs(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,fs.Z)(n,t)}}(h,o)}),[h]);const Z=(0,X.Z)("EmojiTooltip composer-tooltip custom-scroll-x",c);return a.ZP.createElement("div",{ref:o,className:Z,onMouseEnter:i.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:i.$b?void 0:()=>{document.body.classList.remove("no-select")}},l&&d?d.map(((e,t)=>a.ZP.createElement(bs,{key:e.id,emoji:e,focus:h===t,onClick:u}))):l?a.ZP.createElement(Pe.Z,null):void 0)})),er=(0,a.X$)((({title:e,description:t,thumbnail:n,thumbUrl:s,focus:r,transitionClassNames:o="",onClick:l})=>{let i="";const c=(0,p.Z)(n?`webDocument:${n.url}`:void 0);return(s=s||c)?i=a.ZP.createElement("img",{src:s,className:o,alt:"",decoding:"async",draggable:"false"}):e&&(i=(0,pn.Xv)(e,1)),a.ZP.createElement(Ee.Z,{focus:r,className:"BaseResult chat-item-clickable",onMouseDown:Rs.b,onClick:l},a.ZP.createElement("span",{className:"thumb"},"string"==typeof i?(0,$.Z)(i):i),a.ZP.createElement("div",{className:"content-inner"},e&&a.ZP.createElement("div",{className:"title"},e),t&&a.ZP.createElement("div",{className:"description"},t)))})),tr=(0,a.X$)((({focus:e,isForGallery:t,inlineResult:n,onClick:s})=>{var r;let o,l,i;"photo"in n&&(o=n.photo),"thumbnail"in n&&(l=n.thumbnail),"webThumbnail"in n&&t&&(i=n.webThumbnail);const c=(0,p.Z)(i?`webDocument:${i.url}`:void 0),d=(0,p.Z)(o&&`photo${o.id}?size=m`),m=(0,vn.Z)(d),u=(0,a.I4)((()=>{s(n)}),[n,s]);var h,Z;if(t)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:u},a.ZP.createElement("img",{src:(null===(h=o)||void 0===h||null===(Z=h.thumbnail)||void 0===Z?void 0:Z.dataUri)||c,alt:""}),a.ZP.createElement("img",{src:d,className:(0,X.Z)("full-media",m),alt:""}));const{title:P,description:g}=n;return a.ZP.createElement(er,{focus:e,thumbUrl:d||(null===(r=l)||void 0===r?void 0:r.dataUri)||c,transitionClassNames:m,title:P,description:g,onClick:u})})),nr=(0,a.X$)((({focus:e,inlineResult:t,onClick:n})=>{const{title:s,url:r,description:o,webThumbnail:l}=t,i=(0,a.I4)((()=>{n(t)}),[t,n]);return a.ZP.createElement(er,{focus:e,thumbnail:l,title:s||r,description:o,onClick:i})})),ar=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{gif:s}=e,r=(0,a.I4)((()=>{n(e)}),[e,n]);if(s)return a.ZP.createElement($s,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:r})})),sr=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{sticker:s}=e;if(s)return a.ZP.createElement(fn.Z,{sticker:s,size:l.zq,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:n,clickArg:e})})),rr=(0,z.P2)((e=>e()),500,!0),or=(0,a.X$)((0,s.c$)(void 0,((e,t)=>(0,h.ei)(t,["startBot","openChat","sendInlineBotResult"])))((({isOpen:e,botId:t,isGallery:n,inlineBotResults:s,switchPm:r,loadMore:l,onClose:c,openChat:d,startBot:m,onSelectResult:u})=>{const h=(0,a.sO)(null),{shouldRender:Z,transitionClassNames:P}=(0,Y.Z)(e,void 0,void 0,!1),{observe:g}=(0,gn.S1)({rootRef:h,debounceMs:200,isDisabled:!e}),v=(0,a.I4)((({direction:e})=>{e===o.Uq.Backwards&&rr(l)}),[l]),p=hs({isActive:e,shouldRemoveSelectionOnReset:n,noArrowNavigation:n,items:s,onSelect:u,onClose:c});(0,a.d4)((()=>{ms(".chat-item-clickable",p,h)}),[p]);const E=(0,a.I4)((()=>{d({id:t}),m({botId:t,param:r.startParam})}),[t,d,m,r]),C=(0,f.Z)(null!=s&&s.length?s:void 0,Z),b=s&&!s.length?C:s;if(!Z||!b||!b.length&&!r)return;const I=(0,X.Z)("InlineBotTooltip composer-tooltip",i.$b?"no-scrollbar":"custom-scroll",n&&"gallery",P);return a.ZP.createElement(pe.Z,{ref:h,className:I,items:b,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:v,sensitiveArea:160},r&&a.ZP.createElement(Ee.Z,{ripple:!0,className:"switch-pm scroll-item",onClick:E},a.ZP.createElement("span",{className:"title"},r.text)),b.map(((e,t)=>{switch(e.type){case"gif":return a.ZP.createElement(ar,{key:e.id,inlineResult:e,observeIntersection:g,onClick:u});case"photo":return a.ZP.createElement(tr,{key:e.id,isForGallery:n,inlineResult:e,onClick:u});case"sticker":return a.ZP.createElement(sr,{key:e.id,inlineResult:e,observeIntersection:g,onClick:u});case"video":case"game":return a.ZP.createElement(tr,{key:e.id,focus:p===t,inlineResult:e,onClick:u});case"article":case"audio":return a.ZP.createElement(nr,{key:e.id,focus:p===t,inlineResult:e,onClick:u});default:return}})))})));var lr=n(6844);const ir=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),a=n&&(0,m.Zw)(e,n.id);if(!n||!a)return{};const{query:s,results:r}=(0,m.n5)(e)||{},{totalCount:o,foundIds:l}=r||{};return{chat:n,messagesById:a,query:s,totalCount:o,foundIds:l}}),((e,t)=>(0,h.ei)(t,["searchTextMessagesLocal","focusMessage"])))((({chatId:e,threadId:t,onClose:n,isActive:r,chat:o,messagesById:l,query:i,totalCount:c,foundIds:d,searchTextMessagesLocal:Z,focusMessage:P})=>{const g=(0,M.Z)(),v=(0,a.Ye)((()=>{if(!(i&&d&&d.length&&l))return je.D;const n=d.map((n=>{const a=l[n];if(!a)return;const r=a.senderId?(0,m.dy)((0,s.Rd)(),a.senderId):void 0;let i;if(o&&(0,u.eA)(o))i=o;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;i=e&&t?(0,m.Z1)((0,s.Rd)(),t):void 0}else i=a.senderId?(0,m.Z1)((0,s.Rd)(),a.senderId):void 0;return{message:a,senderUser:r,senderChat:i,onClick:()=>P({chatId:e,threadId:t,messageId:n})}})).filter(Boolean);return(0,h.Xo)(n,(({message:e})=>e.date),"desc")}),[e,t,P,d,o,l,i]);(0,T.ZP)(r,n);const p=(0,a.sO)(null),E=(0,he.Z)(p,!0,(e=>{const t=null==v?void 0:v[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0);return a.ZP.createElement(pe.Z,{className:"RightSearch custom-scroll",items:v,preloadBackwards:0,onLoadMore:Z,noFastList:!0,onKeyDown:E,ref:p},a.ZP.createElement("p",{className:"helper-text",dir:"auto"},i?0!==c&&v.length?1===c?"1 message found":`${v.length&&(c||v.length)} messages found`:g("lng_search_no_results"):g("lng_dlg_search_for_messages")),v.map((({message:e,senderUser:t,senderChat:n,onClick:s})=>{const r=n?(0,u.U)(g,n):(0,u.Js)(t),o=(0,u.MK)(g,e);return a.ZP.createElement(Ee.Z,{className:"chat-item-clickable search-result-message m-0",onClick:s},a.ZP.createElement(D.Z,{chat:n,user:t}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},r&&(0,$.Z)(r)),a.ZP.createElement(lr.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,$.Z)(o,["emoji","highlight"],{highlight:i}))))})))})));var cr=n(9290);const dr=(0,a.X$)((0,s.c$)(((e,{stickerSetId:t})=>({set:(0,m.Ny)(e,t),shouldPlay:(0,m.yB)(e)})),((e,t)=>(0,h.ei)(t,["loadStickers","toggleStickerSet"])))((({stickerSetId:e,observeIntersection:t,set:n,shouldPlay:s,loadStickers:r,toggleStickerSet:o,isSomeModalOpen:i,onModalToggle:c})=>{const d=(0,M.Z)(),m=n&&Boolean(n.installedDate),u=Boolean(null==n?void 0:n.stickers),[h,Z,P]=(0,Ae.Z)();(0,cr.Z)((()=>{c(h)}),[h,c]);const g=(0,a.Ye)((()=>{if(!n)return[];const e=(n.covers||[]).map((({id:e})=>e)),t=n.stickers?n.stickers.filter((({id:t})=>!e.includes(t))):[];return[...n.covers||[],...t].slice(0,5)}),[n]);(0,a.d4)((()=>{!u&&g.length<5&&r({stickerSetId:e})}),[u,g.length,r,e]);const v=(0,a.I4)((()=>{o({stickerSetId:e})}),[o,e]);if(!n)return;const p=g.length>0;return a.ZP.createElement("div",{key:n.id,className:"sticker-set",dir:d.isRtl?"rtl":void 0},a.ZP.createElement("div",{className:"sticker-set-header"},a.ZP.createElement("div",{className:"title-wrapper"},a.ZP.createElement("h3",{className:"title",dir:"auto"},n.title),a.ZP.createElement("p",{className:"count",dir:"auto"},d("Stickers",n.count,"i"))),a.ZP.createElement(R.Z,{className:m?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:v},d(m?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!p&&a.ZP.createElement(F.Z,null),p&&g.map((e=>a.ZP.createElement(fn.Z,{sticker:e,size:l.Y7,observeIntersection:t,noAnimate:!s||h||i,onClick:Z})))),p&&a.ZP.createElement(In.Z,{isOpen:h,fromSticker:g[0],onClose:P}))}))),mr=(0,z.P2)((e=>e()),6e4,!0),ur=(0,a.X$)((0,s.c$)((e=>{const t=(0,m.y5)(e),{query:n,resultIds:a}=t||{},{featured:s}=e.stickers;return{query:n,featuredIds:s.setIds,resultIds:a}}),((e,t)=>(0,h.ei)(t,["loadFeaturedStickers"])))((({onClose:e,isActive:t,query:n,featuredIds:s,resultIds:r,loadFeaturedStickers:o})=>{const l=(0,a.sO)(null),i=(0,M.Z)(),[c,d]=(0,a.eJ)(!1),{observe:m}=(0,gn.S1)({rootRef:l,throttleMs:200});return(0,a.d4)((()=>{mr((()=>{o()}))})),(0,T.ZP)(t,e),a.ZP.createElement("div",{ref:l,className:"StickerSearch custom-scroll",dir:i.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&s?s.map((e=>a.ZP.createElement(dr,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:c,onModalToggle:d}))):r?r.length?r.map((e=>a.ZP.createElement(dr,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:c,onModalToggle:d}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},"Nothing found."):a.ZP.createElement(Pe.Z,null)}())}))),hr=(0,a.X$)((0,s.c$)((e=>{const t=(0,m.yN)(e),{query:n,results:a}=t||{},{chatId:s}=(0,m.Bt)(e)||{},r=s?(0,m.Z1)(e,s):void 0;return{query:n,results:a,chat:r,isChatWithBot:r?(0,m.xo)(e,r):void 0}}),((e,t)=>(0,h.ei)(t,["searchMoreGifs","sendMessage","setGifSearchQuery"])))((({onClose:e,isActive:t,query:n,results:s,chat:r,isChatWithBot:o,searchMoreGifs:l,sendMessage:c,setGifSearchQuery:d})=>{const m=(0,a.sO)(null),{observe:h}=(0,gn.S1)({rootRef:m,debounceMs:300}),{canSendGifs:Z}=(0,u.H5)(r,o),P=(0,a.I4)((e=>{Z&&c({gif:e}),i.$b&&d({query:void 0})}),[Z,c,d]),g=(0,M.Z)();(0,T.ZP)(t,e);const v=Boolean(void 0!==n&&s&&s.length);return a.ZP.createElement("div",{className:"GifSearch",dir:g.isRtl?"rtl":void 0},a.ZP.createElement(pe.Z,{ref:m,className:(0,X.Z)("gif-container custom-scroll",v&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:l},function(){if(void 0!==n)return s?s.length?s.map((e=>a.ZP.createElement($s,{key:e.id,gif:e,observeIntersection:h,onClick:P}))):a.ZP.createElement("p",{className:"helper-text",dir:"auto"},g("NoGIFsFound")):a.ZP.createElement(Pe.Z,null)}()))}))),Zr=(0,a.X$)((0,s.c$)(((e,{answer:t})=>{const{voters:n,offsets:a}=e.pollResults;return{voters:null==n?void 0:n[t.option],offset:(null==a?void 0:a[t.option])||""}}),((e,t)=>(0,h.ei)(t,["loadPollOptionResults","openChat","closePollResults"])))((({chat:e,message:t,answer:n,answerVote:s,totalVoters:r,voters:o,offset:l,loadPollOptionResults:i,openChat:c,closePollResults:d})=>{const m=(0,f.Z)(s.votersCount),[u,h]=(0,a.eJ)(!0),Z=Boolean(o),{option:P,text:g}=n,v=(0,M.Z)();(0,a.d4)((()=>{Z&&m===s.votersCount||i({chat:e,messageId:t.id,option:P,offset:l,limit:4,shouldResetVoters:!0})}),[s.votersCount,Z]);const p=(0,a.I4)((()=>{h(!0),i({chat:e,messageId:t.id,option:P,offset:l,limit:50})}),[e,i,t.id,l,P]);(0,a.d4)((()=>{h(!1)}),[o]);const E=(0,a.I4)((e=>{c({id:e}),d()}),[d,c]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},o?o.map((e=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable",onClick:()=>E(e)},a.ZP.createElement(fe.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(Pe.Z,null),o&&function(){const e=s.votersCount-o.length;return s.votersCount>4&&e>0&&a.ZP.createElement(ln,{count:e,itemName:"voter",isLoading:u,onClick:p})}()),a.ZP.createElement("div",{className:"answer-head",dir:v.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},g),a.ZP.createElement("span",{className:"answer-percent",dir:v.isRtl?"auto":void 0},(C=s.votersCount,(b=r)>0?(C/b*100).toFixed():0),"%")));var C,b}))),Pr=(0,a.X$)((0,s.c$)((e=>{const{pollResults:{chatId:t,messageId:n},lastSyncTime:a}=e;return t&&n?{chat:(0,m.Z1)(e,t),message:(0,m.hj)(e,t,n),lastSyncTime:a}:{}}))((({onClose:e,isActive:t,chat:n,message:s,lastSyncTime:r})=>{const o=(0,M.Z)();if((0,T.ZP)(t,e),!s||!n)return a.ZP.createElement(Pe.Z,null);const{summary:l,results:i}=(0,u.t9)(s);if(!i.results)return;const c=(0,h.ee)(i.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},(0,$.Z)(l.question,["emoji","br"])),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},r&&l.answers.map((e=>a.ZP.createElement(Zr,{key:`${s.id}-${e.option}`,chat:n,message:s,answer:e,answerVote:c[e.option],totalVoters:i.totalVoters}))),!r&&a.ZP.createElement(Pe.Z,null)))}))),gr="Please provide first name",vr=(0,a.X$)((0,s.c$)(((e,{userId:t})=>{const n=(0,m.dy)(e,t),a=(0,m.Z1)(e,t),{progress:s}=e.management;return{user:n,chat:a,progress:s,isMuted:(0,u.i4)(a,(0,m.dZ)(e),(0,m.NJ)(e))}}),((e,t)=>(0,h.ei)(t,["updateContact","deleteUser","closeManagement","openChat","deleteHistory"])))((({userId:e,user:t,chat:n,progress:s,isMuted:r,updateContact:l,deleteUser:i,deleteHistory:c,closeManagement:d,openChat:m,onClose:u,isActive:h})=>{const[Z,P,g]=(0,Ae.Z)(),[v,p]=(0,a.eJ)(!1),[E,C]=(0,a.eJ)(),f=(0,M.Z)();(0,T.ZP)(h,u);const b=t&&t.firstName||"",I=t&&t.lastName||"",[y,S]=(0,a.eJ)(b),[w,N]=(0,a.eJ)(I),[k,A]=(0,a.eJ)(!r);(0,a.d4)((()=>{A(!r)}),[r]),(0,a.d4)((()=>{p(!1),g()}),[g,e]),(0,a.d4)((()=>{S(b),N(I)}),[b,I,t]),(0,a.d4)((()=>{s===o.wv.Complete&&(p(!1),C(void 0),g())}),[g,s]);const L=(0,a.I4)((e=>{S(e.target.value),p(!0)}),[]),R=(0,a.I4)((e=>{N(e.target.value),p(!0)}),[]),B=(0,a.I4)((e=>{A(e.target.checked),p(!0)}),[]),$=(0,a.I4)((()=>{const t=y.trim(),n=w.trim();t.length||C(gr),l({userId:e,isMuted:!k,firstName:t,lastName:n})}),[y,w,l,e,k]),D=(0,a.I4)((()=>{c({chatId:n.id,shouldDeleteForAll:!1}),i({userId:e}),g(),d(),m({id:void 0})}),[n.id,g,d,c,i,m,e]);if(!t)return;const U=s===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(fe.Z,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(ve.Z,{id:"user-first-name",label:f("UserInfo.FirstNamePlaceholder"),onChange:L,value:y,error:E===gr?E:void 0}),a.ZP.createElement(ve.Z,{id:"user-last-name",label:f("UserInfo.LastNamePlaceholder"),onChange:R,value:w}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(Qt.Z,{checked:k,label:f("Notifications"),subLabel:f(k?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:B}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:P},f("DeleteContact")))),a.ZP.createElement(zt.Z,{isShown:v,onClick:$,disabled:U,ariaLabel:f("Save")},U?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Te.Z,{isOpen:Z,onClose:g,text:f("AreYouSureDeleteContact"),confirmLabel:f("DeleteContact"),confirmHandler:D,confirmIsDestructive:!0}))}))),pr="Group title can't be empty",Er=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,m.Z1)(e,t),{progress:s}=e.management,r=Boolean(null===(n=a.fullInfo)||void 0===n?void 0:n.linkedChatId),o=(0,u.G9)(a);return{chat:a,progress:s,isBasicGroup:o,hasLinkedChannel:r,canChangeInfo:o?a.isCreator:(0,u.VE)(a,"changeInfo"),canBanUsers:o?a.isCreator:(0,u.VE)(a,"banUsers")}}),((e,t)=>(0,h.ei)(t,["togglePreHistoryHidden","updateChat","closeManagement","leaveChannel","deleteChannel","deleteChat","openChat"])))((({chatId:e,chat:t,progress:n,isBasicGroup:s,hasLinkedChannel:l,canChangeInfo:i,canBanUsers:c,onScreenSelect:d,togglePreHistoryHidden:m,updateChat:h,deleteChat:Z,leaveChannel:P,deleteChannel:g,closeManagement:v,openChat:E,onClose:C,isActive:f})=>{var b,I,y;const[S,w,N]=(0,Ae.Z)(),k=t.title,A=t.fullInfo&&t.fullInfo.about||"",[L,R]=(0,a.eJ)(!1),[B,D]=(0,a.eJ)(k),[U,O]=(0,a.eJ)(A),[x,G]=(0,a.eJ)(),[J,z]=(0,a.eJ)(),X=(0,u.RT)(t),_=(0,p.Z)(X,!1,r.IU.BlobUrl),Y=(0,M.Z)();(0,T.ZP)(f,C),(0,a.d4)((()=>{n===o.wv.Complete&&(R(!1),z(void 0))}),[n]);const H=(0,a.I4)((()=>{d(o.u1.ChatPrivacyType)}),[d]),j=(0,a.I4)((()=>{d(o.u1.Discussion)}),[d]),V=(0,a.I4)((()=>{d(o.u1.GroupPermissions)}),[d]),K=(0,a.I4)((()=>{d(o.u1.ChatAdministrators)}),[d]),q=(0,a.I4)((e=>{G(e),R(!0)}),[]),W=(0,a.I4)((e=>{D(e.target.value),R(!0)}),[]),Q=(0,a.I4)((e=>{O(e.target.value),R(!0)}),[]),ee=(0,a.I4)((()=>{const t=B.trim(),n=U.trim();t.length?h({chatId:e,title:t,about:n,photo:x}):z(pr)}),[U,e,x,B,h]),te=(0,a.I4)((()=>{d(o.u1.GroupMembers)}),[d]),ne=(0,a.I4)((()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;m({chatId:t.id,isEnabled:!e})}),[t,m]),ae=(0,a.Ye)((()=>{if(!t.defaultBannedRights)return 0;let e=["sendMessages","sendMedia","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages"].filter((e=>!t.defaultBannedRights[e])).length;const{sendStickers:n,sendGifs:a}=t.defaultBannedRights;return n||a||(e+=1),e}),[t]),se=(null===(b=t.fullInfo)||void 0===b||null===(I=b.adminMembers)||void 0===I?void 0:I.length)||0,re=(0,a.I4)((()=>{s?Z({chatId:t.id}):t.isCreator?g({chatId:t.id}):P({chatId:t.id}),N(),v(),E({id:void 0})}),[s,t.isCreator,t.id,N,v,P,g,Z,E]);if(t.isRestricted)return;const oe=n===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Jt.Z,{currentAvatarBlobUrl:_,onChange:q,disabled:!i}),a.ZP.createElement(ve.Z,{id:"group-title",label:Y("GroupName"),onChange:W,value:B,error:J===pr?J:void 0,disabled:!i}),a.ZP.createElement(ve.Z,{id:"group-about",className:"mb-2",label:Y("DescriptionPlaceholder"),onChange:Q,value:U,disabled:!i}),t.isCreator&&a.ZP.createElement(Ee.Z,{icon:"lock",multiline:!0,onClick:H},a.ZP.createElement("span",{className:"title"},Y("GroupType")),a.ZP.createElement("span",{className:"subtitle"},t.username?Y("TypePublic"):Y("TypePrivate"))),l&&a.ZP.createElement(Ee.Z,{icon:"message",multiline:!0,onClick:j},a.ZP.createElement("span",{className:"title"},Y("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},Y("DiscussionUnlink"))),a.ZP.createElement(Ee.Z,{icon:"permissions",multiline:!0,onClick:V,disabled:!c},a.ZP.createElement("span",{className:"title"},Y("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ae,"/",8)),a.ZP.createElement(Ee.Z,{icon:"admin",multiline:!0,onClick:K},a.ZP.createElement("span",{className:"title"},Y("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},(0,pn.kh)(se)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"group",multiline:!0,onClick:te},a.ZP.createElement("span",{className:"title"},Y("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,pn.kh)(null!==(y=t.membersCount)&&void 0!==y?y:0))),t.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(Qt.Z,{checked:!t.fullInfo.isPreHistoryHidden,label:Y("ChatHistory"),onChange:ne,disabled:!c}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:w},Y("DeleteMega")))),a.ZP.createElement(zt.Z,{isShown:L,onClick:ee,disabled:oe,ariaLabel:Y("Save")},oe?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Te.Z,{isOpen:S,onClose:N,textParts:(0,$.Z)(s||!t.isCreator?Y("AreYouSureDeleteAndExit"):Y("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:s||!t.isCreator?Y("DeleteMega"):Y("DeleteGroupForAll"),confirmHandler:re,confirmIsDestructive:!0}))}))),Cr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,m.Z1)(e,t),currentUserId:e.currentUserId})),((e,t)=>(0,h.ei)(t,["updateChatDefaultBannedRights"])))((({onScreenSelect:e,onChatMemberSelect:t,chat:n,currentUserId:s,updateChatDefaultBannedRights:r,onClose:l,isActive:i})=>{const[c,d]=(0,a.eJ)({}),[m,u]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),P=(0,M.Z)();(0,T.ZP)(i,l);const g=(0,a.I4)((()=>{e(o.u1.GroupRemovedUsers)}),[e]),v=(0,a.I4)((()=>{e(o.u1.GroupUserPermissionsCreate)}),[e]),p=(0,a.I4)((n=>{t(n.userId,n.promotedByUserId===s),e(o.u1.GroupUserPermissions)}),[s,t,e]);(0,a.d4)((()=>{d((null==n?void 0:n.defaultBannedRights)||{}),u(!1),setTimeout((()=>{Z(!1)}),250)}),[n]);const E=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}d((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),u(!0)}),[]),C=(0,a.I4)((()=>{n&&(Z(!0),r({chatId:n.id,bannedRights:c}))}),[n,c,r]),f=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.kickedMembers?n.fullInfo.kickedMembers.length:0),[n]),b=(0,a.Ye)((()=>n&&n.fullInfo&&n.fullInfo.members?n.fullInfo.members.filter((({bannedRights:e})=>!!e)):[]),[n]),I=(0,a.I4)((e=>{const{bannedRights:t}=e;if(!t||!n)return;const{defaultBannedRights:a}=n;return Object.keys(t).reduce(((e,n)=>{if(!t[n]||null!=a&&a[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)return e;const s=function(e){switch(e){case"sendMessages":return"UserRestrictionsNoSend";case"sendMedia":return"UserRestrictionsNoSendMedia";case"sendStickers":return"UserRestrictionsNoSendStickers";case"embedLinks":return"UserRestrictionsNoEmbedLinks";case"sendPolls":return"UserRestrictionsNoSendPolls";case"changeInfo":return"UserRestrictionsNoChangeInfo";case"inviteUsers":return"UserRestrictionsInviteUsers";case"pinMessages":return"UserRestrictionsPinMessages";default:return}}(n);if(!s)return e;const r=P(s);return`${e}${e.length?`, ${r}`:r}`}),"")}),[n,P]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},P("ChannelPermissionsHeader")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendMessages",checked:!c.sendMessages,label:P("UserRestrictionsSend"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendMedia",checked:!c.sendMedia,label:P("UserRestrictionsSendMedia"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendStickers",checked:!c.sendStickers&&!c.sendGifs,label:P("UserRestrictionsSendStickers"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendPolls",checked:!c.sendPolls,label:P("UserRestrictionsSendPolls"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"embedLinks",checked:!c.embedLinks,label:P("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:P("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"pinMessages",checked:!c.pinMessages,label:P("UserRestrictionsPinMessages"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!c.changeInfo,label:P("UserRestrictionsChangeInfo"),blocking:!0,onChange:E}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete-user",multiline:!0,narrow:!0,onClick:g},a.ZP.createElement("span",{className:"title"},P("ChannelBlockedUsers")),a.ZP.createElement("span",{className:"subtitle"},f))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},P("PrivacyExceptions")),a.ZP.createElement(Ee.Z,{icon:"add-user",onClick:v},P("ChannelAddException")),b.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>p(e)},a.ZP.createElement(fe.Z,{userId:e.userId,status:I(e)})))))),a.ZP.createElement(zt.Z,{isShown:m,onClick:C,ariaLabel:P("Save"),disabled:h},h?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),fr=(0,a.X$)((0,s.c$)((e=>{const{users:{byId:t},currentUserId:n}=e;return{usersById:t,currentUserId:n}}),((e,t)=>(0,h.ei)(t,["loadMoreMembers","deleteChatMember"])))((({chat:e,usersById:t,currentUserId:n,isOpen:s,onClose:r,loadMoreMembers:o,deleteChatMember:l})=>{var i;const c=(0,M.Z)(),[d,m]=(0,a.eJ)(""),h=(0,a.sO)(null),Z=(0,a.Ye)((()=>{var a;return((null===(a=e.fullInfo)||void 0===a?void 0:a.members)||[]).filter((e=>!e.isAdmin&&!e.isOwner&&e.userId!==n)).reduce(((e,n)=>(d&&t[n.userId]&&!(0,me.Z)((0,u.Js)(t[n.userId])||"",d)||e.push(n.userId),e)),[])}),[null===(i=e.fullInfo)||void 0===i?void 0:i.members,n,d,t]),P=(0,a.I4)((t=>{l({chatId:e.id,userId:t}),r()}),[e.id,l,r]);return a.ZP.createElement(be,{isOpen:s,chatOrUserIds:Z,filterRef:h,filterPlaceholder:c("ChannelBlockUser"),filter:d,onFilterChange:m,loadMore:o,onSelectChatOrUser:P,onClose:r})}))),br=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{byId:a}=e.users;return{chat:n,usersById:a,canDeleteMembers:n&&((0,u.VE)(n,"banUsers")||n.isCreator)}}),((e,t)=>(0,h.ei)(t,["updateChatMemberBannedRights"])))((({chat:e,usersById:t,canDeleteMembers:n,updateChatMemberBannedRights:s,onClose:r,isActive:o})=>{const l=(0,M.Z)(),[i,c,d]=(0,Ae.Z)();(0,T.ZP)(o,r);const m=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[]),[e]),h=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const n=t[e.kickedByUserId];return n?l("UserRemovedBy",(0,u.Js)(n)):void 0}),[l,t]),Z=(0,a.I4)((t=>{if(e)return[{title:l("Unblock"),icon:"delete",destructive:!0,handler:()=>s({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[l,e,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:l.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},l("NoBlockedGroup2")),m.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:Z(e)},a.ZP.createElement(fe.Z,{userId:e.userId,status:h(e)})))),n&&a.ZP.createElement(zt.Z,{isShown:!0,onClick:c,ariaLabel:l("Channel.EditAdmin.Permission.BanUsers")},a.ZP.createElement("i",{className:"icon-add-user-filled"})),e&&n&&a.ZP.createElement(fr,{chat:e,isOpen:i,onClose:d}))))}))),Ir="Channel title can't be empty",yr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{progress:a}=e.management;return{chat:n,progress:a,isSignaturesShown:Boolean(null==n?void 0:n.isSignaturesShown),canChangeInfo:(0,u.VE)(n,"changeInfo")}}),((e,t)=>(0,h.ei)(t,["toggleSignatures","updateChat","closeManagement","leaveChannel","deleteChannel","openChat"])))((({chatId:e,chat:t,progress:n,isSignaturesShown:s,canChangeInfo:l,onScreenSelect:i,updateChat:c,toggleSignatures:d,closeManagement:m,leaveChannel:h,deleteChannel:Z,openChat:P,onClose:g,isActive:v})=>{var E,C,f,b;const I=t&&t.title||"",y=null!=t&&t.fullInfo&&t.fullInfo.about||"",S=null==t||null===(E=t.fullInfo)||void 0===E?void 0:E.linkedChatId,[w,N,k]=(0,Ae.Z)(),[A,L]=(0,a.eJ)(!1),[R,B]=(0,a.eJ)(I),[$,D]=(0,a.eJ)(y),[U,O]=(0,a.eJ)(),[x,G]=(0,a.eJ)(),J=t&&(0,u.RT)(t),z=(0,p.Z)(J,!1,r.IU.BlobUrl),X=(0,M.Z)();(0,T.ZP)(v,g),(0,a.d4)((()=>{n===o.wv.Complete&&(L(!1),G(void 0))}),[n]);const _=(null==t||null===(C=t.fullInfo)||void 0===C||null===(f=C.adminMembers)||void 0===f?void 0:f.length)||0,Y=(0,a.I4)((()=>{i(o.u1.ChatPrivacyType)}),[i]),H=(0,a.I4)((()=>{i(o.u1.Discussion)}),[i]),j=(0,a.I4)((()=>{i(o.u1.ChatAdministrators)}),[i]),V=(0,a.I4)((e=>{O(e),L(!0)}),[]),K=(0,a.I4)((e=>{B(e.target.value),L(!0)}),[]),q=(0,a.I4)((e=>{D(e.target.value),L(!0)}),[]),W=(0,a.I4)((()=>{const t=R.trim(),n=$.trim();t.length?c({chatId:e,title:t,about:n,photo:U}):G(Ir)}),[$,e,U,R,c]),Q=(0,a.I4)((()=>{d({chatId:e,isEnabled:!s})}),[e,s,d]),ee=(0,a.I4)((()=>{i(o.u1.ChannelSubscribers)}),[i]),te=(0,a.I4)((()=>{t.isCreator?Z({chatId:t.id}):h({chatId:t.id}),k(),m(),P({id:void 0})}),[t.isCreator,t.id,k,m,h,Z,P]);if(t.isRestricted)return;const ne=n===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Jt.Z,{currentAvatarBlobUrl:z,onChange:V,disabled:!l}),a.ZP.createElement(ve.Z,{id:"channel-title",label:X("EnterChannelName"),onChange:K,value:R,error:x===Ir?x:void 0,disabled:!l}),a.ZP.createElement(ve.Z,{id:"channel-about",className:"mb-2",label:X("DescriptionPlaceholder"),onChange:q,value:$,disabled:!l}),t.isCreator&&a.ZP.createElement(Ee.Z,{icon:"lock",multiline:!0,onClick:Y},a.ZP.createElement("span",{className:"title"},X("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},t.username?X("TypePublic"):X("TypePrivate"))),a.ZP.createElement(Ee.Z,{icon:"message",multiline:!0,onClick:H,disabled:!l},a.ZP.createElement("span",{className:"title"},X("Discussion")),a.ZP.createElement("span",{className:"subtitle"},X(S?"DiscussionUnlink":"Add"))),a.ZP.createElement(Ee.Z,{icon:"admin",multiline:!0,onClick:j},a.ZP.createElement("span",{className:"title"},X("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},_)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(Qt.Z,{checked:s,label:X("ChannelSignMessages"),onChange:Q}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"group",multiline:!0,onClick:ee},a.ZP.createElement("span",{className:"title",dir:"auto"},X("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},X("Subscribers",null!==(b=t.membersCount)&&void 0!==b?b:0,"i")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:N},t.isCreator?X("ChannelDelete"):X("LeaveChannel")))),a.ZP.createElement(zt.Z,{isShown:A,onClick:W,disabled:ne,ariaLabel:X("Save")},ne?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Te.Z,{isOpen:w,onClose:k,text:t.isCreator?X("ChannelDeleteAlert"):X("ChannelLeaveAlert"),confirmLabel:t.isCreator?X("ChannelDelete"):X("LeaveChannel"),confirmHandler:te,confirmIsDestructive:!0}))})));var Sr=n(88);const wr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{isUsernameAvailable:a}=(0,m.aW)(e,t);return{chat:n,isChannel:(0,u.eA)(n),progress:e.management.progress,isUsernameAvailable:a}}),((e,t)=>(0,h.ei)(t,["checkPublicLink","updatePublicLink","updatePrivateLink"])))((({chat:e,onClose:t,isActive:n,isChannel:s,progress:r,isUsernameAvailable:l,checkPublicLink:i,updatePublicLink:c,updatePrivateLink:d})=>{var m;const u=Boolean(e.username),h=null===(m=e.fullInfo)||void 0===m?void 0:m.inviteLink,[Z,P]=(0,a.eJ)(u?"public":"private"),[g,v]=(0,a.eJ)(),[p,E,C]=(0,Ae.Z)(),f=Boolean("public"===Z&&g&&l||"private"===Z&&u);(0,T.ZP)(n,t),(0,a.d4)((()=>{Z&&!h&&d()}),[Z,h,d]);const b=(0,a.I4)((e=>{P(e)}),[]),I=(0,a.I4)((()=>{c({username:"public"===Z?g:""})}),[Z,c,g]),y=(0,a.I4)((()=>{C(),d()}),[C,d]),S=(0,M.Z)(),w=s?"Channel":"Mega",N=s?"Channel":"Group",k=[{value:"private",label:S(`${w}Private`),subLabel:S(`${w}PrivateInfo`)},{value:"public",label:S(`${w}Public`),subLabel:S(`${w}PublicInfo`)}],A=r===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:S.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},S(`${N}Type`)),a.ZP.createElement(Xe.Z,{selected:Z,name:"channel-type",options:k,onChange:b})),"private"===Z?a.ZP.createElement("div",{className:"section",dir:S.isRtl?"rtl":void 0},h?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Sr.Z,{url:h,className:"group-link",text:h}),a.ZP.createElement("p",{className:"section-info",dir:S.isRtl?"rtl":void 0},S(`${w}PrivateLinkHelp`)),a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:E},S("RevokeLink")),a.ZP.createElement(Te.Z,{isOpen:p,onClose:C,text:S("RevokeAlert"),confirmLabel:S("RevokeButton"),confirmHandler:y,confirmIsDestructive:!0})):a.ZP.createElement(Pe.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(jt,{asLink:!0,currentUsername:e.username,isLoading:A,isUsernameAvailable:l,checkUsername:i,onChange:v}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},S(`${N}.Username.CreatePublicLinkHelp`)))),a.ZP.createElement(zt.Z,{isShown:f,disabled:A,ariaLabel:S("Save"),onClick:I},A?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),Nr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,m.Z1)(e,t),{forDiscussionIds:s,byId:r}=e.chats;return{chat:a,chatsByIds:r,forDiscussionIds:s,linkedChat:null!=a&&null!==(n=a.fullInfo)&&void 0!==n&&n.linkedChatId?(0,m.Z1)(e,a.fullInfo.linkedChatId):void 0,isChannel:a&&(0,u.eA)(a)}}),((e,t)=>(0,h.ei)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"])))((({chat:e,onClose:t,isActive:n,chatId:s,chatsByIds:r,linkedChat:i,forDiscussionIds:c,isChannel:d,onScreenSelect:m,loadGroupsForDiscussion:u,linkDiscussionGroup:h,unlinkDiscussionGroup:Z})=>{const[P,g]=(0,a.eJ)(),[v,p]=(0,a.eJ)(),[E,C]=(0,a.eJ)(!1),f=(0,a.I4)((()=>C(!0)),[]),[b,I,y]=(0,Ae.Z)(),[S,w,N]=(0,Ae.Z)(),k=(0,M.Z)(),F=null==i?void 0:i.id;(0,T.ZP)(n,t),(0,a.d4)((()=>{u()}),[u]),(0,a.d4)((()=>{v||(0,nn.Z)("DiscussionGroups").then(p)}),[v]);const A=(0,a.I4)((()=>{y(),Z({channelId:d?s:F}),d||m(o.u1.Initial)}),[y,Z,d,s,F,m]),L=(0,a.I4)((()=>{N(),h({channelId:s,chatId:P})}),[N,h,s,P]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement("div",{className:"section-icon"},v&&a.ZP.createElement(an.Z,{id:"discussionGroupsDucks",size:l.bM,animationData:v,play:E,noLoop:!0,onLoad:f})),i&&a.ZP.createElement("div",null,a.ZP.createElement(Ee.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Ce.Z,{chatId:i.id})),a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:I},k(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Te.Z,{isOpen:b,onClose:y,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(D.Z,{size:"tiny",chat:i}),a.ZP.createElement("div",{className:"modal-title"},k(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,$.Z)(k(d?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",i.title),["br","simple_markdown"]),confirmLabel:k(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:A,confirmIsDestructive:!0})),!i&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},k("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Ee.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},k("DiscussionCreateGroup")),c?c.map(((e,t)=>a.ZP.createElement(Ee.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{g(e),w()}},a.ZP.createElement(Ce.Z,{chatId:e})))):a.ZP.createElement(lt.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},k("DiscussionChannelHelp2")),a.ZP.createElement(Te.Z,{isOpen:S,onClose:N,header:function(){const e=r[P];if(e)return a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(D.Z,{size:"tiny",chat:e}),a.ZP.createElement("div",{className:"modal-title"},k("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const t=r[P];if(t)return t.hasPrivateLink?(0,$.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):(0,$.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"])}(),confirmLabel:k("DiscussionLinkGroup"),confirmHandler:L,isButtonsInOneRow:!0})))))}))),kr=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,m.Z1)(e,t);return{chat:a,isFormFullyDisabled:!(a.isCreator||n)}}),((e,t)=>(0,h.ei)(t,["updateChatMemberBannedRights"])))((({chat:e,selectedChatMemberId:t,onScreenSelect:n,updateChatMemberBannedRights:s,isFormFullyDisabled:r,onClose:l,isActive:i})=>{const[c,d]=(0,a.eJ)({}),[m,u]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),[P,g,v]=(0,Ae.Z)(),p=(0,M.Z)();(0,T.ZP)(i,l);const E=(0,a.Ye)((()=>{if(e&&e.fullInfo&&e.fullInfo.members)return e.fullInfo.members.find((({userId:e})=>e===t))}),[e,t]);(0,a.d4)((()=>{null!=e&&e.fullInfo&&t&&!E&&n(o.u1.GroupPermissions)}),[e,n,E,t]),(0,a.d4)((()=>{d((null==E?void 0:E.bannedRights)||(null==e?void 0:e.defaultBannedRights)||{}),u(!1),Z(!1)}),[e,E]);const C=(0,a.I4)((e=>{const{name:t}=e.target;function n(e){return!e||void 0}d((e=>({...e,[t]:n(e[t]),..."sendStickers"===t&&{sendGifs:n(e[t])}}))),u(!0)}),[]),f=(0,a.I4)((()=>{e&&t&&(Z(!0),s({chatId:e.id,userId:t,bannedRights:c}))}),[e,t,c,s]),b=(0,a.I4)((()=>{e&&t&&s({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})}),[e,t,s]),I=(0,a.I4)((t=>!!r||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t]),[e,r]);if(E)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(fe.Z,{userId:E.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},p("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendMessages",checked:!c.sendMessages,label:p("UserRestrictionsSend"),blocking:!0,disabled:I("sendMessages"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendMedia",checked:!c.sendMedia,label:p("UserRestrictionsSendMedia"),blocking:!0,disabled:I("sendMedia"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendStickers",checked:!c.sendStickers&&!c.sendGifs,label:p("UserRestrictionsSendStickers"),blocking:!0,disabled:I("sendStickers"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"sendPolls",checked:!c.sendPolls,label:p("UserRestrictionsSendPolls"),blocking:!0,disabled:I("sendPolls"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"embedLinks",checked:!c.embedLinks,label:p("UserRestrictionsEmbedLinks"),blocking:!0,disabled:I("embedLinks"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:p("UserRestrictionsInviteUsers"),blocking:!0,disabled:I("inviteUsers"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"pinMessages",checked:!c.pinMessages,label:p("UserRestrictionsPinMessages"),blocking:!0,disabled:I("pinMessages"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!c.changeInfo,label:p("UserRestrictionsChangeInfo"),blocking:!0,disabled:I("changeInfo"),onChange:C}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:g},p("UserRestrictionsBlock")))),a.ZP.createElement(zt.Z,{isShown:m,onClick:f,ariaLabel:p("Save"),disabled:h},h?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Te.Z,{isOpen:P,onClose:v,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:b,confirmIsDestructive:!0}))}))),Mr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{byId:a}=e.users;return{chat:n,currentUserId:e.currentUserId,isChannel:(0,u.eA)(n),usersById:a}}))((({chat:e,isChannel:t,currentUserId:n,usersById:s,onScreenSelect:r,onChatMemberSelect:l,onClose:i,isActive:c})=>{const d=(0,M.Z)();(0,T.ZP)(c,i);const m=(0,a.Ye)((()=>e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[e]),h=(0,a.I4)((e=>{l(e.userId,e.promotedByUserId===n),r(o.u1.ChatAdminRights)}),[n,l,r]),Z=(0,a.I4)((e=>{if(e.isOwner)return d("ChannelCreator");const t=e.promotedByUserId?s[e.promotedByUserId]:void 0;return t?d("EditAdminPromotedBy",(0,u.Js)(t)):d("ChannelAdmin")}),[d,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"recent",multiline:!0,onClick:function(){r(o.u1.GroupRecentActions)}},a.ZP.createElement("span",{className:"title"},d("EventLog")),a.ZP.createElement("span",{className:"subtitle"},d(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:d.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),m.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>h(e)},a.ZP.createElement(fe.Z,{userId:e.userId,status:Z(e),forceShowSelf:!0})))))))}))),Tr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>({chat:(0,m.Z1)(e,t)})))((({chat:e,onClose:t,isActive:n})=>{const s=(0,M.Z)();(0,T.ZP)(n,t);const r=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.adminMembers?e.fullInfo.adminMembers.sort(((e,t)=>e.isOwner?-1:t.isOwner?1:0)):[]),[e]),o=(0,a.I4)((e=>e.isOwner?s("ChannelCreator"):s("ChannelAdmin")),[s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section not-implemented",dir:s.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},"Actions"),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterLeavingMembers"),onChange:void 0}))),a.ZP.createElement("div",{className:"section not-implemented",dir:s.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading",dir:"auto"},s("Channel.Management.Title")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllAdmins"),onChange:void 0})),r.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable picker-list-item",onClick:void 0,ripple:!0},a.ZP.createElement(Qt.Z,{label:"",checked:!0}),a.ZP.createElement(fe.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),Fr=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,m.Z1)(e,t),{byId:s}=e.users,{currentUserId:r}=e;return{chat:a,usersById:s,currentUserId:r,isChannel:(0,u.eA)(a),isFormFullyDisabled:!(a.isCreator||n)}}),((e,t)=>(0,h.ei)(t,["updateChatAdmin"])))((({selectedChatMemberId:e,onScreenSelect:t,chat:n,usersById:s,currentUserId:r,isChannel:l,isFormFullyDisabled:i,updateChatAdmin:c,onClose:d,isActive:m})=>{const[h,Z]=(0,a.eJ)({}),[P,g]=(0,a.eJ)(!1),[v,p]=(0,a.eJ)(!1),[E,C,f]=(0,Ae.Z)(),[b,I]=(0,a.eJ)(""),y=(0,M.Z)();(0,T.ZP)(m,d);const S=(0,a.Ye)((()=>{if(n.fullInfo&&n.fullInfo.adminMembers)return n.fullInfo.adminMembers.find((({userId:t})=>t===e))}),[n,e]);(0,a.d4)((()=>{null!=n&&n.fullInfo&&e&&!S&&t(o.u1.ChatAdministrators)}),[n,t,S,e]),(0,a.d4)((()=>{Z((null==S?void 0:S.adminRights)||{}),I(((null==S?void 0:S.customTitle)||"").substr(0,16)),g(!1),p(!1)}),[S]);const w=(0,a.I4)((e=>{const{name:t}=e.target;Z((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),g(!0)}),[]),N=(0,a.I4)((()=>{e&&(p(!0),c({chatId:n.id,userId:e,adminRights:h,customTitle:b}))}),[n,e,h,b,c]),k=(0,a.I4)((()=>{e&&(c({chatId:n.id,userId:e,adminRights:{}}),f())}),[n.id,f,e,c]),A=(0,a.I4)((e=>!((0,u.G9)(n)||!i&&n.adminRights&&n.adminRights[e])),[n,i]),L=(0,a.Ye)((()=>{if(!S)return;if(S.isOwner)return y("ChannelCreator");const e=S.promotedByUserId?s[S.promotedByUserId]:void 0;return e?y("EditAdminPromotedBy",(0,u.Js)(e)):y("ChannelAdmin")}),[S,s,y]),R=(0,a.I4)((e=>{const{value:t}=e.target;I(t),g(!0)}),[]);if(S)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(fe.Z,{userId:S.userId,status:L,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},y("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"changeInfo",checked:!!h.changeInfo,label:y(l?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:A("changeInfo"),onChange:w})),l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"postMessages",checked:!!h.postMessages,label:y("EditAdminPostMessages"),blocking:!0,disabled:A("postMessages"),onChange:w})),l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"editMessages",checked:!!h.editMessages,label:y("EditAdminEditMessages"),blocking:!0,disabled:A("editMessages"),onChange:w})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"deleteMessages",checked:!!h.deleteMessages,label:y(l?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:A("deleteMessages"),onChange:w})),!l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"banUsers",checked:!!h.banUsers,label:y("EditAdminBanUsers"),blocking:!0,disabled:A("banUsers"),onChange:w})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"inviteUsers",checked:!!h.inviteUsers,label:y("EditAdminAddUsers"),blocking:!0,disabled:A("inviteUsers"),onChange:w})),!l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"pinMessages",checked:!!h.pinMessages,label:y("EditAdminPinMessages"),blocking:!0,disabled:A("pinMessages"),onChange:w})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"addAdmins",checked:!!h.addAdmins,label:y("EditAdminAddAdmins"),blocking:!0,disabled:A("addAdmins"),onChange:w})),!l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(Qt.Z,{name:"anonymous",checked:!!h.anonymous,label:y("EditAdminSendAnonymously"),blocking:!0,disabled:A("anonymous"),onChange:w})),i&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},y("Channel.EditAdmin.CannotEdit")),!l&&a.ZP.createElement(ve.Z,{id:"admin-title",label:y("EditAdminRank"),onChange:R,value:b,disabled:i,maxLength:16}),r!==e&&!i&&a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:C},y("EditAdminRemoveAdmin")))),a.ZP.createElement(zt.Z,{isShown:P,onClick:N,ariaLabel:y("Save"),disabled:v},v?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Te.Z,{isOpen:E,onClose:f,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:k,confirmIsDestructive:!0}))}))),Ar=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,m.Z1)(e,t),{byId:s}=e.users;return{members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,usersById:s,isChannel:a&&(0,u.eA)(a),serverTimeOffset:e.serverTimeOffset}}),((e,t)=>(0,h.ei)(t,["openUserInfo"])))((({members:e,usersById:t,isChannel:n,openUserInfo:s,onClose:r,isActive:o,serverTimeOffset:l})=>{const i=(0,a.Ye)((()=>{if(e&&t)return(0,u.Z0)(e.map((({userId:e})=>e)),t,void 0,l)}),[e,l,t]),c=(0,a.I4)((e=>{s({id:e})}),[s]);return(0,T.ZP)(o,r),a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},i?i.map(((e,t)=>a.ZP.createElement(Ee.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>c(e)},a.ZP.createElement(fe.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(lt.Z,{teactOrderKey:0,key:"nothing-found",text:n?"No subscribers found":"No members found"}))))}))),Lr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,m.Z1)(e,t),{byId:s}=e.users;return{members:null==a||null===(n=a.fullInfo)||void 0===n?void 0:n.members,usersById:s,isChannel:a&&(0,u.eA)(a),serverTimeOffset:e.serverTimeOffset}}))((({usersById:e,members:t,isChannel:n,onScreenSelect:s,onChatMemberSelect:r,onClose:l,isActive:i,serverTimeOffset:c})=>{(0,T.ZP)(i,l);const d=(0,a.Ye)((()=>{if(t&&e)return(0,u.Z0)(t.filter((e=>!e.isOwner)).map((({userId:e})=>e)),e,void 0,c)}),[t,c,e]),m=(0,a.I4)((e=>{r(e),s(o.u1.GroupUserPermissions)}),[r,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},d?d.map(((e,t)=>a.ZP.createElement(Ee.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e)},a.ZP.createElement(fe.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(lt.Z,{teactOrderKey:0,key:"nothing-found",text:n?"No subscribers found":"No members found"}))))}))),Rr=(0,a.X$)((0,s.c$)((e=>({managementType:(0,m.pP)(e)})))((({chatId:e,currentScreen:t,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,onChatMemberSelect:l,onClose:i,isActive:c,managementType:d})=>{switch(t){case o.u1.Initial:switch(d){case"user":return a.ZP.createElement(vr,{key:e,userId:e,onClose:i,isActive:c});case"group":return a.ZP.createElement(Er,{key:e,chatId:e,onScreenSelect:r,onClose:i,isActive:c||[o.u1.ChatPrivacyType,o.u1.Discussion,o.u1.GroupPermissions,o.u1.ChatAdministrators,o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions,o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t)});case"channel":return a.ZP.createElement(yr,{key:e,chatId:e,onScreenSelect:r,onClose:i,isActive:c||[o.u1.ChannelSubscribers,o.u1.ChatAdministrators,o.u1.Discussion,o.u1.ChatPrivacyType,o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t)})}break;case o.u1.ChatPrivacyType:return a.ZP.createElement(wr,{chatId:e,isActive:c,onClose:i});case o.u1.Discussion:return a.ZP.createElement(Nr,{chatId:e,onScreenSelect:r,isActive:c,onClose:i});case o.u1.GroupPermissions:return a.ZP.createElement(Cr,{chatId:e,onScreenSelect:r,onChatMemberSelect:l,isActive:c||[o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions].includes(t),onClose:i});case o.u1.GroupRemovedUsers:return a.ZP.createElement(br,{chatId:e,isActive:c,onClose:i});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(Lr,{chatId:e,onChatMemberSelect:l,onScreenSelect:r,isActive:c||[o.u1.GroupUserPermissions].includes(t),onClose:i});case o.u1.GroupUserPermissions:return a.ZP.createElement(kr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:i});case o.u1.ChatAdministrators:return a.ZP.createElement(Mr,{chatId:e,onScreenSelect:r,onChatMemberSelect:l,isActive:c||[o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t),onClose:i});case o.u1.GroupRecentActions:return a.ZP.createElement(Tr,{chatId:e,isActive:c,onClose:i});case o.u1.ChatAdminRights:return a.ZP.createElement(Fr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:i});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(Ar,{chatId:e,isActive:c,onClose:i})}})));var Br=n(9937);const $r=/^4[0-9]{12}(?:[0-9]{1,3})?$/,Dr=/^5[1-5][0-9]{11,14}$/,Ur=/^2[2-7][0-9]{11,14}$/;let Or;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(Or||(Or={}));const xr={[Or.Default]:"",[Or.Visa]:"visa",[Or.Mastercard]:"mastercard"};function Gr(e){return e=e.replace(/\s/g,""),$r.test(e)?Or.Visa:Dr.test(e)||Ur.test(e)?Or.Mastercard:Or.Default}const Jr={},zr=/(\d{1,3})(\d{1,3})?(\d{1,3})?(\d{1,3})?(\d{1,3})?/,Xr="AF🇦🇫93Afghanistan333\nAO🇦🇴244Angola333\nAL🇦🇱355Albania234\nAD🇦🇩376Andorra222\nAE🇦🇪971United Arab Emirates234\nAI🇦🇮1264Anguilla34\nAR🇦🇷54Argentina\nAM🇦🇲374Armenia233\nAG🇦🇬1268Antigua and Barbuda34\nAU🇦🇺61Australia333\nAS🇦🇸1684American Samoa34\nAT🇦🇹43Austria\nAW🇦🇼297Aruba34\nAZ🇦🇿994Azerbaijan2322\nBI🇧🇮257Burundi224\nBE🇧🇪32Belgium3222\nBJ🇧🇯229Benin233\nBF🇧🇫226Burkina Faso2222\nBD🇧🇩880Bangladesh\nBG🇧🇬359Bulgaria\nBH🇧🇭973Bahrain44\nBS🇧🇸1242Bahamas34\nBA🇧🇦387Bosnia and Herzegovina\nBY🇧🇾375Belarus2322\nBZ🇧🇿501Belize\nBO🇧🇴591Bolivia134\nBR🇧🇷55Brazil254\nBB🇧🇧1246Barbados34\nBM🇧🇲1441Bermuda34\nBN🇧🇳673Brunei34\nBQ🇧🇶599Bonaire, Sint Eustatius and Saba\nBT🇧🇹975Bhutan\nBW🇧🇼267Botswana233\nCF🇨🇫236Central African Republic2222\nCA🇨🇦1Canada334\nCH🇨🇭41Switzerland234\nCK🇨🇰682Cook Islands\nCL🇨🇱56Chile144\nCN🇨🇳86China344\nCI🇨🇮225Côte d`Ivoire233\nCM🇨🇲237Cameroon44\nCD🇨🇩243DR Congo234\nCG🇨🇬242Republic of the Congo234\nCO🇨🇴57Colombia334\nKM🇰🇲269Comoros34\nCV🇨🇻238Cape Verde34\nCR🇨🇷506Costa Rica\nCU🇨🇺53Cuba44\nCY🇨🇾357Cyprus44\nCW🇨🇼599Curaçao\nCZ🇨🇿420Czech Republic\nDE🇩🇪49Germany38\nDJ🇩🇯253Djibouti2222\nDM🇩🇲1767Dominica34\nDK🇩🇰45Denmark44\nDO🇩🇴1Dominican Republic334\nDZ🇩🇿213Algeria3222\nEC🇪🇨593Ecuador\nEG🇪🇬20Egypt234\nER🇪🇷291Eritrea133\nES🇪🇸34Spain333\nEE🇪🇪372Estonia\nET🇪🇹251Ethiopia234\nFI🇫🇮358Finland\nFJ🇫🇯679Fiji\nFK🇫🇰500Falkland Islands\nFM🇫🇲691Micronesia\nFO🇫🇴298Faroe Islands33\nFR🇫🇷33France12222\nGA🇬🇦241Gabon1222\nGB🇬🇧44United Kingdom46\nGE🇬🇪995Georgia\nGF🇬🇫594French Guiana\nGH🇬🇭233Ghana\nGI🇬🇮350Gibraltar44\nGL🇬🇱299Greenland33\nGN🇬🇳224Guinea333\nGM🇬🇲220Gambia34\nGP🇬🇵590Guadeloupe\nGU🇬🇺1671Guam34\nGW🇬🇼245Guinea-Bissau34\nGQ🇬🇶240Equatorial Guinea333\nGR🇬🇷30Greece244\nGD🇬🇩1473Grenada34\nGT🇬🇹502Guatemala134\nGY🇬🇾592Guyana\nHK🇭🇰852Hong Kong\nHN🇭🇳504Honduras44\nHR🇭🇷385Croatia\nHT🇭🇹509Haiti\nHU🇭🇺36Hungary234\nID🇮🇩62Indonesia\nIN🇮🇳91India55\nIO🇩🇬246Diego Garcia34\nIE🇮🇪353Ireland234\nIR🇮🇷98Iran334\nIQ🇮🇶964Iraq334\nIS🇮🇸354Iceland34\nIL🇮🇱972Israel234\nIT🇮🇹39Italy334\nJM🇯🇲1876Jamaica34\nJO🇯🇴962Jordan144\nJP🇯🇵81Japan244\nKZ🇰🇿7Kazakhstan3322\nKE🇰🇪254Kenya333\nKG🇰🇬996Kyrgyzstan\nKH🇰🇭855Cambodia\nKI🇰🇮686Kiribati\nKN🇰🇳1869Saint Kitts and Nevis34\nKR🇰🇷82South Korea\nKW🇰🇼965Kuwait44\nKY🇰🇾1345Cayman Islands34\nLA🇱🇦856Laos\nLB🇱🇧961Lebanon\nLR🇱🇷231Liberia\nLY🇱🇾218Libya234\nLC🇱🇨1758Saint Lucia34\nLI🇱🇮423Liechtenstein\nLK🇱🇰94Sri Lanka234\nLS🇱🇸266Lesotho233\nLT🇱🇹370Lithuania35\nLU🇱🇺352Luxembourg\nLV🇱🇻371Latvia35\nMA🇲🇦212Morocco234\nMC🇲🇨377Monaco44\nMD🇲🇩373Moldova233\nMG🇲🇬261Madagascar2232\nMP🇲🇵1670Northern Mariana Islands34\nMO🇲🇴853Macau\nMS🇲🇸1664Montserrat34\nMV🇲🇻960Maldives\nMX🇲🇽52Mexico\nMH🇲🇭692Marshall Islands\nMK🇲🇰389Macedonia\nML🇲🇱223Mali44\nMT🇲🇹356Malta2222\nMM🇲🇲95Myanmar\nME🇲🇪382Montenegro\nMN🇲🇳976Mongolia\nMZ🇲🇿258Mozambique234\nMQ🇲🇶596Martinique\nMR🇲🇷222Mauritania44\nMU🇲🇺230Mauritius\nMW🇲🇼265Malawi\nMY🇲🇾60Malaysia\nNA🇳🇦264Namibia234\nNC🇳🇨687New Caledonia6\nNE🇳🇪227Niger2222\nNF🇳🇫672Norfolk Island\nNG🇳🇬234Nigeria\nNI🇳🇮505Nicaragua44\nNL🇳🇱31Netherlands12222\nNO🇳🇴47Norway44\nNP🇳🇵977Nepal\nNU🇳🇺683Niue\nNR🇳🇷674Nauru\nNZ🇳🇿64New Zealand\nOM🇴🇲968Oman44\nPK🇵🇰92Pakistan334\nPA🇵🇦507Panama44\nPE🇵🇪51Peru333\nPF🇵🇫689French Polynesia\nPH🇵🇭63Philippines334\nPM🇵🇲508Saint Pierre and Miquelon\nPR🇵🇷1Puerto Rico334\nPS🇵🇸970Palestine324\nPW🇵🇼680Palau\nPG🇵🇬675Papua New Guinea\nPL🇵🇱48Poland333\nKP🇰🇵850North Korea\nPT🇵🇹351Portugal144\nPY🇵🇾595Paraguay333\nQA🇶🇦974Qatar\nRE🇷🇪262Réunion333\nRO🇷🇴40Romania333\nRU🇷🇺7Russia3322\nRW🇷🇼250Rwanda333\nSA🇸🇦966Saudi Arabia\nSD🇸🇩249Sudan234\nSN🇸🇳221Senegal234\nSG🇸🇬65Singapore44\nSH🇸🇭290Saint Helena23\nSH🇸🇭247Saint Helena4\nSB🇸🇧677Solomon Islands\nSL🇸🇱232Sierra Leone233\nSV🇸🇻503El Salvador44\nSM🇸🇲378San Marino334\nSO🇸🇴252Somalia233\nRS🇷🇸381Serbia234\nSS🇸🇸211South Sudan234\nST🇸🇹239São Tomé and Príncipe25\nSR🇸🇷597Suriname34\nSK🇸🇰421Slovakia\nSI🇸🇮386Slovenia\nSE🇸🇪46Sweden234\nSZ🇸🇿268Swaziland44\nSC🇸🇨248Seychelles1222\nSX🇸🇽1721Sint Maarten34\nSY🇸🇾963Syria\nTC🇹🇨1649Turks and Caicos Islands34\nTD🇹🇩235Chad2222\nTG🇹🇬228Togo233\nTH🇹🇭66Thailand144\nTJ🇹🇯992Tajikistan\nTK🇹🇰690Tokelau\nTM🇹🇲993Turkmenistan26\nTL🇹🇱670Timor-Leste\nTO🇹🇴676Tonga\nTT🇹🇹1868Trinidad and Tobago34\nTN🇹🇳216Tunisia233\nTR🇹🇷90Turkey334\nTV🇹🇻688Tuvalu\nTW🇹🇼886Taiwan\nTZ🇹🇿255Tanzania234\nUG🇺🇬256Uganda234\nUA🇺🇦380Ukraine2322\nUY🇺🇾598Uruguay44\nUS🇺🇸1United States334\nUZ🇺🇿998Uzbekistan27\nVA🇻🇦3Vatican City\nVC🇻🇨1784Saint Vincent and the Grenadines34\nVE🇻🇪58Venezuela334\nVG🇻🇬1284British Virgin Islands34\nVI🇻🇮1340US Virgin Islands34\nVN🇻🇳84Vietnam\nVU🇻🇺678Vanuatu\nWF🇼🇫681Wallis and Futuna\nWS🇼🇸685Samoa\nXK🇽🇰383Kosovo44\nYE🇾🇪967Yemen333\nZA🇿🇦27South Africa234\nZM🇿🇲260Zambia234\nZW🇿🇼263Zimbabwe234".split("\n").map((e=>({id:e.substr(0,2),flag:e.substr(2,4),code:`+${e.match(/\d+/)[0]}`,name:e.split(/\d+/)[1],phoneFormat:function(e){if(!e)return zr;const t=e[0];let n;if(!Jr[t]){const e=t.split("").map(Number);n=e.reduce(((e,t,n)=>`${e}(\\d{1,${t}})${n>0?"?":""}`),""),Jr[t]=new RegExp(`${n}${"()?".repeat(5-e.length)}`)}return Jr[t]}(e.match(/\d+$/))}))),_r={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Yr=(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:Hr(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:Hr(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Hr(e){const t=Xr.find((({id:t})=>t===e));return t?t.name:""}function jr(e,t=400){(0,a.d4)((()=>{i.$b||setTimeout((()=>{(0,z.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const Vr=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:r,error:o,ref:l,placeholder:i,onChange:c,children:d}=e,m=o||s,u=(0,X.Z)("input-group",n&&"touched",o&&"error",m&&"with-label",r&&"with-arrow","input-group");return a.ZP.createElement("div",{className:u},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:c,placeholder:i||s,ref:l},d),m&&t&&a.ZP.createElement("label",{htmlFor:t},m))})),Kr=(0,a.X$)((({state:e,needEmail:t,needPhone:n,needName:s,needAddress:r,dispatch:o})=>{const l=(0,a.sO)(null),i=(0,a.sO)(null),c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==e.countryIso2&&(c.current.value=e.countryIso2)}),[e.countryIso2]);const d=(0,M.Z)();jr(l);const m=(0,a.I4)((e=>{o({type:"changeAddress1",payload:e.target.value})}),[o]),u=(0,a.I4)((e=>{o({type:"changeAddress2",payload:e.target.value})}),[o]),h=(0,a.I4)((e=>{o({type:"changeCity",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeState",payload:e.target.value})}),[o]),P=(0,a.I4)((e=>{o({type:"changeCountry",payload:e.target.value})}),[o]),g=(0,a.I4)((e=>{o({type:"changePostCode",payload:e.target.value})}),[o]),v=(0,a.I4)((e=>{o({type:"changeFullName",payload:e.target.value})}),[o]),p=(0,a.I4)((e=>{o({type:"changeEmail",payload:e.target.value})}),[o]),E=(0,a.I4)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,i.current&&(i.current.value=t),o({type:"changePhone",payload:t})}),[o]),C=(0,a.I4)((e=>{o({type:"changeSaveInfo",payload:e.target.value})}),[o]),{formErrors:f}=e;return a.ZP.createElement("div",{className:"ShippingInfo"},a.ZP.createElement("form",null,r?a.ZP.createElement("div",null,a.ZP.createElement("h5",null,d("PaymentShippingAddress")),a.ZP.createElement(ve.Z,{ref:l,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:f.streetLine1}),a.ZP.createElement(ve.Z,{label:"Address2 (Street)",onChange:u,value:e.streetLine2,inputMode:"text",error:f.streetLine2}),a.ZP.createElement(ve.Z,{label:"City",onChange:h,value:e.city,inputMode:"text",error:f.city}),a.ZP.createElement(ve.Z,{label:"State",onChange:Z,value:e.state,inputMode:"text",error:f.state}),a.ZP.createElement(Vr,{label:"Country",placeholder:"Country",onChange:P,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:f.countryIso2,ref:c},Xr.map((({name:e,id:t})=>a.ZP.createElement("option",{value:t,className:"county-item"},e)))),a.ZP.createElement(ve.Z,{label:"Post Code",onChange:g,value:e.postCode,inputMode:"text",error:f.postCode})):void 0,s||t||n?a.ZP.createElement("h5",null,d("PaymentShippingReceiver")):void 0,s&&a.ZP.createElement(ve.Z,{label:"Full name",onChange:v,value:e.fullName,inputMode:"text",error:f.fullName}),t&&a.ZP.createElement(ve.Z,{label:"Email",onChange:p,value:e.email,inputMode:"email",error:f.email}),n&&a.ZP.createElement(ve.Z,{label:"Phone number",onChange:E,value:e.phone,inputMode:"tel",error:f.phone,ref:i}),a.ZP.createElement(Qt.Z,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:C})))})),qr=(0,a.X$)((({state:e,shippingOptions:t,currency:n,dispatch:s})=>{const r=(0,M.Z)();(0,a.d4)((()=>{t&&!e.shipping&&s({type:"changeShipping",payload:t[0].id})}),[t,e.shipping,s]);const o=(0,a.I4)((e=>{s({type:"changeShipping",payload:e})}),[s]),l=(0,a.Ye)((()=>t.map((({id:e,title:t,amount:a})=>({label:t,subLabel:(0,Br.x)(a,n,r.code),value:e})))),[t,n,r.code]);return a.ZP.createElement("div",{className:"Shipping"},a.ZP.createElement("form",null,a.ZP.createElement("p",null,"Select shipping method"),a.ZP.createElement(Xe.Z,{name:"shipping-options",options:l,onChange:o,selected:e.shipping})))}));function Wr(e,t,n,s,r=!1){return a.ZP.createElement("div",{className:"price-info-item "+(r?"price-info-item-main":"")},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("div",{className:"value"},(0,Br.x)(n,s,e)))}function Qr(e,t,n){return a.ZP.createElement("div",{className:"checkout-info-item"},a.ZP.createElement("i",{className:e}," "),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"title"},t),a.ZP.createElement("p",{className:"data"},n)))}const eo=(0,a.X$)((({invoiceContent:e,prices:t,shippingPrices:n,checkoutInfo:s,currency:r,totalPrice:o})=>{const l=(0,M.Z)(),{photoUrl:i,title:c,text:d}=e||{},{paymentMethod:m,paymentProvider:u,shippingAddress:h,name:Z,phone:P,shippingMethod:g}=s||{};return a.ZP.createElement("div",{className:"Checkout"},a.ZP.createElement("div",{className:"description has-image"},i&&a.ZP.createElement("img",{src:i,alt:""}),a.ZP.createElement("div",{className:"text"},a.ZP.createElement("h5",null,c),a.ZP.createElement("p",null,d))),a.ZP.createElement("div",{className:"price-info"},t&&t.map((e=>Wr(l.code,e.label,e.amount,r))),n&&n.map((e=>Wr(l.code,e.label,e.amount,r))),void 0!==o&&Wr(l.code,l("Checkout.TotalAmount"),o,r,!0)),a.ZP.createElement("div",{className:"invoice-info"},m&&Qr("icon-card",m,"Payment method"),u&&Qr("stripe-provider",u,"Payment provider"),h&&Qr("icon-location",h,"Shipping address"),Z&&Qr("icon-user",Z,"Name"),P&&Qr("icon-phone",P,"Phone number"),g&&Qr("icon-truck",g,"Shipping method")))})),to=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null),r=(0,a.I4)((t=>{if("Backspace"===t.key&&"/"===e.charAt(e.length-1)){const t=e.slice(0,e.length-1);s.current&&(s.current.value=t)}}),[e]),o=(0,a.I4)((e=>{n(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return null!=t&&t[0]&&Number(t[0])>12&&(t[0]="12"),null!=t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))}),[n]);return a.ZP.createElement(ve.Z,{label:"Expiry date",ref:s,onChange:o,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}));var no=n(6352),ao=n(5753);const so=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null);jr(s);const[r,o]=(0,a.eJ)(Or.Default);(0,a.d4)((()=>{const t=Gr(e);o(t)}),[]);const l=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),a=Gr(e.target.value);o(a),n(t),s.current&&(s.current.value=t)}),[n,s]),i=function(e){switch(e){case Or.Mastercard:return a.ZP.createElement("img",{src:no,alt:""});case Or.Visa:return a.ZP.createElement("img",{src:ao,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},i),a.ZP.createElement(ve.Z,{ref:s,label:"Card number",onChange:l,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))})),ro=(0,a.X$)((({state:e,canSaveCredentials:t,needCardholderName:n,needCountry:s,needZip:r,dispatch:o})=>{const l=(0,a.sO)(null);(0,a.d4)((()=>{l.current&&l.current.value!==e.billingCountry&&(l.current.value=e.billingCountry)}),[e.billingCountry]);const i=(0,a.I4)((e=>{o({type:"changeCardNumber",payload:e})}),[o]),c=(0,a.I4)((e=>{o({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[o]),d=(0,a.I4)((e=>{o({type:"changeExpiryDate",payload:e})}),[o]),m=(0,a.I4)((e=>{o({type:"changeCvvCode",payload:e.target.value})}),[o]),u=(0,a.I4)((e=>{o({type:"changeBillingCountry",payload:e.target.value})}),[o]),h=(0,a.I4)((e=>{o({type:"changeBillingZip",payload:e.target.value})}),[o]),Z=(0,a.I4)((e=>{o({type:"changeSaveCredentials",payload:e.target.value})}),[o]),P=(0,M.Z)(),{formErrors:g={}}=e;return a.ZP.createElement("div",{className:"PaymentInfo"},a.ZP.createElement("form",null,a.ZP.createElement("h5",null,P("PaymentCardTitle")),a.ZP.createElement(so,{onChange:i,value:e.cardNumber,error:g.cardNumber}),n&&a.ZP.createElement(ve.Z,{label:"Name on card",onChange:c,value:e.cardholder,inputMode:"text",error:g.cardholder}),a.ZP.createElement("section",{className:"inline-inputs"},a.ZP.createElement(to,{value:e.expiry,onChange:d,error:g.expiry}),a.ZP.createElement(ve.Z,{label:"CVV code",onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,error:g.cvv})),s||r?a.ZP.createElement("h5",null,P("PaymentBillingAddress")):void 0,s&&a.ZP.createElement(Vr,{label:"Country",placeholder:"Country",onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,ref:l},Xr.map((({name:e})=>a.ZP.createElement("option",{value:e,className:"county-item"},e)))),r&&a.ZP.createElement(ve.Z,{label:"Post Code",onChange:h,value:e.billingZip,inputMode:"text",error:g.billingZip}),t&&a.ZP.createElement(Qt.Z,{label:P("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:Z})))})),oo=(0,a.X$)((0,s.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:r,invoiceContent:o,nativeProvider:l,nativeParams:i,passwordMissing:c,error:d}=e.payment,m=Boolean(r&&(!l||"stripe"!==l)),{needCardholderName:u,needCountry:h,needZip:Z}=i||{},{nameRequested:P,phoneRequested:g,emailRequested:v,shippingAddressRequested:p,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I}=r||{};return{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:l,passwordMissing:c,nameRequested:P,shippingAddressRequested:p,phoneRequested:g,emailRequested:v,flexible:E,phoneToProvider:C,emailToProvider:f,currency:b,prices:I,isProviderError:m,invoiceContent:o,needCardholderName:u,needCountry:h,needZip:Z,error:d}}),((e,t)=>(0,h.ei)(t,["validateRequestedInfo","sendPaymentForm","setPaymentStep","sendCredentialsInfo","clearPaymentError"])))((({isOpen:e,onClose:t,step:n,shippingOptions:s,savedInfo:r,canSaveCredentials:l,nameRequested:i,shippingAddressRequested:c,phoneRequested:d,emailRequested:m,phoneToProvider:u,emailToProvider:h,currency:Z,passwordMissing:P,isProviderError:g,invoiceContent:v,nativeProvider:p,prices:E,needCardholderName:C,needCountry:f,needZip:b,error:I,validateRequestedInfo:y,sendPaymentForm:S,setPaymentStep:w,sendCredentialsInfo:N,clearPaymentError:k})=>{const[T,A]=(0,Bt.Z)(Yr,_r),[B,$]=(0,a.eJ)(!1),D=(0,M.Z)();(0,a.d4)((()=>{(n||I)&&$(!1)}),[n,I]),(0,a.d4)((()=>{null!=I&&I.field&&A({type:"setFormErrors",payload:{[I.field]:I.message}})}),[I,A]),(0,a.d4)((()=>{if(r){const{name:e,phone:t,email:n,shippingAddress:a}=r;A({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...a||{}}})}}),[r,A]);const U=(0,a.I4)((()=>{k()}),[k]),O=(0,a.Ye)((()=>n!==o.KB.Checkout?0:function(e=[],t,n){const a=t?io(t,n):[];let s=0;return s=e.concat(a||[]).reduce(((e,t)=>e+t.amount),s),s}(E,s,T.shipping)),[n,T.shipping,E,s]),x=(0,a.Ye)((()=>{if(n===o.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=Gr(e);return xr[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:o}=e,l=t?lo(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:o,phone:r,shippingMethod:null==l?void 0:l.title}}(T,s,p||"")}),[n,T,s,p]),G=(0,a.I4)((()=>{const{saveInfo:e}=T,t=function(e){const{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o,fullName:l,phone:i,email:c}=e;return{name:l,phone:i,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o}}}(T);y({requestInfo:t,saveInfo:e})}),[y,T]),J=(0,a.I4)((()=>{const e=function(e){const{cardNumber:t,cardholder:n,expiry:a,cvv:s,billingCountry:r,billingZip:o}=e,[l,i]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:l,expiryYear:i,cvv:s,country:r,zip:o}}}(T);N({credentials:e})}),[N,T]),z=(0,a.I4)((()=>{S({shippingOptionId:T.shipping,saveCredentials:T.saveCredentials})}),[S,T]),X=(0,a.I4)((e=>{w({step:e})}),[w]),_=(0,a.I4)((()=>{switch($(!0),n){case o.KB.ShippingInfo:return G();case o.KB.Shipping:return X(o.KB.PaymentInfo);case o.KB.PaymentInfo:return J();case o.KB.Checkout:return z();default:return()=>{}}}),[n,G,X,J,z]),Y=(0,a.Ye)((()=>{switch(n){case o.KB.ShippingInfo:return D("PaymentShippingInfo");case o.KB.Shipping:return D("PaymentShippingMethod");case o.KB.PaymentInfo:return D("PaymentCardInfo");case o.KB.Checkout:return D("PaymentCheckout");default:return""}}),[n,D]),H=(0,a.Ye)((()=>{switch(n){case o.KB.Checkout:return D("Checkout.PayPrice",(0,Br.x)(O,Z,D.code));default:return D("Next")}}),[n,D,Z,O]);return g?a.ZP.createElement(ge.Z,{className:"error",isOpen:e,onClose:t},a.ZP.createElement("p",null,"Sorry, Telegram WebZ doesn't support payments with this provider yet. ",a.ZP.createElement("br",null),"Please use one of our mobile apps to do this."),a.ZP.createElement(R.Z,{isText:!0,onClick:t},D("OK"))):a.ZP.createElement(ge.Z,{className:"PaymentModal",isOpen:e,onClose:t},a.ZP.createElement("div",{className:"header",dir:D.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null,Y)),void 0!==n?a.ZP.createElement(L.Z,{name:"slide",activeKey:n},(()=>a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case o.KB.ShippingInfo:return a.ZP.createElement(Kr,{state:T,dispatch:A,needAddress:Boolean(c),needEmail:Boolean(m||h),needPhone:Boolean(d||u),needName:Boolean(i)});case o.KB.Shipping:return a.ZP.createElement(qr,{state:T,dispatch:A,shippingOptions:s||[],currency:Z});case o.KB.PaymentInfo:return a.ZP.createElement(ro,{state:T,dispatch:A,canSaveCredentials:Boolean(!P&&l),needCardholderName:C,needCountry:f,needZip:b});case o.KB.Checkout:return a.ZP.createElement(eo,{prices:E,shippingPrices:T.shipping&&s?io(s,T.shipping):void 0,totalPrice:O,invoiceContent:v,checkoutInfo:x,currency:Z});default:return}}(n)))):a.ZP.createElement("div",{className:"empty-content"},a.ZP.createElement(F.Z,{color:"gray"})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{type:"submit",onClick:_,disabled:B,isLoading:B},H)),I&&!I.field&&function(){if(I)return a.ZP.createElement(ge.Z,{className:"error",isOpen:Boolean(I),onClose:U},a.ZP.createElement("h4",null,I.description||"Error"),a.ZP.createElement("p",null,I.description||"Error"),a.ZP.createElement(R.Z,{isText:!0,onClick:k},D("OK")))}())})));function lo(e,t){return e.find((({id:e})=>e===t))}function io(e,t){const n=lo(e,t);return null==n?void 0:n.prices}const co=(0,a.X$)((0,s.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:l,shippingMethod:i,photoUrl:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:l,shippingMethod:i,photoUrl:c,text:d,title:m}}))((({isOpen:e,onClose:t,prices:n,shippingPrices:s,totalAmount:r,currency:o,info:l,photoUrl:i,text:c,title:d,credentialsTitle:m,shippingMethod:u})=>{const h=(0,M.Z)(),Z=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=null!=a&&a.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:r,name:o}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:o,phone:r,shippingMethod:n}}(m,l,u)),[l,u,m]);return a.ZP.createElement(ge.Z,{className:"PaymentModal PaymentModal-receipt",isOpen:e,onClose:t},a.ZP.createElement("div",null,a.ZP.createElement("div",{className:"header",dir:h.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:t,ariaLabel:"Close"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("h3",null," ",h("PaymentReceipt")," ")),a.ZP.createElement("div",{className:"receipt-content custom-scroll"},a.ZP.createElement(eo,{prices:n,shippingPrices:s,totalPrice:r,invoiceContent:{photoUrl:i,text:c,title:d},checkoutInfo:Z,currency:o}))))})))},9364:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(4050),s=n(3716),r=n(7361),o=n(6752),l=n(9107),i=n(231);const c=r.wB?550:400,d=(0,a.X$)((({isLoading:e=!1,isPasswordVisible:t,error:n,hint:d,placeholder:m="Password",submitLabel:u="Next",clearError:h,onChangePasswordVisibility:Z,onInputChange:P,onSubmit:g})=>{const v=(0,a.sO)(null),p=(0,l.Z)(),[E,C]=(0,a.eJ)(""),[f,b]=(0,a.eJ)(!1);return(0,a.d4)((()=>{r.$b||setTimeout((()=>{v.current.focus()}),c)}),[]),(0,a.d4)((()=>{n&&requestAnimationFrame((()=>{v.current.focus(),v.current.select()}))}),[n]),a.ZP.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||f&&g(E)},autoComplete:"off"},a.ZP.createElement("div",{className:(0,o.Z)("input-group password-input",E&&"touched",n&&"error"),dir:p.isRtl?"rtl":void 0},a.ZP.createElement("input",{ref:v,className:"form-control",type:t?"text":"password",id:"sign-in-password",value:E||"",autoComplete:"current-password",onChange:function(e){n&&h();const{target:t}=e;C(t.value),b(t.value.length>=s.lo),P&&P(t.value)},dir:"auto"}),a.ZP.createElement("label",null,n||d||m),a.ZP.createElement("div",{className:"toggle-password",onClick:function(){Z(!t)},role:"button",tabIndex:0,title:"Toggle password visibility"},a.ZP.createElement("i",{className:t?"icon-eye":"icon-eye-closed"}))),f&&a.ZP.createElement(i.Z,{type:"submit",ripple:!0,isLoading:e},u))}))},3490:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(4050),s=n(3716),r=n(7361),o=n(7324),l=n(7799);const i=[0,50],c=[0,20],d=[20,0],m=r.wB?s.qp:s.z7,u=(0,a.X$)((({isPasswordVisible:e,isBig:t})=>{const[n,r]=(0,a.eJ)(),[u,h]=(0,a.eJ)(),[Z,P]=(0,a.eJ)(!1),[g,v]=(0,a.eJ)(!1);(0,a.d4)((()=>{n?setTimeout((()=>v(!0)),2e3):(0,o.Z)("MonkeyClose").then(r)}),[n]),(0,a.d4)((()=>{u||(0,o.Z)("MonkeyPeek").then(h)}),[u]);const p=(0,a.I4)((()=>P(!0)),[]);return a.ZP.createElement("div",{id:"monkey",className:t?"big":""},!Z&&a.ZP.createElement("div",{className:"monkey-preview"}),n&&a.ZP.createElement(l.Z,{id:"closeMonkey",size:t?s.K2:m,className:g?"hidden":"shown",animationData:n,playSegment:i,noLoop:!0,onLoad:p}),u&&a.ZP.createElement(l.Z,{id:"peekMonkey",size:t?s.K2:m,className:g?"shown":"hidden",animationData:u,playSegment:e?c:d,noLoop:!0}))}))},7324:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(6137),s=n(647);const r={MonkeyIdle:n(1679),MonkeyTracking:n(4889),MonkeyClose:n(4185),MonkeyPeek:n(8431),FoldersAll:n(6041),FoldersNew:n(7196),DiscussionGroups:n(4349)};function o(e){const t=r[e].replace(window.location.origin,"");return s.he(`file${t}`,a.IU.Lottie)}},710:(e,t,n)=>{n.d(t,{Z:()=>g});var a=n(4050),s=n(6752),r=n(3716),o=n(1394),l=n(9107),i=n(231),c=n(3103),d=n(4288);const m={type:"blob",quality:1,format:"jpeg",circle:!1};let u,h,Z;const P=(0,a.X$)((({file:e,onChange:t,onClose:s})=>{const[P,g]=(0,a.eJ)(!1);(0,a.d4)((()=>{e&&(P?async function(e){try{const t=document.getElementById("avatar-crop");if(!t)return;const{offsetWidth:n,offsetHeight:a}=t;Z=new u(t,{enableZoom:!0,boundary:{width:n,height:a},viewport:{width:n-16,height:a-16,type:"circle"}});const s=await(0,o.YJ)(e);await Z.bind({url:s})}catch(e){r.eM&&console.error(e)}}(e):async function(){return h||(h=Promise.all([n.e(99),n.e(472)]).then(n.bind(n,3472)),u=(await h).default),h}().then((()=>g(!0))))}),[e,P]);const v=(0,l.Z)();return a.ZP.createElement(c.Z,{isOpen:Boolean(e),onClose:s,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},P?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(i.Z,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!Z)return;const e=await Z.result(m),n="string"==typeof e?e:(0,o.hl)(e,"avatar.jpg");t(n)},ariaLabel:v("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),g=(0,a.X$)((({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:n,onChange:r})=>{const[o,l]=(0,a.eJ)(),[i,c]=(0,a.eJ)(n);(0,a.d4)((()=>{c(n)}),[n]);const d=(0,s.Z)(i&&"filled",t&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:d,role:"button",tabIndex:0,title:e},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(l(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),i&&a.ZP.createElement("img",{src:i,alt:"Avatar"})),a.ZP.createElement(P,{file:o,onClose:function(){l(void 0)},onChange:function(e){l(void 0),r(e),i&&URL.revokeObjectURL(i),c(URL.createObjectURL(e))}}))}))},4349:(e,t,n)=>{e.exports=n.p+"DiscussionGroupsDucks.9ea453d1be9d1b0ee77a..tgs"},6041:(e,t,n)=>{e.exports=n.p+"FoldersAll.3f9f9e243d19f0fbf9aa..tgs"},7196:(e,t,n)=>{e.exports=n.p+"FoldersNew.9a40d71c0c8be70f5bd1..tgs"},4185:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyClose.604c4c833d322b7e6c3e..tgs"},1679:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyIdle.dea4a492c144df84ddab..tgs"},8431:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyPeek.1905436b042520363d7e..tgs"},4889:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyTracking.eb5a7a6f166fb7589c12..tgs"},6352:(e,t,n)=>{e.exports=n.p+"mastercard.4216118edafe23cc2dec..svg"},5753:(e,t,n)=>{e.exports=n.p+"visa.e5a7c336e1deb4b92a63..svg"}}]);
|
||
//# sourceMappingURL=701.a95ae53d58d15587f298.js.map
|