mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 01:27:37 +01:00
2 lines
256 KiB
JavaScript
2 lines
256 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[347],{6347:(e,t,n)=>{n.r(t),n.d(t,{ArchivedChats:()=>Ma,AttachMenu:()=>Rs,AttachmentModal:()=>is,BotCommandMenu:()=>Ds,BotCommandTooltip:()=>Bs,CalendarModal:()=>$e,ContactList:()=>ba,ContextMenuContainer:()=>Ga,CustomSendMenu:()=>xs,DeleteMessageModal:()=>De,Dialogs:()=>Ne,DropArea:()=>Os.Z,EmojiTooltip:()=>Xs,ForwardPicker:()=>be,GifSearch:()=>ar,HeaderMenuContainer:()=>za,HistoryCalendar:()=>Be,InlineBotTooltip:()=>qs,LeftSearch:()=>Ft,Management:()=>yr,MediaViewer:()=>me,MentionTooltip:()=>rs,MessageSelectToolbar:()=>ze,MobileSearch:()=>ja,NewChat:()=>ka,NewChatStep1:()=>Ia,NewChatStep2:()=>Na,Notifications:()=>ke,PaymentModal:()=>Yr,PinMessageModal:()=>Ue,PollModal:()=>cs,PollResults:()=>rr,ReceiptModal:()=>Vr,RightSearch:()=>Ws,SafeLinkModal:()=>Te,Settings:()=>fa,StickerSearch:()=>nr,StickerSetModal:()=>Ja,StickerTooltip:()=>Us,SymbolMenu:()=>Ls,TextFormatter:()=>Gs.Z,UnpinAllMessagesModal:()=>xe});var a=n(4050),s=n(5116),r=n(6137),o=n(1713),i=n(3716),l=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),p=n(5326),v=n(6202),E=n(2761),f=n(2937),C=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 N(e,t){const n=document.querySelector(".active > .MessageList");let a=e.offsetTop+t.closest(".content-inner, .WebPage").offsetTop;return e.id.includes("album-media-")&&(a+=e.parentElement.offsetTop+e.closest(".Message").offsetTop),a>n.scrollTop&&a+t.offsetHeight<n.scrollTop+n.offsetHeight}function w(e,t){Object.assign(e.style,t)}function 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:r&&r[r.length-1]}}function S(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),$=n(790),B=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:i})=>{const l=(0,a.I4)((()=>{o(),i({chatId:e,messageId:t})}),[e,i,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:l},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,B.Z)(m)),a.ZP.createElement("div",{className:"date",dir:"auto"},s?c("lng_mediaview_profile_photo"):(0,$.ZK)(c,1e3*r.date))))}));var x=n(2619),O=n(3106),G=n(8964),J=n(9196);const X=({mediaData:e,isVideo:t,isZoomed:n,message:s,fileName:r,isAvatar:o,onCloseMediaViewer:i,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 l.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:i},a.ZP.createElement("i",{className:"icon-close"})))};var z=n(9118),_=n(6752);const Y=({text:e="",isHidden:t,isForVideo:n,onClick:s})=>{const[r,o]=(0,a.eJ)(!1);(0,a.d4)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;o(t>2*d.Gw)};t();const n=(0,z.P2)(t,500,!0);return window.addEventListener("resize",n,!1),()=>{window.removeEventListener("resize",n,!1)}}),[]);const i=(0,_.Z)("MediaViewerFooter",n&&"is-for-video",t&&"is-hidden");return a.ZP.createElement("div",{className:i,onClick:function(t){e&&t.stopPropagation()}},e&&a.ZP.createElement("div",{className:"media-viewer-footer-content",onClick:l.wB?void 0:s},a.ZP.createElement("p",{className:"media-text custom-scroll "+(r?"multiline":""),dir:"auto"},e)))};var j=n(1212),H=n(2019);const V=void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":"";var q=n(6898),K=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:i,isFullscreenSupported:c,isFullscreen:d,onChangeFullscreen:m,onPlayPause:u,onSeek:h})=>{const[Z,P]=(0,a.eJ)(!0);(0,a.d4)((()=>{r&&P(r)}),[r]),(0,a.d4)((()=>{let e;return r||(l.wB?P(!1):e=window.setTimeout((()=>{P(!1)}),800)),()=>{e&&window.clearTimeout(e)}}),[r]),(0,a.d4)((()=>((Z||r)&&document.body.classList.add("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[r,Z]);const g=(0,M.Z)();var p,v;if(Z||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"},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}%`}),a.ZP.createElement("input",{min:"0",max:"100",step:.01,type:"range",onInput:s,className:"player-seekline-input",value:r||0})))}(t,n,e,h),a.ZP.createElement(R.Z,{ariaLabel:g("AccActionPlay"),size:"tiny",ripple:!l.wB,color:"translucent-white",className:"play",onClick:u},a.ZP.createElement("i",{className:i?"icon-pause":"icon-play"})),function(e,t){return a.ZP.createElement("div",{className:"player-time"},`${(0,$.k9)(e)} / ${(0,$.k9)(t)}`)}(t,n),e<1&&(p=e,v=s,a.ZP.createElement("div",{className:"player-file-size"},`${Q(v*p)} / ${Q(v)}`)),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:i,noPlay:c,onClose:d})=>{const m=(0,a.sO)(null),[u,h]=(0,a.eJ)(!l.$b||!l.cj),[Z,P]=(0,a.eJ)(0),[g,p]=(0,a.eJ)(!0),[v,E,f]=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"===l.Lt?[n,()=>{e.current&&(V||"iOS"===l.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:C,bufferedProgress:b,bufferingHandlers:y}=(0,H.Z)(),{shouldRender:I,transitionClassNames:N}=(0,j.Z)(!C,void 0,void 0,"slow"),{shouldRender:w,transitionClassNames:k}=(0,j.Z)(l.cj&&!u&&!I,void 0,void 0,"slow");(0,a.d4)((()=>{c||!i?m.current.pause():e&&!l.$b&&(0,K.Z)(m.current)}),[c,i,e]),(0,a.d4)((()=>{m.current.currentTime===m.current.duration?(P(0),h(!1)):P(m.current.currentTime)}),[Z]);const S=(0,a.I4)((e=>{e.stopPropagation(),u?(m.current.pause(),h(!1)):(m.current.play(),h(!0))}),[u]);(0,q.Z)(m,[]);const M=(0,a.I4)((()=>{p(!0)}),[]),T=(0,a.I4)((()=>{p(!1)}),[]),F=(0,a.I4)((e=>{P(e.currentTarget.currentTime)}),[]),A=(0,a.I4)((()=>{P(0),h(!1)}),[]),L=(0,a.I4)((()=>{v&&f?f():!v&&E&&E()}),[f,v,E]),$=(0,a.I4)((e=>{e.stopPropagation(),m.current.currentTime=Number(e.target.value)*m.current.duration/100}),[]),B=(0,a.I4)((e=>{e.stopPropagation(),p(!g)}),[g]);(0,a.d4)((()=>{const e=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S(e))};return document.addEventListener("keydown",e,!1),()=>{document.removeEventListener("keydown",e,!1)}}),[S]);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&&l.wB?B:void 0,onMouseOver:t?void 0:M,onMouseOut:t?void 0:T},a.ZP.createElement("div",{style:D},a.ZP.createElement("video",ne({ref:m,autoPlay:l.$b,playsInline:!0,loop:t,muted:t,id:"media-viewer-video",style:U,onEnded:A,onClick:l.wB?void 0:S,onDoubleClick:L},y,{onTimeUpdate:F}),e&&a.ZP.createElement("source",{src:e}))),w&&a.ZP.createElement(R.Z,{round:!0,className:`play-button ${k}`,onClick:S},a.ZP.createElement("i",{className:"icon-play"})),I&&a.ZP.createElement("div",{className:["spinner-container",N].join(" ")},!C&&a.ZP.createElement("div",{className:"buffering"},"Buffering..."),a.ZP.createElement(J.Z,{size:"xl",progress:C?1:r,square:!0,onClick:d})),!t&&!I&&a.ZP.createElement(te,{isPlayed:u,bufferedProgress:b,currentTime:Z,isFullscreenSupported:Boolean(E),isFullscreen:v,fileSize:o,duration:m.current?m.current.duration:0,isForceVisible:!u||g,isForceMobileVersion:s&&s.width<400,onSeek:$,onChangeFullscreen:L,onPlayPause:S}))})),se=(0,a.X$)((({isShown:e,onChangeZoom:t})=>{const{transitionClassNames:n}=(0,j.Z)(e),s=(0,C.Z)(e),r=(0,a.sO)(null),[o,i]=(0,a.eJ)(1),c=(0,a.sO)(!1);(0,a.d4)((()=>{e&&!s&&i(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,_.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:!l.wB,onClick:()=>{r.current&&i(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:!l.wB,onClick:()=>{r.current&&i(Math.min(3,o+.5))}},a.ZP.createElement("i",{className:"icon-zoom-in"})),a.ZP.createElement("div",{className:"seekline"},a.ZP.createElement("div",{className:"seekline-track"},a.ZP.createElement("div",{className:"seekline-played",style:`width: ${50*(o-1)}%`}),a.ZP.createElement("input",{ref:r,min:1,max:3,step:"0.5",value:o,type:"range",className:"seekline-input",onChange:e=>{i(Math.min(3,Math.max(Number(e.target.value),1)))},onMouseDown: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},ie=150,le=(0,a.X$)((({children:e,className:t,noWrap:n,canPan:s,zoomLevel:r,panDeltaX:o,panDeltaY:i,onPan:l})=>{const c=oe[r]||r,[d,m]=(0,a.eJ)(!1),[u,Z]=(0,a.eJ)({dx:o,dy:i,x:0,y:0}),[P,g]=(0,a.eJ)(re),p=(0,a.sO)(null),v=(0,a.sO)(null);return(0,a.d4)((()=>{const e=c||P[0],t=o||P[4],n=i||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],i=r.height/e*t[3],l=(s.width-o)/2+t[4],c=(s.height-i)/2+t[5];return s.width&&s.width-ie<l?t[4]-=l+s.width-ie:o&&o+l<ie&&(t[4]-=o+l-ie),s.height&&s.height-ie<c?t[5]-=c+s.height-ie:i&&i+c<ie&&(t[5]-=i+c-ie),t}(P[0],a,p.current))}),[o,i,c]),(0,a.d4)((()=>{s||g(re)}),[s]),(0,a.d4)((()=>{v.current&&(v.current.style.transform=`matrix(${P.toString()})`)}),[n,P]),n?e:a.ZP.createElement("div",{ref:p,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),p.current&&p.current.classList.add("move")},onMouseUp:()=>{m(!1),p.current&&p.current.classList.remove("move"),l&&l(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),v.current&&(v.current.style.transform=`matrix(${P.toString()})`)}}},a.ZP.createElement("div",{ref:v,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:i}=e.mediaViewer,{animationLevel:l}=e.settings.byKey;if(i===o.bZ.SearchResult){if(!t||!a)return{animationLevel:l};const n=(0,m.hj)(e,t,a);return n?{chatId:t,messageId:a,senderId:n.senderId,origin:i,message:n,animationLevel:l}:{animationLevel:l}}if(s)return{messageId:-1,senderId:s,avatarOwner:(0,m.dy)(e,s)||(0,m.Z1)(e,s),profilePhotoIndex:r||0,animationLevel:l,origin:i};if(!(t&&n&&a))return{animationLevel:l};let c,d,u;if(c=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,m.Tm)(e,t,a):(0,m.hj)(e,t,a),!c)return{animationLevel:l};if(d=i&&[o.bZ.ScheduledAlbum,o.bZ.ScheduledInline].includes(i)?(0,m.Fn)(e,t):(0,m.Zw)(e,t),i===o.bZ.Inline||i===o.bZ.Album)u=(0,m.qC)(e,t,n)||(0,m.gb)(e,t,n);else if(i===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:i,message:c,chatMessages:d,collectionIds:u,animationLevel:l}}),((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:$,chatMessages:B,collectionIds:D,openMediaViewer:x,closeMediaViewer:O,openForwardMenu:G,focusMessage:J,animationLevel:z})=>{const _=Boolean(h||n),j=m===o.bZ.SharedMedia,H=m===o.bZ.SearchResult,V=$?(0,u.O$)($):void 0,q=$?(0,u.b7)($):void 0,K=$?(0,u.F$)($):void 0,W=$?(0,u.Cg)($):void 0,Q=!!$&&(0,u.rl)($),ee=!!$&&(0,u.hC)($),te=Boolean(q||W||ee),ne=Boolean(!te&&(V||K||Q)),{isGif:re}=q||W||{},oe=Boolean(h),ie=Boolean(K||W),me=(0,a.Ye)((()=>ie&&n?[n]:(0,u.N0)(B||{},D||[],j)),[ie,n,B,D,j]),ue=n?me.indexOf(n):-1,he=0===ue||-1===ue,Ze=ue===me.length-1||-1===ue,Pe=(0,a.sO)(),ge=(0,C.Z)(s);!_||ge&&ge===s&&Pe.current||(Pe.current=ue);const pe=z>=1?"mv-slide":"none",ve=2===z?"slide-fade":"none",Ee=2===z,[fe,Ce]=(0,a.eJ)(!1),[be,ye]=(0,a.eJ)(!1),[Ie,Ne]=(0,a.eJ)(!1),[we,ke]=(0,a.eJ)(1),[Se,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 $&&(0,u.Ti)($,e?"viewerFull":"viewerPreview")}const Fe=(0,v.Z)($&&(j||H)&&(0,u.Ti)($,"pictogram"),void 0,r.IU.BlobUrl,void 0,Ee&&ce),Ae=Te(),Le=(0,v.Z)(Ae,void 0,oe&&Ae&&Ae.startsWith("profilePhoto")?r.IU.DataUri:r.IU.BlobUrl,void 0,Ee&&ce),{mediaData:Re,downloadProgress:$e}=(0,E.Z)(Te(!0),void 0,$&&(0,u.kG)($,"viewerFull"),void 0,Ee&&ce),Be=V||q?(V||q).blobUrl:void 0;let De=!te&&(Be||Re)||Le||Fe;const Ue=(0,f.Z)(!De&&$&&(0,u.DH)($));De||m===o.bZ.SearchResult||(De=Ue);const xe=$?(0,u.c0)($):void 0,Oe=$?(0,u.ep)($):oe?`avatar${h.id}-${F}.jpg`:void 0;let Ge;$?Q||ee?Ge=(0,u.aE)($).mediaSize:V||K?Ge=(0,u.bV)(V||K):(q||W)&&(Ge=(0,u.jC)(q||W)):Ge=d.vY,(0,a.d4)((()=>{l.wB&&document.body.classList.toggle("is-media-viewer-open",_)}),[_]);const Je=(0,p.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 Xe=(0,C.Z)($),ze=(0,C.Z)(m),_e=(0,C.Z)(h),Ye=(0,C.Z)(De);(0,a.d4)((()=>{if(Ee&&_&&!Xe&&!_e){(0,b.YW)(ce+i.fK);const e=$?(0,y.X)($):void 0;!function(e,t,n,a,s,r){const{mediaEl:l}=k(t,r);if(!l)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,p=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:v,left:E,width:f,height:C}=l.getBoundingClientRect();if([o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(t)){const e=function(e,t,n,a,s,r){if(e===t){const o=Math.max(s,r)*(e/t);a-=(o-s)/2,n-=(o-r)/2,s=o,r=o}else if(e>t){const n=s;a-=((s=r*(e/t))-n)/2}else if(t>e){const a=r;n-=((r=s*(t/e))-a)/2}return{top:n,left:a,width:s,height:r}}(Z,P,v,E,f,C);v=e.top,E=e.left,f=e.width,C=e.height}const b=E+f/2-(g+Z/2),y=v+C/2-(p+P/2),N=f/Z,M=C/P,T=I(n||l);w(T,{top:`${p}px`,left:`${g}px`,width:`${Z}px`,height:`${P}px`,transform:`translate3d(${b}px, ${y}px, 0) scale(${N}, ${M})`}),S(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+i.fK)}))}))}(Boolean(e),m,De,Ge,te,$)}Ee&&!_&&(Xe||_e)&&((0,b.YW)(ce+i.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:l,left:d,width:m,height:u}=r.getBoundingClientRect(),{top:h,left:Z,width:P,height:g}=s.getBoundingClientRect();let p=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();p=h<l?-g:e}const v=d+m/2-(Z+P/2),E=l+u/2-(p+g/2);let f=m/P,C=u/g;const b=[o.bZ.Inline,o.bZ.ScheduledInline].includes(e)&&!N(a,s)||[o.bZ.Album,o.bZ.ScheduledAlbum].includes(e)&&!N(a,s);[o.bZ.SharedMedia,o.bZ.Album,o.bZ.ScheduledAlbum,o.bZ.SearchResult].includes(e)&&(f>C?f=C:C>f&&(C=f));const y=document.getElementsByClassName("ghost")[0],M=y||I(t||s,e);y||w(M,{top:`${p}px`,left:`${Z}px`,width:`${P}px`,height:`${g}px`,transform:`translate3d(${v}px, ${E}px, 0) scale(${f}, ${C})`}),requestAnimationFrame((()=>{if(y){const{top:e,left:t,width:n,height:a}=y.getBoundingClientRect();w(M,{transition:"none",top:`${p}px`,left:`${Z}px`,transformOrigin:"top left",transform:`translate3d(${t-Z}px, ${e-p}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"),S(M,e),setTimeout((()=>{requestAnimationFrame((()=>{document.body.contains(M)&&document.body.removeChild(M),document.body.classList.remove("ghost-animating")}))}),200+i.fK)}))}))}(ze,Ye,Xe||void 0))}),[Ee,_,m,ze,$,Xe,_e,De,Ye,Ge,te]),(0,a.d4)((()=>{let e;return Ie?ye(!0):e=window.setTimeout((()=>{ye(!1)}),ce),()=>{e&&window.clearTimeout(e)}}),[Ie]);const je=()=>{Ne(!1),ke(1),Me({x:0,y:0})},He=(0,a.I4)((()=>{Ne(!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&&je()}),[]),qe=(0,a.I4)((()=>{O(),je()}),[O]),Ke=(0,a.I4)((()=>{qe(),J({chatId:e,threadId:t,messageId:n})}),[qe,e,t,J,n]),We=(0,a.I4)((()=>{G({fromChatId:e,messageIds:[n]}),je()}),[G,e,n]);(0,a.d4)((()=>_?(0,P.Z)((()=>{Ie?je():qe()})):void 0),[qe,_,Ie]),(0,a.d4)((()=>{te&&!re&&(0,g.E)()}),[re,te]),(0,a.d4)((()=>{if(_)return c.Z.disableRefresh(),()=>{c.Z.enableRefresh()}}),[_]);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&&!l.cj;return(0,Z.s)(e,{excludedClosestSelector:".backdrop, .navigation, .media-viewer-head, .media-viewer-footer"+(t?"":", .VideoPlayer"),onClick:()=>{Ie||l.$b||qe()},onSwipe:l.$b?(e,t)=>(t===Z.e.Right?et():t===Z.e.Left?tt():e.target&&e.target.closest(".MediaViewerFooter")||qe(),!0):void 0})}),[qe,fe,re,ne,Ie,tt,et]);const nt=(0,a.I4)(((e,t)=>{Me({x:e,y:t})}),[]),at=(0,a.I4)((()=>{l.$b&&(ne||re)&&Ce(!fe)}),[fe,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),!l.wB&&!Ie));if($){const e=(0,y.X)($),s=Boolean(e);return a.ZP.createElement("div",{key:n,className:"media-viewer-content "+(s?"has-footer":""),onClick:at},ne&&de(Be||Re||Le||Fe,$&&(0,d.PA)(Ge,s),!l.wB&&!Ie),te&&a.ZP.createElement(ae,{key:n,url:Be||Re,isGif:re,posterData:De,posterSize:$&&(0,d.PA)(Ge,s,!0),downloadProgress:$e,fileSize:xe,isMediaViewerOpen:_,noPlay:!t,onClose:qe}),e&&a.ZP.createElement(Y,{text:e,onClick:Ke,isHidden:fe&&(!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)(_,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:_},(()=>a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{className:"media-viewer-head",dir:st.isRtl?"rtl":void 0},l.wB&&a.ZP.createElement(R.Z,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:st("Close"),onClick:qe},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(L.Z,{activeKey:Pe.current,name:ve},ot),a.ZP.createElement(X,{mediaData:Re||Le,isVideo:te,isZoomed:Ie,message:$,fileName:Oe,onCloseMediaViewer:qe,onForward:We,onZoomToggle:He,isAvatar:oe})),a.ZP.createElement(le,{noWrap:!be,canPan:Ie,panDeltaX:Se.x,panDeltaY:Se.y,zoomLevel:we,onPan:nt},a.ZP.createElement(L.Z,{className:"slide-container",activeKey:ue,name:pe},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),pe=n(7687),ve=n(1273),Ee=n(1876),fe=n(6058),Ce=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:i,setForwardChatId:c,exitForwardMode:d,loadMoreChats:m})=>{const[Z,P]=(0,a.eJ)(""),g=(0,a.sO)(null),p=(0,M.Z)();(0,a.d4)((()=>{i?l.wB||setTimeout((()=>{requestAnimationFrame((()=>{g.current&&g.current.focus()}))}),500):(g.current&&g.current.blur(),setTimeout((()=>{P("")}),300))}),[i]);const v=(0,a.Ye)((()=>{const a=[...n||[],...s||[]];let i=t||[];return o&&(i=(0,h.Tw)([o,...i])),(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)(p,e[t],void 0,t===o),Z))}))],e,void 0,i)}),[n,s,e,o,Z,p,t]),[E,f]=(0,he.Z)(m,v,Boolean(Z)),C=(0,a.I4)((e=>{P(e.currentTarget.value)}),[]),b=(0,a.sO)(null),y=(0,Ze.Z)(b,i,(e=>{E&&E.length>0&&c({id:E[-1===e?0:e]})}),".ListItem-button",!0),I=a.ZP.createElement("div",{className:"modal-header",dir:p.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:p("Close"),onClick:d},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(pe.Z,{ref:g,value:Z,onChange:C,onKeyDown:y,placeholder:p("ForwardTo")}));return a.ZP.createElement(ge.Z,{isOpen:i,onClose:d,className:"ForwardPicker",header:I},E&&E.length?a.ZP.createElement(ve.Z,{className:"picker-list custom-scroll",items:E,onLoadMore:f,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(fe.Z,{status:e===o?p("SavedMessagesInfo"):void 0,userId:e}):a.ZP.createElement(Ce.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 Ne=(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:i,isChannel:l}=e,c=s(l?"Subscribers":"Members",i,"i"),d=s(l?"ChannelJoin":"JoinGroup");return a.ZP.createElement(ge.Z,{isOpen:!0,onClose:t,className:"error",title:o},void 0!==i&&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,B.Z)(r.message,["emoji","br"]),a.ZP.createElement("div",null,a.ZP.createElement(R.Z,{isText:!0,onClick:t},s("OK")))));var r})))})));var we=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(we.Z,{message:(0,B.Z)(e,["emoji","br","links","simple_markdown"]),onDismiss:()=>t({localId:n})}))))})));var Se=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,Se.Z)(e);return a.ZP.createElement(Me.Z,{isOpen:Boolean(e),onClose:r,title:n("OpenUrlTitle"),textParts:(0,B.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),i=s&&new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0);return!!(i&&r>i)||!!(o&&r<o)}function Re(e){return String(e).padStart(2,"0")}const $e=(0,a.X$)((({selectedAt:e,maxAt:t,isFutureMode:n,isPastMode:s,isOpen:r,withTimePicker:o,submitButtonLabel:i,secondButtonLabel:l,onClose:c,onSubmit:d,onSecondButtonClick:m})=>{const 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,C.Z)(r),[p,v,E]=(0,Fe.Z)(!1),[f,b]=(0,a.eJ)(Z),[y,I]=(0,a.eJ)(Re(Z.getHours())),[N,w]=(0,a.eJ)(Re(Z.getMinutes())),k=f.getFullYear(),S=f.getMonth(),T=f.getDate();(0,a.d4)((()=>{!g&&r&&b(Z)}),[r,Z,g]),(0,a.d4)((()=>{n&&!p&&f.getTime()<Z.getTime()&&(b(Z),I(Re(Z.getHours())),w(Re(Z.getMinutes())))}),[Z,p,n,f]);const F=s&&k>=h.getFullYear()&&S>=h.getMonth()||P&&k>=P.getFullYear()&&S>=P.getMonth(),A=n&&k<=h.getFullYear()&&S<=h.getMonth(),L=(0,a.Ye)((()=>function(e,t){const n=[],a=new Date;a.setFullYear(e),a.setMonth(t),a.setDate(1);const s=a.getDay()||7;for(let e=1;e<s;e++)n.push(0);for(;a.getMonth()===t;){const e=a.getDate();n.push(e),a.setDate(e+1)}return n}(k,S)),[S,k]),B=(0,a.I4)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return I(""),void(e.target.value="");const n=Math.max(0,Math.min(Number(t),23)),a=new Date(f.getTime());a.setHours(n),b(a);const s=Re(n);I(s),e.target.value=s}),[f]),D=(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(f.getTime());a.setMinutes(n),b(a);const s=Re(n);w(s),e.target.value=s}),[f]);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${f.getMonth()+1}`)," ",f.getFullYear()),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",disabled:A,onClick:A?void 0:function(){b((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:F,onClick:F?void 0:function(){b((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))))),L.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}));var t},className:(0,_.Z)("day-button",Le(k,S,e,n?h:void 0,s?h:P)?"disabled":e?"clickable":"",e===T&&"selected")},!!e&&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:y,onChange:B,onFocus:v,onBlur:E}),":",a.ZP.createElement("input",{type:"text",className:"form-control",inputMode:"decimal",value:N,onChange:D,onFocus:v,onBlur:E})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement(R.Z,{onClick:function(){d(f)}},o?function(e,t){const n=(0,$.xH)(t,e.code);return n===(0,$.xH)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,$.mr)(t)):e("Conversation.ScheduleMessage.SendOn",[n,(0,$.mr)(t)])}(u,f):i),l&&a.ZP.createElement(R.Z,{onClick:m,isText:!0},l)))})),Be=(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})}))),De=(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:i,willDeleteForAll:l,onClose:c,deleteMessages:d,deleteScheduledMessages:m})=>{const u=(0,a.I4)((()=>{const e=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=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")),i&&a.ZP.createElement("p",null,Z("lng_delete_for_me_chat_hint",1,"i")),l&&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,B.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")))}))),Ue=(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),i=!!s&&(0,u.ZV)(s);return{isPrivateChat:n,isChatWithSelf:a,isChannel:r,isGroup:o,isSuperGroup:i,canPinForAll:n&&!a||i||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:i,contactName:l,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")),i&&a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:m},l?(0,B.Z)(h("Conversation.PinMessagesFor",l)):h("Conversation.PinMessageAlert.PinAndNotifyMembers")),a.ZP.createElement(R.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},h("Cancel")))}))),xe=(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 Oe=n(517);const Ge=(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:i,onClose:l,deleteMessages:c,deleteScheduledMessages:d,exitMessageSelectMode:m})=>{const u=(0,C.Z)(e),h=(0,a.I4)((()=>{l(),c({messageIds:n,shouldDeleteForAll:!0})}),[c,n,l]),Z=(0,a.I4)((()=>{t?d({messageIds:n}):c({messageIds:n,shouldDeleteForAll:!1}),l()}),[t,l,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:l,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."),i&&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,B.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:l},P("Cancel")))})));var Je=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,i]=(0,a.eJ)("spam"),[l,c]=(0,a.eJ)(""),d=()=>{n({messageIds:t,reason:o,description:l}),s(),r()},m=(0,a.I4)((e=>{i(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(Je.Z,{name:"report-message",options:Z,onChange:m,selected:o}),a.ZP.createElement(pe.Z,{label:h("lng_report_reason_description"),value:l,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")))}))),ze=(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:i,selectedMessageIds:l,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,Oe.Z)({onBackspace:u,onDelete:u,onEsc:c})),[t,m,Z,u,c]);const p=(0,C.Z)(r||void 0,!0),v=t?r:p,E=(0,M.Z)(),f=E("VoiceOver.Chat.MessagesSelected",v),b=(0,_.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:f},f),!!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"))),i&&a.ZP.createElement(G.Z,{icon:"flag",onClick:P,disabled:!i,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(Ge,{isOpen:m,isSchedule:s,onClose:h}),a.ZP.createElement(Xe,{isOpen:Z,onClose:g,messageIds:l}))})));var _e=n(3133),Ye=n(735),je=n(1470);const He=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 Ve=n(329);const qe=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),a=n&&(0,u.zX)(n);return{chat:n,privateChatUser:a?(0,m.dy)(e,a):void 0,isPinned:(0,m.ep)(e,t),isMuted:n?(0,u.i4)(n,(0,m.dZ)(e),(0,m.NJ)(e)):void 0}}))((({chatId:e,chat:t,privateChatUser:n,isPinned:s,isMuted:r,withUsername:o,onClick:i})=>{const[l,c,d]=(0,Fe.Z)(),m=(0,je.Z)({chat:t,privateChatUser:n,isPinned:s,isMuted:r,handleDelete:c}),h=()=>{i(e)},Z=He(h);if(t)return a.ZP.createElement(Ee.Z,{className:"chat-item-clickable search-result",onClick:h,contextActions:m,buttonRef:Z},(0,u.YA)(e)?a.ZP.createElement(fe.Z,{userId:e,withUsername:o,avatarSize:"large"}):a.ZP.createElement(Ce.Z,{chatId:e,withUsername:o,avatarSize:"large"}),a.ZP.createElement(Ve.Z,{isOpen:l,onClose:d,chat:t}))})));var Ke=n(8781);const We=(0,z.P2)((e=>e()),6e4,!0),Qe=(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:i,addRecentlyFoundChatId:l,clearRecentlyFoundChats:c})=>{const d=(0,a.sO)(null);(0,a.d4)((()=>{We((()=>{r(),o()}))}),[r,o]),(0,Ke.Z)(d.current,!e);const m=(0,a.I4)((e=>{i({id:e,shouldReplaceHistory:!0}),s(),setTimeout((()=>{l({id:e})}),250)}),[i,l,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,B.Z)((0,u.Vl)(t[e])||" "))))))),n&&a.ZP.createElement("div",{className:"search-section pt-1"},a.ZP.createElement("h3",{className:"section-heading mt-0 recent-chats-header",dir:h.isRtl?"rtl":void 0},h("Recent"),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",ariaLabel:"Clear recent chats",onClick:c,isRtl:h.isRtl},a.ZP.createElement("i",{className:"icon-close"}))),n.map((e=>a.ZP.createElement(qe,{chatId:e,onClick:m})))))})));var et=n(9411),tt=n(8033);const nt=(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:i})=>{const c=(0,u.DH)(e),d=(0,v.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=He(h);if(s)return a.ZP.createElement(Ee.Z,{className:"ChatMessage chat-item-clickable",ripple:!l.wB,onClick:h,buttonRef:P},a.ZP.createElement(D.Z,{chat:s,user:r,withOnlineStatus:!0,isSavedMessages:r&&r.isSelf,lastSyncTime:i}),a.ZP.createElement("div",{className:"info"},a.ZP.createElement("div",{className:"info-row"},a.ZP.createElement("div",{className:"title"},a.ZP.createElement("h3",{dir:"auto"},(0,B.Z)((0,u.U)(Z,s,r))),s.isVerified&&a.ZP.createElement(et.Z,null)),a.ZP.createElement("div",{className:"message-date"},a.ZP.createElement(tt.Z,{className:"date"},(0,$.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,B.Z)((0,u.MK)(e,t,!0),["emoji","highlight"],{highlight:s})):(0,B.Z)((0,u.MK)(e,t))}(Z,e,d||c,t,m)))))}))),at=(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,$.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,$.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 st=n(7262),rt=n(9187);const ot=(0,z.P2)((e=>e()),500,!0),it=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{byId:n}=e.users,{userIds:a}=e.contactList||{};if(!a)return{chatsById:t,usersById:n};const{currentUserId:s,messages:r,lastSyncTime:o}=e,{fetchingStatus:i,globalResults:l,localResults:c,resultsByType:d}=e.globalSearch,{chatIds:m,userIds:u}=l||{},{chatIds:h,userIds:Z}=c||{},{byChatId:P}=r,{foundIds:g}=d&&d.text||{};return{currentUserId:s,localContactIds:a,localChatIds:h,localUserIds:Z,globalChatIds:m,globalUserIds:u,foundIds:g,globalMessagesByChatId:P,chatsById:t,usersById:n,fetchingStatus:i,lastSyncTime:o}}),((e,t)=>(0,h.ei)(t,["openChat","addRecentlyFoundChatId","searchMessagesGlobal","setGlobalSearchChatId"])))((({searchQuery:e,searchDate:t,dateSearchQuery:n,currentUserId:s,localContactIds:r,localChatIds:i,localUserIds:c,globalChatIds:d,globalUserIds:m,foundIds:Z,globalMessagesByChatId:P,chatsById:g,usersById:p,fetchingStatus:v,lastSyncTime:E,onReset:f,onSearchDateSelect:C,openChat:b,addRecentlyFoundChatId:y,searchMessagesGlobal:I,setGlobalSearchChatId:N})=>{const w=(0,M.Z)(),[k,S]=(0,a.eJ)(!1),[T,F]=(0,a.eJ)(!1),A=(0,a.I4)((({direction:t})=>{E&&t===o.Uq.Backwards&&ot((()=>{I({type:"text",query:e})}))}),[E,I,e]),L=(0,a.I4)((e=>{b({id:e,shouldReplaceHistory:!0}),e!==s&&y({id:e}),l.wB||f()}),[s,b,y,f]),R=(0,a.I4)((e=>{N({id:e})}),[N]),$=(0,a.Ye)((()=>{if(!e||e.startsWith("@")&&e.length<2)return Ye.D;const t=r?r.filter((t=>{const n=p[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)(w("SavedMessages"),e)?[s]:[],...(0,u.ih)((0,h.Tw)([...t,...i||[],...c||[]]),g)]}),[e,r,s,w,i,c,g,p]),B=(0,a.Ye)((()=>!e||e.length<4||!d||!m?Ye.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=>{const[t,n]=e.split("_").map(Number);return P&&P[t]&&P[t].byId[n]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Ye.D),[Z,P,e,t]),U=(0,a.I4)((()=>{S(!k)}),[k]),x=(0,a.I4)((()=>{F(!T)}),[T]),O=v&&!v.chats&&!v.messages&&!$.length&&!B.length&&!D.length;return e||t?a.ZP.createElement(ve.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(at,{searchDate:n,onSelect:C})),O&&a.ZP.createElement(st.Z,{text:w("ChatList.Search.NoResults"),description:w("ChatList.Search.NoResultsDescription")}),!!$.length&&a.ZP.createElement("div",{className:"chat-selection no-selection no-scrollbar",dir:w.isRtl?"rtl":void 0},$.map((e=>a.ZP.createElement(rt.Z,{chatOrUserId:e,onClick:R,clickArg:e})))),!!$.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},$.length>3&&a.ZP.createElement(tt.Z,{onClick:U},w(k?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionDialogs")),$.map(((e,t)=>{if(k||!(t>=3))return a.ZP.createElement(qe,{chatId:e,onClick:L})}))),!!B.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},B.length>3&&a.ZP.createElement(tt.Z,{onClick:x},w(T?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")),w("DialogList.SearchSectionGlobal")),B.map(((e,t)=>{if(T||!(t>=3))return a.ZP.createElement(qe,{chatId:e,withUsername:!0,onClick:L})}))),!!D.length&&a.ZP.createElement("div",{className:"search-section"},a.ZP.createElement("h3",{className:"section-heading",dir:w.isRtl?"auto":void 0},w("SearchMessages")),D.map((function(t){const n=(0,u.MK)(w,t),s=g[t.chatId];if(n&&s)return a.ZP.createElement(nt,{chatId:t.chatId,message:t,searchQuery:e})})))):a.ZP.createElement(Qe,{onReset:f})}))),lt=(0,z.P2)((e=>e()),500,!0),ct=(0,a.X$)((0,s.c$)((e=>{const{byId:t}=e.chats,{currentUserId:n,messages:{byChatId:a},lastSyncTime:s}=e,{fetchingStatus:r,resultsByType:o}=e.globalSearch,{foundIds:i}=o&&o.text||{};return{currentUserId:n,foundIds:i,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:i,fetchingStatus:l,lastSyncTime:c,searchMessagesGlobal:d,onSearchDateSelect:m})=>{const h=(0,M.Z)(),Z=(0,a.I4)((({direction:n})=>{c&&n===o.Uq.Backwards&<((()=>{d({type:"text",query:e,chatId:t})}))}),[t,c,d,e]),P=(0,a.Ye)((()=>s&&0!==s.length?s.map((e=>{const[t,n]=e.split("_").map(Number);return r&&r[t]&&r[t].byId[n]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):Ye.D),[s,r]),g=l&&!l.chats&&!l.messages&&!P.length;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(ve.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(at,{searchDate:n,onSelect:m})),g&&a.ZP.createElement(st.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=i[t.chatId];if(n&&s)return a.ZP.createElement(nt,{chatId:t.chatId,message:t,searchQuery:e})}))))})));function dt(e){return(t,n)=>{const{byId:a}=t.chats,{byId:s}=t.users,{fetchingStatus:r,resultsByType:o,chatId:i}=t.globalSearch,l="audio"!==e?e:n&&n.isVoice?"voice":"audio",{byChatId:c}=t.messages,{foundIds:d}=o&&o[l]||{};return{theme:(0,m.Pu)(t),isLoading:void 0===d||!!r&&Boolean(r.chats||r.messages),chatsById:a,usersById:s,globalMessagesByChatId:c,foundIds:d,searchChatId:i,lastSyncTime:t.lastSyncTime}}}var mt=n(7891),ut=n(3709);const ht="media",Zt=(0,z.P2)((e=>e()),500,!0),Pt=(0,a.X$)((0,s.c$)(dt(ht),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","openMediaViewer"])))((({searchQuery:e,searchChatId:t,isLoading:n,globalMessagesByChatId:s,foundIds:r,lastSyncTime:l,searchMessagesGlobal:c,openMediaViewer:d})=>{const m=(0,M.Z)(),u=(0,a.I4)((({direction:n})=>{l&&n===o.Uq.Backwards&&Zt((()=>{c({type:ht,query:e,chatId:t})}))}),[l,c,e,t]),h=(0,a.Ye)((()=>r&&s?r.map((e=>{const[t,n]=e.split("_").map(Number);return s[t]&&s[t].byId[n]})).filter(Boolean):Ye.D),[s,r]),Z=(0,a.I4)(((e,t)=>{d({chatId:t,messageId:e,origin:o.bZ.SearchResult})}),[d]),P=(0,mt.Z)([e],i.Y)&&!n,g=P&&r&&r.length>0&&!e,p=P&&r&&r.length>0&&e,v=(0,_.Z)("search-content custom-scroll",p&&"chat-list");return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(ve.Z,{className:v,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(st.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(ut.Z,{key:e.id,idPrefix:"search-media",message:e,onClick:Z})))),p&&h.map((e=>a.ZP.createElement(nt,{key:e.id,chatId:e.chatId,message:e})))))})));function gt(e,t,n,a){const{senderId:s}=t;if(!s)return;const r=(0,u.YA)(s)?a[s]:n[s];let o=(0,u.OU)(e,r);const i=n[t.chatId];return i&&((0,u.YA)(s)&&r.isSelf?o=`${e("FromYou")} → ${(0,u.U)(e,i)}`:(0,u.Bf)(i)&&(o+=` → ${(0,u.U)(e,i)}`)),o}var pt=n(5418);const vt="links",Et=(0,z.P2)((e=>e()),500,!0),ft=(0,a.X$)((0,s.c$)(dt(vt),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","focusMessage"])))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:s,usersById:r,globalMessagesByChatId:l,foundIds:c,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:u})=>{const h=(0,M.Z)(),Z=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&Et((()=>{m({type:vt,query:e,chatId:t})}))}),[d,m,e,t]),P=(0,a.Ye)((()=>c&&l?c.map((e=>{const[t,n]=e.split("_").map(Number);return l[t]&&l[t].byId[n]})).filter(Boolean):Ye.D),[l,c]),g=(0,a.I4)(((e,t)=>{u({chatId:t,messageId:e})}),[u]),p=(0,mt.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(ve.Z,{className:"search-content documents-list custom-scroll",items:P,onLoadMore:Z,noFastList:!0},!p&&a.ZP.createElement(Pe.Z,null),p&&(!c||0===c.length)&&a.ZP.createElement(st.Z,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),p&&c&&c.length>0&&P.map(((e,t)=>{const n=0===t||(0,$.kj)(e.date)!==(0,$.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,$.np)(h,new Date(1e3*e.date))),a.ZP.createElement(pt.Z,{key:e.id,message:e,senderTitle:gt(h,e,s,r),onMessageClick:g}))}))))})));var Ct=n(2535);const bt="documents",yt=(0,z.P2)((e=>e()),500,!0),It=(0,a.X$)((0,s.c$)(dt(bt),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","focusMessage"])))((({searchQuery:e,searchChatId:t,isLoading:n,chatsById:s,usersById:r,globalMessagesByChatId:l,foundIds:c,lastSyncTime:d,searchMessagesGlobal:m,focusMessage:h})=>{const Z=(0,M.Z)(),P=(0,a.I4)((({direction:n})=>{d&&n===o.Uq.Backwards&&yt((()=>{m({type:bt,query:e,chatId:t})}))}),[d,m,e,t]),g=(0,a.Ye)((()=>c&&l?c.map((e=>{const[t,n]=e.split("_").map(Number),a=l[t]&&l[t].byId[n];return a&&(0,u.aE)(a)?a:void 0})).filter(Boolean):Ye.D),[l,c]),p=(0,a.I4)(((e,t)=>{h({chatId:t,messageId:e})}),[h]),v=(0,mt.Z)([e],i.Y)&&!n;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(ve.Z,{className:"search-content documents-list custom-scroll",items:g,onLoadMore:P,noFastList:!0},!v&&a.ZP.createElement(Pe.Z,null),v&&(!c||0===c.length)&&a.ZP.createElement(st.Z,{text:Z("ChatList.Search.NoResults"),description:Z("ChatList.Search.NoResultsDescription")}),v&&c&&c.length>0&&g.map(((e,t)=>{const n=0===t||(0,$.kj)(e.date)!==(0,$.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,$.np)(Z,new Date(1e3*e.date))),a.ZP.createElement(Ct.Z,{message:e,withDate:!0,datetime:e.date,smaller:!0,sender:gt(Z,e,s,r),className:"scroll-item",onDateClick:p}))}))))})));var Nt=n(4752);const wt=(0,z.P2)((e=>e()),500,!0),kt=(0,a.X$)((0,s.c$)(dt("audio"),((e,t)=>(0,h.ei)(t,["searchMessagesGlobal","focusMessage","openAudioPlayer"])))((({theme:e,isVoice:t,searchQuery:n,searchChatId:s,isLoading:r,chatsById:l,usersById:c,globalMessagesByChatId:d,foundIds:m,lastSyncTime:u,searchMessagesGlobal:h,focusMessage:Z,openAudioPlayer:P})=>{const g=(0,M.Z)(),p=t?"voice":"audio",v=(0,a.I4)((({direction:e})=>{u&&e===o.Uq.Backwards&&wt((()=>{h({type:p,query:n,chatId:s})}))}),[p,u,h,n,s]),E=(0,a.Ye)((()=>m&&d?m.map((e=>{const[t,n]=e.split("_").map(Number);return d[t]&&d[t].byId[n]})).filter(Boolean):Ye.D),[d,m]),f=(0,a.I4)(((e,t)=>{Z({chatId:t,messageId:e})}),[Z]),C=(0,a.I4)(((e,t)=>{P({chatId:t,messageId:e})}),[P]),b=(0,mt.Z)([n],i.Y)&&!r;return a.ZP.createElement("div",{className:"LeftSearch"},a.ZP.createElement(ve.Z,{className:"search-content documents-list custom-scroll",items:E,onLoadMore:v,noFastList:!0},!b&&a.ZP.createElement(Pe.Z,null),b&&(!m||0===m.length)&&a.ZP.createElement(st.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,$.kj)(t.date)!==(0,$.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,$.np)(g,new Date(1e3*t.date))),a.ZP.createElement(Nt.Z,{key:t.id,theme:e,message:t,target:"searchResult",senderTitle:gt(g,t,l,c),date:t.date,lastSyncTime:u,className:"scroll-item",onPlay:C,onDateClick:f}))}))))}))),St=[{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"}],Mt=[{type:o.nJ.ChatList,title:"All Messages"},...St.slice(1)],Tt=Object.keys(o.nJ).length/2,Ft=(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:i,setGlobalSearchDate:l,onReset:c})=>{const d=(0,M.Z)(),[m,u]=(0,a.eJ)(s),h=(0,a.Ye)((()=>(0,$.xk)(e)),[e]),Z=(0,a.I4)((e=>{const t=St[e];i({content:t.type}),u(e)}),[i]),P=(0,a.I4)((e=>{l({date:e.getTime()/1e3})}),[l]);(0,T.ZP)(n,c,void 0,void 0,!0);const g=(0,a.sO)(null),p=(0,Ze.Z)(g,n,void 0,".ListItem-button",!0);return a.ZP.createElement("div",{className:"LeftSearch",ref:g,onKeyDown:p},a.ZP.createElement(_e.Z,{activeTab:m,tabs:r?Mt:St,onSwitchTab:Z}),a.ZP.createElement(L.Z,{name:d.isRtl?"slide-reversed":"slide",renderCount:Tt,activeKey:s},(()=>{switch(s){case o.nJ.ChatList:return r?a.ZP.createElement(ct,{searchQuery:e,dateSearchQuery:h,onReset:c,onSearchDateSelect:P}):a.ZP.createElement(it,{searchQuery:e,searchDate:t,dateSearchQuery:h,onReset:c,onSearchDateSelect:P});case o.nJ.Media:return a.ZP.createElement(Pt,{searchQuery:e});case o.nJ.Links:return a.ZP.createElement(ft,{searchQuery:e});case o.nJ.Files:return a.ZP.createElement(It,{searchQuery:e});case o.nJ.Music:return a.ZP.createElement(kt,{key:"audio",searchQuery:e});case o.nJ.Voice:return a.ZP.createElement(kt,{key:"voice",isVoice:!0,searchQuery:e});default:return}})))})));var At=n(1090);const Lt={currentPassword:"",password:"",hint:"",email:""},Rt=(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 Lt;default:return e}},$t=(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:i,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)}),[]),p=(0,a.I4)((()=>{h(!1)}),[]),v=(0,a.I4)((()=>{P(),r()}),[P,r]),E=(0,a.I4)((()=>{p(),i({id:t}),n()}),[t,p,i,n]),f=(0,a.Ye)((()=>({onTrigger:e,isOpen:t})=>a.ZP.createElement(R.Z,{round:!0,ripple:!l.wB,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions"},a.ZP.createElement("i",{className:"icon-more"}))),[]),C=(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:C("AccDescrGoBack")},a.ZP.createElement("i",{className:"icon-arrow-left"})),function(){switch(e){case o.MT.EditProfile:return a.ZP.createElement("h3",null,C("lng_settings_information"));case o.MT.General:return a.ZP.createElement("h3",null,C("General"));case o.MT.Notifications:return a.ZP.createElement("h3",null,C("Notifications"));case o.MT.Privacy:return a.ZP.createElement("h3",null,C("PrivacySettings"));case o.MT.Language:return a.ZP.createElement("h3",null,C("Language"));case o.MT.GeneralChatBackground:return a.ZP.createElement("h3",null,C("ChatBackground"));case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement("h3",null,C("SetColor"));case o.MT.PrivacyPhoneNumber:return a.ZP.createElement("h3",null,C("PrivacyPhone"));case o.MT.PrivacyLastSeen:return a.ZP.createElement("h3",null,C("PrivacyLastSeen"));case o.MT.PrivacyProfilePhoto:return a.ZP.createElement("h3",null,C("Privacy.ProfilePhoto"));case o.MT.PrivacyForwarding:return a.ZP.createElement("h3",null,C("PrivacyForwards"));case o.MT.PrivacyGroupChats:return a.ZP.createElement("h3",null,C("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,C("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,C("NeverShareWith"));case o.MT.PrivacyActiveSessions:return a.ZP.createElement("h3",null,C("SessionsTitle"));case o.MT.PrivacyBlockedUsers:return a.ZP.createElement("h3",null,C("BlockedUsers"));case o.MT.TwoFaDisabled:case o.MT.TwoFaEnabled:return a.ZP.createElement("h3",null,C("TwoStepVerification"));case o.MT.TwoFaNewPassword:case o.MT.TwoFaChangePasswordNew:case o.MT.TwoFaChangePasswordConfirm:return a.ZP.createElement("h3",null,C("PleaseEnterCurrentPassword"));case o.MT.TwoFaNewPasswordConfirm:return a.ZP.createElement("h3",null,C("PleaseReEnterPassword"));case o.MT.TwoFaNewPasswordHint:case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement("h3",null,C("PasswordHint"));case o.MT.TwoFaNewPasswordEmail:case o.MT.TwoFaRecoveryEmail:return a.ZP.createElement("h3",null,C("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,C("TwoStepVerificationPasswordSet"));case o.MT.TwoFaChangePasswordCurrent:case o.MT.TwoFaTurnOff:case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement("h3",null,C("PleaseEnterCurrentPassword"));case o.MT.Folders:return a.ZP.createElement("h3",null,C("Filters"));case o.MT.FoldersCreateFolder:return a.ZP.createElement("h3",null,C("FilterNew"));case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,C("FilterEdit")),t&&a.ZP.createElement(O.Z,{className:"settings-more-menu",trigger:f,positionX:"right"},a.ZP.createElement(G.Z,{icon:"delete",destructive:!0,onClick:g},C("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,C("FilterInclude")):a.ZP.createElement("h3",null,C("FilterExclude")),a.ZP.createElement(R.Z,{round:!0,size:"smaller",color:"translucent",className:"color-primary",onClick:s,ariaLabel:C("AutoDeleteConfirm")},a.ZP.createElement("i",{className:"icon-check"})));default:return a.ZP.createElement("div",{className:"settings-main-header"},a.ZP.createElement("h3",null,C("SETTINGS")),a.ZP.createElement(R.Z,{round:!0,ripple:!l.wB,size:"smaller",color:"translucent",onClick:()=>c(o.MT.EditProfile),ariaLabel:C("lng_settings_information")},a.ZP.createElement("i",{className:"icon-edit"})),a.ZP.createElement(O.Z,{className:"settings-more-menu",trigger:f,positionX:"right"},a.ZP.createElement(G.Z,{icon:"logout",onClick:Z},C("LogOutTitle"))))}}(),a.ZP.createElement(Me.Z,{isOpen:d,onClose:P,text:C("lng_sure_logout"),confirmLabel:C("AccountSettings.Logout"),confirmHandler:v,confirmIsDestructive:!0}),a.ZP.createElement(Me.Z,{isOpen:u,onClose:p,text:C("FilterDeleteAlert"),confirmLabel:C("Delete"),confirmHandler:E,confirmIsDestructive:!0}))})));var Bt=n(787),Dt=n(180);const Ut=(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:i})=>{const l=(0,M.Z)(),c=r?r.id:void 0;return(0,a.d4)((()=>{c&&i&&s({profileId:c})}),[i,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(Bt.Z,{userId:r.id,forceShowSelf:!0}),r&&a.ZP.createElement(Dt.Z,{chatOrUserId:r.id,forceShowSelf:!0}),a.ZP.createElement(Ee.Z,{icon:"settings",onClick:()=>t(o.MT.General)},l("Telegram.GeneralSettingsViewController")),a.ZP.createElement(Ee.Z,{icon:"unmute",onClick:()=>t(o.MT.Notifications)},l("Notifications")),a.ZP.createElement(Ee.Z,{icon:"lock",onClick:()=>t(o.MT.Privacy)},l("PrivacySettings")),a.ZP.createElement(Ee.Z,{icon:"folder",onClick:()=>t(o.MT.Folders)},l("Filters")),a.ZP.createElement(Ee.Z,{icon:"language",onClick:()=>t(o.MT.Language)},l("Language"))))})));var xt=n(710),Ot=n(1151);const Gt="https://t.me/",Jt=/https:\/\/t\.me\/?/i,Xt=/^([a-zA-Z0-9_]+)$/,zt=(0,z.Ds)((e=>e()),250,!1),_t=(0,a.X$)((({currentUsername:e,asLink:t,isLoading:n,isUsernameAvailable:s,checkUsername:r,onChange:o})=>{const[i,l]=(0,a.eJ)(e||""),c=(0,M.Z)(),d=t?"SetUrl":"Username",m=c(t?"SetUrlPlaceholder":"Username"),[u,h]=(0,a.Ye)((()=>i.length?i.length<5?[void 0,`${m} is too short`]:i.length>32?[void 0,`${m} is too long`]:Xt.test(i)?void 0===s?[]:[s?c(`${d}Available`,"Username"):void 0,!1===s?c(`${d}InUse`):void 0]:[void 0,`${m} contains invalid characters`]:[]),[i,s,c,d,m]);(0,a.d4)((()=>{l(e||"")}),[t,e]);const Z=(0,a.I4)((e=>{const n=e.target.value.trim().replace(Jt,"");l(n),e.target.value=`${t?Gt:""}${n}`;const a=function(e){return e.length>=5&&e.length<=32&&Xt.test(e)}(n);a&&zt((()=>{r({username:n})})),o&&o(!!a&&n)}),[t,r,o]);return a.ZP.createElement(pe.Z,{value:`${t?Gt:""}${i}`,onChange:Z,label:m,error:h,success:u,readOnly:n})})),Yt=(0,z.P2)((e=>e()),6e4,!0),jt="Please provide your first name",Ht="Bio can' be longer than 70 characters",Vt=(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:i,fullInfo:l}=s,{bio:c}=l||{};return{currentAvatarHash:(0,u.RT)(s),currentFirstName:r,currentLastName:o,currentBio:c,currentUsername:i,progress:n,isUsernameAvailable:a}}),((e,t)=>(0,h.ei)(t,["loadCurrentUser","updateProfile","checkUsername"])))((({isActive:e,onScreenSelect:t,onReset:n,currentAvatarHash:s,currentFirstName:i,currentLastName:l,currentBio:c,currentUsername:d,progress:m,isUsernameAvailable:u,loadCurrentUser:h,updateProfile:Z,checkUsername:P})=>{const g=(0,M.Z)(),[p,E]=(0,a.eJ)(!1),[f,C]=(0,a.eJ)(!1),[b,y]=(0,a.eJ)(),[I,N]=(0,a.eJ)(),[w,k]=(0,a.eJ)(i||""),[S,A]=(0,a.eJ)(l||""),[L,R]=(0,a.eJ)(c||""),[$,D]=(0,a.eJ)(d||""),U=(0,v.Z)(s,!1,r.IU.BlobUrl),x=m===o.rN.InProgress,O=!1===$,G=(0,a.Ye)((()=>!O&&(Boolean(I)||f||!0===u)),[I,f,O,u]);(0,T.ZP)(e,n,t,o.MT.EditProfile),(0,a.d4)((()=>{Yt((()=>{h()}))}),[h]),(0,a.d4)((()=>{N(void 0)}),[U]),(0,a.d4)((()=>{k(i||""),A(l||""),R(c||"")}),[i,l,c]),(0,a.d4)((()=>{D(d||"")}),[d]),(0,a.d4)((()=>{m===o.rN.Complete&&(C(!1),E(!1),y(void 0))}),[m]);const J=(0,a.I4)((e=>{N(e)}),[]),X=(0,a.I4)((e=>{k(e.target.value),C(!0)}),[]),z=(0,a.I4)((e=>{A(e.target.value),C(!0)}),[]),_=(0,a.I4)((e=>{R(e.target.value),C(!0)}),[]),Y=(0,a.I4)((e=>{D(e),E(!0)}),[]),j=(0,a.I4)((()=>{const e=w.trim(),t=S.trim(),n=L.trim();e.length?n.length>70?y(Ht):Z({photo:I,...f&&{firstName:e,lastName:t,bio:n},...p&&{username:$}}):y(jt)}),[I,w,S,L,f,$,p,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(xt.Z,{currentAvatarBlobUrl:U,onChange:J,title:"Edit your profile photo",disabled:x}),a.ZP.createElement(pe.Z,{value:w,onChange:X,label:g("FirstName"),disabled:x,error:b===jt?b:void 0}),a.ZP.createElement(pe.Z,{value:S,onChange:z,label:g("LastName"),disabled:x}),a.ZP.createElement(pe.Z,{value:L,onChange:_,label:g("UserBio"),disabled:x,error:b===Ht?b:void 0}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,B.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(_t,{currentUsername:$||"",isLoading:x,isUsernameAvailable:u,checkUsername:P,onChange:Y}),a.ZP.createElement("p",{className:"settings-item-description",dir:g.isRtl?"rtl":void 0},(0,B.Z)(g("UsernameHelp"),["br","simple_markdown"])),$&&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/",$)))),a.ZP.createElement(Ot.Z,{isShown:G,onClick:j,disabled:x,ariaLabel:"Save changes"},x?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))})));var qt=n(7324),Kt=n(7799);const Wt=(0,z.P2)((e=>e()),6e4,!0),Qt=(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:l,usersById:c,orderedFolderIds:d,foldersById:m,recommendedChatFolders:h,notifySettings:Z,notifyExceptions:P,loadRecommendedChatFolders:g,addChatFolder:p,showDialog:v})=>{const[E,f]=(0,a.eJ)(),[C,b]=(0,a.eJ)(!1),y=(0,a.I4)((()=>b(!0)),[]);(0,a.d4)((()=>{E||(0,qt.Z)("FoldersAll").then(f)}),[E]),(0,a.d4)((()=>{Wt((()=>{g()}))}),[g]);const I=(0,a.I4)((()=>{Object.keys(m).length>=10?v({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):e()}),[m,v,e]),N=(0,M.Z)();(0,T.ZP)(n,r,s,o.MT.Folders);const w=(0,a.Ye)((()=>{if(!d)return;const e=Object.keys(l).map(Number);return d.map((t=>{const n=m[t];return{id:n.id,title:n.title,subtitle:(0,u.SB)(N,l,c,n,e,Z,P)}}))}),[d,l,m,c,Z,P,N]),k=(0,a.I4)((e=>{Object.keys(m).length>=10?v({data:{message:"DIALOG_FILTERS_TOO_MUCH",hasErrorKey:!0}}):p({folder:e})}),[m,p,v]);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(Kt.Z,{id:"settingsFoldersMain",size:i.ku,animationData:E,play:C,noLoop:!0,onLoad:y})),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},N("CreateNewFilterInfo")),a.ZP.createElement(R.Z,{className:"with-icon mb-2",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:I,isRtl:N.isRtl},a.ZP.createElement("i",{className:"icon-add"}),N("CreateNewFilter"))),a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("Filters")),w&&w.length?w.map((e=>a.ZP.createElement(Ee.Z,{className:"mb-2 no-icon",narrow:!0,multiline:!0,onClick:()=>t(m[e.id])},a.ZP.createElement("span",{className:"title"},e.title),a.ZP.createElement("span",{className:"subtitle"},e.subtitle)))):w&&!w.length?a.ZP.createElement("p",{className:"settings-item-description my-4",dir:"auto"},"You have no folders yet."):a.ZP.createElement(Pe.Z,null)),h&&!!h.length&&a.ZP.createElement("div",{className:"settings-item pt-3"},a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:N.isRtl?"rtl":void 0},N("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:N.isRtl},N("Add"))))))))})));var en=n(3455);const tn=({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)},nn="Please provide a title for this folder.",an="ChatList.Filter.Error.Empty",sn=(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:l,onReset:c,onBack:d,loadedActiveChatIds:m,loadedArchivedChatIds:Z,editChatFolder:P,addChatFolder:g,loadMoreChats:p})=>{const[v,E]=(0,a.eJ)(),[f,C]=(0,a.eJ)(!1),b=(0,a.I4)((()=>C(!0)),[]),[y,I]=(0,a.eJ)(!1),[N,w]=(0,a.eJ)(!1),{selectedChatIds:k,selectedChatTypes:S}=(0,en.vb)(e,"included"),{selectedChatIds:A,selectedChatTypes:L}=(0,en.vb)(e,"excluded");(0,a.d4)((()=>{v||(0,qt.Z)("FoldersNew").then(E)}),[v]),(0,a.d4)((()=>{I(!1),w(!1)}),[e.folderId]);const[R,$]=(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-S.length),N?n:n.slice(0,5-L.length)]}),[A,k,S,L,N,y,m,Z]);(0,a.d4)((()=>{(R.length<k.length||$.length<A.length)&&p({listType:"active"})}),[p,A.length,k.length,$.length,R.length]);const B=(0,M.Z)();function D(e){const t="included"===e?S:L,n="included"===e?R:$,s="included"===e?y:N,r=("included"===e?k:A).length-t.length-n.length,o="included"===e?()=>I(!0):()=>w(!0);return a.ZP.createElement(a.ZP.Fragment,null,t.map((t=>function(e,t){const n="included"===t?en.fi.find((({key:t})=>t===e)):en.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},B(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(fe.Z,{avatarSize:"small",userId:e}):a.ZP.createElement(Ce.Z,{avatarSize:"small",chatId:e})))),!s&&r>0&&a.ZP.createElement(tn,{count:r,itemName:"chat",onClick:o}))}return(0,T.ZP)(r,d,l,"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"},v&&a.ZP.createElement(Kt.Z,{id:"settingsFoldersEdit",size:i.ku,animationData:v,play:f&&String(e.folderId),noLoop:!0,onLoad:b})),"create"===e.mode&&a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:B.isRtl?"rtl":void 0},B("FilterIncludeInfo")),a.ZP.createElement(pe.Z,{className:"mb-0",label:B("FilterNameHint"),value:e.folder.title,onChange:function(e){const{currentTarget:n}=e;t({type:"setTitle",payload:n.value.trim()})},error:e.error&&e.error===nn?nn:void 0})),a.ZP.createElement("div",{className:"settings-item no-border pt-3"},e.error&&e.error===an&&a.ZP.createElement("p",{className:"settings-item-description color-danger mb-2",dir:B.isRtl?"rtl":void 0},B(e.error)),a.ZP.createElement("h4",{className:"settings-item-header mb-3",dir:B.isRtl?"rtl":void 0},B("FilterInclude")),a.ZP.createElement(Ee.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:n},B("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:B.isRtl?"rtl":void 0},B("FilterExclude")),a.ZP.createElement(Ee.Z,{className:"settings-folders-list-item color-primary mb-0",icon:"add",onClick:s},B("FilterAddChats")),D("excluded"))),a.ZP.createElement(Ot.Z,{isShown:!!e.isTouched,disabled:e.isLoading,onClick:function(){const{title:n}=e.folder;n?k.length||Object.keys(S).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:an}):t({type:"setError",payload:nn})},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 rn=n(4605);const on=(0,a.X$)((({mode:e,chatIds:t,selectedIds:n,selectedChatTypes:s,filterValue:r,onSelectedIdsChange:o,onSelectedChatTypesChange:i,onFilterChange:l,onLoadMore:c})=>{const d=(0,a.sO)(null),m="included"===e?en.fi:en.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),i(t)}),[s,i]),p=(0,a.I4)((e=>{const{value:t}=e.currentTarget;l(t)}),[l]),v=(0,M.Z)(),[E,f]=(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(rt.Z,{icon:t.icon,title:v(t.title),isMinimized:h,canClose:!0,onClick:g,clickArg:t.key})})),n.map(((e,t)=>a.ZP.createElement(rt.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(pe.Z,{ref:d,value:r,onChange:p,placeholder:v("Search")})),a.ZP.createElement(ve.Z,{className:"picker-list custom-scroll",itemSelector:".chat-item",items:E,onLoadMore:f},(!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:v.isRtl?"rtl":void 0},v("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"},v(e.title)),a.ZP.createElement(rn.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:v.isRtl?"rtl":void 0},v("FilterChats"))),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(fe.Z,{userId:e}):a.ZP.createElement(Ce.Z,{chatId:e,withChatType:!0}),a.ZP.createElement(rn.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"})))})),ln=(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:i,chatsById:l,listIds:c,orderedPinnedIds:d,archivedListIds:m,archivedPinnedIds:h,loadMoreChats:Z})=>{const{chatFilter:P}=r,{selectedChatIds:g,selectedChatTypes:p}=(0,en.vb)(r,s,!0),v=(0,M.Z)(),E=(0,a.Ye)((()=>{const e=c?(0,u.O)(l,c,d,"all"):void 0,t=m?(0,u.O)(l,m,h,"archived"):void 0;if(e||t)return[...e?[...e.pinnedChats,...e.otherChats]:[],...t?t.otherChats:[]]}),[l,c,d,m,h]),f=(0,a.Ye)((()=>{if(E)return E.filter((e=>!P||(0,ue.Z)((0,u.U)(v,e),P)||g.includes(e.id))).map((({id:e})=>e))}),[E,P,v,g]),C=(0,a.I4)((e=>{i({type:"setChatFilter",payload:e})}),[i]),b=(0,a.I4)((e=>{i("included"===s?{type:"setIncludeFilters",payload:{...r.includeFilters,includedChatIds:e}}:{type:"setExcludeFilters",payload:{...r.excludeFilters,excludedChatIds:e}})}),[s,r,i]),y=(0,a.I4)((e=>{const t={};e.forEach((e=>{t[e]=!0})),i("included"===s?{type:"setIncludeFilters",payload:{includedChatIds:g,...t}}:{type:"setExcludeFilters",payload:{excludedChatIds:g,...t}})}),[s,g,i]);return(0,T.ZP)(e,n,t,"included"===s?o.MT.FoldersIncludedChats:o.MT.FoldersExcludedChats),f?a.ZP.createElement(on,{mode:s,chatIds:f,selectedIds:g,selectedChatTypes:p,filterValue:P,onSelectedIdsChange:b,onSelectedChatTypesChange:y,onFilterChange:C,onLoadMore:Z}):a.ZP.createElement(Pe.Z,null)}))),cn=(0,a.X$)((({currentScreen:e,shownScreen:t,state:n,dispatch:s,isActive:r,onScreenSelect:i,onReset:l})=>{const c=(0,a.I4)((()=>{e!==o.MT.FoldersCreateFolder&&e!==o.MT.FoldersEditFolder&&e!==o.MT.FoldersEditFolderFromChatList||setTimeout((()=>{s({type:"reset"})}),200),e!==o.MT.FoldersIncludedChats&&e!==o.MT.FoldersExcludedChats?l():"create"===n.mode?i(o.MT.FoldersCreateFolder):i(o.MT.FoldersEditFolder)}),[n.mode,s,e,l,i]),d=(0,a.I4)((()=>{s({type:"reset"}),i(o.MT.FoldersCreateFolder)}),[i,s]),m=(0,a.I4)((e=>{s({type:"editFolder",payload:e}),i(o.MT.FoldersEditFolder)}),[s,i]),u=(0,a.I4)((()=>{s({type:"editIncludeFilters"}),i(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersIncludedChatsFromChatList:o.MT.FoldersIncludedChats)}),[e,s,i]),h=(0,a.I4)((()=>{s({type:"editExcludeFilters"}),i(e===o.MT.FoldersEditFolderFromChatList?o.MT.FoldersExcludedChatsFromChatList:o.MT.FoldersExcludedChats)}),[e,s,i]);switch(e){case o.MT.Folders:return a.ZP.createElement(Qt,{onCreateFolder:d,onEditFolder:m,onScreenSelect:i,isActive:r||[o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onReset:l});case o.MT.FoldersCreateFolder:case o.MT.FoldersEditFolder:case o.MT.FoldersEditFolderFromChatList:return a.ZP.createElement(sn,{state:n,dispatch:s,onAddIncludedChats:u,onAddExcludedChats:h,onReset:c,onScreenSelect:i,isActive:r||[o.MT.FoldersIncludedChats,o.MT.FoldersExcludedChats].includes(t),onBack:l});case o.MT.FoldersIncludedChats:case o.MT.FoldersIncludedChatsFromChatList:return a.ZP.createElement(ln,{mode:"included",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});case o.MT.FoldersExcludedChats:case o.MT.FoldersExcludedChatsFromChatList:return a.ZP.createElement(ln,{mode:"excluded",state:n,dispatch:s,onReset:c,onScreenSelect:i,isActive:r});default:return}}));var dn=n(3657);const mn=(0,a.X$)((({options:e,range:t,label:n,value:s,disabled:r,onChange:o})=>{const i=(0,M.Z)(),l=(0,a.I4)((e=>{o(Number(e.currentTarget.value))}),[o]),c=(0,_.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:i.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:l}),e&&a.ZP.createElement("div",{className:"slider-options"},e.map(((e,t)=>a.ZP.createElement("div",{className:(0,_.Z)("slider-option no-selection",t===s&&"active"),onClick:()=>o(t)},e))))))}));var un=n(8835),hn=n(2155);const Zn=(0,a.X$)((({size:e=i.DC,stickerSet:t,observeIntersection:n})=>{const s=(0,a.sO)(null),o=(0,dn.Op)(s,n),l=`stickerSet${t.id}`,c=(0,v.Z)(l,!o,r.IU.Lottie),{shouldRenderFullMedia:d,transitionClassNames:m}=(0,un.Z)(c,"slow");return a.ZP.createElement("div",{ref:s,className:"sticker-set-cover"},!d&&(0,hn.Xv)(t.title,2),d&&c&&a.ZP.createElement(Kt.Z,{id:l,size:e,animationData:c,className:m}))})),Pn=(0,a.X$)((({stickerSet:e,observeIntersection:t})=>{const n=(0,a.sO)(null),s=(0,dn.Op)(n,t),r=(0,v.Z)(e.hasThumbnail&&`stickerSet${e.id}`,!s),{shouldRenderFullMedia:o,transitionClassNames:i}=(0,un.Z)(r,"slow");return a.ZP.createElement("div",{ref:n,className:"sticker-set-cover"},!o&&(0,hn.Xv)(e.title,2),o&&a.ZP.createElement("img",{src:r,className:i,alt:""}))}));var gn=n(3547);const pn=(0,a.X$)((({stickerSet:e,observeIntersection:t,onClick:n})=>{const s=(0,M.Z)();if(!e||!e.stickers)return;const r=e.stickers&&e.stickers[0];return e.hasThumbnail||!r?a.ZP.createElement(Ee.Z,{narrow:!0,className:"SettingsStickerSet",inactive:!r,onClick:()=>r&&n(r)},a.ZP.createElement(R.Z,{ariaLabel:e.title,color:"translucent",isRtl:s.isRtl},e.isAnimated?a.ZP.createElement(Zn,{size:i.Mw,stickerSet:e,observeIntersection:t}):a.ZP.createElement(Pn,{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"},s("StickerPack.StickerCount",e.count,"i")))):a.ZP.createElement(Ee.Z,{narrow:!0,className:"SettingsStickerSet",onClick:()=>n(r)},a.ZP.createElement(gn.Z,{sticker:r,size:i.Mw,title:e.title,observeIntersection:t}),a.ZP.createElement("div",{className:"multiline-menu-item"},a.ZP.createElement("div",{className:"title"},e.title),a.ZP.createElement("div",{className:"subtitle"},s("StickerPack.StickerCount",e.count,"i"))))}));var vn=n(4851);const En=["Solid and Steady","Nice and Fast","Lots of Stuff"],fn=(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:i,animationLevel:c,messageSendKeyCombo:d,shouldAutoDownloadMediaFromContacts:m,shouldAutoDownloadMediaInPrivateChats:u,shouldAutoDownloadMediaInGroups:h,shouldAutoDownloadMediaInChannels:Z,shouldAutoPlayGifs:P,shouldAutoPlayVideos:g,shouldSuggestStickers:p,shouldLoopStickers:v,setSettingOption:E,loadStickerSets:f,loadAddedStickers:C})=>{const b=(0,a.sO)(null),{observe:y}=(0,dn.S1)({rootRef:b}),[I,N,w]=(0,Fe.Z)(),[k,S]=(0,a.eJ)(),F=(0,M.Z)(),A=l.$b?void 0:[{value:"enter",label:F("lng_settings_send_enter"),subLabel:"New line by Shift + Enter"},{value:"ctrl-enter",label:F(l.jm?"lng_settings_send_cmdenter":"lng_settings_send_ctrlenter"),subLabel:"New line by Enter"}];(0,a.d4)((()=>{f()}),[f]),(0,a.d4)((()=>{s&&s.length&&C()}),[s,C]);const L=(0,a.I4)((e=>{En.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,l.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]),$=(0,a.I4)((e=>{S(e),N()}),[N]),B=s&&s.map((e=>!!(r&&r[e]&&r[e].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(mn,{label:F("TextSize"),range:{min:12,max:20},value:i,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(mn,{options:En,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(Je.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(rn.Z,{label:F("Contacts"),checked:m,onCheck:e=>E({shouldAutoDownloadMediaFromContacts:e})}),a.ZP.createElement(rn.Z,{label:F("AutodownloadPrivateChats"),checked:u,onCheck:e=>E({shouldAutoDownloadMediaInPrivateChats:e})}),a.ZP.createElement(rn.Z,{label:F("AutodownloadGroupChats"),checked:h,onCheck:e=>E({shouldAutoDownloadMediaInGroups:e})}),a.ZP.createElement(rn.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(rn.Z,{label:F("GifsTab2"),checked:P,onCheck:e=>E({shouldAutoPlayGifs:e})}),a.ZP.createElement(rn.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(rn.Z,{label:F("SuggestStickers"),checked:p,onCheck:e=>E({shouldSuggestStickers:e})}),a.ZP.createElement(rn.Z,{label:F("LoopAnimatedStickers"),checked:v,onCheck:e=>E({shouldLoopStickers:e})}),a.ZP.createElement("div",{className:"mt-4",ref:b},B&&B.map((e=>a.ZP.createElement(pn,{key:e.id,stickerSet:e,observeIntersection:y,onClick:$})))),k&&a.ZP.createElement(vn.Z,{isOpen:I,fromSticker:k,onClose:w})))})));let Cn;function bn(e="*",t,n=!1){Cn||(Cn=document.createElement("input"),Cn.setAttribute("type","file")),Cn.setAttribute("accept",e),n?Cn.removeAttribute("multiple"):Cn.setAttribute("multiple","multiple"),Cn.onchange=null,Cn.value="",Cn.onchange=t,Cn.click()}var yn=n(1394);function In(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}function Nn(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),i=r,l=r-o;if(s=0==r?0:l/r,r==o)a=0;else{switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;case n:a=(e-t)/l+4}a/=6}return[a,s,i]}function kn([e,t,n]){let a,s,r,o=Math.floor(6*e),i=6*e-o,l=n*(1-t),c=n*(1-i*t),d=n*(1-(1-i)*t);switch(o%6){case 0:a=n,s=d,r=l;break;case 1:a=c,s=n,r=l;break;case 2:a=l,s=n,r=d;break;case 3:a=l,s=c,r=n;break;case 4:a=d,s=l,r=n;break;case 5:a=n,s=l,r=c}return[Math.round(255*a),Math.round(255*s),Math.round(255*r)]}function Sn(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 Mn=n(9524),Tn=n(5866);const Fn=(0,a.X$)((({wallpaper:e,theme:t,isSelected:n,onClick:s})=>{const{slug:r,document:l}=e,c=`wallpaper${l.id}`,d=l.previewBlobUrl,m=(0,v.Z)(`${c}?size=m`),u=(0,Tn.Z)(l.thumbnail&&l.thumbnail.dataUri,Boolean(m),!0),{shouldRenderThumb:h,shouldRenderFullMedia:Z,transitionClassNames:P}=(0,un.Z)(m||d,"slow"),[g,p]=(0,a.eJ)(!1),{mediaData:f,downloadProgress:b}=(0,E.Z)(c,!g),y=!1===(0,C.Z)(g),{shouldRender:I,transitionClassNames:N}=(0,j.Z)(g&&!f||r===o.mp,void 0,y,"slow"),w=(0,a.sO)();w.current=t;const k=(0,a.I4)((()=>{(async()=>{const e=await(0,yn.gm)(f);await Mn.save(i.fo,w.current,e),s(r)})()}),[f,s,r]);(0,a.d4)((()=>{f&&k()}),[f,k]);const S=(0,a.I4)((()=>{f?k():p((e=>!e))}),[f,k]),M=(0,_.Z)("WallpaperTile",n&&"selected");return a.ZP.createElement("div",{className:M,onClick:S},a.ZP.createElement("div",{className:"media-inner"},h&&a.ZP.createElement("canvas",{ref:u,className:"thumbnail"}),Z&&a.ZP.createElement("img",{src:m||d,className:`full-media ${P}`,alt:""}),I&&a.ZP.createElement("div",{className:(0,_.Z)("spinner-container",N)},a.ZP.createElement(J.Z,{progress:b,onClick:S}))))})),An=(0,z.P2)((e=>e()),6e4,!0),Ln=(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:l,theme:c,loadWallpapers:d,uploadWallpaper:m,setThemeSettings:u})=>{const h=(0,a.sO)();h.current=c,(0,a.d4)((()=>{An((()=>{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)((()=>{bn("image/jpeg",Z,!0)}),[Z]),g=(0,a.I4)((()=>{t(o.MT.GeneralChatBackgroundColor)}),[t]),p=(0,a.I4)((()=>{u({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?i.Vv:i.g})}),[u,c]),v=(0,a.I4)((e=>{u({theme:h.current,background:e});const t=l&&l.find((t=>t.slug===e));t&&t.document.thumbnail&&async function(e){const t=[0,0,0];let n,a,s,r,o=-4,i=[0,0,0],l=0;const c=document.createElement("canvas"),d=c.getContext&&c.getContext("2d");if(!d)return t;const m=await(0,yn.pt)(e);s=m.naturalHeight||m.offsetHeight||m.height,a=m.naturalWidth||m.offsetWidth||m.width,c.height=s,c.width=a,d.drawImage(m,0,0);try{n=d.getImageData(0,0,a,s)}catch(e){return t}for(r=n.data.length;(o+=20)<r;)++l,i[0]+=n.data[o],i[1]+=n.data[o+1],i[2]+=n.data[o+2];return i[0]=Math.floor(i[0]/l),i[1]=Math.floor(i[1]/l),i[2]=Math.floor(i[2]/l),i}(t.document.thumbnail.dataUri).then((e=>{const t=Sn(e),n=`#${Nn(e)}`;u({theme:h.current,backgroundColor:n,patternColor:t})}))}),[l,u]),E=(0,a.I4)((e=>{u({theme:h.current,isBlurred:e.target.checked})}),[u]),f=(0,M.Z)();(0,T.ZP)(e,n,t,o.MT.GeneralChatBackground);const C=l&&l[0]&&l[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:C,onClick:P},f("UploadImage")),a.ZP.createElement(Ee.Z,{icon:"colorize",className:"mb-0",onClick:g},f("SetColor")),a.ZP.createElement(Ee.Z,{icon:"favorite",onClick:p},f("ThemeResetToDefaults")),a.ZP.createElement(rn.Z,{label:f("BackgroundBlurred"),checked:Boolean(r),onChange:E})),l?a.ZP.createElement("div",{className:"settings-wallpapers"},l.map((e=>a.ZP.createElement(Fn,{wallpaper:e,theme:c,isSelected:s===e.slug,onClick:v})))):a.ZP.createElement(Pe.Z,null))}))),Rn=wn(In("e6ebee")),$n=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function Bn(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 Dn({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 Un=(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:i})=>{const l=(0,a.sO)();l.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(In(e.replace("#",""))):Rn}(r)),p=(0,a.sO)(P);(0,a.d4)((()=>{p.current=P}),[P]);const[v,E,f]=(0,Fe.Z)(),[C,b]=(0,a.eJ)(""),[y,I]=(0,a.eJ)(""),N=(0,a.sO)(),w=(0,a.sO)();(0,a.d4)((()=>{const e={offsetLeft:d.current.offsetLeft,...(0,h.ei)(d.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:m.current.offsetLeft,...(0,h.ei)(m.current.getBoundingClientRect(),["width"])};function n(t){const n=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+c.current.scrollTop),e.height-1)],{huePosition:a}=Bn(p.current,N.current);g(Dn({colorPosition:n,huePosition:a},N.current)),E()}function a(e){const{colorPosition:n}=Bn(p.current,N.current),a=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);g(Dn({colorPosition:n,huePosition:a},N.current)),E()}N.current={colorRect:e,hueRect:t},(0,Z.s)(d.current,{onCapture:n,onDrag:n,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,Z.s)(m.current,{onCapture:a,onDrag:a,onRelease:f,onClick:f,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[E,f]);const{colorPosition:k=[0,0],huePosition:S=0}=N.current?Bn(P,N.current):{},M=Nn(kn(P)),F=P[0],A=Nn(kn([F,1,1]));(0,a.d4)((()=>{const e=kn(P),t=`#${Nn(e)}`;if(b(e.join(", ")),I(t),!u.current){const n=Sn(e);i({theme:l.current,background:void 0,backgroundColor:t,patternColor:n})}u.current=!1}),[P,i]),(0,a.d4)((()=>{!function(e,t,n,a){let s,r,o;n.current&&a.current?(s=a.current.colorRect.width,r=a.current.colorRect.height,o=n.current):(s=e.offsetWidth,r=e.offsetHeight,o=e.getContext("2d"),e.width=s,e.height=r,n.current=o);const i=o.createImageData(s,r),l=i.data,c=kn([t,1,1]);let d=0;for(let e=0;e<r;e++){const t=1-e/(r-1),n=[255*t,255*t,255*t],a=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<s;e++){const t=e/(s-1);l[d++]=n[0]+(a[0]-n[0])*t,l[d++]=n[1]+(a[1]-n[1])*t,l[d++]=n[2]+(a[2]-n[2])*t,l[d++]=255}}o.putImageData(i,0,0)}(d.current.firstChild,F,w,N)}),[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=kn([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(In(t.replace("#","")))),e.currentTarget.value=t}),[]),$=(0,a.I4)((e=>{g(wn(In(e.currentTarget.dataset.color.replace("#",""))))}),[]),B=(0,_.Z)("SettingsGeneralBackgroundColor settings-content custom-scroll",v&&"is-dragging");return(0,T.ZP)(e,n,t,o.MT.GeneralChatBackgroundColor),a.ZP.createElement("div",{ref:c,className:B},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(${S}px); background-color: #${A};`})),a.ZP.createElement("div",{className:"tools"},a.ZP.createElement(pe.Z,{value:y,label:"HEX",onChange:R}),a.ZP.createElement(pe.Z,{value:C,label:"RGB",onChange:L}))),a.ZP.createElement("div",{className:"predefined-colors"},$n.map((e=>a.ZP.createElement("div",{className:e===`#${M}`?"active":void 0,"data-color":e,style:`background-color: ${e};`,onClick:$})))))}))),xn=(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:i,hasGroupMessagePreview:l,hasBroadcastNotifications:c,hasBroadcastMessagePreview:d,hasContactJoinedNotifications:m,hasPushNotifications:u,hasWebNotifications:h,notificationSoundVolume:Z,loadNotificationSettings:P,updateContactSignUpNotification:g,updateNotificationSettings:p,updateWebNotificationSettings:v})=>{(0,a.d4)((()=>{P()}),[P]);const E=(0,a.I4)(((e,t,n)=>{const a="contact"===t?!s:!("group"===t?i:c),o="contact"===t?r:"group"===t?l:d;p({peerType:t,..."silent"===n&&{isSilent:!e.target.checked,shouldShowPreviews:o},..."showPreviews"===n&&{shouldShowPreviews:e.target.checked,isSilent:a}})}),[d,c,l,i,r,s,p]),f=(0,a.I4)((e=>{g({isSilent:!e.target.checked})}),[g]),C=(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:C.isRtl?"rtl":void 0},"Web notifications"),a.ZP.createElement(rn.Z,{label:"Web notifications",subLabel:C(h?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:h,onChange:e=>{v({hasWebNotifications:e.target.checked})}}),a.ZP.createElement(rn.Z,{label:"Offline notifications",disabled:!h,subLabel:C(u?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:u,onChange:e=>{v({hasPushNotifications:e.target.checked})}}),a.ZP.createElement("div",{className:"settings-item-slider"},a.ZP.createElement(mn,{label:"Sound",disabled:!h,range:{min:0,max:10},value:Z,onChange:e=>{v({notificationSoundVolume:e})}}))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("AutodownloadPrivateChats")),a.ZP.createElement(rn.Z,{label:C("NotificationsForPrivateChats"),subLabel:C(s?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:s,onChange:e=>{E(e,"contact","silent")}}),a.ZP.createElement(rn.Z,{label:C("MessagePreview"),disabled:!s,subLabel:C(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:C.isRtl?"rtl":void 0},C("FilterGroups")),a.ZP.createElement(rn.Z,{label:C("NotificationsForGroups"),subLabel:C(i?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:i,onChange:e=>{E(e,"group","silent")}}),a.ZP.createElement(rn.Z,{label:C("MessagePreview"),disabled:!i,subLabel:C(l?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:l,onChange:e=>{E(e,"group","showPreviews")}})),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:C.isRtl?"rtl":void 0},C("FilterChannels")),a.ZP.createElement(rn.Z,{label:C("NotificationsForChannels"),subLabel:C(c?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),checked:c,onChange:e=>{E(e,"broadcast","silent")}}),a.ZP.createElement(rn.Z,{label:C("MessagePreview"),disabled:!c,subLabel:C(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:C.isRtl?"rtl":void 0},C("PhoneOther")),a.ZP.createElement(rn.Z,{label:C("ContactJoined"),checked:m,onChange:f})))}))),On=(0,a.X$)((0,s.c$)((e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:n,canChangeSensitive:a},privacy:s},blocked:r,activeSessions:o}=e;return{hasPassword:t,blockedCount:r.totalCount,sessionsCount:o.length,isSensitiveEnabled:n,canChangeSensitive:a,visibilityPrivacyPhoneNumber:s.phoneNumber&&s.phoneNumber.visibility,visibilityPrivacyLastSeen:s.lastSeen&&s.lastSeen.visibility,visibilityPrivacyProfilePhoto:s.profilePhoto&&s.profilePhoto.visibility,visibilityPrivacyForwarding:s.forwards&&s.forwards.visibility,visibilityPrivacyGroupChats:s.chatInvite&&s.chatInvite.visibility}}),((e,t)=>(0,h.ei)(t,["loadBlockedContacts","loadAuthorizations","loadPrivacySettings","loadContentSettings","updateContentSettings"])))((({isActive:e,onScreenSelect:t,onReset:n,hasPassword:s,blockedCount:r,sessionsCount:i,isSensitiveEnabled:l,canChangeSensitive:c,visibilityPrivacyPhoneNumber:d,visibilityPrivacyLastSeen:m,visibilityPrivacyProfilePhoto:u,visibilityPrivacyForwarding:h,visibilityPrivacyGroupChats:Z,loadPrivacySettings:P,loadBlockedContacts:g,loadAuthorizations:p,loadContentSettings:v,updateContentSettings:E})=>{(0,a.d4)((()=>{g(),p(),P(),v()}),[g,p,P,v]);const f=(0,M.Z)();function C(e){switch(e){case"everybody":return f("P2PEverybody");case"contacts":return f("P2PContacts");case"nobody":return f("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"},f("BlockedUsers")),r>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f("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"},f("TwoStepVerification")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},f(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"},f("SessionsTitle")),i>0&&a.ZP.createElement("span",{className:"subtitle",dir:"auto"},1===i?"1 session":`${i} sessions`)))),a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header mb-4",dir:f.isRtl?"rtl":void 0},f("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"},f("PrivacyPhoneTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C(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"},f("LastSeenTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C(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"},f("PrivacyProfilePhotoTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C(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"},f("PrivacyForwardsTitle")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C(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"},f("WhoCanAddMe")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},C(Z))))),c&&a.ZP.createElement("div",{className:"settings-item"},a.ZP.createElement("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0},f("lng_settings_sensitive_title")),a.ZP.createElement(rn.Z,{label:f("lng_settings_sensitive_disable_filtering"),subLabel:f("lng_settings_sensitive_about"),checked:Boolean(l),disabled:!c,onCheck:E})))})));var Gn=n(663);const Jn=(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:i,setSettingOption:l})=>{const[c,d]=(0,a.eJ)(r),[m,u,h]=(0,Fe.Z)();(0,a.d4)((()=>{i()}),[i]);const Z=(0,a.I4)((e=>{d(e),u(),(0,Gn.m0)(e,(()=>{h(),l({language:e})}))}),[u,h,l]),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(Je.Z,{name:"keyboard-send-settings",options:P,selected:c,loadingOption:m?c:void 0,onChange:Z}):a.ZP.createElement(Pe.Z,null))})));function Xn(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 zn=(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:i,allowChatIds:l,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=Xn(e),p=(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 v=(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}})(),f=(()=>{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}})(),C=(0,a.Ye)((()=>i&&l&&m?l.reduce(((e,t)=>e+(m[t]?m[t].membersCount:0)),i.length):0),[l,i,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},p),a.ZP.createElement(Je.Z,{name:`visibility-${g}`,options:Z,onChange:y,selected:r}),v&&a.ZP.createElement("p",{className:"settings-item-description-larger",dir:h.isRtl?"rtl":void 0},v)),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"},C>0&&a.ZP.createElement("span",{className:"date",dir:"auto"},"+",C),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(f)}},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 _n(e){return[e.region,e.country].filter(Boolean).join(", ")}function Yn(e){return`${e.deviceModel}${e.deviceModel?", ":""} ${e.platform} ${e.systemVersion}`}const jn=(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:i,terminateAllAuthorizations:l})=>{const[c,d,m]=(0,Fe.Z)();(0,a.d4)((()=>{r()}),[r]);const u=(0,a.I4)((e=>{i({hash:e})}),[i]),h=(0,a.I4)((()=>{m(),l()}),[m,l]),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&&(v=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"},v.appName),a.ZP.createElement("span",{className:"subtitle black tight"},Yn(v)),a.ZP.createElement("span",{className:"subtitle"},v.ip," - ",_n(v)))),a.ZP.createElement(Ee.Z,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d},g("TerminateAllSessions")))),P&&(p=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")),p.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,$.VX)(g,1e3*e.dateActive)),a.ZP.createElement("span",{className:"title"},e.appName),a.ZP.createElement("span",{className:"subtitle black tight"},Yn(e)),a.ZP.createElement("span",{className:"subtitle"},e.ip," - ",_n(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 p,v})));var Hn=n(2969);const Vn=(0,a.X$)((0,s.c$)((e=>{const{chats:{byId:t},users:{byId:n},blocked:{ids:a}}=e;return{chatsByIds:t,usersByIds:n,blockedIds:a}}),((e,t)=>(0,h.ei)(t,["unblockContact"])))((({isActive:e,onScreenSelect:t,onReset:n,chatsByIds:s,usersByIds:r,blockedIds:l,unblockContact:c})=>{const d=(0,a.I4)((e=>{c({contactId:e})}),[c]),m=(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:m.isRtl?"rtl":void 0},m("BlockedUsersInfo"))),a.ZP.createElement("div",{className:"chat-list custom-scroll"},l&&l.length?a.ZP.createElement("div",{className:"scroll-container"},l.map(((e,t)=>function(e,t,n){const o=(0,u.YA)(e),l=o?r[e]:void 0,c=o?void 0:s[e],h=(0,_.Z)("Chat chat-item-clickable blocked-list-item small-icon",o?"private":"group");return a.ZP.createElement(Ee.Z,{key:e,className:h,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{d(e)}}],style:`top: ${(0+t)*i.rS}px;`},a.ZP.createElement(D.Z,{size:"medium",user:l,chat:c}),a.ZP.createElement("div",{className:"contact-info",dir:"auto"},a.ZP.createElement("h3",{dir:"auto"},(0,B.Z)((o?(0,u.Js)(l):(0,u.U)(m,c))||"")),l&&l.phoneNumber&&a.ZP.createElement("div",{className:"contact-phone",dir:"auto"},(0,Hn.WZ)(l.phoneNumber)),l&&!l.phoneNumber&&l.username&&a.ZP.createElement("div",{className:"contact-username",dir:"auto"},"@",l.username)))}(e,t)))):l&&!l.length?a.ZP.createElement("div",{className:"no-results",dir:"auto"},"List is empty"):a.ZP.createElement(Pe.Z,{key:"loading"}))),a.ZP.createElement(Ot.Z,{isShown:!0,onClick:()=>{},className:"not-implemented",ariaLabel:"Add a blocked user"},a.ZP.createElement("i",{className:"icon-add"})))})));var qn=n(7854);const Kn=(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(qn.Z,{sticker:n,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},(0,B.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 Wn=n(3490),Qn=n(9364);const ea=(0,a.X$)((({screen:e,isActive:t,onScreenSelect:n,onReset:s,error:r,isLoading:o,expectedPassword:i,placeholder:l="Current Password",hint:c,submitLabel:d,clearError:m,onSubmit:u})=>{const[h,Z]=(0,a.eJ)(""),[P,g]=(0,a.eJ)(!1),p=(0,a.I4)((e=>{i&&e!==i?Z("Passwords Should Be Equal"):u(e)}),[u,i]),v=(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(Wn.Z,{isBig:!0,isPasswordVisible:P})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(Qn.Z,{error:h||r,hint:c,placeholder:l,submitLabel:d||E("Next"),clearError:v,isLoading:o,isPasswordVisible:P,onChangePasswordVisibility:g,onSubmit:p})))})),ta=(0,a.X$)((0,s.c$)((e=>({animatedEmoji:(0,m.zB)(e,"🔐")})))((({isActive:e,onScreenSelect:t,onReset:n,animatedEmoji:s,onStart:r})=>{const i=(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(qn.Z,{sticker:s,size:"large"}),a.ZP.createElement("p",{className:"settings-item-description mb-3",dir:"auto"},i("SetAdditionalPasswordInfo"))),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(R.Z,{onClick:r},i("EditAdminTransferSetPassword"))))}))),na=l.wB?550:400,aa=(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:i,onSubmit:c,isActive:d,onScreenSelect:m,onReset:u,screen:h})=>{const Z=(0,a.sO)(null),[P,g]=(0,a.eJ)(""),[p,v,E]=(0,Fe.Z)(!1);(0,a.d4)((()=>{l.$b||setTimeout((()=>{Z.current.focus()}),na)}),[]);const f=(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(qn.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(pe.Z,{ref:Z,value:P,inputMode:t,label:r,error:s,onChange:e=>{s&&i&&i(),g(e.target.value)}}),P?a.ZP.createElement(R.Z,{type:"submit",isLoading:n,ripple:!0},f("Continue")):a.ZP.createElement(R.Z,{isText:!0,isLoading:n,ripple:!0,onClick:o?v:()=>{c()}},f("YourEmailSkip"))),o&&a.ZP.createElement(ge.Z,{className:"narrow",isOpen:p,title:f("YourEmailSkipWarning"),onClose:E},(0,B.Z)(f("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()}},f("YourEmailSkip")),a.ZP.createElement(R.Z,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:E},f("Cancel"))))))}))),sa=(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(qn.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"))))}))),ra=l.wB?550:400,oa=(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:i,onScreenSelect:c,onReset:d,screen:m})=>{const u=(0,a.sO)(null),[h,Z]=(0,a.eJ)("");(0,a.d4)((()=>{l.$b||setTimeout((()=>{u.current.focus()}),ra)}),[]);const P=(0,M.Z)();return(0,T.ZP)(i,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(qn.Z,{sticker:e,size:"large"})),a.ZP.createElement("div",{className:"settings-item pt-0 no-border"},a.ZP.createElement(pe.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)))}))),ia=(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:i,waitingEmailCodeLength:l,dispatch:c,isActive:d,onScreenSelect:m,onReset:u,updatePassword:h,checkPassword:Z,clearTwoFaError:P,updateRecoveryEmail:g,provideTwoFaEmailCode:p,clearPassword:v})=>{(0,a.d4)((()=>{l&&(e===o.MT.TwoFaNewPasswordEmail?m(o.MT.TwoFaNewPasswordEmailCode):e===o.MT.TwoFaRecoveryEmail&&m(o.MT.TwoFaRecoveryEmailCode))}),[e,m,l]);const E=(0,a.I4)((()=>{c({type:"reset"}),m(o.MT.TwoFaNewPassword)}),[c,m]),f=(0,a.I4)((e=>{c({type:"setPassword",payload:e}),m(o.MT.TwoFaNewPasswordConfirm)}),[c,m]),C=(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]),N=(0,a.I4)((e=>{c({type:"setPassword",payload:e}),m(o.MT.TwoFaChangePasswordConfirm)}),[c,m]),w=(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]),S=(0,a.I4)((e=>{v({currentPassword:e,onSuccess:()=>{m(o.MT.Privacy)}})}),[v,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=>{p({code:e})}),[p]),L=(0,M.Z)();switch(e){case o.MT.TwoFaDisabled:return a.ZP.createElement(ta,{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(ea,{screen:e,placeholder:L("PleaseEnterPassword"),submitLabel:L("Continue"),onSubmit:f,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(ea,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),submitLabel:L("Continue"),onSubmit:C,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(aa,{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(aa,{icon:"email",type:"email",isLoading:r,error:i,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(oa,{isLoading:r,error:i,clearError:P,onSubmit:A,screen:e,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u});case o.MT.TwoFaCongratulations:return a.ZP.createElement(sa,{onScreenSelect:m,isActive:d,onReset:u});case o.MT.TwoFaEnabled:return a.ZP.createElement(Kn,{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(ea,{screen:e,isLoading:r,error:i,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(ea,{screen:e,placeholder:L("PleaseEnterNewFirstPassword"),onSubmit:N,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(ea,{screen:e,expectedPassword:n.password,placeholder:L("PleaseReEnterPassword"),onSubmit:w,onScreenSelect:m,isActive:d||[o.MT.TwoFaChangePasswordHint,o.MT.TwoFaCongratulations].includes(t),onReset:u});case o.MT.TwoFaChangePasswordHint:return a.ZP.createElement(aa,{isLoading:r,error:i,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(ea,{isLoading:r,error:i,clearError:P,hint:s,onSubmit:S,onScreenSelect:m,isActive:d,onReset:u,screen:e});case o.MT.TwoFaRecoveryEmailCurrentPassword:return a.ZP.createElement(ea,{screen:e,isLoading:r,error:i,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(aa,{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(oa,{screen:e,isLoading:r,error:i,clearError:P,onSubmit:A,onScreenSelect:m,isActive:d||t===o.MT.TwoFaCongratulations,onReset:u});default:return}})));var la=n(1820);function ca(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 da=(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:ca(e,t)}}),((e,t)=>(0,h.ei)(t,["setPrivacySettings"])))((({currentUserId:e,isAllowList:t,screen:n,settings:s,chatsById:r,listIds:i,orderedPinnedIds:l,archivedListIds:c,archivedPinnedIds:d,setPrivacySettings:m,isActive:h,onScreenSelect:Z,onReset:P})=>{const g=(0,M.Z)(),p=(0,a.Ye)((()=>s?t?[...s.allowUserIds,...s.allowChatIds]:[...s.blockUserIds,...s.blockChatIds]:[]),[t,s]),[v,E]=(0,a.eJ)(""),[f,C]=(0,a.eJ)(!1),[b,y]=(0,a.eJ)(p),I=(0,a.Ye)((()=>{const e=i?(0,u.O)(r,i,l,"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,i,l,c,d]),N=(0,a.Ye)((()=>{if(I)return I.filter((t=>((0,u.YA)(t.id)&&t.id!==e||(0,u.Bf)(t))&&(!v||(0,ue.Z)((0,u.U)(g,t),v)||p.includes(t.id)))).map((({id:e})=>e))}),[I,e,g,v,p]),w=(0,a.I4)((e=>{y(e),C(!0)}),[]),k=(0,a.I4)((()=>{m({privacyKey:Xn(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(la.Z,{itemIds:N||[],selectedIds:b,filterValue:v,filterPlaceholder:g(t?"AlwaysShareWithPlaceholder":"NeverShareWithPlaceholder"),searchInputId:"new-group-picker-search",onSelectedIdsChange:w,onFilterChange:E}),a.ZP.createElement(Ot.Z,{isShown:f,onClick:k,ariaLabel:g(t?"AlwaysShareWithTitle":"NeverShareWithTitle")},a.ZP.createElement("i",{className:"icon-arrow-right"})))}))),ma=Object.keys(o.MT).length/2,ua=[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],ha=[o.MT.Folders,o.MT.FoldersCreateFolder,o.MT.FoldersEditFolder,o.MT.FoldersEditFolderFromChatList,o.MT.FoldersIncludedChats,o.MT.FoldersIncludedChatsFromChatList,o.MT.FoldersExcludedChats,o.MT.FoldersExcludedChatsFromChatList],Za=[o.MT.PrivacyBlockedUsers,o.MT.PrivacyActiveSessions],Pa=[o.MT.PrivacyPhoneNumberAllowedContacts,o.MT.PrivacyPhoneNumberDeniedContacts],ga=[o.MT.PrivacyLastSeenAllowedContacts,o.MT.PrivacyLastSeenDeniedContacts],pa=[o.MT.PrivacyProfilePhotoAllowedContacts,o.MT.PrivacyProfilePhotoDeniedContacts],va=[o.MT.PrivacyForwardingAllowedContacts,o.MT.PrivacyForwardingDeniedContacts],Ea=[o.MT.PrivacyGroupChatsAllowedContacts,o.MT.PrivacyGroupChatsDeniedContacts],fa=(0,a.X$)((({isActive:e,currentScreen:t,foldersState:n,foldersDispatch:s,onScreenSelect:r,onReset:i,shouldSkipTransition:c})=>{const[d,m]=(0,At.Z)(Rt,Lt),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?i():"create"===n.mode?r(o.MT.FoldersCreateFolder):r(o.MT.FoldersEditFolder)}),[n.mode,s,t,i,r]),h=(0,a.I4)((()=>{s({type:"saveFilters"}),u()}),[s,u]);function Z(i,l,c){return a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement($t,{currentScreen:t,onReset:u,onSaveFilter:h,onScreenSelect:r,editedFolderId:n.folderId}),function(i,l){const c={[o.MT.PrivacyPhoneNumber]:Pa.includes(l),[o.MT.PrivacyLastSeen]:ga.includes(l),[o.MT.PrivacyProfilePhoto]:pa.includes(l),[o.MT.PrivacyForwarding]:va.includes(l),[o.MT.PrivacyGroupChats]:Ea.includes(l)},h=ua.includes(l),Z=ha.includes(l),P=Za.includes(l)||h||Object.keys(c).includes(l.toString())||Object.values(c).find((e=>!0===e));switch(t){case o.MT.Main:return a.ZP.createElement(Ut,{onScreenSelect:r,isActive:e,onReset:u});case o.MT.EditProfile:return a.ZP.createElement(Vt,{onScreenSelect:r,isActive:e&&i,onReset:u});case o.MT.General:return a.ZP.createElement(fn,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor||l===o.MT.GeneralChatBackground||P||Z,onReset:u});case o.MT.Notifications:return a.ZP.createElement(xn,{onScreenSelect:r,isActive:i,onReset:u});case o.MT.Privacy:return a.ZP.createElement(On,{onScreenSelect:r,isActive:i||P||h,onReset:u});case o.MT.Language:return a.ZP.createElement(Jn,{onScreenSelect:r,isActive:i,onReset:u});case o.MT.GeneralChatBackground:return a.ZP.createElement(Ln,{onScreenSelect:r,isActive:i||l===o.MT.GeneralChatBackgroundColor,onReset:u});case o.MT.GeneralChatBackgroundColor:return a.ZP.createElement(Un,{onScreenSelect:r,isActive:i,onReset:u});case o.MT.PrivacyActiveSessions:return a.ZP.createElement(jn,{onScreenSelect:r,isActive:i,onReset:u});case o.MT.PrivacyBlockedUsers:return a.ZP.createElement(Vn,{onScreenSelect:r,isActive:i,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(zn,{screen:t,onScreenSelect:r,isActive:i||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(da,{isAllowList:!0,screen:t,onScreenSelect:r,isActive:i||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(da,{screen:t,onScreenSelect:r,isActive:i,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(cn,{currentScreen:t,shownScreen:l,state:n,dispatch:s,isActive:i,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(ia,{currentScreen:t,state:d,dispatch:m,shownScreen:l,isActive:i,onScreenSelect:r,onReset:u});default:return}}(i,c))}return a.ZP.createElement(L.Z,{id:"Settings",name:c?"none":l.s0,activeKey:t,renderCount:ma},Z)})),Ca=(0,z.P2)((e=>e()),6e4,!0),ba=(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:i,serverTimeOffset:c})=>{(0,a.d4)((()=>{Ca((()=>{o()}))})),(0,T.ZP)(e,t);const d=(0,a.I4)((e=>{i({id:e,shouldReplaceHistory:!0})}),[i]),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(ve.Z,{items:h,onLoadMore:Z,className:"chat-list custom-scroll"},h&&h.length?h.map((e=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable",onClick:()=>d(e),ripple:!l.wB},a.ZP.createElement(fe.Z,{userId:e,forceShowSelf:!0,avatarSize:"large"})))):h&&!h.length?a.ZP.createElement("p",{className:"no-results",key:"no-results",dir:"auto"},n.length?"No contacts matched your search.":"Contact list is empty."):a.ZP.createElement(Pe.Z,{key:"loading"}))}))),ya=(0,z.P2)((e=>e()),6e4,!0),Ia=(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:i,localResults:l}=e.globalSearch,{userIds:c}=i||{},{userIds:d}=l||{};return{currentUserId:s,usersById:n,chatsById:a,localContactIds:t,searchQuery:r,isSearching:o&&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:i,usersById:l,chatsById:c,localContactIds:d,searchQuery:m,isSearching:Z,localUserIds:P,globalUserIds:g,loadContactList:p,setGlobalSearchQuery:v})=>{(0,a.d4)((()=>{ya((()=>{p()}))}));const E=(0,M.Z)();(0,T.ZP)(t,o);const f=(0,a.I4)((e=>{v({query:e})}),[v]),C=(0,a.Ye)((()=>{const e=d?(0,u.ih)(d.filter((e=>e!==i)),c):[];if(!m)return e;const t=e.filter((e=>{const t=l[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=l[e];return!t||!(0,u.cS)(t)||t.canBeInvitedToGroup})),c,!1,n)}),[d,c,m,P,g,n,i,l]),b=(0,a.I4)((()=>{(n.length||e)&&(v({query:""}),r())}),[n.length,e,v,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(la.Z,{itemIds:C,selectedIds:n,filterValue:m,filterPlaceholder:E("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:Z,onSelectedIdsChange:s,onFilterChange:f}),a.ZP.createElement(Ot.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"}))))}))),Na=(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:i,createGroupChat:l,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)(),[p,v]=(0,a.eJ)(),E="Chat title can't be empty",f="Channel title can't be empty",C="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)}),[]),N=(0,a.I4)((()=>{m.length?n.length>199?v(C):l({title:m,photo:P,memberIds:n}):v(E)}),[m,n,l,P,E,C]),w=(0,a.I4)((()=>{m.length?c({title:m,about:h,photo:P,memberIds:n}):v(f)}),[m,c,h,P,n,f]);(0,a.d4)((()=>{r===o.Nh.Complete&&s(!0)}),[r,s]);const k=i||(p!==E&&p!==f?p: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(xt.Z,{onChange:g,title:d("AddPhoto")}),a.ZP.createElement(pe.Z,{value:m,onChange:y,label:d(e?"EnterChannelName":"GroupName"),error:p===E||p===f?p:void 0}),e&&a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(pe.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(fe.Z,{userId:e}))))))),a.ZP.createElement(Ot.Z,{isShown:0!==m.length,onClick:e?w:N,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,ka=(0,a.X$)((({isActive:e,isChannel:t=!1,content:n,onContentChange:s,onReset:r})=>{const[i,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:l.s0,renderCount:wa,activeKey:n},(s=>{switch(n){case o.du.NewChannelStep1:case o.du.NewGroupStep1:return a.ZP.createElement(Ia,{isChannel:t,isActive:e,selectedMemberIds:i,onSelectedMemberIdsChange:c,onNextStep:d,onReset:r});case o.du.NewChannelStep2:case o.du.NewGroupStep2:return a.ZP.createElement(Na,{isChannel:t,isActive:s&&e,memberIds:i,onReset:r});default:return}}))}));var Sa=n(9359);const Ma=(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(Sa.Z,{folderType:"archived",isActive:e}))})),Ta={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},Fa=e=>{e.preventDefault()};function Aa(e){Ta[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)&&Fa(e)}function La(){document.addEventListener("wheel",Fa,{passive:!1}),window.ontouchmove=Fa,document.onkeydown=Aa}function Ra(){document.removeEventListener("wheel",Fa),window.ontouchmove=null,document.onkeydown=null}var $a=n(647),Ba=n(4319);function Da(e){return e?"lng_context_copy_selected":"lng_context_copy_text"}var Ua=n(3394),xa=n(2328);const Oa=({isOpen:e,message:t,anchor:n,canSendNow:s,canReschedule:o,canReply:i,canEdit:l,canPin:c,canUnpin:d,canDelete:m,canReport:h,canForward:Z,canFaveSticker:P,canUnfaveSticker:g,canCopy:p,canCopyLink:v,canSelect:E,onReply:f,onEdit:C,onPin:b,onUnpin:y,onForward:I,onDelete:N,onReport:w,onFaveSticker:k,onUnfaveSticker:S,onSelect:T,onSend:F,onReschedule:A,onClose:L,onCloseAnimationEnd:R,onCopyLink:$})=>{const B=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)),i=(0,u.Ti)(e,"inline"),l=o&&(i||(0,u.BM)(e))&&Ba.yl,c=window.getSelection();if(l&&a.push({label:"lng_context_copy_image",handler:()=>{Promise.resolve(i?$a.he(i,r.IU.BlobUrl):o.blobUrl).then(Ba.VP),t&&t()}}),s){const e=Boolean(c&&c.anchorNode&&c.anchorNode.parentNode&&c.anchorNode.parentNode.closest(".Message .content-inner")&&""!==c.toString().replace(/(?:\r\n|\r|\n)/g,""));a.push({label:Da(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,v?$:void 0),D=(0,a.I4)((()=>document.querySelector(`.active > .MessageList div[data-message-id="${t.id}"]`)),[t.id]),U=(0,a.I4)((()=>document.querySelector(".active > .MessageList")),[]),x=(0,a.I4)((()=>document.querySelector(".MessageContextMenu .bubble")),[]),{positionX:O,positionY:J,style:X}=(0,Ua.Z)(n,D,U,x,10,document.querySelector(".MiddleHeader").offsetHeight),z=(0,M.Z)();return a.ZP.createElement(xa.Z,{isOpen:e,positionX:O,positionY:J,style:X,className:"MessageContextMenu fluid",onClose:L,onCloseAnimationEnd:R},s&&a.ZP.createElement(G.Z,{icon:"send-outline",onClick:F},z("MessageScheduleSend")),o&&a.ZP.createElement(G.Z,{icon:"schedule",onClick:A},z("MessageScheduleEditTime")),i&&a.ZP.createElement(G.Z,{icon:"reply",onClick:f},z("Reply")),l&&a.ZP.createElement(G.Z,{icon:"edit",onClick:C},z("Edit")),P&&a.ZP.createElement(G.Z,{icon:"favorite",onClick:k},z("AddToFavorites")),g&&a.ZP.createElement(G.Z,{icon:"favorite",onClick:S},z("Stickers.RemoveFromFavorites")),p&&B.map((e=>a.ZP.createElement(G.Z,{key:e.label,icon:"copy",onClick:e.handler},z(e.label)))),c&&a.ZP.createElement(G.Z,{icon:"pin",onClick:b},z("DialogPin")),d&&a.ZP.createElement(G.Z,{icon:"unpin",onClick:y},z("DialogUnpin")),Z&&a.ZP.createElement(G.Z,{icon:"forward",onClick:I},z("Forward")),E&&a.ZP.createElement(G.Z,{icon:"select",onClick:T},z("Common.Select")),h&&a.ZP.createElement(G.Z,{icon:"flag",onClick:w},z("lng_context_report_msg")),m&&a.ZP.createElement(G.Z,{destructive:!0,icon:"delete",onClick:N},z("Delete")))},Ga=(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:i,canDelete:l,canReport:c,canEdit:d,canForward:u,canFaveSticker:h,canUnfaveSticker:Z,canCopy:P,canCopyLink:g,canSelect:p}=a&&(0,m._k)(e,t,a)||{},v="pinned"===n,E="scheduled"===n;return{noOptions:s,canSendNow:E,canReschedule:E,canReply:!v&&!E&&r,canPin:!E&&o,canUnpin:!E&&i,canDelete:l,canReport:c,canEdit:!v&&d,canForward:!E&&u,canFaveSticker:!E&&h,canUnfaveSticker:!E&&Z,canCopy:P,canCopyLink:!E&&g,canSelect:p}}),((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:i,onCloseAnimationEnd:l,noOptions:c,canSendNow:d,canReschedule:m,canReply:u,canPin:h,canUnpin:Z,canDelete:P,canReport:g,canEdit:p,canForward:v,canFaveSticker:E,canUnfaveSticker:f,canCopy:C,canCopyLink:b,canSelect:y,setReplyingToId:I,setEditingId:N,pinMessage:w,openForwardMenu:k,faveSticker:S,unfaveSticker:M,toggleMessageSelection:T,sendScheduledMessages:F,rescheduleMessage:A})=>{const{transitionClassNames:L}=(0,j.Z)(e,l,void 0,!1),[R,B]=(0,a.eJ)(!0),[D,U]=(0,a.eJ)(!1),[x,O]=(0,a.eJ)(!1),[G,J]=(0,a.eJ)(!1),[X,z,_]=(0,Fe.Z)(),Y=(0,a.I4)((()=>{B(!1),U(!0)}),[]),H=(0,a.I4)((()=>{B(!1),O(!0)}),[]),V=(0,a.I4)((()=>{B(!1),i()}),[i]),q=(0,a.I4)((()=>{U(!1),i()}),[i]),K=(0,a.I4)((()=>{O(!1),i()}),[i]),W=(0,a.I4)((()=>{J(!1),i()}),[i]),Q=(0,a.I4)((()=>{_(),i()}),[_,i]),ee=(0,a.I4)((()=>{I({messageId:s.id}),V()}),[I,s.id,V]),te=(0,a.I4)((()=>{N({messageId:s.id}),V()}),[N,s.id,V]),ne=(0,a.I4)((()=>{B(!1),J(!0)}),[]),ae=(0,a.I4)((()=>{w({messageId:s.id,isUnpin:!0}),V()}),[w,s.id,V]),se=(0,a.I4)((()=>{if(V(),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(),S({sticker:s.content.sticker})}),[V,s.content.sticker,S]),oe=(0,a.I4)((()=>{V(),M({sticker:s.content.sticker})}),[V,s.content.sticker,M]),ie=(0,a.I4)((()=>{const e=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]),le=(0,a.I4)((()=>{F({chatId:s.chatId,id:s.id}),V()}),[V,s.chatId,s.id,F]),ce=(0,a.I4)((()=>{B(!1),z()}),[z]),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]);(0,a.d4)((()=>(La(),Ra)),[]);const 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(Oa,{message:s,isOpen:R,anchor:o,canSendNow:d,canReschedule:m,canReply:u,canDelete:P,canReport:g,canPin:h,canUnpin:Z,canEdit:p,canForward:v,canFaveSticker:E,canUnfaveSticker:f,canCopy:C,canCopyLink:b,canSelect:y,onReply:ee,onEdit:te,onPin:ne,onUnpin:ae,onForward:se,onDelete:Y,onReport:H,onFaveSticker:re,onUnfaveSticker:oe,onSelect:ie,onSend:le,onReschedule:ce,onClose:V,onCopyLink:me}),a.ZP.createElement(De,{isOpen:D,isSchedule:"scheduled"===t,onClose:q,album:r,message:s}),a.ZP.createElement(Xe,{isOpen:x,onClose:K,messageIds:ue}),a.ZP.createElement(Ue,{isOpen:G,messageId:s.id,chatId:s.chatId,onClose:W}),a.ZP.createElement($e,{isOpen:X,withTimePicker:!0,selectedAt:1e3*s.date,maxAt:(0,$._F)(he),isFutureMode:!0,onClose:Q,onSubmit:de}))}))),Ja=(0,a.X$)((0,s.c$)(((e,{fromSticker:t,stickerSetShortName:n})=>({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,onClose:r,loadStickers:o,toggleStickerSet:l,sendMessage:c})=>{const d=(0,a.sO)(null),m=(0,M.Z)(),{observe:u}=(0,dn.S1)({rootRef:d,throttleMs:200,isDisabled:!e});(0,a.d4)((()=>{if(e)if(t){const{stickerSetId:e,stickerSetAccessHash:n}=t;o({stickerSetId:e,stickerSetAccessHash:n})}else n&&o({stickerSetShortName:n})}),[e,t,o,n]);const h=(0,a.I4)((e=>{e={...e,isPreloadedGlobally:!0},c({sticker:e}),r()}),[r,c]),Z=(0,a.I4)((()=>{s&&(l({stickerSetId:s.id}),r())}),[r,s,l]);return a.ZP.createElement(ge.Z,{className:"StickerSetModal",isOpen:e,onClose:r,hasCloseButton:!0,title:s?(0,B.Z)(s.title,["emoji","links"]):m("AccDescrStickerSet")},s&&s.stickers?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement("div",{ref:d,className:"stickers custom-scroll"},s.stickers.map((e=>a.ZP.createElement(gn.Z,{sticker:e,size:i.yK,observeIntersection:u,onClick:h,clickArg:e})))),a.ZP.createElement("div",{className:"button-wrapper"},a.ZP.createElement(R.Z,{size:"smaller",fluid:!0,color:s.installedDate?"danger":"primary",onClick:Z},m(s.installedDate?"StickerPack.RemoveStickerCount":"StickerPack.AddStickerCount",s.count,"i")))):a.ZP.createElement(Pe.Z,null))})));var Xa=n(2898);const za=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t);return!n||n.isRestricted?{}:{chat:n,isMuted:(0,u.i4)(n,(0,m.dZ)(e),(0,m.NJ)(e)),isPrivate:(0,u.YA)(n.id),canDeleteChat:(0,u.cc)(n)}}),((e,t)=>(0,h.ei)(t,["updateChatMutedState","enterMessageSelectMode","sendBotCommand","restartBot"])))((({chatId:e,isOpen:t,anchor:n,isChannel:s,canStartBot:r,canRestartBot:o,canSubscribe:i,canSearch:c,canMute:d,canSelect:m,canLeave:u,chat:h,isPrivate:Z,isMuted:P,canDeleteChat:g,onSubscribeChannel:p,onSearchClick:v,onClose:E,onCloseAnimationEnd:f,updateChatMutedState:C,enterMessageSelectMode:b,sendBotCommand:y,restartBot:I})=>{const[N,w]=(0,a.eJ)(!0),[k,S]=(0,a.eJ)(!1),{x:T,y:F}=n;(0,j.Z)(t,f,void 0,!1);const A=(0,a.I4)((()=>{w(!1),S(!0)}),[]),L=(0,a.I4)((()=>{w(!1),E()}),[E]),R=(0,a.I4)((()=>{S(!1),E()}),[E]),$=(0,a.I4)((()=>{y({command:"/start"})}),[y]),B=(0,a.I4)((()=>{I({chatId:e})}),[e,I]),D=(0,a.I4)((()=>{C({chatId:e,isMuted:!P}),L()}),[e,L,P,C]),U=(0,a.I4)((()=>{p(),L()}),[L,p]),x=(0,a.I4)((()=>{v(),L()}),[L,v]),O=(0,a.I4)((()=>{b(),L()}),[L,b]);(0,a.d4)((()=>(La(),Ra)),[]);const J=(0,M.Z)();return a.ZP.createElement(Xa.Z,null,a.ZP.createElement("div",{className:"HeaderMenuContainer"},a.ZP.createElement(xa.Z,{isOpen:N,positionX:"right",style:`left: ${T}px;top: ${F}px;`,onClose:L},l.wB&&r&&a.ZP.createElement(G.Z,{icon:"bots",onClick:$},J("BotStart")),l.wB&&o&&a.ZP.createElement(G.Z,{icon:"bots",onClick:B},J("BotRestart")),l.wB&&i&&a.ZP.createElement(G.Z,{icon:s?"channel":"group",onClick:U},J(s?"Subscribe":"Join Group")),l.wB&&c&&a.ZP.createElement(G.Z,{icon:"search",onClick:x},J("Search")),d&&a.ZP.createElement(G.Z,{icon:P?"unmute":"mute",onClick:D},J(P?"ChatsUnmute":"ChatsMute")),m&&a.ZP.createElement(G.Z,{icon:"select",onClick:O},J("ReportSelectMessages")),u&&a.ZP.createElement(G.Z,{destructive:!0,icon:"delete",onClick:A},J(Z?"Delete":g?"GroupInfo.DeleteAndExit":s?"LeaveChannel":"Group.LeaveGroup"))),h&&a.ZP.createElement(Ve.Z,{isOpen:k,onClose:R,chat:h})))})));var _a=n(9589);const Ya=(0,z.Ds)((e=>e()),200,!1),ja=(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:i,searchTextMessagesLocal:l,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=>{i({query:e}),e.length&&Ya(l)}),[l,i]),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]),p=(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(_a.Z,{ref:u,value:n,onChange:P})),a.ZP.createElement("div",{className:"footer"},a.ZP.createElement("div",{className:"counter"},n?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,$._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:p,disabled:!r||!r.length||0===h},a.ZP.createElement("i",{className:"icon-down"}))))})));var Ha=n(5376),Va=n(2365),qa=n(8353),Ka=n(7002),Wa=n(3616);function Qa(e,t,n=0,a=!1,s=!1,r=!1){const o=e[r?"scrollLeft":"scrollTop"],i=o+e[r?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let m=!1;for(let e=0;e<c;e++){const t=l[e],c=t[r?"offsetLeft":"offsetTop"],u=c+t[r?"offsetWidth":"offsetHeight"];if(s?u>=o-n&&u<=i+n:c<=i+n&&u>=o-n)d.push(e),m=!0;else if(m&&!a)break}return{allElements:l,visibleIndexes:d}}const es=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 ts=n(539);function ns(e,t,n){const a=n.current;if(!a||t<0)return;const{visibleIndexes:s,allElements:r}=Qa(a,e,8,!0,!0);if(!r.length||!r[t])return;const o=s[0];if(!s.includes(t)||t===o&&!es(a,r[o])){const e=t>s[s.length-1]?"start":"end";(0,ts.Z)(a,r[t],e,10)}}var as=n(3570);function ss({isActive:e,isHorizontal:t,shouldRemoveSelectionOnReset:n,noArrowNavigation:s,items:r,shouldSelectOnTab:o,onSelect:i,onClose:l}){const[c,d]=(0,a.eJ)(-1),m=(0,a.I4)((e=>r?(0,as.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(),i(t))}}),[r,i,c]);return(0,a.d4)((()=>{d(n?-1:0)}),[r,n]),(0,a.d4)((()=>e?(0,Oe.Z)({onEsc:l,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,l,o]),c}const rs=(0,a.X$)((({isOpen:e,onClose:t,onInsertUserName:n,usersById:s,filteredUsers:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:l}=(0,j.Z)(e,void 0,void 0,!1),c=(0,a.I4)(((e,t=!1)=>{const a=s&&s[e];a&&n(a,t)}),[s,n]),d=(0,a.I4)((e=>{c(e.id,!0)}),[c]),m=ss({isActive:e,items:r,onSelect:d,shouldSelectOnTab:!0,onClose:t});(0,a.d4)((()=>{ns(".chat-item-clickable",m,o)}),[m]),(0,a.d4)((()=>{r&&!r.length&&t()}),[r,t]);const u=(0,C.Z)(r&&r.length?r:void 0,i),h=r&&!r.length?u:r;if(!i||h&&!h.length)return;const Z=(0,_.Z)("MentionTooltip composer-tooltip custom-scroll",l);return a.ZP.createElement("div",{className:Z,ref:o},h&&h.map((({id:e},t)=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable scroll-item",onClick:()=>c(e),focus:m===t},a.ZP.createElement(fe.Z,{userId:e,avatarSize:"small",withUsername:!0})))))}));var os=n(9830);const is=(0,a.X$)((({attachments:e,caption:t,isReady:n,currentUserId:s,groupChatMembers:r,usersById:o,recentEmojis:l,baseEmojiKeywords:c,emojiKeywords:d,addRecentEmoji:m,onCaptionUpdate:u,onSend:h,onFileAppend:Z,onClear:g})=>{const p=(0,a.sO)(null),v=(0,C.Z)(e),E=e.length?e:v,f=Boolean(e.length),[b,y,I]=(0,Fe.Z)(),N=Boolean(E&&E.every((e=>e.quick))),w=(0,M.Z)(),{isMentionTooltipOpen:k,closeMentionTooltip:S,insertMention:T,mentionFilteredUsers:F}=(0,Va.Z)(f,t,u,i.nY,r,void 0,s,o),{isEmojiTooltipOpen:A,closeEmojiTooltip:L,filteredEmojis:$,insertEmoji:B}=(0,qa.Z)(f,t,l,i.nY,u,c,d,!n);(0,a.d4)((()=>f?(0,P.Z)(g):void 0),[f,g]);const D=(0,a.I4)((()=>{f&&h()}),[f,h]),U=(0,a.I4)((e=>{e.preventDefault(),I();const{dataTransfer:{files:t}}=e;if(t&&t.length){const e=N?Array.from(t).filter((e=>e.type&&i.AK.has(e.type))):Array.from(t);Z(e,N)}}),[N,Z,I]);if(!E)return;const x=E.every((e=>e.mimeType.startsWith("image/"))),O=E.every((e=>e.mimeType.startsWith("video/")));let G="";return G=w(x?"PreviewSender.SendPhoto":O?"PreviewSender.SendVideo":"PreviewSender.SendFile",E.length,"i"),a.ZP.createElement(ge.Z,{isOpen:f,onClose:g,header:function(){if(E)return a.ZP.createElement("div",{className:"modal-header-condensed",dir:w.isRtl?"rtl":void 0},a.ZP.createElement(R.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:g},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement("div",{className:"modal-title"},G),a.ZP.createElement(R.Z,{color:"primary",size:"smaller",className:"modal-action-button",onClick:D},w("Send")))}(),className:"AttachmentModal "+(b?"hovered":"")},a.ZP.createElement("div",{className:"drop-target",onDragEnter:y,onDrop:U,onDragOver:function(e){e.preventDefault(),e.stopPropagation(),p.current&&window.clearTimeout(p.current)},onDragLeave:e=>{const{relatedTarget:t,target:n}=e;n.matches(".drop-target")&&!t&&(p.current=window.setTimeout(I,150)),n&&n.closest(".AttachmentModal.hovered")||(t&&e.stopPropagation(),I())},"data-attach-description":w("Preview.Dragging.AddItems",10)},N?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(Ka.Z,{name:e.filename,extension:(0,Ha.mD)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0})))),a.ZP.createElement("div",{className:"attachment-caption-wrapper"},a.ZP.createElement(rs,{isOpen:k,onClose:S,onInsertUserName:T,filteredUsers:F,usersById:o}),a.ZP.createElement(os.Z,{isOpen:A,emojis:$,onClose:L,onEmojiSelect:B,addRecentEmoji:m}),a.ZP.createElement(Wa.Z,{id:"caption-input-text",isAttachmentModalInput:!0,html:t,editableInputId:i.nY,placeholder:w("Caption"),onUpdate:u,onSend:h,shouldSetFocus:Boolean(e.length)}))))}));var ls=n(6980);const cs=(0,a.X$)((({isOpen:e,onSend:t,onClear:n})=>{const s=(0,a.sO)(null),r=(0,a.sO)(null),o=(0,a.sO)(null),[i,l]=(0,a.eJ)(""),[c,d]=(0,a.eJ)([""]),[m,u]=(0,a.eJ)(!0),[h,Z]=(0,a.eJ)(!1),[g,p]=(0,a.eJ)(!1),[v,E]=(0,a.eJ)(),[f,C]=(0,a.eJ)(),[b,y]=(0,a.eJ)(!1),I=(0,M.Z)(),N=(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||(l(""),d([""]),u(!0),Z(!1),p(!1),E(""),C(""),y(!1))}),[e]),(0,a.d4)((()=>N(s)),[N,e]),(0,a.bt)((()=>{const e=o.current;e&&v!==e.innerHTML&&(e.innerHTML=v)}),[v]);const w=(0,a.I4)(((e=[])=>{d([...e,""]),requestAnimationFrame((()=>{const e=r.current;e&&(e.classList.toggle("overflown",e.scrollHeight>320),e.scrollTo({top:e.scrollHeight,behavior:"smooth"}))}))}),[]),k=(0,a.I4)((()=>{if(y(!1),!e)return;const n=i.trim().substring(0,255),a=c.map((e=>e.trim().substring(0,100))).filter((e=>e.length));if(!n||a.length<2)return l(n),a.length?a.length<2?w(a):d(a):w(),void y(!0);if(g&&(!f||!a[Number(f)]))return void y(!0);const s={summary:{question:n,answers:a.map(((e,t)=>({text:e.trim(),option:String(t),...String(t)===f&&{correct:!0}}))),...!m&&{isPublic:!0},...h&&{multipleChoice:!0},...g&&{quiz:!0}}};if(g){const{text:e,entities:t}=v&&(0,ls.Z)(v.substring(0,200))||{};s.quiz={correctAnswers:[f],...e&&{solution:e},...t&&{solutionEntities:t}}}t(s)}),[e,i,c,g,f,m,h,t,w,v]),S=(0,a.I4)(((e,t)=>{const n=[...c];n[e]=t,n[n.length-1].trim().length&&n.length<10?w(n):d(n)}),[c,w]),T=(0,a.I4)((e=>{const t=[...c];t.splice(e,1),d(t),requestAnimationFrame((()=>{r.current&&r.current.classList.toggle("overflown",r.current.scrollHeight>320)}))}),[c]),F=(0,a.I4)((e=>{C(e)}),[C]),A=(0,a.I4)((e=>{u(e.target.checked)}),[]),L=(0,a.I4)((e=>{Z(e.target.checked)}),[]),$=(0,a.I4)((e=>{p(e.target.checked)}),[]),B=(0,a.I4)((e=>{13===e.keyCode&&k()}),[k]),D=(0,a.I4)((()=>{if(b&&!i.trim().length)return I("lng_polls_choose_question")}),[b,I,i]),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(pe.Z,{label:t!==c.length-1||10===c.length?I("OptionHint"):I("CreatePoll.AddOption"),error:U(t),value:e,onChange:e=>S(t,e.currentTarget.value),onKeyPress:B}),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(pe.Z,{ref:s,label:I("AskAQuestion"),value:i,error:D(),onChange:e=>l(e.currentTarget.value),onKeyPress:B}),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&&(!f||!e[Number(f)])&&a.ZP.createElement("p",{className:"error"},I("lng_polls_choose_correct"))}(),g?a.ZP.createElement(Je.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(rn.Z,{label:I("PollAnonymous"),checked:m,onChange:A}),a.ZP.createElement(rn.Z,{label:I("PollMultiple"),checked:h,disabled:g,onChange:L}),a.ZP.createElement(rn.Z,{label:I("PollQuiz"),checked:g,disabled:h,onChange:$}),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 ds=n(6503),ms=n(4284),us=n(1367);const hs=(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]}:`},l.op?e.native:a.ZP.createElement("img",{src:`./img-apple-64/${e.image}.png`,alt:"",loading:"lazy"}))})),Zs=(0,a.X$)((({category:e,index:t,allEmojis:n,observeIntersection:s,shouldRender:r,onEmojiSelect:o})=>{const i=(0,a.sO)(null);(0,dn._N)(i,s);const{transitionClassNames:d}=(0,j.Z)(r,void 0,void 0,"slow"),m=(0,M.Z)(),u=l.wB?Math.floor((c.Z.get().width-8)/44):9,h=44*Math.ceil(e.emojis.length/u);return a.ZP.createElement("div",{ref:i,key:e.id,id:`emoji-category-${t}`,className:"symbol-set"},a.ZP.createElement("p",{className:"symbol-set-name",dir:"auto"},m("recent"===e.id?"RecentStickers":`Emoji${t}`)),a.ZP.createElement("div",{className:(0,_.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(hs,{key:s.id,emoji:s,onClick:o})}))))})),Ps={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"},gs=[];let ps,vs,Es;const fs=(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,dn.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-",""));gs[n]=e.isIntersecting}));const t=gs.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&Z(t[Math.floor(t.length/2)].index)}));(0,Ke.Z)(o.current,!l.wB),(0,a.d4)((()=>{if(!c)return;const e=o.current;if(!e)return;const t=42*h-e.offsetWidth/2+21;(0,us.Z)(e,t)}),[c,h]);const g=(0,M.Z)(),p=(0,a.Ye)((()=>{if(!c)return Ye.D;const e=[...c];return s&&s.length&&e.unshift({id:"recent",name:g("RecentStickers"),emojis:s}),e}),[c,g,s]);(0,a.d4)((()=>{setTimeout((()=>{const e=()=>{d(Es.categories),u(Es.emojis)};Es?e():async function(){return ps||(ps=n.e(501).then(n.t.bind(n,7501,19)),vs=(await ps).default,Es=(0,ms.N)(vs)),ps}().then(e)}),200)}),[]);const v=(0,a.I4)((e=>{Z(e);const t=document.getElementById(`emoji-category-${e}`);(0,ts.Z)(r.current,t,"start",50,800)}),[]),E=(0,a.I4)(((e,n)=>{t(e,n)}),[t]),f=(0,mt.Z)([],i.kU),C=(0,_.Z)("EmojiPicker",e);return m&&f?a.ZP.createElement("div",{className:C},a.ZP.createElement("div",{ref:o,className:"EmojiPicker-header",dir:g.isRtl?"rtl":""},p.map((function(e,t){const n=Ps[e.id];return n&&a.ZP.createElement(R.Z,{className:"symbol-set-button "+(t===h?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>v(t),ariaLabel:e.name},a.ZP.createElement("i",{className:n}))}))),a.ZP.createElement("div",{ref:r,className:(0,_.Z)("EmojiPicker-main no-selection",l.$b?"no-scrollbar":"custom-scroll")},p.map(((e,t)=>a.ZP.createElement(Zs,{category:e,index:t,allEmojis:m,observeIntersection:P,shouldRender:h>=t-1&&h<=t+1,onEmojiSelect:E}))))):a.ZP.createElement("div",{className:C},a.ZP.createElement(Pe.Z,null))}))),Cs=l.wB?8:16,bs=(0,a.X$)((({stickerSet:e,loadAndPlay:t,index:n,observeIntersection:s,shouldRender:r,onStickerSelect:o,onStickerUnfave:d})=>{const m=(0,a.sO)(null);(0,dn._N)(m,s);const{transitionClassNames:u}=(0,j.Z)(r,void 0,void 0,"slow"),h=l.wB?Math.floor((c.Z.get().width-8)/(i.Q+Cs)):5,Z=Math.ceil(e.count/h)*(i.Q+Cs);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,_.Z)("symbol-set-container",u),style:`height: ${Z}px;`},r&&e.stickers&&e.stickers.map((n=>a.ZP.createElement(gn.Z,{key:n.id,sticker:n,size:i.Q,observeIntersection:s,noAnimate:!t,onClick:o,clickArg:n,onUnfaveClick:"favorite"===e.id?d:void 0})))))})),ys=[],Is=(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:p})=>{const v=(0,a.sO)(null),E=(0,a.sO)(null),[f,C]=(0,a.eJ)(0),{observe:b}=(0,dn.S1)({rootRef:v,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-",""));ys[n]=e.isIntersecting}));const t=ys.map(((e,t)=>({index:t,isIntersecting:e}))).filter((({isIntersecting:e})=>e));t.length&&C(t[Math.floor(t.length/2)].index)})),{observe:y}=(0,dn.S1)({rootRef:E}),I=(0,M.Z)(),N=Boolean(o),w=(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)]:Ye.D),[o,I,s,r,c]),k=(0,a.Ye)((()=>N&&0===w.filter((e=>e.stickers&&e.stickers.length)).length),[w,N]);(0,a.d4)((()=>{t&&(u(),h(),Z())}),[t,Z,h,u]),(0,a.d4)((()=>{o&&o.length&&P()}),[o,P]),(0,Ke.Z)(E.current),(0,a.d4)((()=>{if(!N)return;const e=E.current;if(!e)return;const t=52*f-(e.offsetWidth/2-26);(0,us.Z)(e,t)}),[N,f]);const S=(0,a.I4)((e=>{C(e);const t=document.getElementById(`sticker-set-${e}`);(0,ts.Z)(v.current,t,"start",void 0,500)}),[]),T=(0,a.I4)((e=>{m(e),g({sticker:e})}),[g,m]),F=(0,a.I4)((e=>{p({sticker:e})}),[p]),A=(0,mt.Z)([],i.Y),L=(0,_.Z)("StickerPicker",e);return N&&A&&!k&&n?a.ZP.createElement("div",{className:L},a.ZP.createElement("div",{ref:E,className:"StickerPicker-header no-selection no-scrollbar"},w.map((function(e,t){const n=e.stickers&&e.stickers[0],s=(0,_.Z)("symbol-set-button sticker-set-button",t===f&&"activated");return"recent"===e.id||"favorite"===e.id||e.hasThumbnail||!n?a.ZP.createElement(R.Z,{key:e.id,className:s,ariaLabel:e.title,round:!0,faded:"recent"===e.id||"favorite"===e.id,color:"translucent",onClick:()=>S(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(Zn,{stickerSet:e,observeIntersection:y}):a.ZP.createElement(Pn,{stickerSet:e,observeIntersection:y})):a.ZP.createElement(gn.Z,{key:e.id,sticker:n,size:i.DC,title:e.title,className:s,observeIntersection:y,onClick:S,clickArg:t})}))),a.ZP.createElement("div",{ref:v,className:(0,_.Z)("StickerPicker-main no-selection",l.$b?"no-scrollbar":"custom-scroll")},w.map(((e,n)=>a.ZP.createElement(bs,{key:e.id,stickerSet:e,loadAndPlay:Boolean(d&&t),index:n,observeIntersection:b,shouldRender:f>=n-1&&f<=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."))})));function Ns(){return(Ns=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}const ws=(0,a.X$)((({gif:e,observeIntersection:t,isDisabled:n,className:s,onClick:o})=>{const i=(0,a.sO)(null),l=(0,a.sO)(null),c=e.thumbnail&&!!e.thumbnail.dataUri,d=`gif${e.id}`,m=(0,dn.Op)(i,t)&&!n,u=(0,v.Z)(`${d}?size=m`,!m,r.IU.BlobUrl),h=(0,Tn.Z)(e.thumbnail&&e.thumbnail.dataUri,Boolean(u)),Z=(0,v.Z)(d,!m,r.IU.BlobUrl),P=Boolean(m&&Z),{transitionClassNames:g}=(0,un.Z)(c||u||Z,"slow"),{isBuffered:p,bufferingHandlers:E}=(0,H.Z)(!0),f=m&&!p;(0,q.Z)(l,[P]);const C=(0,a.I4)((()=>o({...e,blobUrl:Z})),[o,e,Z]),b=(0,_.Z)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",g,d,s);return a.ZP.createElement("div",{ref:i,className:b,onClick:C},c&&a.ZP.createElement("canvas",{ref:h,className:"thumbnail"}),!c&&u&&a.ZP.createElement("img",{src:u,alt:"",className:"thumbnail"}),(P||u)&&a.ZP.createElement("video",Ns({ref:l,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"none"},E),a.ZP.createElement("source",{src:Z})),f&&a.ZP.createElement(F.Z,{color:u||c?"white":"black"}))})),ks=(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,dn.S1)({rootRef:c,debounceMs:300});(0,a.d4)((()=>{t&&o()}),[t,o]);const m=(0,mt.Z)([],i.Y);return a.ZP.createElement("div",{ref:c,className:(0,_.Z)("GifPicker",e,l.$b?"no-scrollbar":"custom-scroll")},n?m&&s&&s.length?s.map((e=>a.ZP.createElement(ws,{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 Ss;!function(e){e[e.Emoji=0]="Emoji",e[e.Stickers=1]="Stickers",e[e.GIFs=2]="GIFs"}(Ss||(Ss={}));const Ms=Object.values(Ss).filter((e=>"string"==typeof e)),Ts={[Ss.Emoji]:"icon-smile",[Ss.Stickers]:"icon-stickers",[Ss.GIFs]:"icon-gifs"},Fs=(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:Ms[n],round:!0,faded:!0,color:"translucent"},a.ZP.createElement("i",{className:Ts[n]}))}const i=(0,a.I4)((()=>{s(e===Ss.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!==Ss.Emoji&&a.ZP.createElement(R.Z,{className:"symbol-search-button",ariaLabel:e===Ss.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:i},a.ZP.createElement("i",{className:"icon-search"})),o(Ss.Emoji),o(Ss.Stickers),o(Ss.GIFs),e===Ss.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 As=!1;const Ls=(0,a.X$)((0,s.c$)((e=>({isLeftColumnShown:e.isLeftColumnShown})))((({isOpen:e,allowedAttachmentOptions:t,isLeftColumnShown:n,onLoad:s,onClose:r,onEmojiSelect:o,onStickerSelect:i,onGifSelect:c,onRemoveSymbol:d,onSearchOpen:m,addRecentEmoji:u})=>{const[h,Z]=(0,a.eJ)(0),[P,g]=(0,a.eJ)([]),[p,v]=(0,ds.Z)(e,r,void 0,l.wB),{shouldRender:E,transitionClassNames:f}=(0,j.Z)(e,r,!1,!1);!As&&e&&(As=!0),(0,a.d4)((()=>{s()}),[s]),(0,a.bt)((()=>{if(l.wB)return e&&(document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open")),()=>{e&&(0,z.T2)((()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}),350)}))}}),[e]);const C=(0,a.sO)(P);C.current=P,(0,a.d4)((()=>{C.current.length&&(C.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=>{i(e,!0)}),[i]),N=(0,M.Z)(),{canSendStickers:w,canSendGifs:k}=t;function S(t,n){switch(h){case Ss.Emoji:return a.ZP.createElement(fs,{className:"picker-tab",onEmojiSelect:b});case Ss.Stickers:return a.ZP.createElement(Is,{className:"picker-tab",loadAndPlay:!!w&&e&&(t||n),canSendStickers:w,onStickerSelect:I});case Ss.GIFs:return a.ZP.createElement(ks,{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()}},As&&a.ZP.createElement(L.Z,{name:"slide",activeKey:h,renderCount:Ms.length},S)),l.wB&&a.ZP.createElement(R.Z,{round:!0,faded:!0,color:"translucent",ariaLabel:N("Close"),className:"symbol-close-button",size:"tiny",onClick:r},a.ZP.createElement("i",{className:"icon-close"})),a.ZP.createElement(Fs,{activeTab:h,onSwitchTab:Z,onRemoveSymbol:d,onSearchOpen:y}));if(l.wB){if(!E)return;const e=(0,_.Z)("SymbolMenu mobile-menu",f,!n&&"middle-column-open");return a.ZP.createElement(Xa.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:l.$b?void 0:p,onMouseLeave:l.$b?void 0:v,noCloseOnBackdrop:!l.$b},T)}))),Rs=(0,a.X$)((({isOpen:e,allowedAttachmentOptions:t,onFileSelect:n,onPollCreate:s,onClose:r})=>{const[o,c]=(0,ds.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)((()=>{bn(Array.from(i.AK).join(","),(e=>d(e,!0)))}),[d]),u=(0,a.I4)((()=>{bn("*",(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:l.$b?void 0:o,onMouseLeave:l.$b?void 0:c,noCloseOnBackdrop:!l.$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")))})),$s=(0,a.X$)((({withAvatar:e,focus:t,botCommand:n,bot:s,onClick:r})=>a.ZP.createElement(Ee.Z,{key:n.command,className:(0,_.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,B.Z)(n.description)))))),Bs=(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:i})=>{const l=(0,a.sO)(null),{shouldRender:c,transitionClassNames:d}=(0,j.Z)(t,void 0,void 0,!1),m=(0,a.I4)((({botId:t,command:a})=>{const s=e[t];i({command:`/${a}${n&&s?`@${s.username}`:""}`,botId:t}),r()}),[r,i,e,n]),u=ss({isActive:t,items:s,onSelect:m,onClose:o});(0,a.d4)((()=>{s&&!s.length&&o()}),[s,o]),(0,a.d4)((()=>{ns(".chat-item-clickable",u,l)}),[u]);const h=(0,C.Z)(s&&s.length?s:void 0,c),Z=s&&!s.length?h:s;if(!c||Z&&!Z.length)return;const P=(0,_.Z)("BotCommandTooltip composer-tooltip custom-scroll",d);return a.ZP.createElement("div",{className:P,ref:l},Z&&Z.map(((t,n)=>a.ZP.createElement($s,{key:`${t.botId}_${t.command}`,botCommand:t,bot:e[t.botId],withAvatar:!0,onClick:m,focus:u===n}))))}))),Ds=(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,ds.Z)(e,n,void 0,l.wB),i=(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:l.$b?void 0:r,onMouseLeave:l.$b?void 0:o,noCloseOnBackdrop:!l.$b},t.map((e=>a.ZP.createElement($s,{key:e.command,botCommand:e,onClick:i}))))}))),Us=(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,j.Z)(e,void 0,void 0,!1),d=(0,C.Z)(n,!0),m=n||d,{observe:u}=(0,dn.S1)({rootRef:r,throttleMs:200});(0,a.d4)((()=>e?(0,P.Z)(s):void 0),[e,s]);const h=(0,_.Z)("StickerTooltip composer-tooltip custom-scroll",c,!(m&&m.length)&&"hidden");return a.ZP.createElement("div",{ref:r,className:h,onMouseEnter:l.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:l.$b?void 0:()=>{document.body.classList.remove("no-select")}},o&&m?m.map((e=>a.ZP.createElement(gn.Z,{key:e.id,sticker:e,size:i.Q,observeIntersection:u,onClick:t,clickArg:e}))):o?a.ZP.createElement(Pe.Z,null):void 0)}))),xs=(0,a.X$)((({isOpen:e,onSilentSend:t,onScheduleSend:n,onClose:s,onCloseAnimationEnd:r})=>{const[o,i]=(0,ds.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:l.$b?void 0:o,onMouseLeave:l.$b?void 0:i,noCloseOnBackdrop:!l.$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 Os=n(2420),Gs=n(3283),Js=n(2678);const Xs=(0,a.X$)((({isOpen:e,emojis:t,onClose:n,onEmojiSelect:s,addRecentEmoji:r})=>{const o=(0,a.sO)(null),{shouldRender:i,transitionClassNames:c}=(0,j.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=ss({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}=Qa(n,".EmojiButton",8,!0,!0,!0);if(!s.length||!s[e])return;const r=a[0];if(!a.includes(e)||e===r&&!es(n,s[r],!0)){const t="start"==(e>a[a.length-1]?"start":"end")?44*e:0;(0,us.Z)(n,t)}}(h,o)}),[h]);const Z=(0,_.Z)("EmojiTooltip composer-tooltip custom-scroll-x",c);return a.ZP.createElement("div",{ref:o,className:Z,onMouseEnter:l.$b?void 0:()=>{document.body.classList.add("no-select")},onMouseLeave:l.$b?void 0:()=>{document.body.classList.remove("no-select")}},i&&d?d.map(((e,t)=>a.ZP.createElement(hs,{key:e.id,emoji:e,focus:h===t,onClick:u}))):i?a.ZP.createElement(Pe.Z,null):void 0)})),zs=(0,a.X$)((({title:e,description:t,thumbnail:n,thumbUrl:s,focus:r,transitionClassNames:o="",onClick:i})=>{let l="";const c=(0,v.Z)(n?`webDocument:${n.url}`:void 0);return(s=s||c)?l=a.ZP.createElement("img",{src:s,className:o,alt:"",decoding:"async",draggable:"false"}):e&&(l=(0,hn.Xv)(e,1)),a.ZP.createElement(Ee.Z,{focus:r,className:"BaseResult chat-item-clickable",onClick:i},a.ZP.createElement("span",{className:"thumb"},"string"==typeof l?(0,B.Z)(l):l),a.ZP.createElement("div",{className:"content-inner"},e&&a.ZP.createElement("div",{className:"title"},e),t&&a.ZP.createElement("div",{className:"description"},t)))})),_s=(0,a.X$)((({focus:e,isForGallery:t,inlineResult:n,onClick:s})=>{let r,o,i;"photo"in n&&(r=n.photo),"thumbnail"in n&&(o=n.thumbnail),"webThumbnail"in n&&t&&(i=n.webThumbnail);const l=(0,v.Z)(i?`webDocument:${i.url}`:void 0),c=(0,v.Z)(r&&`photo${r.id}?size=m`),{shouldRenderThumb:d,shouldRenderFullMedia:m,transitionClassNames:u}=(0,un.Z)(c,"slow"),h=(0,a.I4)((()=>{s(n)}),[n,s]);if(t)return a.ZP.createElement("div",{className:"MediaResult chat-item-clickable",onClick:h},d&&a.ZP.createElement("img",{src:r&&r.thumbnail&&r.thumbnail.dataUri||l,alt:""}),m&&a.ZP.createElement("img",{src:c,className:`${u} full-media`,alt:""}));const{title:Z,description:P}=n;return a.ZP.createElement(zs,{focus:e,thumbUrl:m?c:o&&o.dataUri||l,transitionClassNames:m?u:void 0,title:Z,description:P,onClick:h})})),Ys=(0,a.X$)((({focus:e,inlineResult:t,onClick:n})=>{const{title:s,url:r,description:o,webThumbnail:i}=t,l=(0,a.I4)((()=>{n(t)}),[t,n]);return a.ZP.createElement(zs,{focus:e,thumbnail:i,title:s||r,description:o,onClick:l})})),js=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{gif:s}=e,r=(0,a.I4)((()=>{n(e)}),[e,n]);if(s)return a.ZP.createElement(ws,{gif:s,observeIntersection:t,className:"chat-item-clickable",onClick:r})})),Hs=(0,a.X$)((({inlineResult:e,observeIntersection:t,onClick:n})=>{const{sticker:s}=e;if(s)return a.ZP.createElement(gn.Z,{sticker:s,size:i.zq,observeIntersection:t,title:s.emoji,className:"chat-item-clickable",onClick:n,clickArg:e})})),Vs=(0,z.P2)((e=>e()),500,!0),qs=(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:i,onClose:c,openChat:d,startBot:m,onSelectResult:u})=>{const h=(0,a.sO)(null),{shouldRender:Z,transitionClassNames:P}=(0,j.Z)(e,void 0,void 0,!1),{observe:g}=(0,dn.S1)({rootRef:h,debounceMs:200,isDisabled:!e}),p=(0,a.I4)((({direction:e})=>{e===o.Uq.Backwards&&Vs(i)}),[i]),v=ss({isActive:e,shouldRemoveSelectionOnReset:n,noArrowNavigation:n,items:s,onSelect:u,onClose:c});(0,a.d4)((()=>{ns(".chat-item-clickable",v,h)}),[v]);const E=(0,a.I4)((()=>{d({id:t}),m({botId:t,param:r.startParam})}),[t,d,m,r]),f=(0,C.Z)(s&&s.length?s:void 0,Z),b=s&&!s.length?f:s;if(!Z||!b||!b.length&&!r)return;const y=(0,_.Z)("InlineBotTooltip composer-tooltip",l.$b?"no-scrollbar":"custom-scroll",n&&"gallery",P);return a.ZP.createElement(ve.Z,{ref:h,className:y,items:b,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:p,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(js,{key:e.id,inlineResult:e,observeIntersection:g,onClick:u});case"photo":return a.ZP.createElement(_s,{key:e.id,isForGallery:n,inlineResult:e,onClick:u});case"sticker":return a.ZP.createElement(Hs,{key:e.id,inlineResult:e,observeIntersection:g,onClick:u});case"video":case"game":return a.ZP.createElement(_s,{key:e.id,focus:v===t,inlineResult:e,onClick:u});case"article":case"audio":return a.ZP.createElement(Ys,{key:e.id,focus:v===t,inlineResult:e,onClick:u});default:return}})))})));var Ks=n(6844);const Ws=(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:i}=r||{};return{chat:n,messagesById:a,query:s,totalCount:o,foundIds:i}}),((e,t)=>(0,h.ei)(t,["searchTextMessagesLocal","focusMessage"])))((({chatId:e,threadId:t,onClose:n,isActive:r,chat:o,messagesById:i,query:l,totalCount:c,foundIds:d,searchTextMessagesLocal:Z,focusMessage:P})=>{const g=(0,M.Z)(),p=(0,a.Ye)((()=>{if(!(l&&d&&d.length&&i))return Ye.D;const n=d.map((n=>{const a=i[n];if(!a)return;const r=a.senderId?(0,m.dy)((0,s.Rd)(),a.senderId):void 0;let l;if(o&&(0,u.eA)(o))l=o;else if(a.forwardInfo){const{isChannelPost:e,fromChatId:t}=a.forwardInfo;l=e&&t?(0,m.Z1)((0,s.Rd)(),t):void 0}else l=a.senderId?(0,m.Z1)((0,s.Rd)(),a.senderId):void 0;return{message:a,senderUser:r,senderChat:l,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,i,l]);(0,T.ZP)(r,n);const v=(0,a.sO)(null),E=(0,Ze.Z)(v,!0,(e=>{const t=p&&p[-1===e?0:e];t&&t.onClick()}),".ListItem-button",!0);return a.ZP.createElement(ve.Z,{className:"RightSearch custom-scroll",items:p,preloadBackwards:0,onLoadMore:Z,noFastList:!0,onKeyDown:E,ref:v},a.ZP.createElement("p",{className:"helper-text",dir:"auto"},l?0!==c&&p.length?1===c?"1 message found":`${p.length&&(c||p.length)} messages found`:g("lng_search_no_results"):g("lng_dlg_search_for_messages")),p.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,B.Z)(r)),a.ZP.createElement(Ks.Z,{message:e})),a.ZP.createElement("div",{className:"subtitle",dir:"auto"},(0,B.Z)(o,["emoji","highlight"],{highlight:l}))))})))})));var Qs=n(9290);const er=(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:l,onModalToggle:c})=>{const d=(0,M.Z)(),m=n&&Boolean(n.installedDate),u=Boolean(n&&n.stickers),[h,Z,P]=(0,Fe.Z)();(0,Qs.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 p=(0,a.I4)((()=>{o({stickerSetId:e})}),[o,e]);if(!n)return;const v=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:p},d(m?"Stickers.Installed":"Stickers.Install"))),a.ZP.createElement("div",{className:"sticker-set-main"},!v&&a.ZP.createElement(F.Z,null),v&&g.map((e=>a.ZP.createElement(gn.Z,{sticker:e,size:i.Y7,observeIntersection:t,noAnimate:!s||h||l,onClick:Z})))),v&&a.ZP.createElement(vn.Z,{isOpen:h,fromSticker:g[0],onClose:P}))}))),tr=(0,z.P2)((e=>e()),6e4,!0),nr=(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 i=(0,a.sO)(null),l=(0,M.Z)(),[c,d]=(0,a.eJ)(!1),{observe:m}=(0,dn.S1)({rootRef:i,throttleMs:200});return(0,a.d4)((()=>{tr((()=>{o()}))})),(0,T.ZP)(t,e),a.ZP.createElement("div",{ref:i,className:"StickerSearch custom-scroll",dir:l.isRtl?"rtl":void 0},function(){if(void 0!==n)return!n&&s?s.map((e=>a.ZP.createElement(er,{key:e,stickerSetId:e,observeIntersection:m,isSomeModalOpen:c,onModalToggle:d}))):r?r.length?r.map((e=>a.ZP.createElement(er,{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)}())}))),ar=(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:i,sendMessage:c,setGifSearchQuery:d})=>{const m=(0,a.sO)(null),{observe:h}=(0,dn.S1)({rootRef:m,debounceMs:300}),{canSendGifs:Z}=(0,u.H5)(r,o),P=(0,a.I4)((e=>{Z&&c({gif:e}),l.$b&&d({query:void 0})}),[Z,c,d]),g=(0,M.Z)();(0,T.ZP)(t,e);const p=Boolean(void 0!==n&&s&&s.length);return a.ZP.createElement("div",{className:"GifSearch",dir:g.isRtl?"rtl":void 0},a.ZP.createElement(ve.Z,{ref:m,className:(0,_.Z)("gif-container custom-scroll",p&&"grid"),items:s,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:i},function(){if(void 0!==n)return s?s.length?s.map((e=>a.ZP.createElement(ws,{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)}()))}))),sr=(0,a.X$)((0,s.c$)(((e,{answer:t})=>{const{voters:n,offsets:a}=e.pollResults;return{voters:n&&n[t.option],offset:a&&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:i,loadPollOptionResults:l,openChat:c,closePollResults:d})=>{const m=(0,C.Z)(s.votersCount),[u,h]=(0,a.eJ)(!0),Z=Boolean(o),{option:P,text:g}=n,p=(0,M.Z)();(0,a.d4)((()=>{Z&&m===s.votersCount||l({chat:e,messageId:t.id,option:P,offset:i,limit:4,shouldResetVoters:!0})}),[s.votersCount,Z]);const v=(0,a.I4)((()=>{h(!0),l({chat:e,messageId:t.id,option:P,offset:i,limit:50})}),[e,l,t.id,i,P]);(0,a.d4)((()=>{h(!1)}),[o]);const E=(0,a.I4)((e=>{c({id:e}),d()}),[d,c]);return a.ZP.createElement("div",{className:"PollAnswerResults"},a.ZP.createElement("div",{className:"poll-voters"},o?o.map((e=>a.ZP.createElement(Ee.Z,{key:e,className:"chat-item-clickable",onClick:()=>E(e)},a.ZP.createElement(fe.Z,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0})))):a.ZP.createElement(Pe.Z,null),o&&function(){const e=s.votersCount-o.length;return s.votersCount>4&&e>0&&a.ZP.createElement(tn,{count:e,itemName:"voter",isLoading:u,onClick:v})}()),a.ZP.createElement("div",{className:"answer-head",dir:p.isRtl?"rtl":void 0},a.ZP.createElement("span",{className:"answer-title",dir:"auto"},g),a.ZP.createElement("span",{className:"answer-percent",dir:p.isRtl?"auto":void 0},(f=s.votersCount,(b=r)>0?(f/b*100).toFixed():0),"%")));var f,b}))),rr=(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:i,results:l}=(0,u.t9)(s);if(!l.results)return;const c=(0,h.ee)(l.results,"option");return a.ZP.createElement("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"poll-question",dir:"auto"},i.question),a.ZP.createElement("div",{className:"poll-results-list custom-scroll"},r&&i.answers.map((e=>a.ZP.createElement(sr,{key:`${s.id}-${e.option}`,chat:n,message:s,answer:e,answerVote:c[e.option],totalVoters:l.totalVoters}))),!r&&a.ZP.createElement(Pe.Z,null)))}))),or="Please provide first name",ir=(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:i,deleteUser:l,deleteHistory:c,closeManagement:d,openChat:m,onClose:u,isActive:h})=>{const[Z,P,g]=(0,Fe.Z)(),[p,v]=(0,a.eJ)(!1),[E,f]=(0,a.eJ)(),C=(0,M.Z)();(0,T.ZP)(h,u);const b=t&&t.firstName||"",y=t&&t.lastName||"",[I,N]=(0,a.eJ)(b),[w,k]=(0,a.eJ)(y),[S,A]=(0,a.eJ)(!r);(0,a.d4)((()=>{A(!r)}),[r]),(0,a.d4)((()=>{v(!1),g()}),[g,e]),(0,a.d4)((()=>{N(b),k(y)}),[b,y,t]),(0,a.d4)((()=>{s===o.wv.Complete&&(v(!1),f(void 0),g())}),[g,s]);const L=(0,a.I4)((e=>{N(e.target.value),v(!0)}),[]),R=(0,a.I4)((e=>{k(e.target.value),v(!0)}),[]),$=(0,a.I4)((e=>{A(e.target.checked),v(!0)}),[]),B=(0,a.I4)((()=>{const t=I.trim(),n=w.trim();t.length||f(or),i({userId:e,isMuted:!S,firstName:t,lastName:n})}),[I,w,i,e,S]),D=(0,a.I4)((()=>{c({chatId:n.id,shouldDeleteForAll:!1}),l({userId:e}),g(),d(),m({id:void 0})}),[n.id,g,d,c,l,m,e]);if(!t)return;const U=s===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(fe.Z,{userId:t.id,avatarSize:"jumbo",status:"original name",withFullInfo:!0}),a.ZP.createElement(pe.Z,{id:"user-first-name",label:C("UserInfo.FirstNamePlaceholder"),onChange:L,value:I,error:E===or?E:void 0}),a.ZP.createElement(pe.Z,{id:"user-last-name",label:C("UserInfo.LastNamePlaceholder"),onChange:R,value:w}),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(rn.Z,{checked:S,label:C("Notifications"),subLabel:C(S?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:$}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:P},C("DeleteContact")))),a.ZP.createElement(Ot.Z,{isShown:p,onClick:B,disabled:U,ariaLabel:C("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:C("AreYouSureDeleteContact"),confirmLabel:C("DeleteContact"),confirmHandler:D,confirmIsDestructive:!0}))}))),lr="Group title can't be empty",cr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{progress:a}=e.management,s=Boolean(n.fullInfo&&n.fullInfo.linkedChatId),r=(0,u.G9)(n);return{chat:n,progress:a,isBasicGroup:r,hasLinkedChannel:s,canChangeInfo:r?n.isCreator:(0,u.VE)(n,"changeInfo"),canBanUsers:r?n.isCreator:(0,u.VE)(n,"banUsers")}}),((e,t)=>(0,h.ei)(t,["togglePreHistoryHidden","updateChat","closeManagement","leaveChannel","deleteChannel","deleteChat","openChat"])))((({chatId:e,chat:t,progress:n,isBasicGroup:s,hasLinkedChannel:i,canChangeInfo:l,canBanUsers:c,onScreenSelect:d,togglePreHistoryHidden:m,updateChat:h,deleteChat:Z,leaveChannel:P,deleteChannel:g,closeManagement:p,openChat:E,onClose:f,isActive:C})=>{const[b,y,I]=(0,Fe.Z)(),N=t.title,w=t.fullInfo&&t.fullInfo.about||"",[k,S]=(0,a.eJ)(!1),[A,L]=(0,a.eJ)(N),[R,$]=(0,a.eJ)(w),[D,U]=(0,a.eJ)(),[x,O]=(0,a.eJ)(),G=(0,u.RT)(t),J=(0,v.Z)(G,!1,r.IU.BlobUrl),X=(0,M.Z)();(0,T.ZP)(C,f),(0,a.d4)((()=>{n===o.wv.Complete&&(S(!1),O(void 0))}),[n]);const z=(0,a.I4)((()=>{d(o.u1.ChatPrivacyType)}),[d]),_=(0,a.I4)((()=>{d(o.u1.Discussion)}),[d]),Y=(0,a.I4)((()=>{d(o.u1.GroupPermissions)}),[d]),j=(0,a.I4)((()=>{d(o.u1.ChatAdministrators)}),[d]),H=(0,a.I4)((e=>{U(e),S(!0)}),[]),V=(0,a.I4)((e=>{L(e.target.value),S(!0)}),[]),q=(0,a.I4)((e=>{$(e.target.value),S(!0)}),[]),K=(0,a.I4)((()=>{const t=A.trim(),n=R.trim();t.length?h({chatId:e,title:t,about:n,photo:D}):O(lr)}),[R,e,D,A,h]),W=(0,a.I4)((()=>{d(o.u1.GroupMembers)}),[d]),Q=(0,a.I4)((()=>{if(!t.fullInfo)return;const{isPreHistoryHidden:e}=t.fullInfo;m({chatId:t.id,isEnabled:!e})}),[t,m]),ee=(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]),te=t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,ne=(0,a.I4)((()=>{s?Z({chatId:t.id}):t.isCreator?g({chatId:t.id}):P({chatId:t.id}),I(),p(),E({id:void 0})}),[s,t.isCreator,t.id,I,p,P,g,Z,E]);if(t.isRestricted)return;const ae=n===o.wv.InProgress;return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(xt.Z,{currentAvatarBlobUrl:J,onChange:H,disabled:!l}),a.ZP.createElement(pe.Z,{id:"group-title",label:X("GroupName"),onChange:V,value:A,error:x===lr?x:void 0,disabled:!l}),a.ZP.createElement(pe.Z,{id:"group-about",className:"mb-2",label:X("DescriptionPlaceholder"),onChange:q,value:R,disabled:!l}),t.isCreator&&a.ZP.createElement(Ee.Z,{icon:"lock",multiline:!0,onClick:z},a.ZP.createElement("span",{className:"title"},X("GroupType")),a.ZP.createElement("span",{className:"subtitle"},t.username?X("TypePublic"):X("TypePrivate"))),i&&a.ZP.createElement(Ee.Z,{icon:"message",multiline:!0,onClick:_},a.ZP.createElement("span",{className:"title"},X("LinkedChannel")),a.ZP.createElement("span",{className:"subtitle"},X("DiscussionUnlink"))),a.ZP.createElement(Ee.Z,{icon:"permissions",multiline:!0,onClick:Y,disabled:!c},a.ZP.createElement("span",{className:"title"},X("ChannelPermissions")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},ee,"/",8)),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"},(0,hn.kh)(te)))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"group",multiline:!0,onClick:W},a.ZP.createElement("span",{className:"title"},X("GroupMembers")),a.ZP.createElement("span",{className:"subtitle"},(0,hn.kh)(t.membersCount))),t.fullInfo&&a.ZP.createElement("div",{className:"ListItem narrow no-selection"},a.ZP.createElement(rn.Z,{checked:!t.fullInfo.isPreHistoryHidden,label:X("ChatHistory"),onChange:Q,disabled:!c}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:y},X("DeleteMega")))),a.ZP.createElement(Ot.Z,{isShown:k,onClick:K,disabled:ae,ariaLabel:X("Save")},ae?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Me.Z,{isOpen:b,onClose:I,textParts:(0,B.Z)(s||!t.isCreator?X("AreYouSureDeleteAndExit"):X("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:s||!t.isCreator?X("DeleteMega"):X("DeleteGroupForAll"),confirmHandler:ne,confirmIsDestructive:!0}))}))),dr=(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:i,isActive:l})=>{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)(l,i);const g=(0,a.I4)((()=>{e(o.u1.GroupRemovedUsers)}),[e]),p=(0,a.I4)((()=>{e(o.u1.GroupUserPermissionsCreate)}),[e]),v=(0,a.I4)((n=>{t(n.userId,n.promotedByUserId===s),e(o.u1.GroupUserPermissions)}),[s,t,e]);(0,a.d4)((()=>{d(n&&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)}),[]),f=(0,a.I4)((()=>{n&&(Z(!0),r({chatId:n.id,bannedRights:c}))}),[n,c,r]),C=(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]||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(rn.Z,{name:"sendMessages",checked:!c.sendMessages,label:P("UserRestrictionsSend"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"sendMedia",checked:!c.sendMedia,label:P("UserRestrictionsSendMedia"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.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(rn.Z,{name:"sendPolls",checked:!c.sendPolls,label:P("UserRestrictionsSendPolls"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"embedLinks",checked:!c.embedLinks,label:P("UserRestrictionsEmbedLinks"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:P("UserRestrictionsInviteUsers"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"pinMessages",checked:!c.pinMessages,label:P("UserRestrictionsPinMessages"),blocking:!0,onChange:E})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.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"},C))),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:p},P("ChannelAddException")),b.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable exceptions-member",onClick:()=>v(e)},a.ZP.createElement(fe.Z,{userId:e.userId,status:y(e)})))))),a.ZP.createElement(Ot.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"})))}))),mr=(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 i=(0,a.Ye)((()=>e&&e.fullInfo&&e.fullInfo.kickedMembers?e.fullInfo.kickedMembers:[]),[e]),l=(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")),i.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable",ripple:!0,contextActions:c(e)},a.ZP.createElement(fe.Z,{userId:e.userId,status:l(e)})))))))}))),ur="Channel title can't be empty",hr=(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(n&&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:i,onScreenSelect:l,updateChat:c,toggleSignatures:d,closeManagement:m,leaveChannel:h,deleteChannel:Z,openChat:P,onClose:g,isActive:p})=>{const E=t&&t.title||"",f=t&&t.fullInfo&&t.fullInfo.about||"",C=t&&t.fullInfo&&t.fullInfo.linkedChatId,[b,y,I]=(0,Fe.Z)(),[N,w]=(0,a.eJ)(!1),[k,S]=(0,a.eJ)(E),[A,L]=(0,a.eJ)(f),[R,$]=(0,a.eJ)(),[B,D]=(0,a.eJ)(),U=t&&(0,u.RT)(t),x=(0,v.Z)(U,!1,r.IU.BlobUrl),O=(0,M.Z)();(0,T.ZP)(p,g),(0,a.d4)((()=>{n===o.wv.Complete&&(w(!1),D(void 0))}),[n]);const G=t&&t.fullInfo&&t.fullInfo.adminMembers&&t.fullInfo.adminMembers.length||0,J=(0,a.I4)((()=>{l(o.u1.ChatPrivacyType)}),[l]),X=(0,a.I4)((()=>{l(o.u1.Discussion)}),[l]),z=(0,a.I4)((()=>{l(o.u1.ChatAdministrators)}),[l]),_=(0,a.I4)((e=>{$(e),w(!0)}),[]),Y=(0,a.I4)((e=>{S(e.target.value),w(!0)}),[]),j=(0,a.I4)((e=>{L(e.target.value),w(!0)}),[]),H=(0,a.I4)((()=>{const t=k.trim(),n=A.trim();t.length?c({chatId:e,title:t,about:n,photo:R}):D(ur)}),[A,e,R,k,c]),V=(0,a.I4)((()=>{d({chatId:e,isEnabled:!s})}),[e,s,d]),q=(0,a.I4)((()=>{l(o.u1.ChannelSubscribers)}),[l]),K=(0,a.I4)((()=>{t.isCreator?Z({chatId:t.id}):h({chatId:t.id}),I(),m(),P({id:void 0})}),[t.isCreator,t.id,I,m,h,Z,P]);if(t.isRestricted)return;const W=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(xt.Z,{currentAvatarBlobUrl:x,onChange:_,disabled:!i}),a.ZP.createElement(pe.Z,{id:"channel-title",label:O("EnterChannelName"),onChange:Y,value:k,error:B===ur?B:void 0,disabled:!i}),a.ZP.createElement(pe.Z,{id:"channel-about",className:"mb-2",label:O("DescriptionPlaceholder"),onChange:j,value:A,disabled:!i}),t.isCreator&&a.ZP.createElement(Ee.Z,{icon:"lock",multiline:!0,onClick:J},a.ZP.createElement("span",{className:"title"},O("ChannelType")),a.ZP.createElement("span",{className:"subtitle"},t.username?O("TypePublic"):O("TypePrivate"))),a.ZP.createElement(Ee.Z,{icon:"message",multiline:!0,onClick:X,disabled:!i},a.ZP.createElement("span",{className:"title"},O("Discussion")),a.ZP.createElement("span",{className:"subtitle"},O(C?"DiscussionUnlink":"Add"))),a.ZP.createElement(Ee.Z,{icon:"admin",multiline:!0,onClick:z},a.ZP.createElement("span",{className:"title"},O("ChannelAdministrators")),a.ZP.createElement("span",{className:"subtitle"},G)),a.ZP.createElement("div",{className:"ListItem no-selection narrow"},a.ZP.createElement(rn.Z,{checked:s,label:O("ChannelSignMessages"),onChange:V}))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"group",multiline:!0,onClick:q},a.ZP.createElement("span",{className:"title",dir:"auto"},O("ChannelSubscribers")),a.ZP.createElement("span",{className:"subtitle",dir:"auto"},O("Subscribers",t.membersCount,"i")))),a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:y},t.isCreator?O("ChannelDelete"):O("LeaveChannel")))),a.ZP.createElement(Ot.Z,{isShown:N,onClick:H,disabled:W,ariaLabel:O("Save")},W?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Me.Z,{isOpen:b,onClose:I,text:t.isCreator?O("ChannelDeleteAlert"):O("ChannelLeaveAlert"),confirmLabel:t.isCreator?O("ChannelDelete"):O("LeaveChannel"),confirmHandler:K,confirmIsDestructive:!0}))})));var Zr=n(88);const Pr=(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:i,checkPublicLink:l,updatePublicLink:c,updatePrivateLink:d})=>{const m=Boolean(e.username),u=e.fullInfo&&e.fullInfo.inviteLink,[h,Z]=(0,a.eJ)(m?"public":"private"),[P,g]=(0,a.eJ)(),[p,v,E]=(0,Fe.Z)(),f=Boolean("public"===h&&P&&i||"private"===h&&m);(0,T.ZP)(n,t),(0,a.d4)((()=>{h&&!u&&d()}),[h,u,d]);const C=(0,a.I4)((e=>{Z(e)}),[]),b=(0,a.I4)((()=>{c({username:"public"===h?P:""})}),[h,c,P]),y=(0,a.I4)((()=>{E(),d()}),[E,d]),I=(0,M.Z)(),N=s?"Channel":"Mega",w=s?"Channel":"Group",k=[{value:"private",label:I(`${N}Private`),subLabel:I(`${N}PrivateInfo`)},{value:"public",label:I(`${N}Public`),subLabel:I(`${N}PublicInfo`)}],S=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:I.isRtl?"rtl":void 0},a.ZP.createElement("h3",{className:"section-heading"},I(`${w}Type`)),a.ZP.createElement(Je.Z,{selected:h,name:"channel-type",options:k,onChange:C})),"private"===h?a.ZP.createElement("div",{className:"section",dir:I.isRtl?"rtl":void 0},u?a.ZP.createElement(a.ZP.Fragment,null,a.ZP.createElement(Zr.Z,{url:u,className:"group-link",text:u}),a.ZP.createElement("p",{className:"section-info",dir:I.isRtl?"rtl":void 0},I(`${N}PrivateLinkHelp`)),a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:v},I("RevokeLink")),a.ZP.createElement(Me.Z,{isOpen:p,onClose:E,text:I("RevokeAlert"),confirmLabel:I("RevokeButton"),confirmHandler:y,confirmIsDestructive:!0})):a.ZP.createElement(Pe.Z,null)):a.ZP.createElement("div",{className:"section no-border"},a.ZP.createElement(_t,{asLink:!0,currentUsername:e.username,isLoading:S,isUsernameAvailable:i,checkUsername:l,onChange:g}),a.ZP.createElement("p",{className:"section-info",dir:"auto"},I(`${w}.Username.CreatePublicLinkHelp`)))),a.ZP.createElement(Ot.Z,{isShown:f,disabled:S,ariaLabel:I("Save"),onClick:b},S?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})))}))),gr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{forDiscussionIds:a,byId:s}=e.chats;return{chat:n,chatsByIds:s,forDiscussionIds:a,linkedChat:n&&n.fullInfo&&n.fullInfo.linkedChatId?(0,m.Z1)(e,n.fullInfo.linkedChatId):void 0,isChannel:n&&(0,u.eA)(n)}}),((e,t)=>(0,h.ei)(t,["loadGroupsForDiscussion","linkDiscussionGroup","unlinkDiscussionGroup"])))((({chat:e,onClose:t,isActive:n,chatId:s,chatsByIds:r,linkedChat:l,forDiscussionIds:c,isChannel:d,onScreenSelect:m,loadGroupsForDiscussion:u,linkDiscussionGroup:h,unlinkDiscussionGroup:Z})=>{const[P,g]=(0,a.eJ)(),[p,v]=(0,a.eJ)(),[E,f]=(0,a.eJ)(!1),C=(0,a.I4)((()=>f(!0)),[]),[b,y,I]=(0,Fe.Z)(),[N,w,k]=(0,Fe.Z)(),S=(0,M.Z)(),F=l&&l.id;(0,T.ZP)(n,t),(0,a.d4)((()=>{u()}),[u]),(0,a.d4)((()=>{p||(0,qt.Z)("DiscussionGroups").then(v)}),[p]);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"},p&&a.ZP.createElement(Kt.Z,{id:"discussionGroupsDucks",size:i.bM,animationData:p,play:E,noLoop:!0,onLoad:C})),l&&a.ZP.createElement("div",null,a.ZP.createElement(Ee.Z,{className:"chat-item-clickable",inactive:!0},a.ZP.createElement(Ce.Z,{chatId:l.id})),a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:y},S(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:l}),a.ZP.createElement("div",{className:"modal-title"},S(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"))),textParts:(0,B.Z)(S(d?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",l.title),["br","simple_markdown"]),confirmLabel:S(d?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:A,confirmIsDestructive:!0})),!l&&a.ZP.createElement("div",null,a.ZP.createElement("p",{className:"section-help",dir:"auto"},S("DiscussionChannelHelp")),a.ZP.createElement("div",{teactFastList:!0},a.ZP.createElement(Ee.Z,{key:"create-group",icon:"group",ripple:!0,teactOrderKey:0,className:"not-implemented"},S("DiscussionCreateGroup")),c?c.map(((e,t)=>a.ZP.createElement(Ee.Z,{key:e,teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{g(e),w()}},a.ZP.createElement(Ce.Z,{chatId:e})))):a.ZP.createElement(st.Z,{key:"nothing-found",teactOrderKey:0,text:"No discussion groups found"})),a.ZP.createElement("p",{className:"mt-4 mb-0 section-help",dir:"auto"},S("DiscussionChannelHelp2")),a.ZP.createElement(Me.Z,{isOpen:N,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"},S("Channel.DiscussionGroup.LinkGroup")))}(),textParts:function(){const t=r[P];if(t)return t.hasPrivateLink?(0,B.Z)(`Do you want to make **${t.title}** the discussion board for **${e.title}**?`,["br","simple_markdown"]):(0,B.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:S("DiscussionLinkGroup"),confirmHandler:L,isButtonsInOneRow:!0})))))}))),pr=(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:i,isActive:l})=>{const[c,d]=(0,a.eJ)({}),[m,u]=(0,a.eJ)(!1),[h,Z]=(0,a.eJ)(!1),[P,g,p]=(0,Fe.Z)(),v=(0,M.Z)();(0,T.ZP)(l,i);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)((()=>{e&&e.fullInfo&&t&&!E&&n(o.u1.GroupPermissions)}),[e,n,E,t]),(0,a.d4)((()=>{d(E&&E.bannedRights||e&&e.defaultBannedRights||{}),u(!1),Z(!1)}),[e,E]);const f=(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)((()=>{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(fe.Z,{userId:E.userId})),a.ZP.createElement("h3",{className:"section-heading mt-4",dir:"auto"},v("UserRestrictionsCanDo")),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"sendMessages",checked:!c.sendMessages,label:v("UserRestrictionsSend"),blocking:!0,disabled:y("sendMessages"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"sendMedia",checked:!c.sendMedia,label:v("UserRestrictionsSendMedia"),blocking:!0,disabled:y("sendMedia"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"sendStickers",checked:!c.sendStickers&&!c.sendGifs,label:v("UserRestrictionsSendStickers"),blocking:!0,disabled:y("sendStickers"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"sendPolls",checked:!c.sendPolls,label:v("UserRestrictionsSendPolls"),blocking:!0,disabled:y("sendPolls"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"embedLinks",checked:!c.embedLinks,label:v("UserRestrictionsEmbedLinks"),blocking:!0,disabled:y("embedLinks"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"inviteUsers",checked:!c.inviteUsers,label:v("UserRestrictionsInviteUsers"),blocking:!0,disabled:y("inviteUsers"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"pinMessages",checked:!c.pinMessages,label:v("UserRestrictionsPinMessages"),blocking:!0,disabled:y("pinMessages"),onChange:f})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"changeInfo",checked:!c.changeInfo,label:v("UserRestrictionsChangeInfo"),blocking:!0,disabled:y("changeInfo"),onChange:f}))),!r&&a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"delete-user",ripple:!0,destructive:!0,onClick:g},v("UserRestrictionsBlock")))),a.ZP.createElement(Ot.Z,{isShown:m,onClick:C,ariaLabel:v("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:p,text:"Are you sure you want to ban and remove this user from the group?",confirmLabel:"Remove",confirmHandler:b,confirmIsDestructive:!0}))}))),vr=(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:i,onClose:l,isActive:c})=>{const d=(0,M.Z)();(0,T.ZP)(c,l);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=>{i(e.userId,e.promotedByUserId===n),r(o.u1.ChatAdminRights)}),[n,i,r]),Z=(0,a.I4)((e=>{if(e.isOwner)return d("ChannelCreator");const t=e.promotedByUserId?s[e.promotedByUserId]:void 0;return t?d("EditAdminPromotedBy",(0,u.Js)(t)):d("ChannelAdmin")}),[d,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{icon:"recent",multiline:!0,onClick:function(){r(o.u1.GroupRecentActions)}},a.ZP.createElement("span",{className:"title"},d("EventLog")),a.ZP.createElement("span",{className:"subtitle"},d(t?"EventLogInfoDetailChannel":"EventLogInfoDetail")))),a.ZP.createElement("div",{className:"section",dir:d.isRtl?"rtl":void 0},a.ZP.createElement("p",{className:"text-muted",dir:"auto"},t?"You can add administrators to help you manage your channel.":"You can add administrators to help you manage your group."),m.map((e=>a.ZP.createElement(Ee.Z,{key:e.userId,className:"chat-item-clickable",onClick:()=>h(e)},a.ZP.createElement(fe.Z,{userId:e.userId,status:Z(e),forceShowSelf:!0})))))))}))),Er=(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(rn.Z,{name:"changeInfo",checked:!0,label:s("EventLogAllEvents"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewAdmins"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterNewMembers"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterChannelInfo"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterDeletedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"changeInfo",checked:!0,label:s("EventLogFilterEditedMessages"),onChange:void 0})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.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(rn.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(rn.Z,{label:"",checked:!0}),a.ZP.createElement(fe.Z,{userId:e.userId,status:o(e),forceShowSelf:!0})))))))}))),fr=(0,a.X$)((0,s.c$)(((e,{chatId:t,isPromotedByCurrentUser:n})=>{const a=(0,m.Z1)(e,t),{byId:s}=e.users,{currentUserId:r}=e;return{chat:a,usersById:s,currentUserId:r,isChannel:(0,u.eA)(a),isFormFullyDisabled:!(a.isCreator||n)}}),((e,t)=>(0,h.ei)(t,["updateChatAdmin"])))((({selectedChatMemberId:e,onScreenSelect:t,chat:n,usersById:s,currentUserId:r,isChannel:i,isFormFullyDisabled:l,updateChatAdmin:c,onClose:d,isActive:m})=>{const[h,Z]=(0,a.eJ)({}),[P,g]=(0,a.eJ)(!1),[p,v]=(0,a.eJ)(!1),[E,f,C]=(0,Fe.Z)(),[b,y]=(0,a.eJ)(""),I=(0,M.Z)();(0,T.ZP)(m,d);const N=(0,a.Ye)((()=>{if(n.fullInfo&&n.fullInfo.adminMembers)return n.fullInfo.adminMembers.find((({userId:t})=>t===e))}),[n,e]);(0,a.d4)((()=>{n&&n.fullInfo&&e&&!N&&t(o.u1.ChatAdministrators)}),[n,t,N,e]),(0,a.d4)((()=>{Z(N&&N.adminRights||{}),y((N&&N.customTitle||"").substr(0,16)),g(!1),v(!1)}),[N]);const w=(0,a.I4)((e=>{const{name:t}=e.target;Z((e=>{return{...e,[t]:(n=e[t],!n||void 0)};var n})),g(!0)}),[]),k=(0,a.I4)((()=>{e&&(v(!0),c({chatId:n.id,userId:e,adminRights:h,customTitle:b}))}),[n,e,h,b,c]),S=(0,a.I4)((()=>{e&&(c({chatId:n.id,userId:e,adminRights:{}}),C())}),[n.id,C,e,c]),A=(0,a.I4)((e=>!((0,u.G9)(n)||!l&&n.adminRights&&n.adminRights[e])),[n,l]),L=(0,a.Ye)((()=>{if(!N)return;if(N.isOwner)return I("ChannelCreator");const e=N.promotedByUserId?s[N.promotedByUserId]:void 0;return e?I("EditAdminPromotedBy",(0,u.Js)(e)):I("ChannelAdmin")}),[N,s,I]),R=(0,a.I4)((e=>{const{value:t}=e.target;y(t),g(!0)}),[]);if(N)return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section"},a.ZP.createElement(Ee.Z,{inactive:!0,className:"chat-item-clickable"},a.ZP.createElement(fe.Z,{userId:N.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(rn.Z,{name:"changeInfo",checked:!!h.changeInfo,label:I(i?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:A("changeInfo"),onChange:w})),i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"postMessages",checked:!!h.postMessages,label:I("EditAdminPostMessages"),blocking:!0,disabled:A("postMessages"),onChange:w})),i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"editMessages",checked:!!h.editMessages,label:I("EditAdminEditMessages"),blocking:!0,disabled:A("editMessages"),onChange:w})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"deleteMessages",checked:!!h.deleteMessages,label:I(i?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:A("deleteMessages"),onChange:w})),!i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"banUsers",checked:!!h.banUsers,label:I("EditAdminBanUsers"),blocking:!0,disabled:A("banUsers"),onChange:w})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"inviteUsers",checked:!!h.inviteUsers,label:I("EditAdminAddUsers"),blocking:!0,disabled:A("inviteUsers"),onChange:w})),!i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"pinMessages",checked:!!h.pinMessages,label:I("EditAdminPinMessages"),blocking:!0,disabled:A("pinMessages"),onChange:w})),a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"addAdmins",checked:!!h.addAdmins,label:I("EditAdminAddAdmins"),blocking:!0,disabled:A("addAdmins"),onChange:w})),!i&&a.ZP.createElement("div",{className:"ListItem no-selection"},a.ZP.createElement(rn.Z,{name:"anonymous",checked:!!h.anonymous,label:I("EditAdminSendAnonymously"),blocking:!0,disabled:A("anonymous"),onChange:w})),l&&a.ZP.createElement("p",{className:"section-info mb-4",dir:"auto"},I("Channel.EditAdmin.CannotEdit")),!i&&a.ZP.createElement(pe.Z,{id:"admin-title",label:I("EditAdminRank"),onChange:R,value:b,disabled:l,maxLength:16}),r!==e&&!l&&a.ZP.createElement(Ee.Z,{icon:"delete",ripple:!0,destructive:!0,onClick:f},I("EditAdminRemoveAdmin")))),a.ZP.createElement(Ot.Z,{isShown:P,onClick:k,ariaLabel:I("Save"),disabled:p},p?a.ZP.createElement(F.Z,{color:"white"}):a.ZP.createElement("i",{className:"icon-check"})),a.ZP.createElement(Me.Z,{isOpen:E,onClose:C,text:"Are you sure you want to dismiss this admin?",confirmLabel:"Dismiss",confirmHandler:S,confirmIsDestructive:!0}))}))),Cr=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{byId:a}=e.users;return{members:n&&n.fullInfo&&n.fullInfo.members,usersById:a,isChannel:n&&(0,u.eA)(n),serverTimeOffset:e.serverTimeOffset}}),((e,t)=>(0,h.ei)(t,["openUserInfo"])))((({members:e,usersById:t,isChannel:n,openUserInfo:s,onClose:r,isActive:o,serverTimeOffset:i})=>{const l=(0,a.Ye)((()=>{if(e&&t)return(0,u.Z0)(e.map((({userId:e})=>e)),t,void 0,i)}),[e,i,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},l?l.map(((e,t)=>a.ZP.createElement(Ee.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>c(e)},a.ZP.createElement(fe.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(st.Z,{teactOrderKey:0,key:"nothing-found",text:n?"No subscribers found":"No members found"}))))}))),br=(0,a.X$)((0,s.c$)(((e,{chatId:t})=>{const n=(0,m.Z1)(e,t),{byId:a}=e.users;return{members:n&&n.fullInfo&&n.fullInfo.members,usersById:a,isChannel:n&&(0,u.eA)(n),serverTimeOffset:e.serverTimeOffset}}))((({usersById:e,members:t,isChannel:n,onScreenSelect:s,onChatMemberSelect:r,onClose:i,isActive:l,serverTimeOffset:c})=>{(0,T.ZP)(l,i);const d=(0,a.Ye)((()=>{if(t&&e)return(0,u.Z0)(t.filter((e=>!e.isOwner)).map((({userId:e})=>e)),e,void 0,c)}),[t,c,e]),m=(0,a.I4)((e=>{r(e),s(o.u1.GroupUserPermissions)}),[r,s]);return a.ZP.createElement("div",{className:"Management"},a.ZP.createElement("div",{className:"custom-scroll"},a.ZP.createElement("div",{className:"section",teactFastList:!0},d?d.map(((e,t)=>a.ZP.createElement(Ee.Z,{key:e,teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e)},a.ZP.createElement(fe.Z,{userId:e,forceShowSelf:!0})))):a.ZP.createElement(st.Z,{teactOrderKey:0,key:"nothing-found",text:n?"No subscribers found":"No members found"}))))}))),yr=(0,a.X$)((0,s.c$)((e=>({managementType:(0,m.pP)(e)})))((({chatId:e,currentScreen:t,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,onChatMemberSelect:i,onClose:l,isActive:c,managementType:d})=>{switch(t){case o.u1.Initial:switch(d){case"user":return a.ZP.createElement(ir,{key:e,userId:e,onClose:l,isActive:c});case"group":return a.ZP.createElement(cr,{key:e,chatId:e,onScreenSelect:r,onClose:l,isActive:c||[o.u1.ChatPrivacyType,o.u1.Discussion,o.u1.GroupPermissions,o.u1.ChatAdministrators,o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions,o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t)});case"channel":return a.ZP.createElement(hr,{key:e,chatId:e,onScreenSelect:r,onClose:l,isActive:c||[o.u1.ChannelSubscribers,o.u1.ChatAdministrators,o.u1.Discussion,o.u1.ChatPrivacyType,o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t)})}break;case o.u1.ChatPrivacyType:return a.ZP.createElement(Pr,{chatId:e,isActive:c,onClose:l});case o.u1.Discussion:return a.ZP.createElement(gr,{chatId:e,onScreenSelect:r,isActive:c,onClose:l});case o.u1.GroupPermissions:return a.ZP.createElement(dr,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.GroupRemovedUsers,o.u1.GroupUserPermissionsCreate,o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupRemovedUsers:return a.ZP.createElement(mr,{chatId:e,isActive:c,onClose:l});case o.u1.GroupUserPermissionsCreate:return a.ZP.createElement(br,{chatId:e,onChatMemberSelect:i,onScreenSelect:r,isActive:c||[o.u1.GroupUserPermissions].includes(t),onClose:l});case o.u1.GroupUserPermissions:return a.ZP.createElement(pr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChatAdministrators:return a.ZP.createElement(vr,{chatId:e,onScreenSelect:r,onChatMemberSelect:i,isActive:c||[o.u1.ChatAdminRights,o.u1.GroupRecentActions].includes(t),onClose:l});case o.u1.GroupRecentActions:return a.ZP.createElement(Er,{chatId:e,isActive:c,onClose:l});case o.u1.ChatAdminRights:return a.ZP.createElement(fr,{chatId:e,selectedChatMemberId:n,isPromotedByCurrentUser:s,onScreenSelect:r,isActive:c,onClose:l});case o.u1.ChannelSubscribers:case o.u1.GroupMembers:return a.ZP.createElement(Cr,{chatId:e,isActive:c,onClose:l})}})));var Ir=n(9937);const Nr=/^4[0-9]{12}(?:[0-9]{1,3})?$/,wr=/^5[1-5][0-9]{11,14}$/,kr=/^2[2-7][0-9]{11,14}$/;let Sr;!function(e){e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard"}(Sr||(Sr={}));const Mr={[Sr.Default]:"",[Sr.Visa]:"visa",[Sr.Mastercard]:"mastercard"};function Tr(e){return e=e.replace(/\s/g,""),Nr.test(e)?Sr.Visa:wr.test(e)||kr.test(e)?Sr.Mastercard:Sr.Default}const Fr={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{}},Ar=(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:Lr(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:Lr(t.payload.countryIso2)}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};default:return e}};function Lr(e){const t=Hn.Jm.find((({id:t})=>t===e));return t?t.name:""}function Rr(e,t=400){(0,a.d4)((()=>{l.$b||setTimeout((()=>{(0,z.T2)((()=>{e.current&&e.current.focus()}))}),t)}),[e,t])}const $r=(0,a.X$)((e=>{const{id:t,value:n,label:s,hasArrow:r,error:o,ref:i,placeholder:l,onChange:c,children:d}=e,m=o||s,u=(0,_.Z)("input-group",n&&"touched",o&&"error",m&&"with-label",r&&"with-arrow","input-group");return a.ZP.createElement("div",{className:u},a.ZP.createElement("select",{className:"form-control",id:t,value:n||"",onChange:c,placeholder:l||s,ref:i},d),m&&t&&a.ZP.createElement("label",{htmlFor:t},m))})),Br=(0,a.X$)((({state:e,needEmail:t,needPhone:n,needName:s,needAddress:r,dispatch:o})=>{const i=(0,a.sO)(null),l=(0,a.sO)(null),c=(0,a.sO)(null);(0,a.d4)((()=>{c.current&&c.current.value!==e.countryIso2&&(c.current.value=e.countryIso2)}),[e.countryIso2]);const d=(0,M.Z)();Rr(i);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]),p=(0,a.I4)((e=>{o({type:"changeFullName",payload:e.target.value})}),[o]),v=(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,"")}`,l.current&&(l.current.value=t),o({type:"changePhone",payload:t})}),[o]),f=(0,a.I4)((e=>{o({type:"changeSaveInfo",payload:e.target.value})}),[o]),{formErrors:C}=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(pe.Z,{ref:i,label:"Address1 (Street)",onChange:m,value:e.streetLine1,inputMode:"text",error:C.streetLine1}),a.ZP.createElement(pe.Z,{label:"Address2 (Street)",onChange:u,value:e.streetLine2,inputMode:"text",error:C.streetLine2}),a.ZP.createElement(pe.Z,{label:"City",onChange:h,value:e.city,inputMode:"text",error:C.city}),a.ZP.createElement(pe.Z,{label:"State",onChange:Z,value:e.state,inputMode:"text",error:C.state}),a.ZP.createElement($r,{label:"Country",placeholder:"Country",onChange:P,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:C.countryIso2,ref:c},Hn.Jm.map((({name:e,id:t})=>a.ZP.createElement("option",{value:t,className:"county-item"},e)))),a.ZP.createElement(pe.Z,{label:"Post Code",onChange:g,value:e.postCode,inputMode:"text",error:C.postCode})):void 0,s||t||n?a.ZP.createElement("h5",null,d("PaymentShippingReceiver")):void 0,s&&a.ZP.createElement(pe.Z,{label:"Full name",onChange:p,value:e.fullName,inputMode:"text",error:C.fullName}),t&&a.ZP.createElement(pe.Z,{label:"Email",onChange:v,value:e.email,inputMode:"email",error:C.email}),n&&a.ZP.createElement(pe.Z,{label:"Phone number",onChange:E,value:e.phone,inputMode:"tel",error:C.phone,ref:l}),a.ZP.createElement(rn.Z,{label:d("PaymentShippingSave"),subLabel:d("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),onChange:f})))})),Dr=(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]),i=(0,a.Ye)((()=>t.map((({id:e,title:t,amount:a})=>({label:t,subLabel:(0,Ir.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(Je.Z,{name:"shipping-options",options:i,onChange:o,selected:e.shipping})))}));function Ur(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,Ir.x)(n,s,e)))}function xr(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 Or=(0,a.X$)((({invoiceContent:e,prices:t,shippingPrices:n,checkoutInfo:s,currency:r,totalPrice:o})=>{const i=(0,M.Z)(),{photoUrl:l,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"},l&&a.ZP.createElement("img",{src:l,alt:""}),a.ZP.createElement("div",{className:"text"},a.ZP.createElement("h5",null,c),a.ZP.createElement("p",null,d))),a.ZP.createElement("div",{className:"price-info"},t&&t.map((e=>Ur(i.code,e.label,e.amount,r))),n&&n.map((e=>Ur(i.code,e.label,e.amount,r))),void 0!==o&&Ur(i.code,i("Checkout.TotalAmount"),o,r,!0)),a.ZP.createElement("div",{className:"invoice-info"},m&&xr("icon-card",m,"Payment method"),u&&xr("stripe-provider",u,"Payment provider"),h&&xr("icon-location",h,"Shipping address"),Z&&xr("icon-user",Z,"Name"),P&&xr("icon-phone",P,"Phone number"),g&&xr("icon-truck",g,"Shipping method")))})),Gr=(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 t&&t[0]&&Number(t[0])>12&&(t[0]="12"),t&&t[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(e.target.value))}),[n]);return a.ZP.createElement(pe.Z,{label:"Expiry date",ref:s,onChange:o,onKeyDown:r,value:e,error:t,inputMode:"numeric",maxLength:5})}));var Jr=n(6352),Xr=n(5753);const zr=(0,a.X$)((({value:e,error:t,onChange:n})=>{const s=(0,a.sO)(null);Rr(s);const[r,o]=(0,a.eJ)(Sr.Default);(0,a.d4)((()=>{const t=Tr(e);o(t)}),[]);const i=(0,a.I4)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),a=Tr(e.target.value);o(a),n(t),s.current&&(s.current.value=t)}),[n,s]),l=function(e){switch(e){case Sr.Mastercard:return a.ZP.createElement("img",{src:Jr,alt:""});case Sr.Visa:return a.ZP.createElement("img",{src:Xr,alt:""});default:return}}(r);return a.ZP.createElement("div",{className:"CardInput"},a.ZP.createElement("span",{className:"left-addon"},l),a.ZP.createElement(pe.Z,{ref:s,label:"Card number",onChange:i,value:e,inputMode:"numeric",className:r?"has-left-addon":"",error:t,maxLength:23}))})),_r=(0,a.X$)((({state:e,canSaveCredentials:t,needCardholderName:n,needCountry:s,needZip:r,dispatch:o})=>{const i=(0,a.sO)(null);(0,a.d4)((()=>{i.current&&i.current.value!==e.billingCountry&&(i.current.value=e.billingCountry)}),[e.billingCountry]);const l=(0,a.I4)((e=>{o({type:"changeCardNumber",payload:e})}),[o]),c=(0,a.I4)((e=>{o({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[o]),d=(0,a.I4)((e=>{o({type:"changeExpiryDate",payload:e})}),[o]),m=(0,a.I4)((e=>{o({type:"changeCvvCode",payload:e.target.value})}),[o]),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(zr,{onChange:l,value:e.cardNumber,error:g.cardNumber}),n&&a.ZP.createElement(pe.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(Gr,{value:e.expiry,onChange:d,error:g.expiry}),a.ZP.createElement(pe.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($r,{label:"Country",placeholder:"Country",onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:g.billingCountry,ref:i},Hn.Jm.map((({name:e})=>a.ZP.createElement("option",{value:e,className:"county-item"},e)))),r&&a.ZP.createElement(pe.Z,{label:"Post Code",onChange:h,value:e.billingZip,inputMode:"text",error:g.billingZip}),t&&a.ZP.createElement(rn.Z,{label:P("PaymentCardSavePaymentInformation"),checked:e.saveCredentials,onChange:Z})))})),Yr=(0,a.X$)((0,s.c$)((e=>{const{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,invoice:r,invoiceContent:o,nativeProvider:i,nativeParams:l,passwordMissing:c,error:d}=e.payment,m=Boolean(r&&(!i||"stripe"!==i)),{needCardholderName:u,needCountry:h,needZip:Z}=l||{},{nameRequested:P,phoneRequested:g,emailRequested:p,shippingAddressRequested:v,flexible:E,phoneToProvider:f,emailToProvider:C,currency:b,prices:y}=r||{};return{step:t,shippingOptions:n,savedInfo:a,canSaveCredentials:s,nativeProvider:i,passwordMissing:c,nameRequested:P,shippingAddressRequested:v,phoneRequested:g,emailRequested:p,flexible:E,phoneToProvider:f,emailToProvider:C,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:i,nameRequested:l,shippingAddressRequested:c,phoneRequested:d,emailRequested:m,phoneToProvider:u,emailToProvider:h,currency:Z,passwordMissing:P,isProviderError:g,invoiceContent:p,nativeProvider:v,prices:E,needCardholderName:f,needCountry:C,needZip:b,error:y,validateRequestedInfo:I,sendPaymentForm:N,setPaymentStep:w,sendCredentialsInfo:k,clearPaymentError:S})=>{const[T,A]=(0,At.Z)(Ar,Fr),[$,B]=(0,a.eJ)(!1),D=(0,M.Z)();(0,a.d4)((()=>{(n||y)&&B(!1)}),[n,y]),(0,a.d4)((()=>{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)((()=>{S()}),[S]),x=(0,a.Ye)((()=>n!==o.KB.Checkout?0:function(e=[],t,n){const a=t?Hr(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=Tr(e);return Mr[t]||""}(e.cardNumber)} *${e.cardNumber.slice(-4)}`,s=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:r,fullName:o}=e,i=t?jr(t,e.shipping):void 0;return{paymentMethod:a,paymentProvider:n,shippingAddress:s,name:o,phone:r,shippingMethod:i?i.title:void 0}}(T,s,v||"")}),[n,T,s,v]),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:i,phone:l,email:c}=e;return{name:i,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:n,city:a,state:s,countryIso2:r,postCode:o}}}(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,[i,l]=a.split("/");return{data:{cardNumber:t,cardholder:n,expiryMonth:i,expiryYear:l,cvv:s,country:r,zip:o}}}(T);k({credentials:e})}),[k,T]),X=(0,a.I4)((()=>{N({shippingOptionId:T.shipping,saveCredentials:T.saveCredentials})}),[N,T]),z=(0,a.I4)((e=>{w({step:e})}),[w]),_=(0,a.I4)((()=>{switch(B(!0),n){case o.KB.ShippingInfo:return G();case o.KB.Shipping:return z(o.KB.PaymentInfo);case o.KB.PaymentInfo:return J();case o.KB.Checkout:return X();default:return()=>{}}}),[n,G,z,J,X]),Y=(0,a.Ye)((()=>{switch(n){case o.KB.ShippingInfo:return D("PaymentShippingInfo");case o.KB.Shipping:return D("PaymentShippingMethod");case o.KB.PaymentInfo:return D("PaymentCardInfo");case o.KB.Checkout:return D("PaymentCheckout");default:return""}}),[n,D]),j=(0,a.Ye)((()=>{switch(n){case o.KB.Checkout:return D("Checkout.PayPrice",(0,Ir.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,Y)),void 0!==n?a.ZP.createElement(L.Z,{name:"slide",activeKey:n},(()=>a.ZP.createElement("div",{className:"content custom-scroll"},function(e){switch(e){case o.KB.ShippingInfo:return a.ZP.createElement(Br,{state:T,dispatch:A,needAddress:Boolean(c),needEmail:Boolean(m||h),needPhone:Boolean(d||u),needName:Boolean(l)});case o.KB.Shipping:return a.ZP.createElement(Dr,{state:T,dispatch:A,shippingOptions:s||[],currency:Z});case o.KB.PaymentInfo:return a.ZP.createElement(_r,{state:T,dispatch:A,canSaveCredentials:Boolean(!P&&i),needCardholderName:f,needCountry:C,needZip:b});case o.KB.Checkout:return a.ZP.createElement(Or,{prices:E,shippingPrices:T.shipping&&s?Hr(s,T.shipping):void 0,totalPrice:x,invoiceContent:p,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:_,disabled:$,isLoading:$},j)),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:S},D("OK")))}())})));function jr(e,t){return e.find((({id:e})=>e===t))}function Hr(e,t){const n=jr(e,t);return n?n.prices:void 0}const Vr=(0,a.X$)((0,s.c$)((e=>{const{receipt:t}=e.payment,{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:i,shippingMethod:l,photoUrl:c,text:d,title:m}=t||{};return{currency:n,prices:a,info:s,totalAmount:r,credentialsTitle:o,shippingPrices:i,shippingMethod:l,photoUrl:c,text:d,title:m}}))((({isOpen:e,onClose:t,prices:n,shippingPrices:s,totalAmount:r,currency:o,info:i,photoUrl:l,text:c,title:d,credentialsTitle:m,shippingMethod:u})=>{const h=(0,M.Z)(),Z=(0,a.Ye)((()=>function(e,t,n){if(!t)return{paymentMethod:e};const{shippingAddress:a}=t,s=a&&a.streetLine1?`${a.streetLine1}, ${a.city}, ${a.countryIso2}`:void 0,{phone:r,name:o}=t;return{paymentMethod:e,paymentProvider:"Stripe",shippingAddress:s,name:o,phone:r,shippingMethod:n}}(m,i,u)),[i,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(Or,{prices:n,shippingPrices:s,totalPrice:r,invoiceContent:{photoUrl:l,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),i=n(9107),l=n(231);const c=r.wB?550:400,d=(0,a.X$)((({isLoading:e=!1,isPasswordVisible:t,error:n,hint:d,placeholder:m="Password",submitLabel:u="Next",clearError:h,onChangePasswordVisibility:Z,onInputChange:P,onSubmit:g})=>{const p=(0,a.sO)(null),v=(0,i.Z)(),[E,f]=(0,a.eJ)(""),[C,b]=(0,a.eJ)(!1);return(0,a.d4)((()=>{r.$b||setTimeout((()=>{p.current.focus()}),c)}),[]),(0,a.d4)((()=>{n&&requestAnimationFrame((()=>{p.current.focus(),p.current.select()}))}),[n]),a.ZP.createElement("form",{action:"",onSubmit:function(t){t.preventDefault(),e||C&&g(E)},autoComplete:"off"},a.ZP.createElement("div",{className:(0,o.Z)("input-group password-input",E&&"touched",n&&"error"),dir:v.isRtl?"rtl":void 0},a.ZP.createElement("input",{ref:p,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;f(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"}))),C&&a.ZP.createElement(l.Z,{type:"submit",ripple:!0,isLoading:e},u))}))},3490:(e,t,n)=>{n.d(t,{Z:()=>u});var a=n(4050),s=n(3716),r=n(7361),o=n(7324),i=n(7799);const l=[0,50],c=[0,20],d=[20,0],m=r.wB?s.qp:s.z7,u=(0,a.X$)((({isPasswordVisible:e,isBig:t})=>{const[n,r]=(0,a.eJ)(),[u,h]=(0,a.eJ)(),[Z,P]=(0,a.eJ)(!1),[g,p]=(0,a.eJ)(!1);(0,a.d4)((()=>{n?setTimeout((()=>p(!0)),2e3):(0,o.Z)("MonkeyClose").then(r)}),[n]),(0,a.d4)((()=>{u||(0,o.Z)("MonkeyPeek").then(h)}),[u]);const v=(0,a.I4)((()=>P(!0)),[]);return a.ZP.createElement("div",{id:"monkey",className:t?"big":""},!Z&&a.ZP.createElement("div",{className:"monkey-preview"}),n&&a.ZP.createElement(i.Z,{id:"closeMonkey",size:t?s.K2:m,className:g?"hidden":"shown",animationData:n,playSegment:l,noLoop:!0,onLoad:v}),u&&a.ZP.createElement(i.Z,{id:"peekMonkey",size:t?s.K2:m,className:g?"shown":"hidden",animationData:u,playSegment:e?c:d,noLoop:!0}))}))},7324:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(6137),s=n(647);const r={MonkeyIdle:n(1679),MonkeyTracking:n(4889),MonkeyClose:n(4185),MonkeyPeek:n(8431),FoldersAll:n(6041),FoldersNew:n(7196),DiscussionGroups:n(4349)};function o(e){const t=r[e].replace(window.location.origin,"");return s.he(`file${t}`,a.IU.Lottie)}},710:(e,t,n)=>{n.d(t,{Z:()=>g});var a=n(4050),s=n(6752),r=n(3716),o=n(1394),i=n(9107),l=n(231),c=n(3103),d=n(4288);const m={type:"blob",quality:.8,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 p=(0,i.Z)();return a.ZP.createElement(c.Z,{isOpen:Boolean(e),onClose:s,title:"Drag to reposition",className:"CropModal",hasCloseButton:!0},P?a.ZP.createElement("div",{id:"avatar-crop"}):a.ZP.createElement(d.Z,null),a.ZP.createElement(l.Z,{className:"confirm-button",round:!0,color:"primary",onClick:async function(){if(!Z)return;const e=await Z.result(m),n="string"==typeof e?e:(0,o.hl)(e,"avatar.jpg");t(n)},ariaLabel:p("CropImage")},a.ZP.createElement("i",{className:"icon-check"})))})),g=(0,a.X$)((({title:e="Change your profile picture",disabled:t,currentAvatarBlobUrl:n,onChange:r})=>{const[o,i]=(0,a.eJ)(),[l,c]=(0,a.eJ)(n);(0,a.d4)((()=>{c(n)}),[n]);const d=(0,s.Z)(l&&"filled",t&&"disabled");return a.ZP.createElement("div",{className:"AvatarEditable"},a.ZP.createElement("label",{className:d,role:"button",tabIndex:0,title:e},a.ZP.createElement("input",{type:"file",onChange:function(e){const t=e.target;t&&t.files&&t.files[0]&&(i(t.files[0]),t.value="")},accept:"image/png, image/jpeg"}),a.ZP.createElement("i",{className:"icon-camera-add"}),l&&a.ZP.createElement("img",{src:l,alt:"Avatar"})),a.ZP.createElement(P,{file:o,onClose:function(){i(void 0)},onChange:function(e){i(void 0),r(e),l&&URL.revokeObjectURL(l),c(URL.createObjectURL(e))}}))}))},4349:(e,t,n)=>{e.exports=n.p+"DiscussionGroupsDucks.9ea453d1be9d1b0ee77a..tgs"},6041:(e,t,n)=>{e.exports=n.p+"FoldersAll.3f9f9e243d19f0fbf9aa..tgs"},7196:(e,t,n)=>{e.exports=n.p+"FoldersNew.9a40d71c0c8be70f5bd1..tgs"},4185:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyClose.604c4c833d322b7e6c3e..tgs"},1679:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyIdle.dea4a492c144df84ddab..tgs"},8431:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyPeek.1905436b042520363d7e..tgs"},4889:(e,t,n)=>{e.exports=n.p+"TwoFactorSetupMonkeyTracking.eb5a7a6f166fb7589c12..tgs"},6352:(e,t,n)=>{e.exports=n.p+"mastercard.4216118edafe23cc2dec..svg"},5753:(e,t,n)=>{e.exports=n.p+"visa.e5a7c336e1deb4b92a63..svg"}}]);
|
||
//# sourceMappingURL=347.0535b78942e76e3ace0e.js.map
|