mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-11 16:49:44 +01:00
2 lines
267 KiB
JavaScript
2 lines
267 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[465],{1465:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>Fa,AttachMenu:()=>Os,AttachmentModal:()=>us,BotCommandMenu:()=>zs,BotCommandTooltip:()=>Js,CalendarModal:()=>$e,ChatFolderModal:()=>La,ContactList:()=>Ia,ContextMenuContainer:()=>_a,CustomSendMenu:()=>Ys,DeleteMessageModal:()=>Ue,Dialogs:()=>Se,DropArea:()=>_s.Z,EmojiTooltip:()=>Vs,ForwardPicker:()=>be,GifSearch:()=>cr,HeaderMenuContainer:()=>Va,HistoryCalendar:()=>De,InlineBotTooltip:()=>nr,LeftSearch:()=>Lt,Management:()=>Mr,MediaViewer:()=>me,MentionTooltip:()=>ds,MessageSelectToolbar:()=>Ye,MobileSearch:()=>Wa,NewChat:()=>Ma,NewChatStep1:()=>Na,NewChatStep2:()=>ka,Notifications:()=>ke,PaymentModal:()=>to,PinMessageModal:()=>xe,PollModal:()=>Zs,PollResults:()=>mr,ReceiptModal:()=>so,RightSearch:()=>sr,SafeLinkModal:()=>Te,Settings:()=>ba,StickerSearch:()=>ir,StickerSetModal:()=>Ha,StickerTooltip:()=>Xs,SymbolMenu:()=>xs,TextFormatter:()=>Hs.Z,UnpinAllMessagesModal:()=>Oe});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(2761),C=n(2937),f=n(7204),b=n(8674),y=n(935);function I(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 N(e,t){Object.assign(e.style,t)}function k(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 w(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.YA)(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=n.id<0,m=(0,u.OU)(c,n);return a.ZP.createElement("div",{className:"SenderInfo",onClick:i},d?a.ZP.createElement(D.Z,{key:n.id,size:"medium",chat:n}):a.ZP.createElement(D.Z,{key:n.id,size:"medium",user:n}),a.ZP.createElement("div",{className:"meta"},a.ZP.createElement("div",{className:"title",dir:"auto"},m&&(0,$.Z)(m)),a.ZP.createElement("div",{className:"date",dir:"auto"},s?c("lng_mediaview_profile_photo"):(0,B.ZK)(c,1e3*r.date,!0))))}));var x=n(2619),O=n(3106),G=n(8964),J=n(9196);const z=({mediaData:e,isVideo:t,isZoomed:n,message:s,fileName:r,isAvatar:o,onCloseMediaViewer:l,onForward:c,onZoomToggle:d})=>{const{isDownloadStarted:m,downloadProgress:h,handleDownloadClick:Z}=(0,x.Z)(s&&t?(0,u.Ti)(s,"download"):void 0,r),P=(0,M.Z)(),g=(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:g,positionX:"right"},!o&&a.ZP.createElement(G.Z,{icon:"forward",onClick:c},P("Forward")),t?a.ZP.createElement(G.Z,{icon:m?"close":"download",onClick:Z},m?`${Math.round(100*h)}% Downloading...`:"Download"):a.ZP.createElement(G.Z,{icon:"download",href:e,download:r},P("AccActionDownload"))),m&&a.ZP.createElement(J.Z,{progress:h,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:P("Forward"),onClick:c},a.ZP.createElement("i",{className:"icon-forward"}))),t?a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:P("AccActionDownload"),onClick:Z},m?a.ZP.createElement(J.Z,{progress:h,size:"s",onClick:Z}):a.ZP.createElement("i",{className:"icon-download"})):a.ZP.createElement(R.Z,{href:e,download:r,round:!0,size:"smaller",color:"translucent-white",ariaLabel:P("AccActionDownload")},a.ZP.createElement("i",{className:"icon-download"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:n?"Zoom Out":"Zoom In",onClick:d},a.ZP.createElement("i",{className:n?"icon-zoom-out":"icon-zoom-in"})),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:P("Close"),onClick:l},a.ZP.createElement("i",{className:"icon-close"})))};var X=n(9118),Y=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,X.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const l=(0,Y.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 H=n(1212),j=n(2019);const V=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var K=n(6898),q=n(4753);const W=["bytes","kB","MB","GB","TB","PB"],Q=e=>{const t=0===e?0:Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**Math.floor(t)).toFixed(1)} ${W[t]}`},ee=e=>{e.stopPropagation()},te=({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 y,I;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:ee},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&&(y=e,I=s,a.ZP.createElement("div",{className:"player-file-size"},`${Q(I*y)} / ${Q(I)}`)),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 ne(){return(ne=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 ae=(0,a.X$)((({url:e,isGif:t,posterData:n,posterSize:s,downloadProgress: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(V&&document[V]));return(0,a.bt)((()=>{const n=()=>{s(Boolean(V&&document[V]))},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))}}),[]),V||"iOS"===i.Lt?[n,()=>{e.current&&(V||"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:y}=(0,j.Z)(),{shouldRender:I,transitionClassNames:S}=(0,H.Z)(!f,void 0,void 0,"slow"),{shouldRender:N,transitionClassNames:k}=(0,H.Z)(i.cj&&!u&&!I,void 0,void 0,"slow");(0,a.d4)((()=>{c||!l?m.current.pause():e&&!i.$b&&(0,q.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 w=(0,a.I4)((e=>{e.stopPropagation(),u?(m.current.pause(),h(!1)):((0,q.Z)(m.current),h(!0),i.wB&&v(!1))}),[u]);(0,K.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(),w(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[w]);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",ne({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:w,onDoubleClick:L},y,{onTimeUpdate:F}),e&&a.ZP.createElement("source",{src:e}))),N&&a.ZP.createElement(R.Z,{round:!0,className:`play-button ${k}`,onClick:w},a.ZP.createElement("i",{className:"icon-play"})),I&&a.ZP.createElement("div",{className:["spinner-container",S].join(" ")},!f&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(J.Z,{size:"xl",progress:f?1:r,square:!0,onClick:d})),!t&&!I&&a.ZP.createElement(te,{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:w}))})),se=(0,a.X$)((({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:n}=(0,H.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,Y.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}))))})),re=[1,0,0,1,0,0],oe={1:1,1.5:1.5,2:2.2,2.5:3.3,3:5.5},le=150,ie=(0,a.X$)((({children:e,className:t,noWrap:n,canPan:s,zoomLevel:r,panDeltaX:o,panDeltaY:l,onPan:i})=>{const c=oe[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)(re),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-le<i?t[4]-=i+s.width-le:o&&o+i<le&&(t[4]-=o+i-le),s.height&&s.height-le<c?t[5]-=c+s.height-le:l&&l+c<le&&(t[5]-=l+c-le),t}(P[0],a,v.current))}),[o,l,c]),(0,a.d4)((()=>{s||g(re)}),[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))})),ce=350;function de(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 me=(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:x,closeMediaViewer:O,openForwardMenu:G,focusMessage:J,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),ne=Boolean(!te&&(V||q||Q)),{isGif:re}=K||W||{},oe=Boolean(h),le=Boolean(q||W),me=(0,a.Ye)((()=>le&&n?[n]:(0,u.N0)($||{},D||[],H)),[le,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,ye]=(0,a.eJ)(!1),[Ie,Se]=(0,a.eJ)(!1),[Ne,ke]=(0,a.eJ)(1),[we,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&&ce),Ae=Te(),Le=(0,p.Z)(Ae,void 0,r.IU.BlobUrl,void 0,Ee&&ce),{mediaData:Re,downloadProgress:Be}=(0,E.Z)(Te(!0),void 0,B&&(0,u.kG)(B,"viewerFull"),void 0,Ee&&ce),$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 xe=B?(0,u.c0)(B):void 0,Oe=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),Ye=(0,f.Z)(h),_e=(0,f.Z)(De);(0,a.d4)((()=>{if(Ee&&Y&&!ze&&!Ye){(0,b.YW)(ce+l.fK);const e=B?(0,y.X)(B):void 0;!function(e,t,n,a,s,r){const{mediaEl:i}=k(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),y=p+f/2-(v+P/2),S=C/Z,M=f/P,T=I(n||i);N(T,{top:`${v}px`,left:`${g}px`,width:`${Z}px`,height:`${P}px`,transform:`translate3d(${b}px, ${y}px, 0) scale(${S}, ${M})`}),w(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||Ye)&&((0,b.YW)(ce+l.fK),function(e,t,n){const{container:a,mediaEl:s}=k(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 y=document.getElementsByClassName("ghost")[0],M=y||I(t||s,e);y||N(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(y){const{top:e,left:t,width:n,height:a}=y.getBoundingClientRect();N(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"),y||document.body.appendChild(M),requestAnimationFrame((()=>{y&&(y.style.transition=""),M.style.transform="",b&&(M.style.opacity="0"),w(M,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(M)&&document.body.removeChild(M),document.body.classList.remove("ghost-animating")}))}),200+l.fK)}))}))}(Xe,_e,ze||void 0))}),[Ee,Y,m,Xe,B,ze,Ye,De,_e,Ge,te]),(0,a.d4)((()=>{let e;return Ie?ye(!0):e=window.setTimeout((()=>{ye(!1)}),ce),()=>{e&&window.clearTimeout(e)}}),[Ie]);const He=()=>{Se(!1),ke(1),Me({x:0,y:0})},je=(0,a.I4)((()=>{Se(!Ie),ke(Ie?1:1.5),Ie&&Me({x:0,y:0})}),[Ie]),Ve=(0,a.I4)(((e,t=!1)=>{ke(e),1===e&&t&&He()}),[]),Ke=(0,a.I4)((()=>{O(),He()}),[O]),qe=(0,a.I4)((()=>{Ke(),J({chatId:e,threadId:t,messageId:n})}),[Ke,e,t,J,n]),We=(0,a.I4)((()=>{G({fromChatId:e,messageIds:[n]}),He()}),[G,e,n]);(0,a.d4)((()=>Y?(0,P.Z)((()=>{Ie?He():Ke()})):void 0),[Ke,Y,Ie]),(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||x({chatId:e,threadId:t,messageId:n?Qe(n,-1):void 0,origin:m})}),[e,t,Qe,he,n,x,m]),tt=(0,a.I4)((()=>{Ze||x({chatId:e,threadId:t,messageId:n?Qe(n,1):void 0,origin:m})}),[e,t,Qe,Ze,n,x,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:()=>{Ie||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,ne,Ie,tt,et]);const nt=(0,a.I4)(((e,t)=>{Me({x:e,y:t})}),[]),at=(0,a.I4)((()=>{i.$b&&(ne||re)&&fe(!Ce)}),[Ce,re,ne]),st=(0,M.Z)();function rt(t){if(oe)return a.ZP.createElement("div",{key:e,className:"media-viewer-content"},de(Re||Le,(0,d.PA)(d.vY,!1),!i.wB&&!Ie));if(B){const e=(0,y.X)(B),s=Boolean(e);return a.ZP.createElement("div",{key:n,className:"media-viewer-content "+(s?"has-footer":""),onClick:at},ne&&de($e||Re||Le||Fe,B&&(0,d.PA)(Ge,s),!i.wB&&!Ie),te&&a.ZP.createElement(ae,{key:n,url:$e||Re,isGif:re,posterData:De,posterSize:B&&(0,d.PA)(Ge,s,!0),downloadProgress:Be,fileSize:xe,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,O,x,{chatId:e,threadId:t,messageId:n,origin:m,avatarOwnerId:h&&h.id}),a.ZP.createElement(A.Z,{id:"MediaViewer",className:Ie?"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(z,{mediaData:Re||Le,isVideo:te,isZoomed:Ie,message:B,fileName:Oe,onCloseMediaViewer:Ke,onForward:We,onZoomToggle:je,isAvatar:oe})),a.ZP.createElement(ie,{noWrap:!be,canPan:Ie,panDeltaX:we.x,panDeltaY:we.y,zoomLevel:Ne,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(se,{isShown:Ie,onChangeZoom:Ve}))))})));var ue=n(5765),he=n(7407),Ze=n(2313),Pe=n(4288),ge=n(3103),ve=n(7687),pe=n(1273),Ee=n(1876),Ce=n(6058),fe=n(8799);const be=(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:c,exitForwardMode:d,loadMoreChats:m})=>{const[Z,P]=(0,a.eJ)(""),g=(0,a.sO)(null),v=(0,M.Z)();(0,a.d4)((()=>{l?i.wB||setTimeout((()=>{requestAnimationFrame((()=>{g.current&&g.current.focus()}))}),500):(g.current&&g.current.blur(),setTimeout((()=>{P("")}),300))}),[l]);const p=(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,ue.Z)((0,u.U)(v,e[t],void 0,t===o),Z))}))],e,void 0,l)}),[n,s,e,o,Z,v,t]),[E,C]=(0,he.Z)(m,p,Boolean(Z)),f=(0,a.I4)((e=>{P(e.currentTarget.value)}),[]),b=(0,a.sO)(null),y=(0,Ze.Z)(b,l,(e=>{E&&E.length>0&&c({id:E[-1===e?0:e]})}),".ListItem-button",!0),I=a.ZP.createElement("div",{className:"modal-header",dir:v.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:v("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(ve.Z,{ref:g,value:Z,onChange:f,onKeyDown:y,placeholder:v("ForwardTo")}));return a.ZP.createElement(ge.Z,{isOpen:l,onClose:d,className:"ForwardPicker",header:I},null!=E&&E.length?a.ZP.createElement(pe.Z,{className:"picker-list custom-scroll",items:E,onLoadMore:C,noScrollRestore:Boolean(Z),ref:b,onKeyDown:y},E.map((e=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable force-rounded-corners",onClick:()=>c({id:e})},(0,u.YA)(e)?a.ZP.createElement(Ce.Z,{status:e===o?v("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(fe.Z,{chatId:e}))))):E&&!E.length?a.ZP.createElement("p",{className:"no-results"},"Sorry, nothing found."):a.ZP.createElement(Pe.Z,null))})));var ye=n(1947);function Ie(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Se=(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:Ie(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 we=n(8360),Me=n(7551);const Te=(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,we.Z)(e);return a.ZP.createElement(Me.Z,{isOpen:Boolean(e),onClose:r,title:n("OpenUrlTitle"),textParts:(0,$.Z)(n("OpenUrlAlert2",o),["links"]),confirmLabel:n("OpenUrlTitle"),confirmHandler:s})})));var Fe=n(706);const Ae=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function Le(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 Re(e){return String(e).padStart(2,"0")}function Be(e,t,n){return`${e}-${t+1}-${n}`}const $e=(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,Fe.Z)(!1),[C,b]=(0,a.eJ)(Z),[y,I]=(0,a.eJ)(new Date(C.getFullYear(),C.getMonth(),1)),[S,N]=(0,a.eJ)(Re(Z.getHours())),[k,w]=(0,a.eJ)(Re(Z.getMinutes())),T=Be(C.getFullYear(),C.getMonth(),C.getDate()),F=y.getFullYear(),A=y.getMonth();(0,a.d4)((()=>{!g&&r&&(b(Z),I(new Date(Z.getFullYear(),Z.getMonth(),1)))}),[Z,r,g]),(0,a.d4)((()=>{n&&!v&&C.getTime()<Z.getTime()&&(b(Z),N(Re(Z.getHours())),w(Re(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:x}=(0,a.Ye)((()=>function(e,t){const n=[],a=[],s=[],r=new Date;r.setDate(1),r.setMonth(t),r.setFullYear(e);const o=r.getDay(),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]),O=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return N(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(C.getTime());a.setHours(n),b(a);const s=Re(n);N(s),e.target.value=s}),[C]),G=(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),59)),a=new Date(C.getTime());a.setMinutes(n),b(a);const s=Re(n);w(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(){I((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(){I((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"},Ae.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,Y.Z)("day-button",Le(F,A,e,n?h:void 0,s?h:P)?"disabled":e?"clickable":"",T===Be(F,A,e)&&"selected")},!!e&&a.ZP.createElement("span",null,e)))),x.map((e=>a.ZP.createElement("div",{className:"day-button disabled"},a.ZP.createElement("span",null,e)))))),o&&a.ZP.createElement("div",{className:"timepicker"},a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:S,onChange:O,onFocus:p,onBlur:E}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:k,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("Conversation.ScheduleMessage.SendOn",[n,(0,B.mr)(t)])}(u,C):l),i&&a.ZP.createElement(R.Z,{onClick:m,isText:!0},i)))})),De=(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($e,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:o("JumpToDate"),onClose:s,onSubmit:r})}))),Ue=(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.YA)(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.YA)(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.YA)(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")))}))),Oe=(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 Ge=n(517);const Je=(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.YA)(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 ze=n(4434);const Xe=(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(ze.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),{messageIds:s}=e.selectedMessages||{};return{isSchedule:"scheduled"===t,selectedMessagesCount:(0,m.D7)(e),canDeleteMessages:n,canReportMessages:a,selectedMessageIds:s}}),((e,t)=>(0,h.ei)(t,["exitMessageSelectMode","openForwardMenuForSelectedMessages"])))((({canPost:e,isActive:t,messageListType:n,isSchedule:s,selectedMessagesCount:r,canDeleteMessages:o,canReportMessages:l,selectedMessageIds:i,exitMessageSelectMode:c,openForwardMenuForSelectedMessages:d})=>{const[m,u,h]=(0,Fe.Z)(),[Z,P,g]=(0,Fe.Z)();(0,a.d4)((()=>!t||m||Z?void 0:(0,Ge.Z)({onBackspace:u,onDelete:u,onEsc:c})),[t,m,Z,u,c]);const v=(0,f.Z)(r||void 0,!0),p=t?r:v,E=(0,M.Z)(),C=E("VoiceOver.Chat.MessagesSelected",p,"i"),b=(0,Y.Z)("MessageSelectToolbar",e&&"with-composer",t&&"shown");return a.ZP.createElement("div",{className:b},a.ZP.createElement("div",{className:"MessageSelectToolbar-inner"},a.ZP.createElement(R.Z,{color:"translucent",round:!0,onClick:c,ariaLabel:"Exit select mode"},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("span",{className:"MessageSelectToolbar-count",title:C},C),!!r&&a.ZP.createElement("div",{className:"MessageSelectToolbar-actions"},"scheduled"!==n&&a.ZP.createElement(G.Z,{icon:"forward",ariaLabel:"Forward Messages",onClick:d},a.ZP.createElement("span",{className:"item-text"},E("Forward"))),l&&a.ZP.createElement(G.Z,{icon:"flag",onClick:P,disabled:!l,ariaLabel:E("Conversation.ReportMessages")},a.ZP.createElement("span",{className:"item-text"},E("Report"))),a.ZP.createElement(G.Z,{destructive:!0,icon:"delete",onClick:u,disabled:!o,ariaLabel:E("EditAdminGroupDeleteMessages")},a.ZP.createElement("span",{className:"item-text"},E("Delete"))))),a.ZP.createElement(Je,{isOpen:m,isSchedule:s,onClose:h}),a.ZP.createElement(Xe,{isOpen:Z,onClose:g,messageIds:i}))})));var _e=n(3133),He=n(735),je=n(1470);const Ve=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 Ke=n(329),qe=n(742);const We=(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,Fe.Z)(),[m,h,Z]=(0,Fe.Z)(),P=(0,je.Z)({chat:t,privateChatUser:n,isPinned:s,isMuted:r,handleDelete:c,handleChatFolderChange:h},!0),g=()=>{l(e)},v=Ve(g);if(t)return a.ZP.createElement(Ee.Z,{className:"chat-item-clickable search-result",onClick:g,contextActions:P,buttonRef:v},(0,u.YA)(e)?a.ZP.createElement(Ce.Z,{userId:e,withUsername:o,avatarSize:"large"}):a.ZP.createElement(fe.Z,{chatId:e,withUsername:o,avatarSize:"large"}),a.ZP.createElement(Ke.Z,{isOpen:i,onClose:d,chat:t}),a.ZP.createElement(qe.Z,{isOpen:m,onClose:Z,chatId:e}))})));var Qe=n(8781);const et=(0,X.P2)((e=>e()),6e4,!0),tt=(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)((()=>{et((()=>{r(),o()}))}),[r,o]),(0,Qe.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(We,{chatId:e,onClick:m})))))})));var nt=n(9411),at=n(8033);const st=(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=Ve(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(nt.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(at.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)))))}))),rt=(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 ot=n(7262),lt=n(9187);const it=(0,X.P2)((e=>e()),500,!0),ct=(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:y,searchMessagesGlobal:I,setGlobalSearchChatId:S})=>{const N=(0,M.Z)(),[k,w]=(0,a.eJ)(!1),[T,F]=(0,a.eJ)(!1),A=(0,a.I4)((({direction:t})=>{E&&t===o.Uq.Backwards&&it((()=>{I({type:"text",query:e})}))}),[E,I,e]),L=(0,a.I4)((e=>{b({id:e,shouldReplaceHistory:!0}),e!==s&&y({id:e}),i.wB||C()}),[s,b,y,C]),R=(0,a.I4)((e=>{S({id:e})}),[S]),B=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return He.D;const t=r?r.filter((t=>{const n=v[t];if(!n)return!1;const a=(0,u.Js)(n);return a&&(0,ue.Z)(a,e)||(0,ue.Z)(n.username,e)})):[];return[...s&&(0,ue.Z)(N("SavedMessages"),e)?[s]:[],...(0,u.ih)((0,h.Tw)([...t,...l||[],...c||[]]),g)]}),[e,r,s,N,l,c,g,v]),$=(0,a.Ye)((()=>!e||e.length<4||!d||!m?He.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("_").map(Number);return null==P||null===(t=P[n])||void 0===t?void 0:t.byId[a]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):He.D),[Z,P,e,t]),U=(0,a.I4)((()=>{w(!k)}),[k]),x=(0,a.I4)((()=>{F(!T)}),[T]),O=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(rt,{searchDate:n,onSelect:f})),O&&a.ZP.createElement(ot.Z,{text:N("ChatList.Search.NoResults"),description:N("ChatList.Search.NoResultsDescription")}),!!B.length&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:N.isRtl?"rtl":void 0},B.map((e=>a.ZP.createElement(lt.Z,{chatOrUserId:e,onClick:R,clickArg:e})))),!!B.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:N.isRtl?"auto":void 0},B.length>3&&a.ZP.createElement(at.Z,{onClick:U},N(k?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),N("DialogList.SearchSectionDialogs")),B.map(((e,t)=>{if(k||!(t>=3))return a.ZP.createElement(We,{chatId:e,onClick:L})}))),!!$.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:N.isRtl?"auto":void 0},$.length>3&&a.ZP.createElement(at.Z,{onClick:x},N(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),N("DialogList.SearchSectionGlobal")),$.map(((e,t)=>{if(T||!(t>=3))return a.ZP.createElement(We,{chatId:e,withUsername:!0,onClick:L})}))),!!D.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:N.isRtl?"auto":void 0},N("SearchMessages")),D.map((function(t){const n=(0,u.MK)(N,t),s=g[t.chatId];if(n&&s)return a.ZP.createElement(st,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(tt,{onReset:C})}))),dt=(0,X.P2)((e=>e()),500,!0),mt=(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&&dt((()=>{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("_").map(Number);return null==r||null===(t=r[n])||void 0===t?void 0:t.byId[a]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):He.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(rt,{searchDate:n,onSelect:m})),g&&a.ZP.createElement(ot.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(st,{chatId:t.chatId,message:t,searchQuery:e})}))))})));function ut(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;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,lastSyncTime:t.lastSyncTime}}}var ht=n(7891),Zt=n(3709);const Pt="media",gt=(0,X.P2)((e=>e()),500,!0),vt=(0,a.X$)((0,s.c$)(ut(Pt),((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&>((()=>{c({type:Pt,query:e,chatId:t})}))}),[i,c,e,t]),h=(0,a.Ye)((()=>r&&s?r.map((e=>{var t;const[n,a]=e.split("_").map(Number);return null===(t=s[n])||void 0===t?void 0:t.byId[a]})).filter(Boolean):He.D),[s,r]),Z=(0,a.I4)(((e,t)=>{d({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[d]),P=(0,ht.Z)([e],l.Y)&&!n,g=P&&r&&r.length>0&&!e,v=P&&r&&r.length>0&&e,p=(0,Y.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(ot.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(Zt.Z,{key:e.id,idPrefix:"search-media",message:e,onClick:Z})))),v&&h.map((e=>a.ZP.createElement(st,{key:e.id,chatId:e.chatId,message:e})))))})));var pt=n(91),Et=n(5418);const Ct="links",ft=(0,X.P2)((e=>e()),500,!0),bt=(0,a.X$)((0,s.c$)(ut(Ct),((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&&ft((()=>{m({type:Ct,query:e,chatId:t})}))}),[d,m,e,t]),P=(0,a.Ye)((()=>c&&i?c.map((e=>{var t;const[n,a]=e.split("_").map(Number);return null===(t=i[n])||void 0===t?void 0:t.byId[a]})).filter(Boolean):He.D),[i,c]),g=(0,a.I4)(((e,t)=>{u({chatId:t,messageId:e})}),[u]),v=(0,ht.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(ot.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(Et.Z,{key:e.id,message:e,senderTitle:(0,pt.F)(h,e,s,r),onMessageClick:g}))}))))})));var yt=n(2535);const It="documents",St=(0,X.P2)((e=>e()),500,!0),Nt=(0,a.X$)((0,s.c$)(ut(It),((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:h})=>{const Z=(0,M.Z)(),P=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&St((()=>{m({type:It,query:e,chatId:t})}))}),[d,m,e,t]),g=(0,a.Ye)((()=>c&&i?c.map((e=>{var t;const[n,a]=e.split("_").map(Number),s=null===(t=i[n])||void 0===t?void 0:t.byId[a];return s&&(0,u.aE)(s)?s:void 0})).filter(Boolean):He.D),[i,c]),v=(0,a.I4)(((e,t)=>{h({chatId:t,messageId:e})}),[h]),p=(0,ht.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:g,onLoadMore:P,noFastList:!0},!p&&a.ZP.createElement(Pe.Z,null),p&&(!c||0===c.length)&&a.ZP.createElement(ot.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),p&&c&&c.length>0&&g.map(((e,t)=>{const n=0===t||(0,B.kj)(e.date)!==(0,B.kj)(g[t-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:e.id},n&&a.ZP.createElement("p",{className:"section-heading"},(0,B.np)(Z,new Date(1e3*e.date))),a.ZP.createElement(yt.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,pt.F)(Z,e,s,r),className:"scroll-item",onDateClick:v}))}))))})));var kt=n(4752);const wt=(0,X.P2)((e=>e()),500,!0),Mt=(0,a.X$)((0,s.c$)(ut("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,searchMessagesGlobal:h,focusMessage:Z,openAudioPlayer:P})=>{const g=(0,M.Z)(),v=t?"voice":"audio",p=(0,a.I4)((({direction:e})=>{u&&e===o.Uq.Backwards&&wt((()=>{h({type:v,query:n,chatId:s})}))}),[v,u,h,n,s]),E=(0,a.Ye)((()=>m&&d?m.map((e=>{var t;const[n,a]=e.split("_").map(Number);return null===(t=d[n])||void 0===t?void 0:t.byId[a]})).filter(Boolean):He.D),[d,m]),C=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),f=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e,origin:o.Cr.Search})}),[P]),b=(0,ht.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:E,onLoadMore:p,noFastList:!0},!b&&a.ZP.createElement(Pe.Z,null),b&&(!m||0===m.length)&&a.ZP.createElement(ot.Z,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),b&&m&&m.length>0&&E.map(((t,n)=>{const s=0===n||(0,B.kj)(t.date)!==(0,B.kj)(E[n-1].date);return a.ZP.createElement("div",{className:"ListItem small-icon",key:t.id},s&&a.ZP.createElement("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0},(0,B.np)(g,new Date(1e3*t.date))),a.ZP.createElement(kt.Z,{key:t.id,theme:e,message:t,origin:o.Cr.Search,senderTitle:(0,pt.F)(g,t,i,c),date:t.date,lastSyncTime:u,className:"scroll-item",onPlay:f,onDateClick:C}))}))))}))),Tt=[{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"}],Ft=[{type:o.nJ.ChatList,title:"All Messages"},...Tt.slice(1)],At=Object.keys(o.nJ).length/2,Lt=(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=Tt[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,Ze.Z)(g,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:g,onKeyDown:v},a.ZP.createElement(_e.Z,{activeTab:m,tabs:r?Ft:Tt,onSwitchTab:Z}),a.ZP.createElement(L.Z,{name:d.isRtl?"slide-reversed":"slide",renderCount:At,activeKey:s},(()=>{switch(s){case o.nJ.ChatList:return r?a.ZP.createElement(mt,{searchQuery:e,dateSearchQuery:h,onReset:c,onSearchDateSelect:P}):a.ZP.createElement(ct,{searchQuery:e,searchDate:t,dateSearchQuery:h,onReset:c,onSearchDateSelect:P});case o.nJ.Media:return a.ZP.createElement(vt,{searchQuery:e});case o.nJ.Links:return a.ZP.createElement(bt,{searchQuery:e});case o.nJ.Files:return a.ZP.createElement(Nt,{searchQuery:e});case o.nJ.Music:return a.ZP.createElement(Mt,{key:"audio",searchQuery:e});case o.nJ.Voice:return a.ZP.createElement(Mt,{key:"voice",isVoice:!0,searchQuery:e});default:return}})))})));var Rt=n(1090);const Bt={currentPassword:"",password:"",hint:"",email:""},$t=(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 Bt;default:return e}},Dt=(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.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(G.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(G.Z,{icon:"logout",onClick:Z},f("LogOutTitle"))))}}(),a.ZP.createElement(Me.Z,{isOpen:d,onClose:P,text:f("lng_sure_logout"),confirmLabel:f("AccountSettings.Logout"),confirmHandler:p,confirmIsDestructive:!0}),a.ZP.createElement(Me.Z,{isOpen:u,onClose:v,text:f("FilterDeleteAlert"),confirmLabel:f("Delete"),confirmHandler:E,confirmIsDestructive:!0}))})));var Ut=n(787),xt=n(180);const Ot=(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(Ut.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:"folder",onClick:()=>t(o.MT.Folders)},i("Filters")),a.ZP.createElement(Ee.Z,{icon:"language",onClick:()=>t(o.MT.Language)},i("Language"))))})));var Gt=n(710),Jt=n(1151);const zt="https://t.me/",Xt=/https:\/\/t\.me\/?/i,Yt=/^([a-zA-Z0-9_]+)$/,_t=(0,X.Ds)((e=>e()),250,!1),Ht=(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(Xt,"");i(n),e.target.value=`${t?zt:""}${n}`;const a=function(e){return e.length>=5&&e.length<=32&&Yt.test(e)}(n);a&&_t((()=>{r({username:n})})),o&&o(!!a&&n)}),[t,r,o]);return a.ZP.createElement(ve.Z,{value:`${t?zt:""}${l}`,onChange:Z,label:m,error:h,success:u,readOnly:n})})),jt=(0,X.P2)((e=>e()),6e4,!0),Vt="Please provide your first name",Kt="Bio can' be longer than 70 characters",qt=(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,y]=(0,a.eJ)(),[I,S]=(0,a.eJ)(),[N,k]=(0,a.eJ)(l||""),[w,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),x=m===o.rN.InProgress,O=!1===B,G=(0,a.Ye)((()=>!O&&(Boolean(I)||C||!0===u)),[I,C,O,u]);(0,T.ZP)(e,n,t,o.MT.EditProfile),(0,a.d4)((()=>{jt((()=>{h()}))}),[h]),(0,a.d4)((()=>{S(void 0)}),[U]),(0,a.d4)((()=>{k(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),y(void 0))}),[m]);const J=(0,a.I4)((e=>{S(e)}),[]),z=(0,a.I4)((e=>{k(e.target.value),f(!0)}),[]),X=(0,a.I4)((e=>{A(e.target.value),f(!0)}),[]),Y=(0,a.I4)((e=>{R(e.target.value),f(!0)}),[]),_=(0,a.I4)((e=>{D(e),E(!0)}),[]),H=(0,a.I4)((()=>{const e=N.trim(),t=w.trim(),n=L.trim();e.length?n.length>70?y(Kt):Z({photo:I,...C&&{firstName:e,lastName:t,bio:n},...v&&{username:B}}):y(Vt)}),[I,N,w,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(Gt.Z,{currentAvatarBlobUrl:U,onChange:J,title:"Edit your profile photo",disabled:x}),a.ZP.createElement(ve.Z,{value:N,onChange:z,label:g("FirstName"),disabled:x,error:b===Vt?b:void 0}),a.ZP.createElement(ve.Z,{value:w,onChange:X,label:g("LastName"),disabled:x}),a.ZP.createElement(ve.Z,{value:L,onChange:Y,label:g("UserBio"),disabled:x,error:b===Kt?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(Ht,{currentUsername:B||"",isLoading:x,isUsernameAvailable:u,checkUsername:P,onChange:_}),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(Jt.Z,{isShown:G,onClick:H,disabled:x,ariaLabel:"Save changes"},x?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var Wt=n(7324),Qt=n(7799);const en=(0,X.P2)((e=>e()),6e4,!0),tn=(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),y=(0,a.I4)((()=>b(!0)),[]);(0,a.d4)((()=>{E||(0,Wt.Z)("FoldersAll").then(C)}),[E]),(0,a.d4)((()=>{en((()=>{g()}))}),[g]);const I=(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 N=(0,a.Ye)((()=>{if(!d)return;const e=Object.keys(i).map(Number);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]),k=(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(Qt.Z,{id:"settingsFoldersMain",size:l.ku,animationData:E,play:f,noLoop:!0,onLoad:y})),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:I,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!=N&&N.length?N.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)))):N&&!N.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:()=>k(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 nn=n(3455);const an=({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)},sn="Please provide a title for this folder.",rn="ChatList.Filter.Error.Empty",on=(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)),[]),[y,I]=(0,a.eJ)(!1),[S,N]=(0,a.eJ)(!1),{selectedChatIds:k,selectedChatTypes:w}=(0,nn.vb)(e,"included"),{selectedChatIds:A,selectedChatTypes:L}=(0,nn.vb)(e,"excluded");(0,a.d4)((()=>{p||(0,Wt.Z)("FoldersNew").then(E)}),[p]),(0,a.d4)((()=>{I(!1),N(!1)}),[e.folderId]);const[R,B]=(0,a.Ye)((()=>{const e=new Set([...m||[],...Z||[]]),t=(0,h.eL)(k,e),n=(0,h.eL)(A,e);return[y?t:t.slice(0,5-w.length),S?n:n.slice(0,5-L.length)]}),[A,k,w,L,S,y,m,Z]);(0,a.d4)((()=>{(R.length<k.length||B.length<A.length)&&v({listType:"active"})}),[v,A.length,k.length,B.length,R.length]);const $=(0,M.Z)();function D(e){const t="included"===e?w:L,n="included"===e?R:B,s="included"===e?y:S,r=("included"===e?k:A).length-t.length-n.length,o="included"===e?()=>I(!0):()=>N(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?nn.fi.find((({key:t})=>t===e)):nn.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.YA)(e)?a.ZP.createElement(Ce.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(fe.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(an,{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(Qt.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===sn?sn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===rn&&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(Jt.Z,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:n}=e.folder;n?k.length||Object.keys(w).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:rn}):t({type:"setError",payload:sn})},ariaLabel:"edit"===e.mode?"Save changes":"Create folder"},e.isLoading?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var ln=n(4605);const cn=(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?nn.fi:nn.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,he.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(lt.Z,{icon:t.icon,title:p(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(lt.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(ln.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.YA)(e)?a.ZP.createElement(Ce.Z,{userId:e}):a.ZP.createElement(fe.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(ln.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"})))})),dn=(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,nn.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,ue.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]),y=(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(cn,{mode:s,chatIds:C,selectedIds:g,selectedChatTypes:v,filterValue:P,onSelectedIdsChange:b,onSelectedChatTypesChange:y,onFilterChange:f,onLoadMore:Z}):a.ZP.createElement(Pe.Z,null)}))),mn=(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(tn,{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(on,{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(dn,{mode:"included",state:n,dispatch:s,onReset:c,onScreenSelect:l,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(dn,{mode:"excluded",state:n,dispatch:s,onReset:c,onScreenSelect:l,isActive:r});default:return}}));var un=n(3657);const hn=(0,a.X$)((({options:e,range:t,label:n,value:s,disabled:r,onChange:o})=>{const l=(0,M.Z)(),i=(0,a.I4)((e=>{o(Number(e.currentTarget.value))}),[o]),c=(0,Y.Z)("RangeSlider",r&&"disabled"),d=(0,a.Ye)((()=>{if(e)return s/(e.length-1)*100;if(t){const e=(t.max-t.min)/(t.step||1);return(s-t.min)/e*100}return 0}),[s,e,t]),[m,u,h]=(0,a.Ye)((()=>e?[0,e.length-1,1]:t?[t.min,t.max,t.step||1]:[0,0,0]),[t,e]);return a.ZP.createElement("div",{className:c},n&&a.ZP.createElement("div",{className:"slider-top-row",dir:l.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"label",dir:"auto"},n),t&&a.ZP.createElement("span",{className:"value",dir:"auto"},s)),a.ZP.createElement("div",{className:"slider-main"},a.ZP.createElement("div",{className:"slider-fill-track",style:`width: ${d}%`}),a.ZP.createElement("input",{min:m,max:u,value:s,step:h,type:"range",onChange:i}),e&&a.ZP.createElement("div",{className:"slider-options"},e.map(((e,t)=>a.ZP.createElement("div",{className:(0,Y.Z)("slider-option no-selection",t===s&&"active"),onClick:()=>o(t)},e))))))}));var Zn=n(8835),Pn=n(2155);const gn=(0,a.X$)((({size:e=l.DC,stickerSet:t,observeIntersection:n})=>{const s=(0,a.sO)(null),o=(0,un.Op)(s,n),i=`stickerSet${t.id}`,c=(0,p.Z)(i,!o,r.IU.Lottie),{shouldRenderFullMedia:d,transitionClassNames:m}=(0,Zn.Z)(c,"slow");return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},!d&&(0,Pn.Xv)(t.title,2),d&&c&&a.ZP.createElement(Qt.Z,{id:i,size:e,animationData:c,className:m}))})),vn=(0,a.X$)((({stickerSet:e,observeIntersection:t})=>{const n=(0,a.sO)(null),s=(0,un.Op)(n,t),r=(0,p.Z)(e.hasThumbnail&&`stickerSet${e.id}`,!s),{shouldRenderFullMedia:o,transitionClassNames:l}=(0,Zn.Z)(r,"slow");return a.ZP.createElement("div",{ref:n,className:"sticker-set-cover"},!o&&(0,Pn.Xv)(e.title,2),o&&a.ZP.createElement("img",{src:r,className:l,alt:""}))}));var pn=n(3547);const En=(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(gn,{size:l.Mw,stickerSet:e,observeIntersection:t}):a.ZP.createElement(vn,{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(pn.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 Cn=n(4851);const fn=["Solid and Steady","Nice and Fast","Lots of Stuff"],bn=(0,a.X$)((0,s.c$)((e=>({...(0,h.ei)(e.settings.byKey,["messageTextSize","animationLevel","messageSendKeyCombo","shouldAutoDownloadMediaFromContacts","shouldAutoDownloadMediaInPrivateChats","shouldAutoDownloadMediaInGroups","shouldAutoDownloadMediaInChannels","shouldAutoPlayGifs","shouldAutoPlayVideos","shouldSuggestStickers","shouldLoopStickers","isSensitiveEnabled","canChangeSensitive"]),stickerSetIds:e.stickers.added.setIds,stickerSetsById:e.stickers.setsById})),((e,t)=>(0,h.ei)(t,["setSettingOption","loadStickerSets","loadAddedStickers"])))((({isActive:e,onScreenSelect:t,onReset:n,stickerSetIds:s,stickerSetsById:r,messageTextSize:l,animationLevel:c,messageSendKeyCombo:d,shouldAutoDownloadMediaFromContacts:m,shouldAutoDownloadMediaInPrivateChats:u,shouldAutoDownloadMediaInGroups:h,shouldAutoDownloadMediaInChannels:Z,shouldAutoPlayGifs:P,shouldAutoPlayVideos:g,shouldSuggestStickers:v,shouldLoopStickers:p,setSettingOption:E,loadStickerSets:C,loadAddedStickers:f})=>{const b=(0,a.sO)(null),{observe:y}=(0,un.S1)({rootRef:b}),[I,S,N]=(0,Fe.Z)(),[k,w]=(0,a.eJ)(),F=(0,M.Z)(),A=i.$b?void 0:[{value:"enter",label:F("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:F(i.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];(0,a.d4)((()=>{C()}),[C]),(0,a.d4)((()=>{null!=s&&s.length&&f()}),[s,f]);const L=(0,a.I4)((e=>{fn.forEach(((t,n)=>{document.body.classList.toggle(`animation-level-${n}`,e===n)})),E({animationLevel:e})}),[E]),R=(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()),E({messageTextSize:e})}),[E]),B=(0,a.I4)((e=>{w(e),S()}),[S]),$=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:F.isRtl?"rtl":void 0},F("SETTINGS")),a.ZP.createElement(hn,{label:F("TextSize"),range:{min:12,max:20},value:l,onChange:R}),a.ZP.createElement(Ee.Z,{icon:"photo",onClick:()=>t(o.MT.GeneralChatBackground)},F("ChatBackground"))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},"Animation Level"),a.ZP.createElement("p",{className:"settings-item-description",dir:F.isRtl?"rtl":void 0},"Choose the desired animations amount."),a.ZP.createElement(hn,{options:fn,value:c,onChange:L})),A&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("VoiceOver.Keyboard")),a.ZP.createElement(ze.Z,{name:"keyboard-send-settings",options:A,onChange:e=>E({messageSendKeyCombo:e}),selected:d})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("AutoDownloadMedia")),a.ZP.createElement(ln.Z,{label:F("Contacts"),checked:m,onCheck:e=>E({shouldAutoDownloadMediaFromContacts:e})}),a.ZP.createElement(ln.Z,{label:F("AutodownloadPrivateChats"),checked:u,onCheck:e=>E({shouldAutoDownloadMediaInPrivateChats:e})}),a.ZP.createElement(ln.Z,{label:F("AutodownloadGroupChats"),checked:h,onCheck:e=>E({shouldAutoDownloadMediaInGroups:e})}),a.ZP.createElement(ln.Z,{label:F("FilterChannels"),checked:Z,onCheck:e=>E({shouldAutoDownloadMediaInChannels:e})})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("AutoplayMedia")),a.ZP.createElement(ln.Z,{label:F("GifsTab2"),checked:P,onCheck:e=>E({shouldAutoPlayGifs:e})}),a.ZP.createElement(ln.Z,{label:F("DataAndStorage.Autoplay.Videos"),checked:g,onCheck:e=>E({shouldAutoPlayVideos:e})})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:F.isRtl?"rtl":void 0},F("AccDescrStickers")),a.ZP.createElement(ln.Z,{label:F("SuggestStickers"),checked:v,onCheck:e=>E({shouldSuggestStickers:e})}),a.ZP.createElement(ln.Z,{label:F("LoopAnimatedStickers"),checked:p,onCheck:e=>E({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:b},$&&$.map((e=>a.ZP.createElement(En,{key:e.id,stickerSet:e,observeIntersection:y,onClick:B})))),k&&a.ZP.createElement(Cn.Z,{isOpen:I,fromSticker:k,onClose:N})))})));let yn;function In(e="*",t,n=!1){yn||(yn=document.createElement("input"),yn.setAttribute("type","file")),yn.setAttribute("accept",e),n?yn.removeAttribute("multiple"):yn.setAttribute("multiple","multiple"),yn.onchange=null,yn.value="",yn.onchange=t,yn.click()}var Sn=n(1394);function Nn(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function kn(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 wn([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 Mn([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 Tn(e){let[t,n,a]=wn(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 Fn=n(9524),An=n(5866);const Ln=(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,An.Z)(null===(r=c.thumbnail)||void 0===r?void 0:r.dataUri,Boolean(u),!0),{shouldRenderThumb:Z,shouldRenderFullMedia:P,transitionClassNames:g}=(0,Zn.Z)(u||m,"slow"),[v,C]=(0,a.eJ)(!1),{mediaData:b,downloadProgress:y}=(0,E.Z)(d,!v),I=!1===(0,f.Z)(v),{shouldRender:S,transitionClassNames:N}=(0,H.Z)(v&&!b||i===o.mp,void 0,I,"slow"),k=(0,a.sO)();k.current=t;const w=(0,a.I4)((()=>{(async()=>{const e=await(0,Sn.gm)(b);await Fn.save(l.fo,k.current,e),s(i)})()}),[b,s,i]);(0,a.d4)((()=>{b&&w()}),[b,w]);const M=(0,a.I4)((()=>{b?w():C((e=>!e))}),[b,w]),T=(0,Y.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:T,onClick:M},a.ZP.createElement("div",{className:"media-inner"},Z&&a.ZP.createElement("canvas",{ref:h,className:"thumbnail"}),P&&a.ZP.createElement("img",{src:u||m,className:`full-media ${g}`,alt:""}),S&&a.ZP.createElement("div",{className:(0,Y.Z)("spinner-container",N)},a.ZP.createElement(J.Z,{progress:y,onClick:M}))))})),Rn=(0,X.P2)((e=>e()),6e4,!0),Bn=(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)((()=>{Rn((()=>{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)((()=>{In("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,Sn.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=Tn(e),n=`#${kn(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(ln.Z,{label:C("BackgroundBlurred"),checked:Boolean(r),onChange:E})),i?a.ZP.createElement("div",{className:"settings-wallpapers"},i.map((e=>a.ZP.createElement(Ln,{wallpaper:e,theme:c,isSelected:s===e.slug,onClick:p})))):a.ZP.createElement(Pe.Z,null))}))),$n=wn(Nn("e6ebee")),Dn=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Un(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 xn({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 On=(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("#")?wn(Nn(e.replace("#",""))):$n}(r)),v=(0,a.sO)(P);(0,a.d4)((()=>{v.current=P}),[P]);const[p,E,C]=(0,Fe.Z)(),[f,b]=(0,a.eJ)(""),[y,I]=(0,a.eJ)(""),S=(0,a.sO)(),N=(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}=Un(v.current,S.current);return g(xn({colorPosition:n,huePosition:a},S.current)),E(),!0}function a(e){const{colorPosition:n}=Un(v.current,S.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return g(xn({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:k=[0,0],huePosition:w=0}=S.current?Un(P,S.current):{},M=kn(Mn(P)),F=P[0],A=kn(Mn([F,1,1]));(0,a.d4)((()=>{const e=Mn(P),t=`#${kn(e)}`;if(b(e.join(", ")),I(t),!u.current){const n=Tn(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=Mn([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,N,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=Mn([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(wn(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(wn(Nn(t.replace("#","")))),e.currentTarget.value=t}),[]),B=(0,a.I4)((e=>{g(wn(Nn(e.currentTarget.dataset.color.replace("#",""))))}),[]),$=(0,Y.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(${k[0]}px, ${k[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(${w}px); background-color: #${A};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(ve.Z,{value:y,label:"HEX",onChange:R}),a.ZP.createElement(ve.Z,{value:f,label:"RGB",onChange:L}))),a.ZP.createElement("div",{className:"predefined-colors"},Dn.map((e=>a.ZP.createElement("div",{className:e===`#${M}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:B})))))}))),Gn=(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(ln.Z,{label:"Web notifications",subLabel:f(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:e=>{p({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(ln.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(hn,{label:"Sound",disabled:!h,range:{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(ln.Z,{label:f("NotificationsForPrivateChats"),subLabel:f(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{E(e,"contact","silent")}}),a.ZP.createElement(ln.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(ln.Z,{label:f("NotificationsForGroups"),subLabel:f(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{E(e,"group","silent")}}),a.ZP.createElement(ln.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(ln.Z,{label:f("NotificationsForChannels"),subLabel:f(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{E(e,"broadcast","silent")}}),a.ZP.createElement(ln.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(ln.Z,{label:f("ContactJoined"),checked:m,onChange:C})))}))),Jn=(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(ln.Z,{label:C("lng_settings_sensitive_disable_filtering"),subLabel:C("lng_settings_sensitive_about"),checked:Boolean(i),disabled:!c,onCheck:E})))})));var zn=n(663);const Xn=(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,Fe.Z)();(0,a.d4)((()=>{l()}),[l]);const Z=(0,a.I4)((e=>{d(e),u(),(0,zn.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(ze.Z,{name:"keyboard-send-settings",options:P,selected:c,loadingOption:m?c:void 0,onChange:Z}):a.ZP.createElement(Pe.Z,null))})));function Yn(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 _n=(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=Yn(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]),y=(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(ze.Z,{name:`visibility-${g}`,options:Z,onChange:y,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 Hn(e){return[e.region,e.country].filter(Boolean).join(", ")}function jn(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const Vn=(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,Fe.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"},jn(p)),a.ZP.createElement("span",{className:"subtitle"},p.ip," - ",Hn(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"},jn(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",Hn(e))))})))),P&&a.ZP.createElement(Me.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 Kn=n(6272);const qn=(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,a.I4)((e=>{d({contactId:e})}),[d]),h=(0,M.Z)();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:h.isRtl?"rtl":void 0},h("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.YA)(e),i=o?r[e]:void 0,d=o?void 0:s[e],Z=(0,Y.Z)("Chat chat-item-clickable blocked-list-item small-icon",o?"private":"group");return a.ZP.createElement(Ee.Z,{key:e,className:Z,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{m(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)(h,d))||"")),(null==i?void 0:i.phoneNumber)&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,Kn.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"},"List is empty"):a.ZP.createElement(Pe.Z,{key:"loading"}))),a.ZP.createElement(Jt.Z,{isShown:!0,onClick:()=>{},className:"not-implemented",ariaLabel:"Add a blocked user"},a.ZP.createElement("i",{className:"icon-add"})))})));var Wn=n(7854);const Qn=(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(Wn.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 ea=n(3490),ta=n(9364);const na=(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(ea.Z,{isBig:!0,isPasswordVisible:P})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(ta.Z,{error:h||r,hint:c,placeholder:i,submitLabel:d||E("Next"),clearError:p,isLoading:o,isPasswordVisible:P,onChangePasswordVisibility:g,onSubmit:v})))})),aa=(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(Wn.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"))))}))),sa=i.wB?550:400,ra=(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,Fe.Z)(!1);(0,a.d4)((()=>{i.$b||setTimeout((()=>{Z.current.focus()}),sa)}),[]);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(Wn.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"))))))}))),oa=(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(Wn.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"))))}))),la=i.wB?550:400,ia=(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()}),la)}),[]);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(Wn.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)))}))),ca=(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]),y=(0,a.I4)((e=>{c({type:"setEmail",payload:e}),h({...n,email:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,h]),I=(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]),N=(0,a.I4)((()=>{m(o.MT.TwoFaChangePasswordHint)}),[m]),k=(0,a.I4)((e=>{c({type:"setHint",payload:e}),h({...n,hint:e,onSuccess:()=>{m(o.MT.TwoFaCongratulations)}})}),[c,m,n,h]),w=(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(aa,{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(na,{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(na,{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(ra,{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(ra,{icon:"email",type:"email",isLoading:r,error:l,clearError:P,placeholder:L("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:y,screen:e,onScreenSelect:m,isActive:d||[o.MT.TwoFaNewPasswordEmailCode,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaNewPasswordEmailCode:return a.ZP.createElement(ia,{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(oa,{onScreenSelect:m,isActive:d,onReset:u});case o.MT.TwoFaEnabled:return a.ZP.createElement(Qn,{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(na,{screen:e,isLoading:r,error:l,clearError:P,hint:s,onSubmit:I,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(na,{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(na,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),onSubmit:N,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(ra,{isLoading:r,error:l,clearError:P,icon:"hint",placeholder:L("PasswordHintPlaceholder"),onSubmit:k,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u,screen:e});case o.MT.TwoFaTurnOff:return a.ZP.createElement(na,{isLoading:r,error:l,clearError:P,hint:s,onSubmit:w,onScreenSelect:m,isActive:d,onReset:u,screen:e});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(na,{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(ra,{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(ia,{screen:e,isLoading:r,error:l,clearError:P,onSubmit:A,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u});default:return}})));var da=n(1820);function ma(e,t){const{privacy:n}=e.settings;switch(t){case o.MT.PrivacyPhoneNumberAllowedContacts:case o.MT.PrivacyPhoneNumberDeniedContacts:return n.phoneNumber;case o.MT.PrivacyLastSeenAllowedContacts:case o.MT.PrivacyLastSeenDeniedContacts:return n.lastSeen;case o.MT.PrivacyProfilePhotoAllowedContacts:case o.MT.PrivacyProfilePhotoDeniedContacts:return n.profilePhoto;case o.MT.PrivacyForwardingAllowedContacts:case o.MT.PrivacyForwardingDeniedContacts:return n.forwards;case o.MT.PrivacyGroupChatsDeniedContacts:case o.MT.PrivacyGroupChatsAllowedContacts:return n.chatInvite}}const ua=(0,a.X$)((0,s.c$)(((e,{screen:t})=>{const{chats:{byId:n,listIds:a,orderedPinnedIds:s},currentUserId:r}=e;return{currentUserId:r,chatsById:n,listIds:a.active,orderedPinnedIds:s.active,archivedPinnedIds:s.archived,archivedListIds:a.archived,settings:ma(e,t)}}),((e,t)=>(0,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,y]=(0,a.eJ)(v),I=(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(I)return I.filter((t=>((0,u.YA)(t.id)&&t.id!==e||(0,u.Bf)(t))&&(!p||(0,ue.Z)((0,u.U)(g,t),p)||v.includes(t.id)))).map((({id:e})=>e))}),[I,e,g,p,v]),N=(0,a.I4)((e=>{y(e),f(!0)}),[]),k=(0,a.I4)((()=>{m({privacyKey:Yn(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(da.Z,{itemIds:S||[],selectedIds:b,filterValue:p,filterPlaceholder:g(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:N,onFilterChange:E}),a.ZP.createElement(Jt.Z,{isShown:C,onClick:k,ariaLabel:g(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),ha=Object.keys(o.MT).length/2,Za=[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],Pa=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],ga=[o.MT.PrivacyBlockedUsers,o.MT.PrivacyActiveSessions],va=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],pa=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],Ea=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],Ca=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],fa=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],ba=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:s,onScreenSelect:r,onReset:l,shouldSkipTransition:c})=>{const[d,m]=(0,Rt.Z)($t,Bt),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(Dt,{currentScreen:t,onReset:u,onSaveFilter:h,onScreenSelect:r,editedFolderId:n.folderId}),function(l,i){const c={[o.MT.PrivacyPhoneNumber]:va.includes(i),[o.MT.PrivacyLastSeen]:pa.includes(i),[o.MT.PrivacyProfilePhoto]:Ea.includes(i),[o.MT.PrivacyForwarding]:Ca.includes(i),[o.MT.PrivacyGroupChats]:fa.includes(i)},h=Za.includes(i),Z=Pa.includes(i),P=ga.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(Ot,{onScreenSelect:r,isActive:e,onReset:u});case o.MT.EditProfile:return a.ZP.createElement(qt,{onScreenSelect:r,isActive:e&&l,onReset:u});case o.MT.General:return a.ZP.createElement(bn,{onScreenSelect:r,isActive:l||i===o.MT.GeneralChatBackgroundColor||i===o.MT.GeneralChatBackground||P||Z,onReset:u});case o.MT.Notifications:return a.ZP.createElement(Gn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.Privacy:return a.ZP.createElement(Jn,{onScreenSelect:r,isActive:l||P||h,onReset:u});case o.MT.Language:return a.ZP.createElement(Xn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.GeneralChatBackground:return a.ZP.createElement(Bn,{onScreenSelect:r,isActive:l||i===o.MT.GeneralChatBackgroundColor,onReset:u});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(On,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.PrivacyActiveSessions:return a.ZP.createElement(Vn,{onScreenSelect:r,isActive:l,onReset:u});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(qn,{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(_n,{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(ua,{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(ua,{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(mn,{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(ca,{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:ha},Z)})),ya=(0,X.P2)((e=>e()),6e4,!0),Ia=(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)((()=>{ya((()=>{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,ue.Z)(a,n)})):r;return(0,u.Z0)(e,s,void 0,c)}),[r,n,s,c]),[h,Z]=(0,he.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(Ce.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"}))}))),Sa=(0,X.P2)((e=>e()),6e4,!0),Na=(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)((()=>{Sa((()=>{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,ue.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(da.Z,{itemIds:f,selectedIds:n,filterValue:m,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:Z,onSelectedIdsChange:s,onFilterChange:C}),a.ZP.createElement(Jt.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"}))))}))),ka=(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,y=(0,a.I4)((e=>{const{value:t}=e.currentTarget,n=t.replace(/^\s+/,"");u(n),n!==t&&(e.currentTarget.value=n)}),[]),I=(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]),N=(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 k=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(Gt.Z,{onChange:g,title:d("AddPhoto")}),a.ZP.createElement(ve.Z,{value:m,onChange:y,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:I,label:d("DescriptionOptionalPlaceholder")}),a.ZP.createElement("p",{className:"note"},d("DescriptionInfo"))),k&&a.ZP.createElement("p",{className:"error"},k),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(Ce.Z,{userId:e}))))))),a.ZP.createElement(Jt.Z,{isShown:0!==m.length,onClick:e?N: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"})))}))),wa=Object.keys(o.du).length/2,Ma=(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:wa,activeKey:n},(s=>{switch(n){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(Na,{isChannel:t,isActive:e,selectedMemberIds:l,onSelectedMemberIdsChange:c,onNextStep:d,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(ka,{isChannel:t,isActive:s&&e,memberIds:l,onReset:r});default:return}}))}));var Ta=n(9359);const Fa=(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(Ta.Z,{folderType:"archived",isActive:e}))}));var Aa=n(1218);const La=(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))).map(Number),n=d.filter((e=>!c.includes(e))).map(Number);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(Aa.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 Ra=n(647),Ba=n(4319);function $a(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}let Da;const Ua={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},xa=e=>{const t="deltaY"in e?e.deltaY:(e=>"changedTouches"in e?e.changedTouches[0].clientY:0)(e);(!Da||!Da.contains(e.target)||Da.scrollTop<=0&&t<=0||Da.scrollTop>=Da.scrollHeight-Da.offsetHeight&&t>=0)&&e.preventDefault()};function Oa(e){Ua[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 Ga(e){Da=e,document.addEventListener("wheel",xa,{passive:!1}),document.addEventListener("touchmove",xa,{passive:!1}),document.onkeydown=Oa}function Ja(){Da=void 0,document.removeEventListener("wheel",xa),document.removeEventListener("touchmove",xa),document.onkeydown=null}var za=n(3394),Xa=n(2328);const Ya=({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,onReply:C,onEdit:f,onPin:b,onUnpin:y,onForward:I,onDelete:S,onReport:N,onFaveSticker:k,onUnfaveSticker:w,onSelect:T,onSend:F,onReschedule:A,onClose:L,onCloseAnimationEnd:R,onCopyLink:B})=>{const $=(0,a.sO)(null),D=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))&&Ba.yl,c=window.getSelection();if(i&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(l?Ra.he(l,r.IU.BlobUrl):o.blobUrl).then(Ba.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:$a(e),handler:()=>{const n=e&&c?c.toString():s;(0,Ba.TE)(n),t&&t()}})}return n&&a.push({label:"lng_context_copy_message_link",handler:()=>{n(),t&&t()}}),a}(t,L,p?B:void 0),U=(0,a.I4)((()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`)),[t.id]),x=(0,a.I4)((()=>document.querySelector(".active > .MessageList")),[]),O=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),{positionX:J,positionY:z,style:X,menuStyle:Y,withScroll:_}=(0,za.Z)(n,U,x,O,10,document.querySelector(".MiddleHeader").offsetHeight);(0,a.d4)((()=>(Ga(_?$.current:void 0),Ja)),[_]);const H=(0,M.Z)();return a.ZP.createElement(Xa.Z,{ref:$,isOpen:e,positionX:J,positionY:z,style:X,menuStyle:Y,className:"MessageContextMenu fluid",onClose:L,onCloseAnimationEnd:R},s&&a.ZP.createElement(G.Z,{icon:"send-outline",onClick:F},H("MessageScheduleSend")),o&&a.ZP.createElement(G.Z,{icon:"schedule",onClick:A},H("MessageScheduleEditTime")),l&&a.ZP.createElement(G.Z,{icon:"reply",onClick:C},H("Reply")),i&&a.ZP.createElement(G.Z,{icon:"edit",onClick:f},H("Edit")),P&&a.ZP.createElement(G.Z,{icon:"favorite",onClick:k},H("AddToFavorites")),g&&a.ZP.createElement(G.Z,{icon:"favorite",onClick:w},H("Stickers.RemoveFromFavorites")),v&&D.map((e=>a.ZP.createElement(G.Z,{key:e.label,icon:"copy",onClick:e.handler},H(e.label)))),c&&a.ZP.createElement(G.Z,{icon:"pin",onClick:b},H("DialogPin")),d&&a.ZP.createElement(G.Z,{icon:"unpin",onClick:y},H("DialogUnpin")),Z&&a.ZP.createElement(G.Z,{icon:"forward",onClick:I},H("Forward")),E&&a.ZP.createElement(G.Z,{icon:"select",onClick:T},H("Common.Select")),h&&a.ZP.createElement(G.Z,{icon:"flag",onClick:N},H("lng_context_report_msg")),m&&a.ZP.createElement(G.Z,{destructive:!0,icon:"delete",onClick:S},H("Delete")))},_a=(0,a.X$)((0,s.c$)(((e,{message:t,messageListType:n})=>{const{threadId:a}=(0,m.Bt)(e)||{},{noOptions:s,canReply:r,canPin:o,canUnpin:l,canDelete:i,canReport:c,canEdit:d,canForward:u,canFaveSticker:h,canUnfaveSticker:Z,canCopy:P,canCopyLink:g,canSelect:v}=a&&(0,m._k)(e,t,a)||{},p="pinned"===n,E="scheduled"===n;return{noOptions:s,canSendNow:E,canReschedule:E,canReply:!p&&!E&&r,canPin:!E&&o,canUnpin:!E&&l,canDelete:i,canReport:c,canEdit:!p&&d,canForward:!E&&u,canFaveSticker:!E&&h,canUnfaveSticker:!E&&Z,canCopy:P,canCopyLink:!E&&g,canSelect:v}}),((e,t)=>(0,h.ei)(t,["setReplyingToId","setEditingId","pinMessage","openForwardMenu","faveSticker","unfaveSticker","toggleMessageSelection","sendScheduledMessages","rescheduleMessage"])))((({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:y,setReplyingToId:I,setEditingId:S,pinMessage:N,openForwardMenu:k,faveSticker:w,unfaveSticker:M,toggleMessageSelection:T,sendScheduledMessages:F,rescheduleMessage:A})=>{const{transitionClassNames:L}=(0,H.Z)(e,i,void 0,!1),[R,$]=(0,a.eJ)(!0),[D,U]=(0,a.eJ)(!1),[x,O]=(0,a.eJ)(!1),[G,J]=(0,a.eJ)(!1),[z,X,Y]=(0,Fe.Z)(),_=(0,a.I4)((()=>{$(!1),U(!0)}),[]),j=(0,a.I4)((()=>{$(!1),O(!0)}),[]),V=(0,a.I4)((()=>{$(!1),l()}),[l]),K=(0,a.I4)((()=>{U(!1),l()}),[l]),q=(0,a.I4)((()=>{O(!1),l()}),[l]),W=(0,a.I4)((()=>{J(!1),l()}),[l]),Q=(0,a.I4)((()=>{Y(),l()}),[Y,l]),ee=(0,a.I4)((()=>{I({messageId:s.id}),V()}),[I,s.id,V]),te=(0,a.I4)((()=>{S({messageId:s.id}),V()}),[S,s.id,V]),ne=(0,a.I4)((()=>{$(!1),J(!0)}),[]),ae=(0,a.I4)((()=>{N({messageId:s.id,isUnpin:!0}),V()}),[N,s.id,V]),se=(0,a.I4)((()=>{if(V(),null!=r&&r.messages){const e=r.messages.map((({id:e})=>e));k({fromChatId:s.chatId,messageIds:e})}else k({fromChatId:s.chatId,messageIds:[s.id]})}),[k,s,V,r]),re=(0,a.I4)((()=>{V(),w({sticker:s.content.sticker})}),[V,s.content.sticker,w]),oe=(0,a.I4)((()=>{V(),M({sticker:s.content.sticker})}),[V,s.content.sticker,M]),le=(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};T(e),V()}),[V,s.id,T,r]),ie=(0,a.I4)((()=>{F({chatId:s.chatId,id:s.id}),V()}),[V,s.chatId,s.id,F]),ce=(0,a.I4)((()=>{$(!1),X()}),[X]),de=(0,a.I4)((e=>{A({chatId:s.chatId,messageId:s.id,scheduledAt:Math.round(e.getTime()/1e3)})}),[s.chatId,s.id,A]),me=(0,a.I4)((()=>{(0,Ba.TE)(`https://t.me/${n||`c/${Math.abs(s.chatId)}`}/${s.id}`),V()}),[n,V,s.chatId,s.id]),ue=(0,a.Ye)((()=>(r?r.messages:[s]).map((({id:e})=>e))),[r,s]);if(c)return void V();const he=new Date;return he.setFullYear(he.getFullYear()+1),a.ZP.createElement("div",{className:["ContextMenuContainer",L].join(" ")},a.ZP.createElement(Ya,{message:s,isOpen:R,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:y,onReply:ee,onEdit:te,onPin:ne,onUnpin:ae,onForward:se,onDelete:_,onReport:j,onFaveSticker:re,onUnfaveSticker:oe,onSelect:le,onSend:ie,onReschedule:ce,onClose:V,onCopyLink:me}),a.ZP.createElement(Ue,{isOpen:D,isSchedule:"scheduled"===t,onClose:K,album:r,message:s}),a.ZP.createElement(Xe,{isOpen:x,onClose:q,messageIds:ue}),a.ZP.createElement(xe,{isOpen:G,messageId:s.id,chatId:s.chatId,onClose:W}),a.ZP.createElement($e,{isOpen:z,withTimePicker:!0,selectedAt:1e3*s.date,maxAt:(0,B._F)(he),isFutureMode:!0,onClose:Q,onSubmit:de}))}))),Ha=(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,un.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(pn.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 ja=n(2898);const Va=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{var n;const a=(0,m.Z1)(e,t);return!a||a.isRestricted?{}:{chat:a,isMuted:(0,u.i4)(a,(0,m.dZ)(e),(0,m.NJ)(e)),isPrivate:(0,u.YA)(a.id),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"])))((({chatId:e,isOpen:t,anchor:n,isChannel:s,canStartBot:r,canRestartBot:o,canSubscribe:l,canSearch:c,canMute:d,canLeave:m,chat:u,isPrivate:h,isMuted:Z,canDeleteChat:P,hasLinkedChat:g,onSubscribeChannel:v,onSearchClick:p,onClose:E,onCloseAnimationEnd:C,updateChatMutedState:f,enterMessageSelectMode:b,sendBotCommand:y,restartBot:I,openLinkedChat:S})=>{const[N,k]=(0,a.eJ)(!0),[w,T]=(0,a.eJ)(!1),{x:F,y:A}=n;(0,H.Z)(t,C,void 0,!1);const L=(0,a.I4)((()=>{k(!1),T(!0)}),[]),R=(0,a.I4)((()=>{k(!1),E()}),[E]),B=(0,a.I4)((()=>{T(!1),E()}),[E]),$=(0,a.I4)((()=>{y({command:"/start"})}),[y]),D=(0,a.I4)((()=>{I({chatId:e})}),[e,I]),U=(0,a.I4)((()=>{f({chatId:e,isMuted:!Z}),R()}),[e,R,Z,f]),x=(0,a.I4)((()=>{S({id:e}),R()}),[e,R,S]),O=(0,a.I4)((()=>{v(),R()}),[R,v]),J=(0,a.I4)((()=>{p(),R()}),[R,p]),z=(0,a.I4)((()=>{b(),R()}),[R,b]);(0,a.d4)((()=>(Ga(),Ja)),[]);const X=(0,M.Z)();return a.ZP.createElement(ja.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(Xa.Z,{isOpen:N,positionX:"right",style:`left: ${F}px;top: ${A}px;`,onClose:R},i.wB&&r&&a.ZP.createElement(G.Z,{icon:"bots",onClick:$},X("BotStart")),i.wB&&o&&a.ZP.createElement(G.Z,{icon:"bots",onClick:D},X("BotRestart")),i.wB&&l&&a.ZP.createElement(G.Z,{icon:s?"channel":"group",onClick:O},X(s?"Subscribe":"Join Group")),i.wB&&c&&a.ZP.createElement(G.Z,{icon:"search",onClick:J},X("Search")),d&&a.ZP.createElement(G.Z,{icon:Z?"unmute":"mute",onClick:U},X(Z?"ChatsUnmute":"ChatsMute")),g&&a.ZP.createElement(G.Z,{icon:s?"comments":"channel",onClick:x},X(s?"ViewDiscussion":"lng_profile_view_channel")),a.ZP.createElement(G.Z,{icon:"select",onClick:z},X("ReportSelectMessages")),m&&a.ZP.createElement(G.Z,{destructive:!0,icon:"delete",onClick:L},X(h?"DeleteChatUser":P?"GroupInfo.DeleteAndExit":s?"LeaveChannel":"Group.LeaveGroup"))),u&&a.ZP.createElement(Ke.Z,{isOpen:w,onClose:B,chat:u})))})));var Ka=n(9589);const qa=(0,X.Ds)((e=>e()),200,!1),Wa=(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&&qa(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(Ka.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 Qa=n(5376),es=n(2365),ts=n(8353),ns=n(7002),as=n(3616);function ss(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 rs=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 os=n(539);function ls(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:r}=ss(a,e,8,!0,!0);if(!r.length||!r[t])return;const o=s[0];if(!s.includes(t)||t===o&&!rs(a,r[o])){const e=t>s[s.length-1]?"start":"end";(0,os.Z)(a,r[t],e,10)}}var is=n(3570);function cs({isActive:e,isHorizontal:t,shouldRemoveSelectionOnReset:n,noArrowNavigation:s,items:r,shouldSelectOnTab:o,onSelect:l,onClose:i}){const[c,d]=(0,a.eJ)(-1),m=(0,a.I4)((e=>r?(0,is.Z)(r.length,e):-1),[r]),u=(0,a.I4)(((e,t)=>{t.preventDefault(),d((t=>m(t+e)))}),[d,m]),h=(0,a.I4)((e=>{if(r&&r.length&&c>-1){const t=r[c];t&&(e.preventDefault(),l(t))}}),[r,l,c]);return(0,a.d4)((()=>{d(n?-1:0)}),[r,n]),(0,a.d4)((()=>e?(0,Ge.Z)({onEsc:i,onUp:s||t?void 0:e=>u(-1,e),onDown:s||t?void 0:e=>u(1,e),onLeft:s||!t?void 0:e=>u(-1,e),onRight:s||!t?void 0:e=>u(1,e),onTab:o?h:void 0,onEnter:h}):void 0),[s,u,h,e,t,i,o]),c}const ds=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,usersById:s,filteredUsers:r})=>{const o=(0,a.sO)(null),{shouldRender:l,transitionClassNames:i}=(0,H.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=cs({isActive:e,items:r,onSelect:d,shouldSelectOnTab:!0,onClose:t});(0,a.d4)((()=>{ls(".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,Y.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(Ce.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var ms=n(9830);const us=(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,y,I]=(0,Fe.Z)(),S=Boolean(E&&E.every((e=>e.quick))),N=(0,M.Z)(),{isMentionTooltipOpen:k,closeMentionTooltip:w,insertMention:T,mentionFilteredUsers:F}=(0,es.Z)(C,t,u,l.nY,r,void 0,s,o),{isEmojiTooltipOpen:A,closeEmojiTooltip:L,filteredEmojis:B,insertEmoji:$}=(0,ts.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(),I();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,I]);if(!E)return;const x=E.every((e=>l.oG.has(e.mimeType))),O=E.every((e=>l.wG.has(e.mimeType))),G=E.every((e=>e.mimeType.startsWith("audio/")));let J="";return J=N(x?"PreviewSender.SendPhoto":O?"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:N.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},N("Send")))}(),className:"AttachmentModal "+(b?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:y,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(I,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),I())},"data-attach-description":N("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(ns.Z,{name:e.filename,extension:(0,Qa.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(ds,{isOpen:k,onClose:w,onInsertUserName:T,filteredUsers:F,usersById:o}),a.ZP.createElement(ms.Z,{isOpen:A,emojis:B,onClose:L,onEmojiSelect:$,addRecentEmoji:m}),a.ZP.createElement(as.Z,{id:"caption-input-text",isAttachmentModalInput:!0,html:t,editableInputId:l.nY,placeholder:N("Caption"),onUpdate:u,onSend:h,shouldSetFocus:Boolean(e.length)}))))}));var hs=n(6980);const Zs=(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,y]=(0,a.eJ)(!1),I=(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(""),y(!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 N=(0,a.I4)(((e=[])=>{d([...e,""]),requestAnimationFrame((()=>{const e=r.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),k=(0,a.I4)((()=>{if(y(!1),!e)return;const n=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?N(a):d(a):N(),void y(!0);if(g&&(!C||!a[Number(C)]))return void y(!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,hs.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,N,p]),w=(0,a.I4)(((e,t)=>{const n=[...c];n[e]=t,n[n.length-1].trim().length&&n.length<10?N(n):d(n)}),[c,N]),T=(0,a.I4)((e=>{const t=[...c];t.splice(e,1),d(t),requestAnimationFrame((()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)}))}),[c]),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&&k()}),[k]),D=(0,a.I4)((()=>{if(b&&!l.trim().length)return I("lng_polls_choose_question")}),[b,I,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 I("lng_polls_choose_answers")}),[b,I,c]);function x(){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?I("OptionHint"):I("CreatePoll.AddOption"),error:U(t),value:e,onChange:e=>w(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:I("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"},I("NewPoll")),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:k},I("Create"))),className:"PollModal"},a.ZP.createElement(ve.Z,{ref:s,label:I("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"},I("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"},I("lng_polls_choose_correct"))}(),g?a.ZP.createElement(ze.Z,{name:"correctOption",options:x().map(((e,t)=>({value:String(t),label:e,hidden:t===c.length-1}))),onChange:F}):x()),a.ZP.createElement("div",{className:"options-divider"}),a.ZP.createElement("div",{className:"quiz-mode"},a.ZP.createElement(ln.Z,{label:I("PollAnonymous"),checked:m,onChange:A}),a.ZP.createElement(ln.Z,{label:I("PollMultiple"),checked:h,disabled:g,onChange:L}),a.ZP.createElement(ln.Z,{label:I("PollQuiz"),checked:g,disabled:h,onChange:B}),g&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("h3",{className:"options-header"},I("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"},I("CreatePoll.ExplanationInfo")))))}));var Ps=n(6503),gs=n(4284),vs=n(1367);const ps=(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"}))})),Es=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:r,onEmojiSelect:o})=>{const l=(0,a.sO)(null);(0,un._N)(l,s);const{transitionClassNames:d}=(0,H.Z)(r,void 0,void 0,"slow"),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,Y.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(ps,{key:s.id,emoji:s,onClick:o})}))))})),Cs={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"},fs=[];let bs,ys,Is;const Ss=(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,un.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-",""));fs[n]=e.isIntersecting}));const t=fs.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,Qe.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,vs.Z)(e,t)}),[c,h]);const g=(0,M.Z)(),v=(0,a.Ye)((()=>{if(!c)return He.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(Is.categories),u(Is.emojis)};Is?e():async function(){return bs||(bs=n.e(501).then(n.t.bind(n,7501,19)),ys=(await bs).default,Is=(0,gs.NM)(ys)),bs}().then(e)}),200)}),[]);const p=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,os.Z)(r.current,t,"start",50,800)}),[]),E=(0,a.I4)(((e,n)=>{t(e,n)}),[t]),C=(0,ht.Z)([],l.kU),f=(0,Y.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=Cs[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,Y.Z)("EmojiPicker-main no-selection",i.$b?"no-scrollbar":"custom-scroll")},v.map(((e,t)=>a.ZP.createElement(Es,{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))}))),Ns=i.wB?8:16,ks=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,observeIntersection:s,shouldRender:r,onStickerSelect:o,onStickerUnfave:d})=>{const m=(0,a.sO)(null);(0,un._N)(m,s);const{transitionClassNames:u}=(0,H.Z)(r,void 0,void 0,"slow"),h=i.wB?Math.floor((c.Z.get().width-8)/(l.Q+Ns)):5,Z=Math.ceil(e.count/h)*(l.Q+Ns);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,Y.Z)("symbol-set-container",u),style:`height: ${Z}px;`},r&&e.stickers&&e.stickers.map((n=>a.ZP.createElement(pn.Z,{key:n.id,sticker:n,size:l.Q,observeIntersection:s,noAnimate:!t,onClick:o,clickArg:n,onUnfaveClick:"favorite"===e.id?d:void 0})))))})),ws=[],Ms=(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,un.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-",""));ws[n]=e.isIntersecting}));const t=ws.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&f(t[Math.floor(t.length/2)].index)})),{observe:y}=(0,un.S1)({rootRef:E}),I=(0,M.Z)(),S=Boolean(o),N=(0,a.Ye)((()=>o?[{id:"recent",title:I("RecentStickers"),stickers:s,count:s.length},{id:"favorite",title:I("FavoriteStickers"),stickers:r,count:r.length},...o.map((e=>c[e])).filter(Boolean)]:He.D),[o,I,s,r,c]),k=(0,a.Ye)((()=>S&&0===N.filter((e=>{var t;return null===(t=e.stickers)||void 0===t?void 0:t.length})).length),[N,S]);(0,a.d4)((()=>{t&&(u(),h(),Z())}),[t,Z,h,u]),(0,a.d4)((()=>{null!=o&&o.length&&P()}),[o,P]),(0,Qe.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,vs.Z)(e,t)}),[S,C]);const w=(0,a.I4)((e=>{f(e);const t=document.getElementById(`sticker-set-${e}`);(0,os.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,ht.Z)([],l.Y),L=(0,Y.Z)("StickerPicker",e);return S&&A&&!k&&n?a.ZP.createElement("div",{className:L},a.ZP.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},N.map((function(e,t){var n;const s=null===(n=e.stickers)||void 0===n?void 0:n[0],r=(0,Y.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:()=>w(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(gn,{stickerSet:e,observeIntersection:y}):a.ZP.createElement(vn,{stickerSet:e,observeIntersection:y})):a.ZP.createElement(pn.Z,{key:e.id,sticker:s,size:l.DC,title:e.title,className:r,observeIntersection:y,onClick:w,clickArg:t})}))),a.ZP.createElement("div",{ref:p,className:(0,Y.Z)("StickerPicker-main no-selection",i.$b?"no-scrollbar":"custom-scroll")},N.map(((e,n)=>a.ZP.createElement(ks,{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?k?a.ZP.createElement("div",{className:"picker-disabled"},"You have no saved Stickers."):a.ZP.createElement(Pe.Z,null):a.ZP.createElement("div",{className:"picker-disabled"},"Sending stickers is not allowed in this chat."))})));var Ts=n(386);function Fs(){return(Fs=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 As=(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,un.Op)(c,t)&&!n,Z=(0,p.Z)(`${u}?size=m`,!h,r.IU.BlobUrl),P=(0,An.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,j.Z)(!0),f=h&&!E,b=h&&E;(0,K.Z)(d,[v]);const y=(0,a.I4)((()=>o({...e,blobUrl:g})),[o,e,g]),I=(0,Y.Z)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",u,s);return a.ZP.createElement("div",{ref:c,className:I,onMouseDown:Ts.b,onClick:y},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",Fs({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"}))})),Ls=(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,un.S1)({rootRef:c,debounceMs:300});(0,a.d4)((()=>{t&&o()}),[t,o]);const m=(0,ht.Z)([],l.Y);return a.ZP.createElement("div",{ref:c,className:(0,Y.Z)("GifPicker",e,i.$b?"no-scrollbar":"custom-scroll")},n?m&&s&&s.length?s.map((e=>a.ZP.createElement(As,{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 Rs;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(Rs||(Rs={}));const Bs=Object.values(Rs).filter((e=>"string"==typeof e)),$s={[Rs.Emoji]:"icon-smile",[Rs.Stickers]:"icon-stickers",[Rs.GIFs]:"icon-gifs"},Ds=(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:Bs[n],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:$s[n]}))}const l=(0,a.I4)((()=>{s(e===Rs.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!==Rs.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-search-button",ariaLabel:e===Rs.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:l},a.ZP.createElement("i",{className:"icon-search"})),o(Rs.Emoji),o(Rs.Stickers),o(Rs.GIFs),e===Rs.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 Us=!1;const xs=(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,Ps.Z)(e,r,void 0,i.wB),{shouldRender:E,transitionClassNames:C}=(0,H.Z)(e,r,!1,!1);!Us&&e&&(Us=!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,X.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]),y=(0,a.I4)((e=>{r(),m(e)}),[r,m]),I=(0,a.I4)((e=>{l(e,!0)}),[l]),S=(0,M.Z)(),{canSendStickers:N,canSendGifs:k}=t;function w(t,n){switch(h){case Rs.Emoji:return a.ZP.createElement(Ss,{className:"picker-tab",onEmojiSelect:b});case Rs.Stickers:return a.ZP.createElement(Ms,{className:"picker-tab",loadAndPlay:!!N&&e&&(t||n),canSendStickers:N,onStickerSelect:I});case Rs.GIFs:return a.ZP.createElement(Ls,{className:"picker-tab",loadAndPlay:!!k&&e&&(t||n),canSendGifs:k,onGifSelect:c})}}const T=a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()}},Us&&a.ZP.createElement(L.Z,{name:"slide",activeKey:h,renderCount:Bs.length},w)),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(Ds,{activeTab:h,onSwitchTab:Z,onRemoveSymbol:d,onSearchOpen:y}));if(i.wB){if(!E)return;const e=(0,Y.Z)("SymbolMenu mobile-menu",C,!n&&"middle-column-open");return a.ZP.createElement(ja.Z,null,a.ZP.createElement("div",{className:e},T))}return a.ZP.createElement(Xa.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)}))),Os=(0,a.X$)((({isOpen:e,allowedAttachmentOptions:t,onFileSelect:n,onPollCreate:s,onClose:r})=>{const[o,c]=(0,Ps.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)((()=>{In(Array.from(l.dI).join(","),(e=>d(e,!0)))}),[d]),u=(0,a.I4)((()=>{In("*",(e=>d(e,!1)))}),[d]),h=(0,M.Z)(),{canAttachMedia:Z,canAttachPolls:P}=t;return a.ZP.createElement(Xa.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(G.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(G.Z,{icon:"photo",onClick:m},h("AttachmentMenu.PhotoOrVideo")),a.ZP.createElement(G.Z,{icon:"document",onClick:u},h("AttachDocument"))),P&&a.ZP.createElement(G.Z,{icon:"poll",onClick:s},h("Poll")))})),Gs=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:r})=>a.ZP.createElement(Ee.Z,{key:n.command,className:(0,Y.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)))))),Js=(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,H.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=cs({isActive:t,items:s,onSelect:m,onClose:o});(0,a.d4)((()=>{s&&!s.length&&o()}),[s,o]),(0,a.d4)((()=>{ls(".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,Y.Z)("BotCommandTooltip composer-tooltip custom-scroll",d);return a.ZP.createElement("div",{className:P,ref:i},Z&&Z.map(((t,n)=>a.ZP.createElement(Gs,{key:`${t.botId}_${t.command}`,botCommand:t,bot:e[t.botId],withAvatar:!0,onClick:m,focus:u===n}))))}))),zs=(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,Ps.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(Xa.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(Gs,{key:e.command,botCommand:e,onClick:l}))))}))),Xs=(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,H.Z)(e,void 0,void 0,!1),d=(0,f.Z)(n,!0),m=n||d,{observe:u}=(0,un.S1)({rootRef:r,throttleMs:200});(0,a.d4)((()=>e?(0,P.Z)(s):void 0),[e,s]);const h=(0,Y.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(pn.Z,{key:e.id,sticker:e,size:l.Q,observeIntersection:u,onClick:t,clickArg:e}))):o?a.ZP.createElement(Pe.Z,null):void 0)}))),Ys=(0,a.X$)((({isOpen:e,onSilentSend:t,onScheduleSend:n,onClose:s,onCloseAnimationEnd:r})=>{const[o,l]=(0,Ps.Z)(e,s),c=(0,M.Z)();return a.ZP.createElement(Xa.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(G.Z,{icon:"mute",onClick:t},c("SendWithoutSound")),n&&a.ZP.createElement(G.Z,{icon:"schedule",onClick:n},c("ScheduleMessage")))}));var _s=n(2420),Hs=n(3283),js=n(2678);const Vs=(0,a.X$)((({isOpen:e,emojis:t,onClose:n,onEmojiSelect:s,addRecentEmoji:r})=>{const o=(0,a.sO)(null),{shouldRender:l,transitionClassNames:c}=(0,H.Z)(e,void 0,void 0,!1),d=(0,js.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=cs({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}=ss(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!rs(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,vs.Z)(n,t)}}(h,o)}),[h]);const Z=(0,Y.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(ps,{key:e.id,emoji:e,focus:h===t,onClick:u}))):l?a.ZP.createElement(Pe.Z,null):void 0)})),Ks=(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:Ts.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)))})),qs=(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`),{shouldRenderThumb:m,shouldRenderFullMedia:u,transitionClassNames:h}=(0,Zn.Z)(d,"slow"),Z=(0,a.I4)((()=>{s(n)}),[n,s]);var P,g;if(t)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:Z},m&&a.ZP.createElement("img",{src:(null===(P=o)||void 0===P||null===(g=P.thumbnail)||void 0===g?void 0:g.dataUri)||c,alt:""}),u&&a.ZP.createElement("img",{src:d,className:`${h} full-media`,alt:""}));const{title:v,description:E}=n;return a.ZP.createElement(Ks,{focus:e,thumbUrl:u?d:(null===(r=l)||void 0===r?void 0:r.dataUri)||c,transitionClassNames:u?h:void 0,title:v,description:E,onClick:Z})})),Ws=(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(Ks,{focus:e,thumbnail:l,title:s||r,description:o,onClick:i})})),Qs=(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(As,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:r})})),er=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{sticker:s}=e;if(s)return a.ZP.createElement(pn.Z,{sticker:s,size:l.zq,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:n,clickArg:e})})),tr=(0,X.P2)((e=>e()),500,!0),nr=(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,H.Z)(e,void 0,void 0,!1),{observe:g}=(0,un.S1)({rootRef:h,debounceMs:200,isDisabled:!e}),v=(0,a.I4)((({direction:e})=>{e===o.Uq.Backwards&&tr(l)}),[l]),p=cs({isActive:e,shouldRemoveSelectionOnReset:n,noArrowNavigation:n,items:s,onSelect:u,onClose:c});(0,a.d4)((()=>{ls(".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 y=(0,Y.Z)("InlineBotTooltip composer-tooltip",i.$b?"no-scrollbar":"custom-scroll",n&&"gallery",P);return a.ZP.createElement(pe.Z,{ref:h,className:y,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(Qs,{key:e.id,inlineResult:e,observeIntersection:g,onClick:u});case"photo":return a.ZP.createElement(qs,{key:e.id,isForGallery:n,inlineResult:e,onClick:u});case"sticker":return a.ZP.createElement(er,{key:e.id,inlineResult:e,observeIntersection:g,onClick:u});case"video":case"game":return a.ZP.createElement(qs,{key:e.id,focus:p===t,inlineResult:e,onClick:u});case"article":case"audio":return a.ZP.createElement(Ws,{key:e.id,focus:p===t,inlineResult:e,onClick:u});default:return}})))})));var ar=n(6844);const sr=(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 He.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,Ze.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(ar.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,$.Z)(o,["emoji","highlight"],{highlight:i}))))})))})));var rr=n(9290);const or=(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,Fe.Z)();(0,rr.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(pn.Z,{sticker:e,size:l.Y7,observeIntersection:t,noAnimate:!s||h||i,onClick:Z})))),p&&a.ZP.createElement(Cn.Z,{isOpen:h,fromSticker:g[0],onClose:P}))}))),lr=(0,X.P2)((e=>e()),6e4,!0),ir=(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,un.S1)({rootRef:l,throttleMs:200});return(0,a.d4)((()=>{lr((()=>{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(or,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:c,onModalToggle:d}))):r?r.length?r.map((e=>a.ZP.createElement(or,{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)}())}))),cr=(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,un.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,Y.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(As,{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)}()))}))),dr=(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(Ce.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(an,{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}))),mr=(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(dr,{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)))}))),ur="Please provide first name",hr=(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,Fe.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||"",y=t&&t.lastName||"",[I,S]=(0,a.eJ)(b),[N,k]=(0,a.eJ)(y),[w,A]=(0,a.eJ)(!r);(0,a.d4)((()=>{A(!r)}),[r]),(0,a.d4)((()=>{p(!1),g()}),[g,e]),(0,a.d4)((()=>{S(b),k(y)}),[b,y,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=>{k(e.target.value),p(!0)}),[]),B=(0,a.I4)((e=>{A(e.target.checked),p(!0)}),[]),$=(0,a.I4)((()=>{const t=I.trim(),n=N.trim();t.length||C(ur),l({userId:e,isMuted:!w,firstName:t,lastName:n})}),[I,N,l,e,w]),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(Ce.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:I,error:E===ur?E:void 0}),a.ZP.createElement(ve.Z,{id:"user-last-name",label:f("UserInfo.LastNamePlaceholder"),onChange:R,value:N}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(ln.Z,{checked:w,label:f("Notifications"),subLabel:f(w?"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(Jt.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(Me.Z,{isOpen:Z,onClose:g,text:f("AreYouSureDeleteContact"),confirmLabel:f("DeleteContact"),confirmHandler:D,confirmIsDestructive:!0}))}))),Zr="Group title can't be empty",Pr=(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,y,I;const[S,N,k]=(0,Fe.Z)(),w=t.title,A=t.fullInfo&&t.fullInfo.about||"",[L,R]=(0,a.eJ)(!1),[B,D]=(0,a.eJ)(w),[U,x]=(0,a.eJ)(A),[O,G]=(0,a.eJ)(),[J,z]=(0,a.eJ)(),X=(0,u.RT)(t),Y=(0,p.Z)(X,!1,r.IU.BlobUrl),_=(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=>{x(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:O}):z(Zr)}),[U,e,O,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===(y=b.adminMembers)||void 0===y?void 0:y.length)||0,re=(0,a.I4)((()=>{s?Z({chatId:t.id}):t.isCreator?g({chatId:t.id}):P({chatId:t.id}),k(),v(),E({id:void 0})}),[s,t.isCreator,t.id,k,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(Gt.Z,{currentAvatarBlobUrl:Y,onChange:q,disabled:!i}),a.ZP.createElement(ve.Z,{id:"group-title",label:_("GroupName"),onChange:W,value:B,error:J===Zr?J:void 0,disabled:!i}),a.ZP.createElement(ve.Z,{id:"group-about",className:"mb-2",label:_("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"},_("GroupType")),a.ZP.createElement("span",{className:"subtitle"},t.username?_("TypePublic"):_("TypePrivate"))),l&&a.ZP.createElement(Ee.Z,{icon:"message",multiline:!0,onClick:j},a.ZP.createElement("span",{className:"title"},_("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},_("DiscussionUnlink"))),a.ZP.createElement(Ee.Z,{icon:"permissions",multiline:!0,onClick:V,disabled:!c},a.ZP.createElement("span",{className:"title"},_("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"},_("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"},_("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,Pn.kh)(null!==(I=t.membersCount)&&void 0!==I?I:0))),t.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(ln.Z,{checked:!t.fullInfo.isPreHistoryHidden,label:_("ChatHistory"),onChange:ne,disabled:!c}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:N},_("DeleteMega")))),a.ZP.createElement(Jt.Z,{isShown:L,onClick:ee,disabled:oe,ariaLabel:_("Save")},oe?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Me.Z,{isOpen:S,onClose:k,textParts:(0,$.Z)(s||!t.isCreator?_("AreYouSureDeleteAndExit"):_("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:s||!t.isCreator?_("DeleteMega"):_("DeleteGroupForAll"),confirmHandler:re,confirmIsDestructive:!0}))}))),gr=(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]),y=(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(ln.Z,{name:"sendMessages",checked:!c.sendMessages,label:P("UserRestrictionsSend"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"sendMedia",checked:!c.sendMedia,label:P("UserRestrictionsSendMedia"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.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(ln.Z,{name:"sendPolls",checked:!c.sendPolls,label:P("UserRestrictionsSendPolls"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"embedLinks",checked:!c.embedLinks,label:P("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:P("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"pinMessages",checked:!c.pinMessages,label:P("UserRestrictionsPinMessages"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.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(Ce.Z,{userId:e.userId,status:y(e)})))))),a.ZP.createElement(Jt.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"})))}))),vr=(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}}),((e,t)=>(0,h.ei)(t,["updateChatMemberBannedRights"])))((({chat:e,usersById:t,updateChatMemberBannedRights:n,onClose:s,isActive:r})=>{const o=(0,M.Z)();(0,T.ZP)(r,s);const l=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[]),[e]),i=(0,a.I4)((e=>{if(!e.kickedByUserId)return;const n=t[e.kickedByUserId];return n?o("UserRemovedBy",(0,u.Js)(n)):void 0}),[o,t]),c=(0,a.I4)((t=>{if(e)return[{title:o("Unblock"),icon:"delete",destructive:!0,handler:()=>n({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[o,e,n]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted"},o("NoBlockedGroup2")),l.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:c(e)},a.ZP.createElement(Ce.Z,{userId:e.userId,status:i(e)})))))))}))),pr="Channel title can't be empty",Er=(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 y=t&&t.title||"",I=null!=t&&t.fullInfo&&t.fullInfo.about||"",S=null==t||null===(E=t.fullInfo)||void 0===E?void 0:E.linkedChatId,[N,k,w]=(0,Fe.Z)(),[A,L]=(0,a.eJ)(!1),[R,B]=(0,a.eJ)(y),[$,D]=(0,a.eJ)(I),[U,x]=(0,a.eJ)(),[O,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 Y=(null==t||null===(C=t.fullInfo)||void 0===C||null===(f=C.adminMembers)||void 0===f?void 0:f.length)||0,_=(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=>{x(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(pr)}),[$,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}),w(),m(),P({id:void 0})}),[t.isCreator,t.id,w,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(Gt.Z,{currentAvatarBlobUrl:z,onChange:V,disabled:!l}),a.ZP.createElement(ve.Z,{id:"channel-title",label:X("EnterChannelName"),onChange:K,value:R,error:O===pr?O: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:_},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"},Y)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(ln.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:k},t.isCreator?X("ChannelDelete"):X("LeaveChannel")))),a.ZP.createElement(Jt.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(Me.Z,{isOpen:N,onClose:w,text:t.isCreator?X("ChannelDeleteAlert"):X("ChannelLeaveAlert"),confirmLabel:t.isCreator?X("ChannelDelete"):X("LeaveChannel"),confirmHandler:te,confirmIsDestructive:!0}))})));var Cr=n(88);const fr=(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,Fe.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)}),[]),y=(0,a.I4)((()=>{c({username:"public"===Z?g:""})}),[Z,c,g]),I=(0,a.I4)((()=>{C(),d()}),[C,d]),S=(0,M.Z)(),N=s?"Channel":"Mega",k=s?"Channel":"Group",w=[{value:"private",label:S(`${N}Private`),subLabel:S(`${N}PrivateInfo`)},{value:"public",label:S(`${N}Public`),subLabel:S(`${N}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(`${k}Type`)),a.ZP.createElement(ze.Z,{selected:Z,name:"channel-type",options:w,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(Cr.Z,{url:h,className:"group-link",text:h}),a.ZP.createElement("p",{className:"section-info",dir:S.isRtl?"rtl":void 0},S(`${N}PrivateLinkHelp`)),a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:E},S("RevokeLink")),a.ZP.createElement(Me.Z,{isOpen:p,onClose:C,text:S("RevokeAlert"),confirmLabel:S("RevokeButton"),confirmHandler:I,confirmIsDestructive:!0})):a.ZP.createElement(Pe.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(Ht,{asLink:!0,currentUsername:e.username,isLoading:A,isUsernameAvailable:l,checkUsername:i,onChange:v}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},S(`${k}.Username.CreatePublicLinkHelp`)))),a.ZP.createElement(Jt.Z,{isShown:f,disabled:A,ariaLabel:S("Save"),onClick:y},A?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),br=(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,y,I]=(0,Fe.Z)(),[S,N,k]=(0,Fe.Z)(),w=(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,Wt.Z)("DiscussionGroups").then(p)}),[v]);const A=(0,a.I4)((()=>{I(),Z({channelId:d?s:F}),d||m(o.u1.Initial)}),[I,Z,d,s,F,m]),L=(0,a.I4)((()=>{k(),h({channelId:s,chatId:P})}),[k,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(Qt.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(fe.Z,{chatId:i.id})),a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:y},w(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")),a.ZP.createElement(Me.Z,{isOpen:b,onClose:I,header:a.ZP.createElement("div",{className:"modal-header"},a.ZP.createElement(D.Z,{size:"tiny",chat:i}),a.ZP.createElement("div",{className:"modal-title"},w(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,$.Z)(w(d?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",i.title),["br","simple_markdown"]),confirmLabel:w(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:A,confirmIsDestructive:!0})),!i&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},w("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Ee.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},w("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),N()}},a.ZP.createElement(fe.Z,{chatId:e})))):a.ZP.createElement(ot.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},w("DiscussionChannelHelp2")),a.ZP.createElement(Me.Z,{isOpen:S,onClose:k,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"},w("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:w("DiscussionLinkGroup"),confirmHandler:L,isButtonsInOneRow:!0})))))}))),yr=(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,Fe.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]),y=(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(Ce.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(ln.Z,{name:"sendMessages",checked:!c.sendMessages,label:p("UserRestrictionsSend"),blocking:!0,disabled:y("sendMessages"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"sendMedia",checked:!c.sendMedia,label:p("UserRestrictionsSendMedia"),blocking:!0,disabled:y("sendMedia"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"sendStickers",checked:!c.sendStickers&&!c.sendGifs,label:p("UserRestrictionsSendStickers"),blocking:!0,disabled:y("sendStickers"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"sendPolls",checked:!c.sendPolls,label:p("UserRestrictionsSendPolls"),blocking:!0,disabled:y("sendPolls"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"embedLinks",checked:!c.embedLinks,label:p("UserRestrictionsEmbedLinks"),blocking:!0,disabled:y("embedLinks"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:p("UserRestrictionsInviteUsers"),blocking:!0,disabled:y("inviteUsers"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"pinMessages",checked:!c.pinMessages,label:p("UserRestrictionsPinMessages"),blocking:!0,disabled:y("pinMessages"),onChange:C})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!c.changeInfo,label:p("UserRestrictionsChangeInfo"),blocking:!0,disabled:y("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(Jt.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(Me.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}))}))),Ir=(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(Ce.Z,{userId:e.userId,status:Z(e),forceShowSelf:!0})))))))}))),Sr=(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(ln.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.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(ln.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(ln.Z,{label:"",checked:!0}),a.ZP.createElement(Ce.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),Nr=(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,Fe.Z)(),[b,y]=(0,a.eJ)(""),I=(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)||{}),y(((null==S?void 0:S.customTitle)||"").substr(0,16)),g(!1),p(!1)}),[S]);const N=(0,a.I4)((e=>{const{name:t}=e.target;Z((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),g(!0)}),[]),k=(0,a.I4)((()=>{e&&(p(!0),c({chatId:n.id,userId:e,adminRights:h,customTitle:b}))}),[n,e,h,b,c]),w=(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 I("ChannelCreator");const e=S.promotedByUserId?s[S.promotedByUserId]:void 0;return e?I("EditAdminPromotedBy",(0,u.Js)(e)):I("ChannelAdmin")}),[S,s,I]),R=(0,a.I4)((e=>{const{value:t}=e.target;y(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(Ce.Z,{userId:S.userId,status:L,forceShowSelf:!0})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},I("EditAdminWhatCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"changeInfo",checked:!!h.changeInfo,label:I(l?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:A("changeInfo"),onChange:N})),l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"postMessages",checked:!!h.postMessages,label:I("EditAdminPostMessages"),blocking:!0,disabled:A("postMessages"),onChange:N})),l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"editMessages",checked:!!h.editMessages,label:I("EditAdminEditMessages"),blocking:!0,disabled:A("editMessages"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"deleteMessages",checked:!!h.deleteMessages,label:I(l?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:A("deleteMessages"),onChange:N})),!l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"banUsers",checked:!!h.banUsers,label:I("EditAdminBanUsers"),blocking:!0,disabled:A("banUsers"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"inviteUsers",checked:!!h.inviteUsers,label:I("EditAdminAddUsers"),blocking:!0,disabled:A("inviteUsers"),onChange:N})),!l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"pinMessages",checked:!!h.pinMessages,label:I("EditAdminPinMessages"),blocking:!0,disabled:A("pinMessages"),onChange:N})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"addAdmins",checked:!!h.addAdmins,label:I("EditAdminAddAdmins"),blocking:!0,disabled:A("addAdmins"),onChange:N})),!l&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(ln.Z,{name:"anonymous",checked:!!h.anonymous,label:I("EditAdminSendAnonymously"),blocking:!0,disabled:A("anonymous"),onChange:N})),i&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},I("Channel.EditAdmin.CannotEdit")),!l&&a.ZP.createElement(ve.Z,{id:"admin-title",label:I("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},I("EditAdminRemoveAdmin")))),a.ZP.createElement(Jt.Z,{isShown:P,onClick:k,ariaLabel:I("Save"),disabled:v},v?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Me.Z,{isOpen:E,onClose:f,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:w,confirmIsDestructive:!0}))}))),kr=(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(Ce.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(ot.Z,{teactOrderKey:0,key:"nothing-found",text:n?"No subscribers found":"No members found"}))))}))),wr=(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(Ce.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(ot.Z,{teactOrderKey:0,key:"nothing-found",text:n?"No subscribers found":"No members found"}))))}))),Mr=(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(hr,{key:e,userId:e,onClose:i,isActive:c});case"group":return a.ZP.createElement(Pr,{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(Er,{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(fr,{chatId:e,isActive:c,onClose:i});case o.u1.Discussion:return a.ZP.createElement(br,{chatId:e,onScreenSelect:r,isActive:c,onClose:i});case o.u1.GroupPermissions:return a.ZP.createElement(gr,{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(vr,{chatId:e,isActive:c,onClose:i});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(wr,{chatId:e,onChatMemberSelect:l,onScreenSelect:r,isActive:c||[o.u1.GroupUserPermissions].includes(t),onClose:i});case o.u1.GroupUserPermissions:return a.ZP.createElement(yr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:i});case o.u1.ChatAdministrators:return a.ZP.createElement(Ir,{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(Sr,{chatId:e,isActive:c,onClose:i});case o.u1.ChatAdminRights:return a.ZP.createElement(Nr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:i});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(kr,{chatId:e,isActive:c,onClose:i})}})));var Tr=n(9937);const Fr=/^4[0-9]{12}(?:[0-9]{1,3})?$/,Ar=/^5[1-5][0-9]{11,14}$/,Lr=/^2[2-7][0-9]{11,14}$/;let Rr;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(Rr||(Rr={}));const Br={[Rr.Default]:"",[Rr.Visa]:"visa",[Rr.Mastercard]:"mastercard"};function $r(e){return e=e.replace(/\s/g,""),Fr.test(e)?Rr.Visa:Ar.test(e)||Lr.test(e)?Rr.Mastercard:Rr.Default}const Dr={},Ur=/(\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 Ur;const t=e[0];let n;if(!Dr[t]){const e=t.split("").map(Number);n=e.reduce(((e,t,n)=>`${e}(\\d{1,${t}})${n>0?"?":""}`),""),Dr[t]=new RegExp(`${n}${"()?".repeat(5-e.length)}`)}return Dr[t]}(e.match(/\d+$/))}))),Or={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Gr=(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:Jr(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:Jr(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Jr(e){const t=xr.find((({id:t})=>t===e));return t?t.name:""}function zr(e,t=400){(0,a.d4)((()=>{i.$b||setTimeout((()=>{(0,X.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const Xr=(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,Y.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))})),Yr=(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)();zr(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(Xr,{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(ln.Z,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:C})))})),_r=(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,Tr.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(ze.Z,{name:"shipping-options",options:l,onChange:o,selected:e.shipping})))}));function Hr(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,Tr.x)(n,s,e)))}function jr(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 Vr=(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=>Hr(l.code,e.label,e.amount,r))),n&&n.map((e=>Hr(l.code,e.label,e.amount,r))),void 0!==o&&Hr(l.code,l("Checkout.TotalAmount"),o,r,!0)),a.ZP.createElement("div",{className:"invoice-info"},m&&jr("icon-card",m,"Payment method"),u&&jr("stripe-provider",u,"Payment provider"),h&&jr("icon-location",h,"Shipping address"),Z&&jr("icon-user",Z,"Name"),P&&jr("icon-phone",P,"Phone number"),g&&jr("icon-truck",g,"Shipping method")))})),Kr=(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 qr=n(6352),Wr=n(5753);const Qr=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null);zr(s);const[r,o]=(0,a.eJ)(Rr.Default);(0,a.d4)((()=>{const t=$r(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=$r(e.target.value);o(a),n(t),s.current&&(s.current.value=t)}),[n,s]),i=function(e){switch(e){case Rr.Mastercard:return a.ZP.createElement("img",{src:qr,alt:""});case Rr.Visa:return a.ZP.createElement("img",{src:Wr,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}))})),eo=(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(Qr,{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(Kr,{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(Xr,{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(ln.Z,{label:P("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:Z})))})),to=(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:y}=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:y,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:y,validateRequestedInfo:I,sendPaymentForm:S,setPaymentStep:N,sendCredentialsInfo:k,clearPaymentError:w})=>{const[T,A]=(0,Rt.Z)(Gr,Or),[B,$]=(0,a.eJ)(!1),D=(0,M.Z)();(0,a.d4)((()=>{(n||y)&&$(!1)}),[n,y]),(0,a.d4)((()=>{null!=y&&y.field&&A({type:"setFormErrors",payload:{[y.field]:y.message}})}),[y,A]),(0,a.d4)((()=>{if(r){const{name:e,phone:t,email:n,shippingAddress:a}=r;A({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:n,...a||{}}})}}),[r,A]);const U=(0,a.I4)((()=>{w()}),[w]),x=(0,a.Ye)((()=>n!==o.KB.Checkout?0:function(e=[],t,n){const a=t?ao(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]),O=(0,a.Ye)((()=>{if(n===o.KB.Checkout)return function(e,t,n){const a=`${function(e){const t=$r(e);return Br[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?no(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);I({requestInfo:t,saveInfo:e})}),[I,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);k({credentials:e})}),[k,T]),z=(0,a.I4)((()=>{S({shippingOptionId:T.shipping,saveCredentials:T.saveCredentials})}),[S,T]),X=(0,a.I4)((e=>{N({step:e})}),[N]),Y=(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]),_=(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,Tr.x)(x,Z,D.code));default:return D("Next")}}),[n,D,Z,x]);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,_)),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(Yr,{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(_r,{state:T,dispatch:A,shippingOptions:s||[],currency:Z});case o.KB.PaymentInfo:return a.ZP.createElement(eo,{state:T,dispatch:A,canSaveCredentials:Boolean(!P&&l),needCardholderName:C,needCountry:f,needZip:b});case o.KB.Checkout:return a.ZP.createElement(Vr,{prices:E,shippingPrices:T.shipping&&s?ao(s,T.shipping):void 0,totalPrice:x,invoiceContent:v,checkoutInfo:O,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:Y,disabled:B,isLoading:B},H)),y&&!y.field&&function(){if(y)return a.ZP.createElement(ge.Z,{className:"error",isOpen:Boolean(y),onClose:U},a.ZP.createElement("h4",null,y.description||"Error"),a.ZP.createElement("p",null,y.description||"Error"),a.ZP.createElement(R.Z,{isText:!0,onClick:w},D("OK")))}())})));function no(e,t){return e.find((({id:e})=>e===t))}function ao(e,t){const n=no(e,t);return null==n?void 0:n.prices}const so=(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(Vr,{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=465.9db7d11e2e0ddcd00ef9.js.map
|