TelegramPWA/dist/9451.ddc92e8a499ab0b273ef.js
Alexander Zinchuk 92cde83653 [Build]
2025-07-31 00:56:20 +02:00

2 lines
668 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

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

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

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[9451],{3178:(e,t,i)=>{i.d(t,{A:()=>p});var s=i(84051),n=i(31481),o=i(83108),a=i(14737),r=i(43874),l=i(37661),c=i(18104),d=i(20021);const h=[0,50],m=[0,20],u=[20,0],p=(0,s.ph)((({isPasswordVisible:e,isBig:t})=>{const[i,p]=(0,l.A)(!1),[v,g]=(0,l.A)(!1),{isMobile:A}=(0,r.Ay)(),b=A?n.UyP:n.H6l;(0,a.A)(g,2e3);const f=(0,s.hb)(p,[p]);return(0,d.FD)("div",{id:"monkey",className:t?"big":"",children:[!i&&(0,d.Y)("div",{className:"monkey-preview"}),(0,d.Y)(c.A,{size:t?n.r2x:b,className:v?"hidden":"shown",tgsUrl:o.w.MonkeyClose,playSegment:h,noLoop:!0,onLoad:f}),(0,d.Y)(c.A,{size:t?n.r2x:b,className:v?"shown":"hidden",tgsUrl:o.w.MonkeyPeek,playSegment:e?m:u,noLoop:!0})]})}))},28384:(e,t,i)=>{i.r(t),i.d(t,{AboutAdsModal:()=>vl,AboutMonetizationModal:()=>Al,AgeVerificationModal:()=>Xr,ArchivedChats:()=>Um,AttachBotInstallModal:()=>ro,AttachBotRecipientPicker:()=>Gs,AttachmentModal:()=>zu,BoostModal:()=>jr,BotCommandMenu:()=>kp,BotTrustModal:()=>ao,CalendarModal:()=>ln,ChatCommandTooltip:()=>yp,ChatFolderModal:()=>Om,ChatInviteModal:()=>cl,ChatLanguageModal:()=>lc,ChatlistModal:()=>al,CollectibleInfoModal:()=>mc,ContactList:()=>Ym,ContextMenuContainer:()=>Gm.A,CountryPickerModal:()=>ka,CreateTopic:()=>Zv,CustomEmojiSetsModal:()=>$m,CustomEmojiTooltip:()=>Ip,CustomSendMenu:()=>Yp,DeleteAccountModal:()=>Qr,DeleteFolderDialog:()=>lo,DeleteMessageModal:()=>$l,Dialogs:()=>Hs,DraftRecipientPicker:()=>Js,DropArea:()=>Fp.A,EditTopic:()=>eg,EmojiInteractionAnimation:()=>rc,EmojiStatusAccessModal:()=>yl,EmojiTooltip:()=>Lp,ForwardRecipientPicker:()=>Ks,FrozenAccountModal:()=>kA,GifSearch:()=>Hp,GiftCodeModal:()=>qr,GiveawayModal:()=>Wa,HeaderMenuContainer:()=>Zm,HistoryCalendar:()=>cn,InlineBotTooltip:()=>Kp,InviteViaLinkModal:()=>fA,LeftSearch:()=>sd,LocationAccessModal:()=>kl,Management:()=>xg,MapModal:()=>Xs,MediaViewer:()=>Bt,MentionTooltip:()=>Uu,MessageSelectToolbar:()=>Zl,MessageStatistics:()=>Mv,MiddleSearch:()=>lu,MinimizedWebAppModal:()=>wn,MuteChatModal:()=>Jm,NewChat:()=>Tm,NewContactModal:()=>hn,Notifications:()=>qs,OneTimeMediaModal:()=>SA,PaymentModal:()=>uA,PinMessageModal:()=>ql,PollModal:()=>Hu,PollResults:()=>Uv,PremiumLimitReachedModal:()=>ir,PremiumMainModal:()=>Aa,PreparedMessageModal:()=>Ml,PrivacySettingsNoticeModal:()=>oc,ReactionPicker:()=>gu,ReactorListModal:()=>ac,ReceiptModal:()=>gA,ReportAdModal:()=>Nl,ReportModal:()=>Yl,SafeLinkModal:()=>Qs,SeenByModal:()=>Xl,SendAsMenu:()=>Jp,Settings:()=>Pm,SharePreparedMessageModal:()=>Rl,SponsoredContextMenuContainer:()=>hl.A,Statistics:()=>yv,StatusPickerMenu:()=>Er,StickerSearch:()=>zp,StickerSetModal:()=>zm,StickerTooltip:()=>wp,StoryStatistics:()=>Ev,StoryViewer:()=>Ys,SuggestMessageModal:()=>El,SuggestedPostApprovalModal:()=>_l,SuggestedStatusModal:()=>Ur,SymbolMenu:()=>fp,TextFormatter:()=>Bp,ToDoListModal:()=>qu,UnpinAllMessagesModal:()=>Wl,UrlAuthModal:()=>tn,VerificationMonetizationModal:()=>Cl,WebAppModal:()=>oo,WebAppsCloseConfirmationModal:()=>yA});var s=i(84051),n=i(13439),o=i(89925),a=i(31481),r=i(66644),l=i(90709),c=i(60919),d=i(53827),h=i(11778),m=i(14680),u=i(9716),p=i(76023),v=i(49086);function g(e){if(!e)return;if("standalone"===e.type)return{media:e.media[e.mediaIndex],isSingle:1===e.media.length};if("avatar"===e.type){const t=e.profilePhotos?.photos[e.mediaIndex];return t?{media:t}:void 0}const{action:t,document:i,photo:s,video:n,webPage:o,paidMedia:a}=(0,l.r_)(e.message);if("chatEditPhoto"===t?.type||"suggestProfilePhoto"===t?.type)return{media:t.photo,isSingle:!0};if(i&&((0,l.Ml)(i)||(0,l.hr)(i)))return{media:i};if(o){const{photo:e,video:t,document:i}=o,s=i&&((0,l.Ml)(i)||(0,l.hr)(i)),n=t||(s?i:void 0)||e;if(n)return{media:n,isSingle:!0}}if(a){const t=a.extendedMedia[e.mediaIndex||0];if(!("mediaType"in t)){const{photo:e,video:i}=t;return{media:e||i}}}const r=n||s;return r?{media:r,isSingle:n?.isGif}:void 0}var A=i(19822),b=i(96454),f=i(83868),C=i(16460),S=i(41512),y=i(43503);function k(e,t){const i=document.createElement("div");i.classList.add("ghost");const s=new Image;if(s.draggable=!1,s.oncontextmenu=f.A,"string"==typeof e?s.src=e:e instanceof HTMLVideoElement?s.src=e.poster:s.src=e.src,i.appendChild(s),t===o.TQ.ProfileAvatar||t===o.TQ.SettingsAvatar){i.classList.add("ProfileInfo"),t===o.TQ.SettingsAvatar&&i.classList.add("self");const e=document.querySelector(t===o.TQ.ProfileAvatar?"#RightColumn .ProfileInfo .info":"#Settings .ProfileInfo .info");e&&i.appendChild(e.cloneNode(!0))}return i}function w(e,t,i){let s,n;switch(e){case o.TQ.Album:case o.TQ.ScheduledAlbum:s=`.Transition_slide-active > .MessageList #album-media-${(0,l.GZ)(t.id,i)}`,n=".full-media";break;case o.TQ.PreviewMedia:s=`#preview-media${i}`,n="img";break;case o.TQ.SharedMedia:s=`#shared-media${(0,l.GZ)(t.id,i)}`,n="img";break;case o.TQ.SearchResult:s=`#search-media${(0,l.GZ)(t.id,i)}`,n="img";break;case o.TQ.MiddleHeaderAvatar:s=".MiddleHeader .Transition_slide-active .ChatInfo .Avatar",n=".avatar-media";break;case o.TQ.SettingsAvatar:s="#Settings .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case o.TQ.ProfileAvatar:s="#RightColumn .ProfileInfo .Transition_slide-active .ProfilePhoto",n=".avatar-media";break;case o.TQ.ChannelAvatar:case o.TQ.SuggestedAvatar:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=".Avatar img";break;case o.TQ.StarsTransaction:s=".transaction-media-preview",n=0===i?`.stars-transaction-media-${i} :is(img, video)`:void 0;break;case o.TQ.SponsoredMessage:s=".Transition_slide-active > .MessageList .sponsored-media-preview",n=`${a.KFG} .full-media,${a.KFG} .thumbnail:not(.blurred-bg)`;break;case o.TQ.ScheduledInline:case o.TQ.Inline:default:s=`.Transition_slide-active > .MessageList #${(0,l.GZ)(t.id,i)}`,n=`${a.KFG} .full-media,${a.KFG} .thumbnail:not(.blurred-bg)`}const r=document.querySelector(s),c=n?r?.querySelectorAll(n):void 0;return{container:r,mediaEl:c?.[0]}}function N(e,t){switch(t){case o.TQ.Album:case o.TQ.ScheduledAlbum:case o.TQ.Inline:case o.TQ.ScheduledInline:case o.TQ.StarsTransaction:case o.TQ.PreviewMedia:e.classList.add("rounded-corners");break;case o.TQ.SharedMedia:case o.TQ.SettingsAvatar:case o.TQ.ProfileAvatar:case o.TQ.SearchResult:e.firstChild.style.objectFit="cover";break;case o.TQ.MiddleHeaderAvatar:case o.TQ.SuggestedAvatar:case o.TQ.ChannelAvatar:e.classList.add("circle")}}var I=i(43874),P=i(77523),Y=i(37661),F=i(30857),D=i(17712),M=i(59030),T=i(41733),B=i(22237);const R=(0,B.n5)(!1),L=R[1];function x(e){if(e.webkitSupportsPresentationMode&&"function"==typeof e.webkitSetPresentationMode)return e.webkitSetPresentationMode.bind(e)}function E(){if(document.pictureInPictureElement)try{document.exitPictureInPicture()}catch(e){a.Oig&&console.log("[MV] PictureInPicture Error",e)}}var V=i(73767),_=i(34780),U=i(23174),O=i(32587),K=i(87679);const J=new Map;var G=i(35297);var j=i(62587),z=i(69419);const H=p.cf,$=({media:e,isAvatar:t,origin:i,delay:n})=>{const a=t&&"photo"===e?.mediaType&&!e.isVideo,r=t&&"photo"===e?.mediaType&&e.isVideo,c="document"===e?.mediaType,d="video"===e?.mediaType&&!e.isRound||c&&(0,l.hr)(e),h="photo"===e?.mediaType||c&&(0,l.Ml)(e),m="video"===e?.mediaType&&e.isGif,u=i===o.TQ.SharedMedia,v=i===o.TQ.SearchResult,g=(0,s.Kr)((()=>t=>{if(e)return!a&&!r||t?r&&t?(0,l.Pg)(e):(0,l.VO)(e,t?"full":"preview"):(0,l.mU)(e)}),[r,a,e]),A=(0,j.A)(e&&(u||v||c)&&(0,l.VO)(e,"pictogram"),void 0,U.qZ.BlobUrl,n),b=g(),f=(0,j.A)(b,void 0,U.qZ.BlobUrl,n),{mediaData:C,loadProgress:S}=(0,z.A)(g(!0),void 0,e&&(0,l.Cz)(e,"full"),n),y=e&&"blobUrl"in e?e.blobUrl:void 0;let k=!d&&(y||C)||f||A;const w=function(e){const t=(0,s.li)();let i=!1;(0,G.A)((()=>{if(i=!0,t.current=void 0,!e)return;const s=new Image;if(s.src=e,!s.width)return;const n=(0,K.PR)(s);(0,O.A)(n.getContext("2d"),0,0,n.width,n.height,2,2),t.current=n.toDataURL()}),[e]);const n=function(e,t=!1,i){const n=(0,s.li)(e?J.get(e):void 0),o=(0,s.li)(),a=(0,F.A)();return o.current&&t&&(clearTimeout(o.current),o.current=void 0),(0,s.vJ)((()=>{if(!e||n.current||t)return;const s=new Image;s.onload=()=>{const t=(0,K.PR)(s);(0,O.A)(t.getContext("2d"),0,0,t.width,t.height,2,2);const i=t.toDataURL();n.current=i,a(),J.size>=1e3&&J.clear(),J.set(e,i)},i?o.current=window.setTimeout((()=>{s.src=e}),i):s.src=e}),[e,i,a,t]),n.current}(e||void 0,Boolean(t.current));return t.current||!i&&n||e||void 0}(!k&&e&&(0,l.VD)(e));k||i===o.TQ.SearchResult||(k=w),r&&f&&(k=f);const N=y||C||(r||d?void 0:f||A||k),I=e&&(0,l.si)(e),P=Boolean(y),Y=(0,s.Kr)((()=>t?r?p._e:p.cf:c?e.mediaSize:h?(0,l.Xn)(e):d?(0,l.NZ)(e):H),[t,c,h,d,r,e]);return{getMediaHash:g,media:e,isVideo:d,isPhoto:h,isGif:m,isDocument:c,bestImageData:k,bestData:N,dimensions:Y,isFromSharedMedia:u,isVideoAvatar:r,isLocal:P,loadProgress:S,mediaSize:I}};var q=i(18276),W=i(64493),Q=i(40664),Z=i(22337),X=i(1087),ee=i(20021);const te=(0,s.ph)((({isOpen:e,peerId:t,photo:i,onClose:o,onCloseAnimationEnd:a})=>{const{reportProfilePhoto:r}=(0,n.ko)(),[l,c]=(0,s.J0)("spam"),[d,h]=(0,s.J0)(""),m=(0,D.A)((()=>{r({chatId:t,photo:i,reason:l,description:d}),o()})),u=(0,D.A)((e=>{c(e)})),p=(0,D.A)((e=>{h(e.target.value)})),v=(0,M.A)(),g=(0,s.Kr)((()=>[{value:"spam",label:v("lng_report_reason_spam")},{value:"violence",label:v("lng_report_reason_violence")},{value:"pornography",label:v("lng_report_reason_pornography")},{value:"childAbuse",label:v("lng_report_reason_child_abuse")},{value:"copyright",label:v("ReportPeer.ReasonCopyright")},{value:"illegalDrugs",label:"Illegal Drugs"},{value:"personalDetails",label:"Personal Details"},{value:"other",label:v("lng_report_reason_other")}]),[v]);if(!t||!i)return;const A=v("ReportPeer.Report");return(0,ee.FD)(Z.A,{isOpen:e,onClose:o,onEnter:e?m:void 0,onCloseAnimationEnd:a,className:"narrow",title:A,children:[(0,ee.Y)(X.A,{className:"dialog-checkbox-group",name:"report-message",options:g,onChange:u,selected:l}),(0,ee.Y)(Q.A,{label:v("lng_report_reason_description"),value:d,onChange:p}),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:m,children:v("lng_report_button")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:v("Cancel")})]})]})}));var ie=i(26607),se=i(41036);const[ne,oe]=(0,B.n5)(1);function ae(){return(0,s._W)((()=>{oe(1)})),[ne,oe]}const re=(0,s.ph)((({isOpen:e,photo:t,profileId:i,onClose:o,onConfirm:a})=>{const{deleteProfilePhoto:r,deleteChatPhoto:l}=(0,n.ko)(),c=(0,s.hb)((()=>{a?.(),(0,u.L8)(i)?r({photo:t}):l({photo:t,chatId:i}),o()}),[a,i,o,r,t,l]),d=(0,M.A)();return(0,ee.Y)(Z.A,{isOpen:e,onClose:o,onEnter:c,className:"delete dialog-buttons-column",title:d("AreYouSure"),children:(0,ee.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ee.Y)(W.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:c,children:d("Preview.DeletePhoto")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:d("Cancel")})]})})}));var le=i(22699),ce=i(24433),de=i(35913);const he=(0,s.ph)((0,n.EK)(((e,{item:t,canUpdateMedia:i})=>{const s=(0,c.nTw)(e),{origin:n}=s.mediaViewer,o="message"===t?.type?t.message:void 0,a="avatar"===t?.type?t.avatarOwner:void 0,r="avatar"===t?.type&&t.profilePhotos.photos[t.mediaIndex],l=(0,c.meB)(e),d=(0,c.Xf0)(e),{threadId:h}=(0,c.Xf0)(e)||{},m=(0,c.ynf)(e,o),u=(0,c.yuw)(e),p=o&&(0,c.ryq)(e,o?.chatId),{canDelete:v}=h&&o&&(0,c.WAX)(e,o,h)||{},g=r&&r.id===a?.avatarPhotoId,A=i&&Boolean(r),b=v||A,f=i&&Boolean(r)&&!g,C=d?.type;return{activeDownloads:u,isProtected:m,chat:l,isChatProtected:p,canDelete:b,canUpdate:f,messageListType:C,origin:n}}))((({item:e,mediaData:t,isVideo:i,chat:o,isChatProtected:a,isProtected:r,canReportAvatar:c,canDelete:d,canUpdate:h,messageListType:m,activeDownloads:p,origin:v,onReportAvatar:A,onCloseMediaViewer:b,onBeforeDelete:f,onForward:C})=>{const[S,y,k]=(0,Y.A)(!1),[w,N]=ae(),{isMobile:P}=(0,I.Ay)(),{downloadMedia:F,cancelMediaDownload:T,updateProfilePhoto:B,updateChatPhoto:R,openMediaViewer:L,openDeleteMessageModal:x}=(0,n.ko)(),E="message"===e?.type,{media:V}=g(e)||{},_=V&&(0,l.sd)(V),U=V&&(0,l.$r)(p,V),{loadProgress:O}=(0,z.A)(V&&(0,l.VO)(V,"download"),!U,V&&(0,l.Cz)(V,"download")),K=(0,D.A)((()=>{if(V)if(U)T({media:V});else{const t="message"===e?.type?e.message:void 0;F({media:V,originMessage:t})}})),J=(0,D.A)((()=>{const e=w();N((e<0?e:0)-1)})),G=(0,D.A)((()=>{const e=w();N((e>0?e:0)+1)})),j=(0,D.A)((()=>{if("avatar"!==e?.type)return;const{avatarOwner:t,profilePhotos:i,mediaIndex:s}=e,n=i?.photos[s];(0,u.L8)(t.id)?B({photo:n}):R({chatId:t.id,photo:n}),L({origin:v,chatId:t.id,mediaIndex:0,isAvatarView:!0},{forceOnHeavyAnimation:!0})})),H=(0,M.A)(),$=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",className:t?"active":void 0,onClick:e,ariaLabel:"More actions",children:(0,ee.Y)(q.A,{name:"more"})})),[]);function Q(){return"avatar"===e?.type?(0,ee.Y)(re,{isOpen:S,onClose:k,onConfirm:f,profileId:e.avatarOwner.id,photo:e.profilePhotos.photos[e.mediaIndex]}):void 0}const Z=(0,D.A)((()=>{"message"===e?.type&&o?x({chatId:o?.id,messageIds:[e.message.id],isSchedule:"scheduled"===m,onConfirm:f}):y()}));if(P){const s=[];if(E&&e.message.isForwardingAllowed&&!e.message.content.action&&!a&&s.push({icon:"forward",onClick:C,children:H("Forward")}),r||(i?s.push({icon:U?"close":"download",onClick:K,children:U?`${Math.round(100*O)}% Downloading...`:"Download"}):s.push({icon:"download",href:t,download:_,children:H("AccActionDownload")})),c&&s.push({icon:"flag",onClick:A,children:H("ReportPeer.Report")}),h&&s.push({icon:"copy-media",onClick:j,children:H("ProfilePhoto.SetMainPhoto")}),d&&s.push({icon:"delete",onClick:Z,children:H("Delete"),destructive:!0}),0===s.length)return;return(0,ee.FD)("div",{className:"MediaViewerActions-mobile",children:[(0,ee.Y)(le.A,{trigger:$,positionX:"right",children:s.map((({icon:e,onClick:t,href:i,download:s,children:n,destructive:o})=>(0,ee.Y)(ce.A,{icon:e,href:i,download:s,onClick:t,destructive:o,children:n},e)))}),U&&(0,ee.Y)(de.A,{progress:O,size:"s",noCross:!0}),d&&Q()]})}return(0,ee.FD)("div",{className:"MediaViewerActions",children:[E&&e.message.isForwardingAllowed&&!a&&(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("Forward"),onClick:C,children:(0,ee.Y)(q.A,{name:"forward"})}),function(){if(!r&&"standalone"!==e?.type)return"sponsoredMessage"!==e?.type&&(i?(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("AccActionDownload"),onClick:K,children:U?(0,ee.Y)(de.A,{progress:O,size:"s",onClick:K}):(0,ee.Y)(q.A,{name:"download"})}):(0,ee.Y)(W.A,{href:t,download:_,round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("AccActionDownload"),children:(0,ee.Y)(q.A,{name:"download"})}))}(),(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("MediaZoomOut"),onClick:J,children:(0,ee.Y)(q.A,{name:"zoom-out"})}),(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("MediaZoomIn"),onClick:G,children:(0,ee.Y)(q.A,{name:"zoom-in"})}),c&&(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H(i?"PeerInfo.ReportProfileVideo":"PeerInfo.ReportProfilePhoto"),onClick:A,children:(0,ee.Y)(q.A,{name:"flag"})}),h&&(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("ProfilePhoto.SetMainPhoto"),onClick:j,children:(0,ee.Y)(q.A,{name:"copy-media"})}),d&&(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("Delete"),onClick:Z,children:(0,ee.Y)(q.A,{name:"delete"})}),(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent-white",ariaLabel:H("Close"),onClick:b,children:(0,ee.Y)(q.A,{name:"close"})}),d&&Q()]})})));var me=i(87357),ue=i(50442),pe=i(43336),ve=i(37836),ge=i(14737),Ae=i(16581),be=i(19129),fe=i(26072),Ce=i(15283);function Se(e){const t=(0,s.li)(e());return(0,Ce.A)((()=>e.subscribe((()=>{t.current=e()})))),t}var ye=i(90423),ke=i(39751),we=i(83414);const[Ne,Ie]=(0,B.n5)(!1),[Pe,Ye]=(0,B.n5)(!1);function Fe(){return[(0,we.A)((()=>Ne()&&!Pe()),[Ne,Pe]),Ie,Ye]}var De=i(63495);const[Me,Te]=(0,B.n5)(0);function Be(){return(0,s._W)((()=>{Te(0)})),[Me,Te]}var Re=i(5718),Le=i(672),xe=i(57474);const Ee=({text:e="",buttonText:t,isForVideo:i,onClick:n,handleSponsoredClick:o,isProtected:a,isForceMobileVersion:r})=>{const[l,c]=(0,s.J0)(!1),{isMobile:d}=(0,I.Ay)(),[h]=Fe(),m=(0,be.A)((()=>!!b.TF&&!h()),[h]);(0,s.vJ)((()=>{const e=document.querySelector(".MediaViewerFooter .media-text"),t=()=>{const t=e?e.clientHeight:0;c(t>2*p.$)};t();const i=(0,ve.nF)(t,500,!0);return window.addEventListener("resize",i,!1),()=>{window.removeEventListener("resize",i,!1)}}),[]);const u=(0,D.A)((()=>{o()})),v=(0,me.A)("MediaViewerFooter",i&&"is-for-video",m&&"is-hidden",a&&"is-protected",r&&"mobile");return(0,ee.FD)("div",{className:v,onClick:function(t){e&&t.stopPropagation()},children:[Boolean(e)&&(0,ee.Y)("div",{className:"media-viewer-footer-content",onClick:d?void 0:n,children:(0,ee.Y)("p",{className:"media-text custom-scroll allow-selection "+(l?"multiline":""),dir:"auto",children:e})}),Boolean(t)&&(0,ee.Y)(W.A,{className:(0,me.A)("media-viewer-footer-content","media-viewer-button"),size:"default",color:"primary",isRectangular:!0,onClick:u,children:t})]})};var Ve=i(15640),_e=i(84313),Ue=i(71533),Oe=i(50680),Ke=i(73622);const[Je,Ge]=(0,B.n5)(!1);function je(){return(0,s._W)((()=>{Ge(!1)})),[Je,Ge]}var ze=i(17663),He=i(14242),$e=i(71429),qe=i(82497),We=i(41074),Qe=i(4875);const Ze=b.Ni||b.pz,Xe=b.Ni||b.pz?.3:.25,et=Ze?40:80,tt=200,it=(0,We.Ay)();let st;class nt{frames=new Map;currentTime=0;constructor(e,t){this.canvas=t,it.forEach((({connector:t},i)=>{t.request({name:"video-preview:init",args:[e,et,i,We.bP,this.onFrame.bind(this)]})}))}onFrame(e,t){this.frames.set(e,t),e===this.currentTime&&this.render(e)}clearCache(){this.frames.forEach((e=>{e.close()})),this.frames.clear()}render(e){this.currentTime=e;const t=this.frames.get(e);return!!t&&((0,r.RK)((()=>{this.canvas.width=t.width,this.canvas.height=t.height,this.canvas.getContext("2d").drawImage(t,0,0,this.canvas.width,this.canvas.height)})),!0)}destroy(){this.clearCache(),it.forEach((({connector:e})=>{e.request({name:"video-preview:destroy",args:[]})}))}}it.forEach((({worker:e})=>{e.addEventListener("message",(async t=>{const{type:i,messageId:s,params:n}=t.data;if("requestPart"!==i)return;const o=await(0,Qe.px)("downloadMedia",{mediaFormat:U.qZ.Progressive,...n});if(!o)return;const{arrayBuffer:a}=o;e.postMessage({type:"partResponse",messageId:s,result:a},[a])}))}));var ot=i(63988);const at="Od9ZSc1U";let rt;const lt=(0,s.ph)((({duration:e,bufferedRanges:t,isReady:i,posterSize:n,playbackRate:o,url:a,isActive:r,isPlaying:l,isPreviewDisabled:c,onSeek:d,onSeekStart:h})=>{const m=(0,s.li)(),[u]=Be(),[p]=je(),v=(0,ot.aG)(u,250),[g,f]=(0,s.Ul)(v()),[C,S]=(0,s.Ul)(0),[y,k]=(0,s.Ul)(0),w=(0,s.li)(!1),[N,I]=(0,s.J0)(!1),[P,Y]=(0,s.J0)(!1),F=(0,s.li)(),M=(0,s.li)(),T=(0,s.li)(),B=(0,s.li)(),R=(0,s.Kr)((()=>function(e,t){const i=(e=Math.round(e*Xe))/(t=Math.round(t*Xe));return e>tt&&(e=tt,t=Math.round(e/i)),t>tt&&(t=tt,e=Math.round(t*i)),{width:e,height:t}}(n?.width||0,n?.height||0)),[n]),L=(0,D.A)((e=>{e=Math.floor(e),k(e),function(e){st&&st.render(e)}(e)}));return(0,s.vJ)((()=>{if(!c&&a&&i)return function(e,t){return st&&st.destroy(),st=new nt(e,t),()=>{st?.destroy(),st=void 0}}(a,F.current)}),[a,i,c]),(0,s.vJ)((()=>{I(!1)}),[r]),(0,s.vJ)((()=>{if(rt&&rt(),rt=void 0,!w.current&&!P){const t=v(),i=e-t;rt=(0,A.Hd)({from:t,to:e,duration:1e3*i/o,onUpdate:f})}}),[v,P,f,o,e]),(0,s.vJ)((()=>{l&&!p()||(rt&&rt(),rt=void 0)}),[l,g,p]),(0,s.vJ)((()=>{if(l){rt&&rt(),rt=void 0;const t=v(),i=e-t;rt=(0,A.Hd)({from:t,to:e,duration:1e3*i/o,onUpdate:f})}}),[l,o,e]),(0,s.Nf)((()=>{if(!T.current)return;const t=(0,pe.LI)(g()/e*100,2);T.current.style.width=`${t}%`}),[g,e]),(0,s.Nf)((()=>{M.current&&(M.current.style.left=`${C()}px`)}),[C]),(0,s.Nf)((()=>{B.current&&(B.current.innerText=(0,ze.QO)(y()))}),[y]),(0,s.vJ)((()=>{if(!m.current||!r)return;const t=m.current;let i=t.getBoundingClientRect(),s=0,n=0;const o=s=>{const n=(0,Ve.A)(s).x,o=(0,pe.qE)(e*((n-i.left)/i.width),0,e);if(c)return[o,0];i.width||(i=t.getBoundingClientRect());const a=M.current;return[o,(0,pe.qE)(n-i.left-a.clientWidth/2,-4,i.width-a.clientWidth+4)]},a=()=>{rt&&rt(),rt=void 0},l=()=>{a(),w.current=!0,I(!1),Y(!1),f(s),d(s),setTimeout((()=>{w.current=!1}),250)},u=(0,ue.wJ)(t,{onCapture:()=>{a(),I(!0),Y(!0),h()},onRelease:l,onClick:l,onDrag:e=>{a(),I(!0),[s,n]=o(e),L(s),S(n),f(s)}});if(b.TF||c)return u;const p=e=>{I(!0),[s,n]=o(e),S(n),L(s)},v=()=>{I(!1)};return t.addEventListener("mousemove",p),t.addEventListener("mouseenter",p),t.addEventListener("mouseleave",v),()=>{u(),t.removeEventListener("mousemove",p),t.removeEventListener("mouseenter",p),t.removeEventListener("mouseleave",v)}}),[e,L,r,d,h,S,f,Y,c,o]),(0,ee.FD)("div",{className:"ingarEvU",ref:m,children:[!c&&(0,ee.FD)(ie.A,{isOpen:!0,isHidden:!N,className:"TqpEWfl3",style:`width: ${R.width}px; height: ${R.height}px`,ref:M,children:[(0,ee.Y)("canvas",{className:"fKVz2lln",ref:F}),(0,ee.Y)("div",{className:"bGiNvx5D",children:(0,ee.Y)("span",{className:"mnkqvOMR",ref:B})})]}),(0,ee.Y)("div",{className:at,children:t.map((({start:e,end:t})=>(0,ee.Y)("div",{className:"ANe2DKfp",style:`left: ${100*e}%; right: ${100-100*t}%`},`${e}-${t}`)))}),(0,ee.Y)("div",{className:at,children:(0,ee.Y)("div",{ref:T,className:(0,me.A)("igaGLblf",P&&"beUP6SqY")})})]})})),ct=e=>{e.stopPropagation()},dt=[.5,1,1.5,2];function ht(e,t){return(0,ee.Y)("div",{className:"player-time",children:`${(0,ze.QO)(e)} / ${(0,ze.QO)(t)}`})}const mt=(0,s.ph)((({url:e,bufferedRanges:t,bufferedProgress:i,duration:n,isReady:o,fileSize:a,isForceMobileVersion:r,isPlaying:l,isFullscreenSupported:c,isFullscreen:d,isBuffered:h,isPreviewDisabled:m,volume:u,isMuted:p,playbackRate:v,posterSize:g,onChangeFullscreen:A,onVolumeClick:f,onVolumeChange:C,onPlaybackRateChange:S,isPictureInPictureSupported:y,onPictureInPictureChange:k,onPlayPause:w,onSeek:N,onSeekingChange:P})=>{const[F,T,B]=(0,Y.A)(),[R]=Be(),L=(0,be.A)((()=>Math.trunc(R())),[R]),[x,E]=(0,s.Ul)(!1),V=(0,s.li)(),{isMobile:_}=(0,I.Ay)(),[U,O]=Fe(),K=(0,be.A)(U);(0,s.vJ)((()=>{if(b.TF||r){if(K&&l&&!F&&!x())return V.current=window.setTimeout((()=>{O(!1)}),3e3),()=>{V.current&&window.clearTimeout(V.current)};V.current&&window.clearTimeout(V.current)}}),[l,K,O,F,x,r]),(0,s.Nf)((()=>(K?document.body.classList.add("video-controls-visible"):document.body.classList.remove("video-controls-visible"),()=>{document.body.classList.remove("video-controls-visible")})),[K]),(0,s.vJ)((()=>{K||B()}),[B,K]);const J=(0,M.A)(),G=(0,D.A)((e=>{E(!1),N(e),P(!1)})),j=(0,D.A)((()=>{E(!0),P(!0)})),z=(0,s.Kr)((()=>0===u||p?"muted":u<.3?"volume-1":u<.6?"volume-2":"volume-3"),[u,p]);return(0,ee.FD)("div",{className:(0,me.A)("VideoPlayerControls",r&&"mobile",K&&"active"),onClick:ct,children:[(0,ee.Y)(lt,{url:e,duration:n,isReady:o,isPlaying:l,isPreviewDisabled:m,posterSize:g,bufferedRanges:t,playbackRate:v,onSeek:G,onSeekStart:j,isActive:K}),(0,ee.FD)("div",{className:"buttons",children:[(0,ee.Y)(W.A,{ariaLabel:J("AccActionPlay"),size:"tiny",ripple:!_,color:"translucent-white",className:"play",round:!0,onClick:w,children:(0,ee.Y)(q.A,{name:l?"pause":"play"})}),(0,ee.Y)(W.A,{ariaLabel:"Volume",size:"tiny",color:"translucent-white",className:"volume",round:!0,onClick:f,children:(0,ee.Y)(q.A,{name:z})}),!b.pz&&(0,ee.Y)(qe.A,{bold:!0,className:"volume-slider",value:p?0:100*u,onChange:C}),ht(L,n),!h&&(0,ee.Y)("div",{className:"player-file-size",children:`${(0,He.v7)(J,a*i)} / ${(0,He.v7)(J,a)}`}),(0,ee.Y)("div",{className:"spacer"}),(0,ee.Y)(W.A,{ariaLabel:"Playback rate",size:"tiny",color:"translucent-white",className:"playback-rate",round:!0,onClick:T,children:`${v}x`}),y&&(0,ee.Y)(W.A,{ariaLabel:"Picture in picture",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:k,children:(0,ee.Y)(q.A,{name:"pip"})}),c&&(0,ee.Y)(W.A,{ariaLabel:"Fullscreen",size:"tiny",color:"translucent-white",className:"fullscreen",round:!0,onClick:A,children:(0,ee.Y)(q.A,{name:d?"smallscreen":"fullscreen"})})]}),(0,ee.Y)($e.A,{isOpen:F,className:(0,me.A)("playback-rate-menu",!c&&"no-fullscreen",!y&&"no-pip"),positionX:"right",positionY:"bottom",autoClose:!0,onClose:B,children:dt.map((e=>(0,ee.Y)(ce.A,{disabled:v===e,onClick:()=>S(e),children:`${e}x`})))})]})})),ut=(0,s.ph)((({url:e,isGif:t,posterData:i,posterSize:o,loadProgress:r,fileSize:l,isMediaViewerOpen:c,noPlay:d,volume:h,isMuted:m,playbackRate:u,isForceMobileVersion:p,shouldCloseOnClick:v,isProtected:g,isClickDisabled:A,isPreviewDisabled:C,isSponsoredMessage:S,timestamp:y,handleSponsoredClick:k,onClose:w})=>{const{setMediaViewerVolume:N,setMediaViewerMuted:P,setMediaViewerPlaybackRate:Y,setMediaViewerHidden:F}=(0,n.ko)(),M=(0,s.li)(),[B,R]=(0,s.J0)(!b.TF||!b.pz),[V,_,U]=(0,ye.Ay)(M,R),{isMobile:O}=(0,I.Ay)(),K=M.current?.duration||0,J=t||K<=30,G=(0,D.A)((()=>{b.Nd||F({isHidden:!0})})),j=(0,D.A)((()=>{b.Nd||F({isHidden:!1})})),[z,H,$]=function(e,t,i){const[n,o]=(0,s.J0)(!1),[r,l]=(0,s.J0)(!1);(0,s.Nf)((()=>{if(b.pz&&b._7||!e.current)return;const s=e.current,n=x(s);if((!document.pictureInPictureEnabled||e.current?.disablePictureInPicture)&&void 0===n)return;s.autoPictureInPicture=!0,o(!0);const a=()=>{t(),l(!0),L(!0)},r=()=>{L(!1),l(!1),i()};return s.addEventListener("enterpictureinpicture",a),s.addEventListener("leavepictureinpicture",r),()=>{s.removeEventListener("enterpictureinpicture",a),s.removeEventListener("leavepictureinpicture",r)}}),[e,t,i]);const c=(0,s.hb)((()=>{if(!e.current)return;const t=x(e.current);t?t("inline"):E()}),[e]),d=(0,s.hb)((()=>{if(!e.current)return;c();const t=e.current,i=(0,T.e)(t),s=x(t);s?s("picture-in-picture"):function(e){if(e.requestPictureInPicture)try{e.requestPictureInPicture()}catch(e){a.Oig&&console.log("[MV] PictureInPicture Error",e)}}(t),i&&(0,T.A)(t)}),[e,c]);return n?[n,d,r]:[!1]}(M,G,j),[,Q,Z]=Fe(),[X,te]=(0,s.Ul)(!1),ie=(0,s.li)({x:0,y:0});(0,s.vJ)((()=>{const e=e=>{ie.current=(0,Ve.A)(e)};return window.addEventListener("mousemove",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}}),[]);const se=(0,D.A)(((e,t)=>{const i=M.current?.getBoundingClientRect();i&&(e<=i.left||e>=i.right||t<=i.top||t>=i.bottom)&&(X()||Q(!1))})),ne=(0,D.A)((()=>{Q(!0)})),oe=(0,D.A)((e=>{se(e.clientX,e.clientY)})),ae=(0,D.A)((e=>{if(te(e),!e){const{x:e,y:t}=ie.current;se(e,t)}})),{isReady:re,isBuffered:le,bufferedRanges:ce,bufferingHandlers:he,bufferedProgress:me}=(0,Ue.A)(),ue=(0,_e.A)(M,void 0,!e),{shouldRender:ve,transitionClassNames:ge}=(0,Oe.A)(!le&&!ue,void 0,void 0,"slow"),{shouldRender:Ae,transitionClassNames:be}=(0,Oe.A)(b.pz&&!B&&!ve&&!ue,void 0,void 0,"slow"),[,fe]=Be(),[,Ce]=je();(0,s.vJ)((()=>{Z(ve)}),[Z,ve]),(0,s.vJ)((()=>{d||!c||ue?M.current.pause():e&&!b.TF&&(0,T.A)(M.current)}),[d,c,e,P,ue]),(0,s.vJ)((()=>{M.current.volume=h}),[h]),(0,s.vJ)((()=>{M.current.playbackRate=u}),[u]),(0,s.vJ)((()=>{y&&(M.current.currentTime=y,fe(y))}),[fe,y]);const Se=(0,D.A)((e=>{e.stopPropagation(),B?(M.current.pause(),R(!1)):((0,T.A)(M.current),R(!0))})),ke=(0,D.A)((e=>{S&&(k?.(!0),w(e)),A||(v?w(e):Se(e))}));(0,Ke.A)(M,he);const we=(0,D.A)((e=>{const t=e.currentTarget;t.readyState>=4&&(Ce(!1),fe(t.currentTime)),J||t.currentTime!==t.duration||(fe(0),R(!1))})),Ne=(0,D.A)((()=>{J||(fe(0),R(!1),Q(!0))})),Ie=(0,D.A)((()=>{V&&U?U():!V&&_&&_()})),Pe=(0,D.A)((e=>{M.current.currentTime=e})),Ye=(0,D.A)((e=>{N({volume:e/100})})),De=(0,D.A)((()=>{M.current.muted=!M.current.muted,P({isMuted:!m})})),Me=(0,D.A)((e=>{Y({playbackRate:e})}));(0,s.vJ)((()=>{if(!c)return;const e=e=>{if(!V)return;const t=M.current,i=(0,pe.qE)(t.currentTime+5*e,0,t.duration);Number.isFinite(i)&&(t.currentTime=i)},t=t=>{if(!$)switch(t.key){case" ":case"Enter":t.preventDefault(),Se(t);break;case"Left":case"ArrowLeft":t.preventDefault(),e(-1);break;case"Right":case"ArrowRight":t.preventDefault(),e(1)}};return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}}),[Se,c,V,$]);const Te=o&&`width: ${o.width}px; height: ${o.height}px`,Re=`background-image: url(${i})`,Le=!b.TF&&!p;return(0,ee.FD)("div",{className:"VideoPlayer",onMouseMove:Le?ne:void 0,onMouseLeave:Le?oe:void 0,children:[(0,ee.FD)("div",{style:Te,children:[g&&(0,ee.Y)("div",{onContextMenu:f.A,onDoubleClick:b.TF?void 0:Ie,onClick:O?void 0:Se,className:"protector"}),(0,ee.Y)("video",{ref:M,autoPlay:b.TF,controlsList:"nodownload",playsInline:!0,loop:J,muted:t||m,id:"media-viewer-video",style:Re,onWaiting:()=>Ce(!0),onPlay:()=>R(!0),onEnded:Ne,onClick:O||V?void 0:ke,onDoubleClick:b.TF?void 0:Ie,...he,onPause:e=>{R(!1),he.onPause(e)},onTimeUpdate:we,src:e})]}),Ae&&(0,ee.Y)(W.A,{round:!0,className:`play-button ${be}`,onClick:Se,children:(0,ee.Y)(q.A,{name:"play"})}),ve&&(0,ee.FD)("div",{className:["spinner-container",ge].join(" "),children:[!le&&(0,ee.Y)("div",{className:"buffering",children:"Buffering..."}),(0,ee.Y)(de.A,{size:"xl",progress:le?1:r,onClick:w})]}),!t&&!S&&!ue&&(0,ee.Y)(mt,{url:e,isPlaying:B,bufferedRanges:ce,bufferedProgress:me,isBuffered:le,isFullscreenSupported:Boolean(_),isPictureInPictureSupported:z,isFullscreen:V,isPreviewDisabled:C,fileSize:l,duration:K,isReady:re,posterSize:o,isForceMobileVersion:p,onSeek:Pe,onChangeFullscreen:Ie,onPictureInPictureChange:H,onPlayPause:Se,volume:h,playbackRate:u,isMuted:m,onVolumeClick:De,onVolumeChange:Ye,onPlaybackRateChange:Me,onSeekingChange:ae})]})})),pt=(0,s.ph)((0,n.EK)(((e,{item:t})=>{const{volume:i,isMuted:s,playbackRate:n,isHidden:o,origin:a,timestamp:r,threadId:l}=(0,c.nTw)(e).mediaViewer,d="message"===t.type?t.message:void 0,h="sponsoredMessage"===t.type?t.message:void 0,m=d||h,u=d&&(0,c.meW)(e,d,!0);return{origin:a,textMessage:m,isProtected:d&&(0,c.ynf)(e,d),volume:i,isMuted:s,isHidden:o,playbackRate:n,threadId:l,timestamp:r,maxTimestamp:u}}))((({item:e,isActive:t,textMessage:i,origin:s,withAnimation:o,isProtected:r,volume:l,playbackRate:c,isMuted:d,isHidden:h,isMoving:m,threadId:u,timestamp:A,maxTimestamp:f,onClose:C,onFooterClick:S,handleSponsoredClick:y})=>{const{updateLastPlaybackTimestamp:k}=(0,n.ko)(),w=(0,M.A)(),N="avatar"===e.type,P="sponsoredMessage"===e.type,{media:Y}=g(e)||{},{isVideo:F,isPhoto:T,bestImageData:B,bestData:R,dimensions:L,isGif:x,isLocal:E,isVideoAvatar:V,mediaSize:_,loadProgress:U}=$({media:Y,isAvatar:N,origin:s,delay:!!o&&350}),[,O]=Fe(),[K]=Be(),J=Boolean(Y),{isMobile:G}=(0,I.Ay)(),j=(0,D.A)((()=>{O(!0)})),z=(0,Le.A)((()=>{if(!t||!i||"video"!==Y?.mediaType)return;if(Y.duration<a.u4b)return;const e="id"in i?i:void 0,s=K();if(!s||!e||e.isInAlbum)return;const n=Y.duration-s>1?s:void 0;k({chatId:e.chatId,messageId:e.id,timestamp:n})}),[K,t,Y,i],1e3);if((0,Re.R)(z,[K]),!Y)return;if("avatar"===e.type)return V?(0,ee.Y)("div",{className:"MediaViewerContent",children:(0,ee.Y)(ut,{url:R,isGif:!0,posterData:B,posterSize:(0,p.sk)(L,!1,!0),loadProgress:U,fileSize:_,isMediaViewerOpen:J&&t,isProtected:r,isPreviewDisabled:!De.G9||E,noPlay:!t,onClose:C,isMuted:!0,shouldCloseOnClick:!0,volume:0,isClickDisabled:m,playbackRate:1,isSponsoredMessage:P,handleSponsoredClick:y},Y.id)},Y.id):(0,ee.Y)("div",{className:"MediaViewerContent",children:vt(R,(0,p.sk)(L,!1),!G&&!r,r)},Y.id);const H=i&&(i.content.action?"suggestProfilePhoto"===i.content.action.type?w("Conversation.SuggestedPhotoTitle"):void 0:(0,v.V)({message:i,maxTimestamp:f,threadId:u,forcePlayback:!0,isForMediaViewer:!0})),q=i&&"buttonText"in i?i.buttonText:void 0,W=Boolean(H),Q=(0,p.sk)(L,W,F),Z=G||function(e){return!!e&&e.width<350}(Q);return(0,ee.FD)("div",{className:(0,me.A)("MediaViewerContent",W&&"has-footer"),onMouseMove:Z&&!b.TF?j:void 0,children:[T&&vt(R,Q,!G&&!r,r),F&&(t?(0,ee.Y)(ut,{url:R,isGif:x,posterData:B,posterSize:Q,loadProgress:U,fileSize:_,isMediaViewerOpen:J&&t,noPlay:!t,isPreviewDisabled:!De.G9||E,onClose:C,isMuted:d,isHidden:h,isForceMobileVersion:Z,isProtected:r,volume:l,isClickDisabled:m,playbackRate:c,isSponsoredMessage:P,handleSponsoredClick:y,timestamp:A},Y.id):gt(B,Q,!G&&!r,r)),H&&(0,ee.Y)(Ee,{text:H,buttonText:q,onClick:S,isProtected:r,isForceMobileVersion:Z,isForVideo:F&&!x,handleSponsoredClick:y})]})})));function vt(e,t,i,s){return e?(0,ee.FD)("div",{style:"position: relative;",children:[s&&(0,ee.Y)("div",{onContextMenu:f.A,className:"protector"}),(0,ee.Y)("img",{src:e,alt:"",className:(0,me.A)(s&&"is-protected"),style:t?`width: ${t.width}px`:"",draggable:Boolean(i)})]}):(0,ee.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,ee.Y)(xe.A,{color:"white"})})}function gt(e,t,i,s){const n=t&&`width: ${t.width}px; height: ${t.height}px`,o=`background-image: url(${e})`;return e?(0,ee.FD)("div",{className:"VideoPlayer",children:[s&&(0,ee.Y)("div",{onContextMenu:f.A,className:"protector"}),(0,ee.Y)("div",{style:n,children:(0,ee.Y)("video",{style:o,className:(0,me.A)(s&&"is-protected"),draggable:Boolean(i)})})]}):(0,ee.Y)("div",{className:"spinner-wrapper",style:t?`width: ${t.width}px`:"",children:(0,ee.Y)(xe.A,{color:"white"})})}const{easeOutCubic:At,easeOutQuart:bt}=A.qM,ft=b.TF?40:0,Ct=350;let St,yt;var kt=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(kt||{});const wt=(0,s.ph)((({item:e,isVideo:t,isGif:i,isOpen:n,withAnimation:o,isHidden:a,isLoadingMoreMedia:r,isSynced:l,loadMoreItemsIfNeeded:c,getNextItem:d,selectItem:h,onClose:m,onFooterClick:u,handleSponsoredClick:p})=>{const v=(0,s.li)(),g=(0,s.li)(),f=(0,s.li)(),C=(0,s.li)(),S=(0,s.li)({x:0,y:0,scale:1}),y=(0,s.li)(void 0),k=(0,s.li)(void 0),w=(0,s.li)(!1),[N,I]=(0,s.J0)(!0),[P]=ae(),Y=(0,s.li)(P()),F=(0,ye.zk)(),[T,B]=(0,s.J0)(!1),[R,L]=(0,s.Ul)({x:0,y:0,scale:1}),x=Se(R),[E,V]=(0,s.Ul)(e),_=Se(E),U=(0,be.A)((()=>1!==R().scale),[R]),O=(0,be.A)(E),{height:K,width:J,isResizing:G}=(0,ke.A)(),[j,z,H]=Fe(),$=(0,M.A)();(0,fe.A)({isActive:n,onBack:m,shouldBeReplaced:!0});const q=(0,Ae.A)(h,[h],350,!0),W=(0,Ae.A)((()=>{y.current=void 0}),[],500,!0),Q=(0,Ae.A)((e=>I(e)),[],800,!0),Z=Boolean(i&&!b.pz),X=b.TF?40:J/10,te=(0,D.A)((e=>{if(!b.TF)return;const t=K-e.pageY<80;!t&&e.pageX<X||!t&&e.pageX>J-X||z(!j())}));(0,ge.A)((()=>z(!0)),Ct),(0,s.vJ)((()=>{const{scale:t,x:i,y:s}=x.current;0===i&&0===s&&1===t&&V(e)}),[e,V,x]),(0,s.vJ)((()=>{l&&O&&!r&&c(O)}),[O,c,l,r]),(0,s.Nf)((()=>{const{x:e,y:t,scale:i}=R();H(1!==i),f.current&&(f.current.style.transform=Nt(-J+e-ft)),g.current&&(g.current.style.transform=Nt(e,t,i)),C.current&&(C.current.style.transform=Nt(J+e+ft))}),[R,H,J]),(0,s.vJ)((()=>{if(!v.current||void 0===_.current||a||F)return;let e=S.current;const t={x:0,y:0},i={x:0,y:0},s={x:0,y:0};let n,r=Date.now();const l=(0,ve.sg)((()=>{r=Date.now()}),500,!1,!0),c=t=>{const i=_.current;if(void 0===i)return!1;const s=d(i,t);if(void 0!==s){const i=(J+ft)*t,n=x.current.x+i;return I(!1),V(s),q(s),Q(!0),e={x:0,y:0,scale:1},o?(St=(0,A.Hd)({from:n,to:0,duration:Ct,timing:At,onUpdate:e=>L({y:0,x:e,scale:1})}),!0):(L(e),!0)}return!1},h=e=>{const{scale:t}=x.current;if(1!==t)return[!1,!1];if(e.target.closest("div.VideoPlayerControls"))return[!1,!1];let i=0;return K-e.pageY<80?[!1,!1]:(e.pageX<X?i=-1:e.pageX>J-X&&(i=1),[0!==i,c(i)])},u=e=>{const{scale:t}=x.current;if(1===t)switch(e.key){case"Left":case"ArrowLeft":c(-1);break;case"Right":case"ArrowRight":c(1)}},p=({x:e,y:t,scale:i},s=0)=>{const n=k.current;if(!n)return[{x:e,y:t,scale:i},!0,!0];let o=!0,a=!0;const r=(J-J*i)/2,l=(K-K*i)/2,c=Math.max(-n.left*i,r),d=J-n.right*i;o=(0,pe.Bt)(e,d,c),e=(0,pe.qE)(e,d,c);const h=Math.max(-n.top*i+s,l),m=K-n.bottom*i;return a=(0,pe.Bt)(t,m,h),[{x:e,y:t=(0,pe.qE)(t,m,h),scale:i},o,a]},f=n=>{if(w.current)return void(w.current=!1);"mouseup"===n.type&&B(!1);const o=x.current,{y:a,scale:l}=o;let c=o.x;const h=Math.abs(c),u=Math.abs(a);if(W(),Q(!0),l<1)return e={x:0,y:0,scale:1},void(St=(0,A.Hd)({from:[c,a,l],to:[0,0,1],duration:Ct,timing:At,onUpdate:e=>L({x:e[0],y:e[1],scale:e[2]})}));if(l>1){const o=Math.min(l,4),d=o/l;let h=c*d+(i.x-d*i.x),m=a*d+(i.y-d*i.y);const u=.15;if("wheel"!==n.type&&e.scale===l){const e=Math.abs(t.x)/(Date.now()-r),i=Math.abs(t.y)/(Date.now()-r);h-=Math.abs(t.x)*e*u*s.x,m-=Math.abs(t.y)*i*u*s.y}return[e]=p({x:h,y:m,scale:o},60),void(St=(0,A.Hd)({from:[c,a,l],to:[e.x,e.y,e.scale],duration:Ct,timing:At,onUpdate:e=>L({x:e[0],y:e[1],scale:e[2]})}))}if(e={x:c,y:a,scale:l},u>=50)return void m();if(u>0)return void(St=(0,A.Hd)({from:a,to:0,duration:Ct,timing:At,onUpdate:e=>L({x:0,y:e,scale:l})}));const v=c<0?1:-1,g=_.current,b=g&&d(g,c<0?1:-1),f=s.x<0?-1:1;void 0!==b&&h>=50&&v===f&&(c+=(J+ft)*v,V(b),q(b)),St=(0,A.Hd)({from:c,to:0,duration:Ct,timing:At,onUpdate:e=>L({y:0,x:e,scale:l??1})})},C=(0,ue.wJ)(v.current,{isNotPassive:!0,withNativeDrag:!0,excludedClosestSelector:".MediaViewerFooter, .ZoomControls, .VideoPlayerControls",minZoom:1,maxZoom:4,doubleTapZoom:3,withWheelDrag:!0,onCapture:e=>{if(Pt(e))return;const{x:t,y:i,scale:s}=x.current;if("mousedown"!==e.type||(B(!0),1===s)){if(r=Date.now(),0===t&&0===i&&1===s){if(!g.current)return;if(n=g.current.querySelector("img, video"),!n)return;k.current=n.getBoundingClientRect()}}else e.preventDefault()},onDrag:(i,n,{dragOffsetX:o,dragOffsetY:a},r)=>{if(w.current||Pt(i))return;if(b.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=ue.h6||e>=J-ue.h6)return}St&&(St(),St=void 0),s.x=t.x-o,s.y=t.y-a,t.x=o,t.y=a;const c=Math.abs(o),d=Math.abs(a),{x:h,y:m,scale:u}=x.current;if(l(),1===u){if("mousemove"!==i.type){if(y.current!==kt.Vertical&&(y.current===kt.Horizontal||Math.abs(h)>ue.no||c/d>ue.fG)){y.current=kt.Horizontal,I(!1);const e=J+ft,t=(0,pe.qE)(o,-e,e);return L({x:t,y:0,scale:u}),void("wheel"===i.type&&Math.abs(t)>100&&(f(i),w.current=!0))}if(y.current===kt.Vertical||Math.abs(m)>ue.no||d/c>ue.fG){y.current=kt.Vertical;const e=K,t=(0,pe.qE)(a,-e,e);L({x:0,y:t,scale:u}),"wheel"===i.type&&Math.abs(t)>100&&(f(i),w.current=!0)}}}else{const t=e.x+o,s=e.y+a;if(["wheel","mousemove"].includes(i.type)){const[e,i,n]=p({x:t,y:s,scale:u},60);return r&&r(!i,!n),void L(e)}"touches"in i&&1===i.touches.length&&L({x:t,y:s,scale:u})}},onZoom:(t,{zoom:s,zoomFactor:n,initialCenterX:o,initialCenterY:a,dragOffsetX:r,dragOffsetY:l,currentCenterX:c,currentCenterY:d})=>{St&&St(),o=o||J/2,a=a||K/2,c=c||J/2,d=d||K/2;const h=s??(0,pe.qE)(e.scale*n,.5,12),m=h/e.scale,u=Math.abs(Math.min(e.x,0)),v=Math.abs(Math.min(e.y,0));i.x=c,i.y=d;const g=u+o,A=v+a,b=g-m*g,f=A-m*A,[C]=p({x:e.x+b+r,y:e.y+f+l,scale:h});L(C)},onClick(t){B(!1);const[i,s]=h(t);if(i){if(t.preventDefault(),t.stopPropagation(),b.TF)return;s||m()}else 1!==e.scale||b.TF||!Z&&It(t.target,".VideoPlayer")||m()},onDoubleClick(t,{centerX:i,centerY:s}){const[n]=h(t);if(n)return t.preventDefault(),void t.stopPropagation();if(!b.TF&&"wheel"!==t.type)return;const{x:o,y:a,scale:r}=x.current;if(1===r){if(0!==o||0!==a)return;e=p({x:i-3*i,y:s-3*s,scale:3})[0]}else e={x:0,y:0,scale:1};St=(0,A.Hd)({from:[o,a,r],to:[e.x,e.y,e.scale],duration:Ct,timing:At,onUpdate:e=>{const t={x:e[0],y:e[1],scale:e[2]};L(t)}})},onRelease:f});return document.addEventListener("keydown",u,!1),()=>{C(),document.removeEventListener("keydown",u,!1)}}),[_,W,X,d,F,a,m,q,V,Q,L,Z,x,K,J,o]),(0,s.vJ)((()=>{const e=P(),t=void 0!==Y.current&&Y.current!==e;if(!v.current||!t||a||F)return;Y.current=e;const{scale:i}=x.current,s=e>0?-1:1;let n=100,o=0;i<=.6&&s>0||i>=12&&s<0||(1===i&&s>0&&(n=20),yt&&yt(),yt=(0,A.Hd)({from:s,to:s*n,duration:Ct,timing:bt,onUpdate:e=>{if(!v.current)return;const t=(0,pe.LI)(e-o,2);o=e;const i=new WheelEvent("wheel",{deltaY:t,ctrlKey:!0});v.current.dispatchEvent(i)}}))}),[P,a,F,x]);const[ie,se]=(0,s.Kr)((()=>void 0===O?[void 0,void 0]:[d(O,-1),d(O,1)]),[O,d]);if(void 0===O)return;const ne=void 0!==ie,oe=void 0!==se,re=T&&U;return(0,ee.FD)("div",{className:"MediaViewerSlides",ref:v,children:[(0,ee.Y)("div",{className:"MediaViewerSlide",ref:f,children:ne&&!U&&!G&&(0,ee.Y)(pt,{withAnimation:o,isMoving:re,item:ie,onClose:m,onFooterClick:u,handleSponsoredClick:p})}),(0,ee.Y)("div",{className:(0,me.A)("MediaViewerSlide","MediaViewerSlide--active",re&&"MediaViewerSlide--moving"),onClick:te,ref:g,children:(0,ee.Y)(pt,{item:O,withAnimation:o,isActive:N,isMoving:re,onClose:m,onFooterClick:u,handleSponsoredClick:p})}),(0,ee.Y)("div",{className:"MediaViewerSlide",ref:C,children:oe&&!U&&!G&&(0,ee.Y)(pt,{withAnimation:o,isMoving:re,item:se,onClose:m,onFooterClick:u,handleSponsoredClick:p})}),ne&&!U&&!b.TF&&(0,ee.Y)("button",{type:"button",className:`navigation prev ${t&&!i&&"inline"}`,"aria-label":$("AccDescrPrevious"),dir:$.isRtl?"rtl":void 0}),oe&&!U&&!b.TF&&(0,ee.Y)("button",{type:"button",className:`navigation next ${t&&!i&&"inline"}`,"aria-label":$("Next"),dir:$.isRtl?"rtl":void 0})]})}));function Nt(e=0,t=0,i=1){return`translate3d(${e.toFixed(3)}px, ${t.toFixed(3)}px, 0px) scale(${i.toFixed(3)})`}function It(e,t){return!!e&&(!!e.matches(t)||Boolean(e.closest(t)))}function Pt(e){const t=e.target;return!!It(t,".VideoPlayerControls")&&(It(t,".play, .fullscreen, .volume, .volume-slider, .playback-rate, .playback-rate-menu, .SeekLine")||e.preventDefault(),!0)}var Yt=i(70636),Ft=i(4961),Dt=i(21849);const Mt=(0,n.EK)(((e,{item:t})=>{const i="message"===t?.type?t.message:void 0,s=i&&(0,c.Y7C)(e,i);return{owner:"avatar"===t?.type?t.avatarOwner:s}}))((({owner:e,item:t})=>{const{closeMediaViewer:i,focusMessage:o,toggleChatInfo:a}=(0,n.ko)(),{isMobile:r}=(0,I.Ay)(),c=(0,D.A)((()=>{if(i(),"message"!==t?.type)return;const e=t.message;r?setTimeout((()=>{a({force:!1},{forceSyncOnIOs:!0}),o({chatId:e.chatId,messageId:e.id})}),350):o({chatId:e.chatId,messageId:e.id})})),d=(0,M.A)(),h=(0,s.Kr)((()=>{if(!t||"standalone"===t.type)return;const e="avatar"===t.type?t.avatarOwner:void 0,i="avatar"===t.type?t.profilePhotos:void 0,s=i?.photos[t.mediaIndex],n=s?.id===i?.fallbackPhoto?.id,o=s?.id===i?.personalPhoto?.id,a="message"===t.type?t.message.date:s?.date;if(!a)return;const r=(0,ze.fS)(d,1e3*a,!0),c=i?.count&&i.count+(i?.fallbackPhoto?1:0),h=t.mediaIndex+1+(i?.personalPhoto?-1:0),m=c&&d("Of",[h,c]),p=[];if(s){const t=(0,u.L8)(e.id)?void 0:e,i=t&&(0,l.WX)(t),s=t&&(0,l.YE)(t);p.push(d(o?"lng_mediaview_profile_photo_by_you":n?"lng_mediaview_profile_public_photo":i?"lng_mediaview_channel_photo":s?"lng_mediaview_group_photo":"lng_mediaview_profile_photo"))}return!m||o||n||p.push(m),p.push(r),p.join(" • ")}),[t,d]);if(!e)return;const m=(0,Yt.F9)(d,e);return(0,ee.FD)("div",{className:"SenderInfo",onClick:c,children:[(0,ee.Y)(Dt.A,{size:"medium",peer:e},e.id),(0,ee.FD)("div",{className:"meta",children:[(0,ee.Y)("div",{className:"title",dir:"auto",children:m&&(0,Ft.A)(m)}),(0,ee.Y)("div",{className:"date",dir:"auto",children:h})]})]})})),Tt=250,Bt=(0,s.ph)((0,n.EK)((e=>{const{mediaViewer:t,shouldSkipHistoryAnimations:i}=(0,c.nTw)(e),{chatId:s,threadId:n,messageId:a,origin:r,isHidden:d,withDynamicLoading:h,standaloneMedia:m,mediaIndex:p,isAvatarView:v,isSponsoredMessage:g}=t,A=(0,c.xYJ)(e,"mediaViewerAnimations"),{currentUserId:b,isSynced:f}=e,C=Boolean(s)&&(0,c.nZ4)(e,s);if(v){const t=(0,c.PVB)(e,s);let n=!1;t&&(n=(0,u.L8)(t.id)?t.id===b:(0,l.SJ)(t));const o=(0,c.IVq)(e,s);return{profilePhotos:o,avatar:o?.photos[p],avatarOwner:t,isLoadingMoreMedia:o?.isLoading,isChatWithSelf:C,canUpdateMedia:n,withAnimation:A,origin:r,shouldSkipHistoryAnimations:i,isHidden:d,standaloneMedia:m,mediaIndex:p,isSynced:f}}let S,y,k;s&&a&&(S=r&&[o.TQ.ScheduledAlbum,o.TQ.ScheduledInline].includes(r)?(0,c.Jl6)(e,s,a):(0,c.O5q)(e,s,a)),g&&s&&r===o.TQ.SponsoredMessage&&(y=(0,c.v8U)(e,s)),s&&(k=r&&[o.TQ.ScheduledAlbum,o.TQ.ScheduledInline].includes(r)?(0,c.yFI)(e,s):(0,c.zeq)(e,s));let w=!1;const N=r===o.TQ.Inline,I=r===o.TQ.Album;let P;if(s&&n&&a)if(h&&(N||I)){const t=(0,c.CuV)(e);w=Boolean(t?.isLoading);const{foundIds:i}=t?.currentSegment||{};P=i}else if(r===o.TQ.SharedMedia){const t=(0,c.BU_)(e),{foundIds:i}=t&&t.resultsByType&&t.resultsByType.media||{};P=i}else(N||I)&&(P=(0,c.Lzh)(e,s,n,a)||(0,c.gCU)(e,s,n));return{chatId:s,threadId:n,messageId:a,isChatWithSelf:C,origin:r,message:S,chatMessages:k,sponsoredMessage:y,collectedMessageIds:P,withAnimation:A,isHidden:d,shouldSkipHistoryAnimations:i,withDynamicLoading:h,standaloneMedia:m,mediaIndex:p,isLoadingMoreMedia:w,isSynced:f}}))((({chatId:e,threadId:t,messageId:i,message:c,collectedMessageIds:f,isChatWithSelf:T,canUpdateMedia:B,origin:L,avatar:x,avatarOwner:U,profilePhotos:O,chatMessages:K,sponsoredMessage:J,standaloneMedia:G,mediaIndex:j,withAnimation:z,isHidden:H,shouldSkipHistoryAnimations:Q,withDynamicLoading:Z,isLoadingMoreMedia:X,isSynced:ne})=>{const{openMediaViewer:oe,closeMediaViewer:ae,openForwardMenu:re,focusMessage:le,toggleChatInfo:ce,searchChatMediaMessages:de,loadMoreProfilePhotos:me,clickSponsored:ue,openUrl:pe}=(0,n.ko)(),ve=Boolean(U||c||G||J),{isMobile:ge}=(0,I.Ay)(),Ae=(0,s.li)(),be=c?.senderId||U?.id||c?.chatId,fe=(0,V.A)(be),Ce=z?"slideFade":"none",Se=Boolean(z&&!Q),[ye,ke,we]=(0,Y.A)(),Ne=function({message:e,avatarOwner:t,profilePhotos:i,standaloneMedia:s,mediaIndex:n,sponsoredMessage:o}){return t&&i?{type:"avatar",avatarOwner:t,profilePhotos:i,mediaIndex:n}:s?{type:"standalone",media:s,mediaIndex:n}:e?{type:"message",message:e,mediaIndex:n}:o?{type:"sponsoredMessage",message:o,mediaIndex:n}:void 0}({message:c,avatarOwner:U,standaloneMedia:G,profilePhotos:O,mediaIndex:j,sponsoredMessage:J}),{media:Ie,isSingle:Pe}=g(Ne)||{},{isVideo:Ye,isPhoto:Fe,bestImageData:De,bestData:Me,dimensions:Te,isGif:Be,isFromSharedMedia:Re}=$({media:Ie,isAvatar:Boolean(U),origin:L,delay:Se&&Tt}),Le=(()=>{if(T)return!1;if("avatar"!==Ne?.type||!U)return!1;const e=Ne.profilePhotos;return Ie!==e.personalPhoto})(),xe=!H&&ve,Ee=(0,s.Kr)((()=>Z?f:(0,l.Wm)(K||{},f||[],Re)),[K,f,Re,Z]);!ve||fe&&fe===be&&void 0!==Ae.current||(Ae.current=Pe?0:i||j);const[Ve]=R;(0,s.vJ)((()=>{if(!ve||Ve())return;(0,m.FD)();const e=(0,_.w4)();return()=>{e(),(0,m.wb)()}}),[ve,Ve]),(0,s.vJ)((()=>{xe&&E()}),[xe]),(0,s.vJ)((()=>{ge&&(0,r.RK)((()=>{document.body.classList.toggle("is-media-viewer-open",ve)}))}),[ge,ve]);const _e=(0,s.li)();(0,P.A)(_e);const Ue=(0,F.A)();(0,s.vJ)((()=>{const e=window.matchMedia(p.wy);return e.addEventListener("change",Ue),()=>{e.removeEventListener("change",Ue)}}),[Ue]);const Oe=(0,V.A)(c),Ke=(0,V.A)(H),Je=(0,V.A)(L),Ge=(0,V.A)(Ne),je=(0,V.A)(De),ze=c?(0,v.V)({message:c,forcePlayback:!0,isForMediaViewer:!0}):void 0,He=Boolean(ze),$e=Ke&&Ge!==Ne;(0,s.vJ)((()=>{Se&&ve&&($e||!Ge)&&((0,s.VK)(Tt+a.xB5),function(e,t,i,s,n,l,c){const{mediaEl:d}=w(t,l,c);if(!d)return;const{width:h}=y.A.get(),{width:m,height:u}=(0,p.$w)(e,n),{width:v,height:g}=(0,p.ky)(m,u,s.width,s.height),f=(h-v)/2,C=function(e){const t=window.matchMedia(p.wy);let i=4.125;return e&&!b.TF&&(i+=t.matches?.875:2.125),i*p.$}(e)+(u-g)/2;let{top:S,left:I,width:P,height:Y}=d.getBoundingClientRect();if([o.TQ.SharedMedia,o.TQ.Album,o.TQ.ScheduledAlbum,o.TQ.SearchResult].includes(t)){const e=function(e,t,i,s,n,o){if(e===t){const a=Math.max(n,o)*(e/t);s-=(a-n)/2,i-=(a-o)/2,n=a,o=a}else if(e>t){const i=n;s-=((n=o*(e/t))-i)/2}else if(t>e){const s=o;i-=((o=n*(t/e))-s)/2}return{top:i,left:s,width:n,height:o}}(v,g,S,I,P,Y);S=e.top,I=e.left,P=e.width,Y=e.height}const F=I+P/2-(f+v/2),D=S+Y/2-(C+g/2),M=P/v,T=Y/g;(0,r.RK)((()=>{const e=k(i||d);(0,A.ZM)(e,{top:`${C}px`,left:`${f}px`,width:`${v}px`,height:`${g}px`,transform:`translate3d(${F}px, ${D}px, 0) scale(${M}, ${T})`}),N(e,t),document.body.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)((()=>{e.style.transform="",function(e){e.firstChild.style.objectFit="default",e.classList.remove("rounded-corners","circle")}(e),setTimeout((()=>{(0,r.RK)((()=>{document.body.contains(e)&&document.body.removeChild(e),document.body.classList.remove("ghost-animating")}))}),200+a.xB5)}))}))}(He,L,De,Te,Ye,c,j)),Se&&!ve&&Ge&&((0,s.VK)(Tt+a.xB5),function(e,t,i,s){const{container:n,mediaEl:l}=w(e,i,s);if(!l)return;const c=document.getElementById("MediaViewer").querySelector(".MediaViewerSlide--active img, .MediaViewerSlide--active video");if(!c)return;const{top:d,left:h,width:m,height:u}=c.getBoundingClientRect(),{top:p,left:v,width:g,height:b}=l.getBoundingClientRect();let f=p;if(!(0,S.Y)(n)){const{height:e}=y.A.get();f=p<d?-b:e}const I=h+m/2-(v+g/2),P=d+u/2-(f+b/2);let Y=m/g,F=u/b;const D=[o.TQ.Inline,o.TQ.ScheduledInline,o.TQ.Album,o.TQ.ScheduledAlbum].includes(e)&&!function(e){const t=document.querySelector(".Transition_slide-active > .MessageList"),{top:i}=(0,C.A)(e,t);return i>t.scrollTop&&i+e.offsetHeight<t.scrollTop+t.offsetHeight}(l);[o.TQ.SharedMedia,o.TQ.Album,o.TQ.ScheduledAlbum,o.TQ.SearchResult].includes(e)&&(Y>F?Y=F:F>Y&&(F=Y));const M=document.getElementsByClassName("ghost")[0],T=M||k(t||l,e);let B;if(M){const{top:e,left:t,width:i,height:s}=M.getBoundingClientRect();B={transition:"none",top:`${f}px`,left:`${v}px`,transformOrigin:"top left",transform:`translate3d(${t-v}px, ${e-f}px, 0) scale(${i/g}, ${s/b})`,width:`${g}px`,height:`${b}px`}}else B={top:`${f}px`,left:`${v}px`,width:`${g}px`,height:`${b}px`,transform:`translate3d(${I}px, ${P}px, 0) scale(${Y}, ${F})`};(0,r.RK)((()=>{(0,A.ZM)(T,B),M||document.body.appendChild(T),document.body.classList.add("ghost-animating"),(0,r.RK)((()=>{M&&(M.style.transition=""),T.style.transform="",D&&(T.style.opacity="0"),N(T,e),setTimeout((()=>{(0,r.RK)((()=>{document.body.contains(T)&&document.body.removeChild(T),document.body.classList.remove("ghost-animating")}))}),200+a.xB5)}))}))}(Je,je,Oe,Ge?.mediaIndex))}),[De,Te,He,Se,ve,Ye,c,L,je,Ge,Oe,Je,$e,j]);const qe=(0,D.A)((()=>ae())),We=(0,D.A)((s=>{s.target instanceof HTMLElement&&s.target.closest("a")||(qe(),e&&i&&(ge?setTimeout((()=>{ce({force:!1},{forceSyncOnIOs:!0}),le({chatId:e,threadId:t,messageId:i})}),Tt):le({chatId:e,threadId:t,messageId:i})))})),Qe=(0,D.A)((t=>{J&&e&&(ue({isMedia:t,isFullscreen:!0,randomId:J.randomId}),pe({url:J.url}),ae())})),Ze=(0,D.A)((()=>{re({fromChatId:e,messageIds:[i]})}));(0,s.vJ)((()=>ve?(0,h.A)((()=>{qe()})):void 0),[qe,ve]),(0,s.vJ)((()=>{Ye&&!Be&&(0,d._K)()}),[Be,Ye]);const Xe=(0,D.A)((i=>{if(i&&!X){if("avatar"===i.type){if(!(i.mediaIndex>=i.profilePhotos.photos.length-4))return;me({peerId:i.avatarOwner.id})}"message"===i.type&&Z&&de({chatId:e,threadId:t,currentMediaMessageId:i.message.id})}})),et=(0,D.A)(((e,t)=>{if(0===t||Pe)return;if("standalone"===e.type){const{media:i,mediaIndex:s}=e,n=s+t;return n>=0&&n<i.length?{type:"standalone",media:i,mediaIndex:n}:void 0}if("avatar"===e.type){const{avatarOwner:i,profilePhotos:s,mediaIndex:n}=e,o=n+t;return o>=0&&s&&o<s.photos.length?{type:"avatar",avatarOwner:i,profilePhotos:s,mediaIndex:o}:void 0}if("sponsoredMessage"===e.type){const{message:i,mediaIndex:s}=e,n=s+t;return n>=0&&i?{type:"sponsoredMessage",message:i,mediaIndex:n}:void 0}const{message:i,mediaIndex:s}=e,n=(0,l.qG)(i);if(n){const e=s+t;if(e>=0&&e<n.extendedMedia.length)return{type:"message",message:i,mediaIndex:e}}const o=Ee?.indexOf(i.id);if(void 0===o)return;const a=Ee[o+t],r=K?.[a];return r?{type:"message",message:r}:void 0})),tt=(0,D.A)((e=>{if(!e)return void qe();const t="avatar"===e.type?e.avatarOwner.id:"message"===e.type?e.message.chatId:void 0,i="message"===e.type?e.message.id:void 0,s="standalone"===e.type?e.media:void 0;oe({origin:L,chatId:t,messageId:i,standaloneMedia:s,mediaIndex:e.mediaIndex,isAvatarView:"avatar"===e.type,withDynamicLoading:Z},{forceOnHeavyAnimation:!0})})),it=(0,D.A)((()=>{if((O?.photos.length||G?.length||Ee?.length||0)<=1||!Ne)return void qe();const e=et(Ne,-1);e?tt(e):"avatar"===Ne.type&&(0,u.L8)(Ne.avatarOwner.id)||"standalone"===Ne.type||qe()})),st=(0,M.A)();return(0,ee.FD)(ie.A,{id:"MediaViewer",isOpen:ve,isHidden:H,shouldAnimateFirstRender:!0,noCloseTransition:Q,children:[(0,ee.FD)("div",{className:"media-viewer-head",dir:st.isRtl?"rtl":void 0,ref:_e,children:[ge&&(0,ee.Y)(W.A,{className:"media-viewer-close",round:!0,size:"smaller",color:"translucent-white",ariaLabel:st("Close"),onClick:qe,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)(se.Ay,{activeKey:Ae.current,name:Ce,children:(0,ee.Y)(Mt,{item:Ne},Ie?.id)}),(0,ee.Y)(he,{mediaData:Me,isVideo:Ye,item:Ne,canUpdateMedia:B,canReportAvatar:Le,onBeforeDelete:it,onReportAvatar:ke,onCloseMediaViewer:qe,onForward:Ze}),(0,ee.Y)(te,{isOpen:ye,onClose:we,photo:x,peerId:U?.id})]}),(0,ee.Y)(wt,{item:Ne,loadMoreItemsIfNeeded:Xe,isLoadingMoreMedia:X,isSynced:ne,getNextItem:et,chatId:e,isPhoto:Fe,isGif:Be,threadId:t,avatarOwnerId:U?.id,origin:L,isOpen:ve,hasFooter:He,isVideo:Ye,withAnimation:z,onClose:qe,selectItem:tt,isHidden:H,onFooterClick:We,handleSponsoredClick:Qe})]})})));var Rt=i(2429);const Lt="W9A8SEMl",xt="gLHHo5k8",Et="GJVwqV9e",Vt="_Yn4SWUB",_t="hGCH03qc",Ut="ZecqXqKy",Ot="PVZ8TOWS",Kt="Wi0DXPH2",Jt="Ka1CGfzq",Gt="urTtSsk9",jt="AjXOHOgE",zt="uAlXNXJN",Ht="g8ypsnnC",$t="hGTnZuar",qt="TkphaPyQ",Wt="CvnxnCxN",Qt="nZ30pf4g",Zt="MnNC7VHS",Xt="G8OgmMDJ",ei=3.5*p.$,ti=.5*p.$;function ii(e,t=!1,i=!1){const s=document.createElement("div");s.classList.add(i?"TYicp2_K":"fME2l_yv");const n=new Image;if(n.draggable=!1,n.oncontextmenu=f.A,n.classList.add("HjoURJRK"),t){const t=document.createElement("canvas");t.classList.add(Zt),n.onload=()=>{const e=t.getContext("2d",{alpha:!1}),{width:i,height:s}=n;(0,r.RK)((()=>{t.width=i,t.height=s,b.QH&&(e.filter="blur(2px)"),e.drawImage(n,-4,-4,i+8,s+8),b.QH||(0,O.A)(e,0,0,i,s,2,2)}))},n.src=e,s.appendChild(t)}else n.src=e,s.appendChild(n);return s}function si(e,t){let i;const s=`#${(0,l.kR)(t)}`;switch(e){case o.G9.StoryRibbon:i=`#LeftColumn .${Rt.A.root}`;break;case o.G9.MiddleHeaderAvatar:i=".MiddleHeader .Transition_slide-active .ChatInfo";break;case o.G9.ChatList:i="#LeftColumn .chat-list";break;case o.G9.SearchResult:i="#LeftColumn .LeftSearch--container"}const n=document.querySelector(i),a=n&&n.querySelectorAll(`${s} img`);return{container:n,mediaEl:a?.[0]}}function ni({scale:e,slideAmount:t,isActiveSlideSize:i,isMoveThroughActiveSlide:s,isBackward:n}){const o=40+(i?405:135),a=(Math.abs(t)-1)*(40+(s?405:135)),r=(0,pe.Ki)((o+a)*e);return n?-r:r}function oi(){const{width:e,height:t}=(0,ke.A)();return(0,s.Kr)((()=>function(e,t){const i=function(e,t,i,s){const n=i/1200,o=s/800;return Math.min(n,o)}(0,0,e,t),s=(0,pe.Ki)(405*i),n=(0,pe.Ki)(135*i);return{activeSlide:{width:s,height:(0,pe.Ki)(720*i)},slide:{width:n,height:(0,pe.Ki)(240*i)},scale:i,toActiveScale:s/n,fromActiveScale:n/s}}(e,t)),[e,t])}function ai(e,t=!1,i=!1){const s=e&&"content"in e,n=e&&"isDeleted"in e,o=!!s&&(0,l.XR)(e),a=s&&Boolean(e.forwardInfo);let r;s&&(e.content.photo?.thumbnail&&(r=e.content.photo.thumbnail.dataUri),e.content.video?.thumbnail?.dataUri&&(r=e.content.video.thumbnail.dataUri));const c=s?(0,l.EN)(e):void 0,d=(0,j.A)(c),h=Boolean(s&&e.content.video),m=s&&e.content.video?.noSound,u=s?(0,l.EN)(e,"full"):void 0,p=(0,j.A)(u,!e,h?U.qZ.Progressive:U.qZ.BlobUrl),v=h&&s?(0,l.EN)(e,"full",!0):void 0,g=(0,j.A)(v,!e,U.qZ.Progressive),A=Boolean(p||g),b=h?d:p||d,f=!d&&!A,C=t&&s&&!e.noForwards,S=s?(0,l.EN)(e,"download"):void 0;return{isLoadedStory:s,isDeletedStory:n,hasText:o,hasForwardInfo:a,thumbnail:r,previewHash:c,previewBlobUrl:d,isVideo:h,noSound:m,fullMediaHash:u,fullMediaData:p,altMediaHash:v,altMediaData:g,hasFullData:A,bestImageData:b,hasThumb:f,canDownload:C,downloadMediaData:(0,j.A)(S,!C&&!i)}}var ri=i(80140),li=i(22720),ci=i(61361);const di="RGD70uBt",hi="HCYfPccW",mi="L8oRQyKb",ui=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e);return{isOpen:t.storyViewer?.isStealthModalOpen,stealthMode:e.stories.stealthMode,isCurrentUserPremium:(0,c.g29)(e)}}))((({isOpen:e,stealthMode:t,isCurrentUserPremium:i})=>{const{toggleStealthModal:o,activateStealthMode:a,showNotification:r,openPremiumModal:l}=(0,n.ko)(),[c,d]=(0,s.J0)(!1);(0,s.vJ)((()=>{if(!t)return;const e=(0,ri.Fm)();t.cooldownUntil&&t.cooldownUntil>e&&d(!0)}),[t,e]);const h=(0,M.A)(),m=(0,D.A)((()=>{d(!1)})),u=(0,D.A)((()=>{o({isOpen:!1})})),p=(0,D.A)((()=>{i?(a(),r({title:h("StealthModeOn"),message:h("StealthModeOnHint")}),o({isOpen:!1})):l({initialSection:"stories"})}));return(0,ee.FD)(Z.A,{className:"component-theme-dark",contentClassName:"GrE47IXS",isOpen:e,isSlim:!0,onClose:u,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",className:"NlWSF1pA",ariaLabel:h("Close"),onClick:u,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"qKi5jsGM",children:(0,ee.Y)(q.A,{name:"eye-crossed-outline"})}),(0,ee.Y)("div",{className:"BFctFGoT",children:h("StealthMode")}),(0,ee.Y)("div",{className:"fZIJH4IG",children:h(i?"StealthModeHint":"StealthModePremiumHint")}),(0,ee.FD)(li.A,{className:(0,me.A)(di,"smaller-icon"),multiline:!0,inactive:!0,leftElement:(0,ee.Y)(q.A,{name:"stealth-past",className:hi}),children:[(0,ee.Y)("span",{className:"title",children:h("HideRecentViews")}),(0,ee.Y)("span",{className:(0,me.A)("subtitle",mi),children:h("HideRecentViewsDescription")})]}),(0,ee.FD)(li.A,{className:(0,me.A)(di,"smaller-icon"),multiline:!0,inactive:!0,leftElement:(0,ee.Y)(q.A,{name:"stealth-future",className:hi,"aria-hidden":!0}),children:[(0,ee.Y)("span",{className:"title",children:h("HideNextViews")}),(0,ee.Y)("span",{className:(0,me.A)("subtitle",mi),children:h("HideNextViewsDescription")})]}),(0,ee.Y)(W.A,{className:"AM_sxoXP",size:"smaller",disabled:c,isShiny:!i,withPremiumGradient:!i,onClick:p,children:i?c?(0,ee.Y)(ci.A,{langKey:"AvailableIn",endsAt:t.cooldownUntil,onEnd:m}):h("EnableStealthMode"):h("UnlockStealthMode")})]})})));var pi=i(94189);const vi=(0,s.ph)((function({isOpen:e,story:t,onClose:i}){const{deleteStory:o,openNextStory:a}=(0,n.ko)(),r=(0,M.A)(),l=(0,s.hb)((()=>{t&&(a(),o({peerId:t.peerId,storyId:t.id}),i())}),[i,t]);return(0,ee.Y)(pi.A,{isOpen:e,onClose:i,title:r("DeleteStoryTitle"),text:r("DeleteStorySubtitle"),confirmLabel:r("Delete"),confirmHandler:l,confirmIsDestructive:!0,className:"component-theme-dark"})}));var gi=i(21309),Ai=i(63152),bi=i(87894),fi=i(79824),Ci=i(54960);const Si=(0,s.ph)((function({id:e,contactListIds:t,currentUserId:i,selectedIds:n,lockedIds:o,onSelect:a}){const r=(0,M.A)(),[l,c]=(0,s.J0)(""),d=(0,s.Kr)((()=>{const e=(t||[]).filter((e=>e!==i));return(0,bi.Am)((0,Yt.PU)({ids:[...n||[],...e],query:l,type:"user"}))}),[t,i,l,n]);return(0,ee.Y)(Ci.A,{itemIds:d,selectedIds:n??fi.p,lockedSelectedIds:o,filterValue:l,filterPlaceholder:r("Search"),searchInputId:`${e}-picker-search`,isSearchable:!0,withDefaultPadding:!0,forceShowSelf:!0,onSelectedIdsChange:a,onFilterChange:c,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"},e)}));var yi=i(82117),ki=i(12933);const wi=(0,s.ph)((function({isActive:e,contactListIds:t,usersById:i,currentUserId:o,onClose:a}){const{saveCloseFriends:r}=(0,n.ko)(),l=(0,M.A)(),[c,d]=(0,s.J0)(""),[h,m]=(0,s.J0)(!1),[u,p]=(0,s.J0)([]),v=(0,s.Kr)((()=>(t||[]).filter((e=>i[e]?.isCloseFriend))),[t,i]),g=(0,s.Kr)((()=>{const e=(t||[]).filter((e=>e!==o));return(0,bi.Am)((0,Yt.PU)({ids:[...v,...e],query:c,type:"user"}))}),[v,t,o,c]);(0,yi.A)((([t])=>{!t&&e&&(m(!1),p(v))}),[e,v]);const A=(0,s.hb)((e=>{p(e),m(!0)}),[]),b=(0,D.A)((()=>{r({userIds:u}),a()}));return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Ci.A,{itemIds:g||[],selectedIds:u,filterValue:c,filterPlaceholder:l("Search"),searchInputId:"close-friends-picker-search",isSearchable:!0,withDefaultPadding:!0,onSelectedIdsChange:A,onFilterChange:d,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),(0,ee.Y)("div",{className:(0,me.A)("BDK_pgpt",h&&"N8ujSwlC"),children:(0,ee.Y)(ki.A,{isShown:h,onClick:b,ariaLabel:l("Save"),children:(0,ee.Y)(q.A,{name:"check"})})})]})})),Ni={modal:"hz7SomkK",header:"NV6Rt2g9",closeButton:"SN1GFS6L",headerTitle:"gi0Y6Ns6",content:"sTaVDkiD",section:"eUiuPoEC",title:"iPPiw9DI",list:"OUP1Ss0W",option:"JL33Sa3b",checked:"qVPo_cVL",input:"zsDaUk0i",icon:"AfYCVlys",action:"njMeBBwY",optionContent:"TUAAnG2w",footer:"r24Qz2bf",info:"ljeRVBOm",submit:"RwNLN_rH"},Ii=[{name:"StoryPrivacyOptionEveryone",value:"everybody",color:["#50ABFF","#007AFF"],icon:"channel-filled",actions:"blockUserIds"},{name:"StoryPrivacyOptionContacts",value:"contacts",color:["#C36EFF","#8B60FA"],icon:"user-filled",actions:"blockContactUserIds"},{name:"StoryPrivacyOptionCloseFriends",value:"closeFriends",color:["#88D93A","#30B73B"],icon:"favorite-filled",actions:"closeFriends"},{name:"StoryPrivacyOptionSelectedContacts",value:"nobody",color:["#FFB743","#F69A36"],icon:"group-filled",actions:"allowUserIds"}];var Pi=function(e){return e[e.privacy=0]="privacy",e[e.allowList=1]="allowList",e[e.closeFriends=2]="closeFriends",e[e.denyList=3]="denyList",e}(Pi||{});const Yi=(0,s.ph)((0,n.EK)((e=>{const{storyViewer:{storyId:t,peerId:i}}=(0,c.nTw)(e),s=i&&t?(0,c.Msb)(e,i,t):void 0;return{story:s&&"content"in s?s:void 0,visibility:s&&"visibility"in s?s.visibility:void 0,contactListIds:e.contactList?.userIds,usersById:e.users.byId,currentUserId:e.currentUserId}}))((function({isOpen:e,story:t,visibility:i,contactListIds:o,usersById:a,currentUserId:r,onClose:c}){const{editStoryPrivacy:d,toggleStoryInProfile:h}=(0,n.ko)(),m=(0,M.A)(),[u,p,v]=(0,Y.A)(!1),[g,A]=(0,s.J0)(i),[b,C]=(0,s.J0)(t?.isInProfile),[S,y]=(0,s.J0)(Pi.privacy),[k,w]=(0,s.J0)("everybody"),N=S!==Pi.privacy,I=(0,s.Kr)((()=>(o||[]).filter((e=>a[e]?.isCloseFriend))),[o,a]),P=(0,s.Kr)((()=>{if(S===Pi.allowList&&(!g?.allowUserIds?.length||g.allowUserIds[0]===r))return[r]}),[S,r,g?.allowUserIds]),F=(0,s.Kr)((()=>k!==g?.visibility?[]:g?.blockUserIds||[]),[k,g?.blockUserIds,g?.visibility]),T=(0,D.A)((e=>{A({...g,allowUserIds:e?.length?e?.filter((e=>e!==r)):[r]})})),B=(0,D.A)((e=>{A({...g,blockUserIds:e,visibility:k})}));(0,s.vJ)((()=>{e&&(y(Pi.privacy),p())}),[e]),(0,s.vJ)((()=>{A(i)}),[i]);const R=(0,D.A)((()=>{S!==Pi.privacy?y(Pi.privacy):v()})),L=(0,D.A)((()=>{C(!b)})),x=(0,D.A)((()=>{d({peerId:t.peerId,storyId:t.id,privacy:g}),t.isInProfile!==b&&h({peerId:t.peerId,storyId:t.id,isInProfile:b}),v()}));return(0,ee.FD)(Z.A,{isOpen:u,className:(0,me.A)(Ni.modal,"component-theme-dark"),onClose:v,noBackdrop:!0,onCloseAnimationEnd:c,children:[(0,ee.FD)("div",{className:Ni.header,children:[(0,ee.Y)(W.A,{className:(0,me.A)(Ni.closeButton,"close-button"),round:!0,color:"translucent",size:"smaller",onClick:R,ariaLabel:m(N?"Common.Back":"Common.Close"),children:(0,ee.Y)("div",{className:(0,me.A)("animated-close-icon",N&&"state-back")})}),(0,ee.Y)(se.Ay,{name:"slideFade",activeKey:S,children:function(){switch(S){case Pi.privacy:return(0,ee.Y)("h3",{className:Ni.headerTitle,children:m("StoryPrivacyAlertEditTitle")});case Pi.allowList:return(0,ee.Y)("h3",{className:Ni.headerTitle,children:m("StoryPrivacyAlertSelectContactsTitle")});case Pi.closeFriends:return(0,ee.Y)("h3",{className:Ni.headerTitle,children:m("CloseFriends")});case Pi.denyList:return(0,ee.Y)("h3",{className:Ni.headerTitle,children:m("StoryPrivacyAlertExcludedContactsTitle")})}}()})]}),(0,ee.Y)(se.Ay,{activeKey:S,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",className:Ni.content,children:function(e){switch(S){case Pi.privacy:return function(){const e=t?(0,gi.qZ)(t.expireDate-t.date):0;return(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:Ni.section,children:[(0,ee.Y)("h3",{className:Ni.title,children:m("StoryPrivacyAlertSubtitleProfile")}),(0,ee.Y)("div",{className:Ni.list,children:Ii.map((e=>{return(0,ee.FD)("label",{className:(0,me.A)(Ni.option,e.value===g?.visibility&&Ni.checked),children:[(0,ee.Y)("input",{type:"radio",name:"story_privacy",className:Ni.input,value:e.value,checked:e.value===g?.visibility,onChange:()=>{return t=e.value,void A({...g,visibility:t});var t},teactExperimentControlled:!0}),(0,ee.Y)("span",{className:Ni.icon,style:`--color-from: ${e.color[0]}; --color-to: ${e.color[1]}`,children:(0,ee.Y)(q.A,{name:e.icon})}),(0,ee.FD)("div",{className:Ni.optionContent,children:[(0,ee.Y)("span",{className:(0,me.A)(Ni.option_name),children:m(e.name)}),e.actions&&(0,ee.FD)("div",{tabIndex:0,role:"button",className:Ni.action,"aria-label":m("Edit"),onClick:t=>{!function(e,t){switch((0,f.A)(e),t){case"closeFriends":y(Pi.closeFriends);break;case"allowUserIds":y(Pi.allowList);break;case"blockUserIds":y(Pi.denyList),w("everybody");break;case"blockContactUserIds":y(Pi.denyList),w("contacts")}}(t,e.actions)},children:[(0,ee.Y)("span",{className:Ni.actionInner,children:(t=e.actions,"closeFriends"===t?0===I.length?m("StoryPrivacyOptionCloseFriendsDetail"):1===I.length?(0,Yt.F9)(m,a[I[0]]):m("StoryPrivacyOptionPeople",I.length,"i"):"blockUserIds"===t&&"everybody"===g?.visibility||"blockContactUserIds"===t&&"contacts"===g?.visibility?g?.blockUserIds?.length?1===g.blockUserIds.length?m("StoryPrivacyOptionExcludePerson",(0,l.Yg)(a[g.blockUserIds[0]])):m("StoryPrivacyOptionExcludePeople",g.blockUserIds.length,"i"):m("StoryPrivacyOptionContactsDetail"):g?.allowUserIds&&0!==g.allowUserIds.length?1===g.allowUserIds.length?(0,l.Yg)(a[g.allowUserIds[0]]):m("StoryPrivacyOptionPeople",g.allowUserIds.length,"i"):m("StoryPrivacyOptionSelectedContactsDetail"))}),(0,ee.Y)(q.A,{name:"next"})]})]})]},e.value);var t}))})]}),(0,ee.Y)("div",{className:Ni.section,children:(0,ee.FD)(li.A,{ripple:!0,onClick:L,children:[(0,ee.Y)("span",{children:m("StoryKeep")}),(0,ee.Y)(Ai.A,{id:"group-notifications",label:m("StoryKeep"),checked:b,inactive:!0})]})}),(0,ee.FD)("div",{className:Ni.footer,children:[(0,ee.Y)("div",{className:Ni.info,children:m("StoryKeepInfo",e)}),(0,ee.Y)("div",{className:Ni.submit,children:(0,ee.Y)(W.A,{onClick:x,children:m("StoryPrivacyButtonSave")})})]})]})}();case Pi.closeFriends:return(0,ee.Y)(wi,{isActive:e,contactListIds:o,currentUserId:r,usersById:a,onClose:R},"close-friends");case Pi.denyList:return(0,ee.Y)(Si,{id:"deny-list",contactListIds:o,currentUserId:r,selectedIds:F,onSelect:B},"deny-list");case Pi.allowList:return(0,ee.Y)(Si,{id:"allow-list",contactListIds:o,lockedIds:P,currentUserId:r,selectedIds:g?.allowUserIds,onSelect:T},"allow-list")}}})]})})));var Fi=i(95807),Di=i(36353),Mi=i(73104),Ti=i(14),Bi=i(52674),Ri=i(95362),Li=i(48775),xi=i(46051),Ei=i(45470),Vi=i(39351),_i=i(38218),Ui=i(83057),Oi=i(66991),Ki=i(61157),Ji=i(92111),Gi=i(84408),ji=i(65843),zi=i(55158),Hi=i(59816),$i=i(61433),qi=i(91800),Wi=i(23565),Qi=i(35049),Zi=i(18501),Xi=i(11217),es=i(86070),ts=i(39877);const is=(0,s.ph)((0,n.EK)(((e,{forwardInfo:t})=>({sender:t.fromPeerId?(0,c.PVB)(e,t.fromPeerId):void 0,story:t.storyId&&t.fromPeerId?(0,c.Msb)(e,t.fromPeerId,t.storyId):void 0})))((({className:e,forwardInfo:t,sender:i,story:o})=>{const{openStoryViewer:a,loadPeerStoriesByIds:r,openChat:l}=(0,n.ko)(),c=(0,s.li)(),d=(0,M.A)();(0,s.vJ)((()=>{!o&&t.fromPeerId&&t.storyId&&r({peerId:t.fromPeerId,storyIds:[t.storyId]})}),[t,o]);const h=i?(0,Yt.F9)(d,i):t.fromName,m=(0,D.A)((()=>{const{fromPeerId:e,storyId:i}=t;e&&(!o||"isDeleted"in o&&o.isDeleted?l({id:e}):a({peerId:e,storyId:i,isSingleStory:!0}))})),{handleClick:p,handleMouseDown:v}=(0,Xi.Q)(m);return(0,ee.FD)(es.A,{ref:c,className:(0,me.A)("EmbeddedMessage",e,(0,Qi.y)(i,!0,!0)),dir:d.isRtl?"rtl":void 0,onClick:p,onMouseDown:v,children:[i?.color?.backgroundEmojiId&&(0,ee.Y)(ts.A,{emojiDocumentId:i.color.backgroundEmojiId,className:"EmbeddedMessage--background-icons"}),(0,ee.FD)("div",{className:"message-text",children:[function(){if(o&&"content"in o&&o.content.text)return(0,ee.Y)("p",{className:"embedded-text-wrapper",children:(0,Zi.fd)(o.content.text)})}(),(0,ee.Y)("div",{className:"message-title",children:function(){if(!i||!h)return;const e=(0,u.L8)(i.id)?"user-filled":"channel-filled";return(0,ee.FD)(ee.FK,{children:[e&&(0,ee.Y)(q.A,{name:e,className:"embedded-chat-icon"}),h&&(0,Ft.A)(h)]})}()})]})]})})));var ss=i(74936);const ns=(0,s.ph)((function({story:e,isExpanded:t,className:i,onExpand:n,onFold:o}){const a=(0,M.A)(),l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(),m=(0,Ti.A)(e,!0),u=m?.content.text,[p,v]=(0,s.J0)(!1),g=(0,Wi.A)(t||void 0,400),A=t||g;(0,s.vJ)((()=>{(0,r.RK)((()=>{c.current&&(t?(0,$i.YM)(c.current,Wt):(0,$i.HW)(c.current,Wt))}))}),[t]);const b=p&&!A,{shouldRender:f,transitionClassNames:C}=(0,Oe.A)(b,void 0,!0,"slow",!0);(0,s.Nf)((()=>{(0,r.YS)((()=>{const e=c.current,t=h.current;if(!e||!t)return;const{offsetWidth:i}=t;(0,r.RK)((()=>{e.style.setProperty("--expand-button-width",`${i}px`)}))}))}),[f,a]),(0,s.Nf)((()=>{(0,r.gm)((()=>{if(!c.current||!d.current)return;const e=c.current,t=d.current,i=t.offsetTop,{lineHeight:s,totalLines:n}=(0,qi.A)(t),o=n>3,a=i+3*s;return()=>{o&&((0,$i.YM)(e,"e1gyTmKe"),v(!0)),e.style.setProperty("--_overflow-shift",`${a}px`)}}))}),[u]),(0,s.vJ)((()=>{t||l.current?.scrollTo({top:0})}),[t]);const S=(0,me.A)("ilyTRZtw",A&&"HIMnUViv",f&&"Vq8pl_kQ");return(0,ee.FD)("div",{className:(0,me.A)("RKedwa0I",i),children:[(0,ee.Y)("div",{ref:c,className:S,role:b?"button":void 0,onClick:b?n:o,children:(0,ee.FD)("div",{ref:l,className:(0,me.A)("D_5mWNmi","allow-selection","custom-scroll"),children:[m?.forwardInfo&&(0,ee.Y)(is,{forwardInfo:m.forwardInfo,className:"_M8CgT7s"}),m&&u&&(0,ee.Y)("div",{ref:d,className:"hmFA5qb1",children:(0,ee.Y)(ss.A,{messageOrStory:m,withTranslucentThumbs:!0,forcePlayback:!0})})]})}),f&&(0,ee.Y)("div",{ref:h,className:(0,me.A)("bM5rlQtM",C),onClick:n,children:a("Story.CaptionShowMore")})]})}));var os=i(26875),as=i(11241);const rs="YVD19vOP",ls="vJRk_UUk",cs="nIv3YAnZ",ds=(0,s.ph)((({story:e,className:t})=>{const{openStoryViewModal:i,openForwardMenu:o,sendStoryReaction:r}=(0,n.ko)(),c=(0,M.A)(),{views:d,isOut:h,peerId:m,id:p,sentReaction:v}=e,{viewsCount:g,forwardsCount:A,reactionsCount:b}=d||{},f=!(0,u.L8)(m),C=v&&(0,l.a0)(v,a.tNZ),S=Boolean((h||f)&&e.isPublic&&!e.noForwards),y=(0,l.$_)(m,p),k=(0,s.Kr)((()=>{const{users:{byId:e}}=(0,n.mS)(),t=d&&"recentViewerIds"in d?d.recentViewerIds:void 0;if(t)return t.map((t=>e[t])).filter(Boolean)}),[d]),w=(0,D.A)((()=>{i({storyId:p})})),N=(0,D.A)((()=>{o({fromChatId:m,storyId:p})})),I=(0,D.A)((()=>{const e=v?void 0:a.tNZ;r({peerId:m,storyId:p,containerId:y,reaction:e})}));return g?(0,ee.FD)("div",{className:(0,me.A)(rs,t),children:[(0,ee.FD)("div",{className:(0,me.A)("cknL5COh",!f&&"pJAyeGkG"),onClick:f?void 0:w,children:[Boolean(k?.length)&&(0,ee.Y)(os.A,{size:"small",peers:k,className:"Vz_VtJ16"}),f?(0,ee.FD)("span",{className:cs,children:[(0,ee.Y)(q.A,{name:"channelviews",className:"WyBiNM6e"}),g]}):(0,ee.Y)("span",{className:cs,children:c("Views",g,"i")}),Boolean(b)&&!f&&(0,ee.FD)("span",{className:"sf3u_6Vh",children:[(0,ee.Y)(q.A,{name:"heart",className:"Er2XKRqi"}),b]})]}),(0,ee.Y)("div",{className:"kKoeDk3Z"}),S&&(0,ee.Y)(W.A,{color:"translucent",size:"smaller",round:!0,onClick:N,ariaLabel:c("Forward"),className:ls,children:(0,ee.Y)(q.A,{name:"forward"})}),f&&(0,ee.FD)(ee.FK,{children:[Boolean(A)&&(0,ee.FD)("div",{className:ls,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",nonInteractive:!0,ariaLabel:c("PublicShares"),children:(0,ee.Y)(q.A,{name:"loop"})}),(0,ee.Y)("span",{children:A})]}),(0,ee.FD)("div",{className:ls,children:[(0,ee.FD)(W.A,{round:!0,className:"lpDXVIuf",color:"translucent",size:"smaller",onClick:I,ariaLabel:c("AccDescrLike"),children:[v&&(0,ee.Y)(as.A,{containerId:y,reaction:v,withEffectOnly:C},(0,l.Jj)(v)),(!v||C)&&(0,ee.Y)(q.A,{name:C?"heart":"heart-outline",className:(0,me.A)(C&&"twgMDT1y")})]}),Boolean(b)&&(0,ee.Y)("span",{children:b})]})]})]}):(0,ee.Y)("div",{className:(0,me.A)(rs,t),children:c("NobodyViewed")})})),hs=(0,s.ph)((function({isActive:e,isViewed:t,isVideo:i,duration:s=6,isPaused:n,onImageComplete:o}){const a=(0,D.A)((e=>{i||"XY98E7VM"!==e.animationName||o()})),r=(0,me.A)("c1fbGgcx",t&&"xwOKghO2",e&&"ZuByYcIx",n&&"n9V6B7hP");return(0,ee.Y)("span",{className:r,"aria-hidden":!0,children:e&&(0,ee.Y)("i",{style:`--progress-duration: ${s}s`,className:"qyBCpJct",onAnimationEnd:a})})})),ms=b.Yw?4:3,us=(0,s.ph)((0,n.EK)(((e,{peerId:t,storyId:i,isDeleteModalOpen:s})=>{const{appConfig:n}=e,o=(0,c.mBe)(e,t),a=(0,c.hds)(e,t),r=(0,c.vGo)(e,t),l=(0,c.nTw)(e),{storyViewer:{isMuted:d,viewModal:h,isPrivacyModalOpen:m,isStealthModalOpen:u,storyList:p},forwardMessages:{storyId:v},premiumModal:g,safeLinkModalUrl:A,mapModal:b,reportModal:f,giftInfoModal:C,isPaymentMessageConfirmDialogOpen:S}=l,{isOpen:y}=g||{},k=(0,c.Msb)(e,t,i),w=k&&"content"in k,N=Boolean(S||h||v||l.reactionPicker?.storyId||f||m||y||s||A||u||b||C),I=w?k.forwardInfo:void 0,P=w?k.mediaAreas:void 0,Y=I?.fromPeerId||P?.find((e=>"channelPost"===e.type))?.channelId,F=Y?(0,c.PVB)(e,Y):void 0,D=(0,c.xYJ)(e,"mediaViewerAnimations"),M=w&&k.fromId?(0,c.PVB)(e,k.fromId):void 0,T=(0,c.WA9)(e,t),B=(0,c.trm)(e);return{peer:o||a,forwardSender:F,fromPeer:M,story:k,orderedIds:p?.storyIdsByPeerId[t],isMuted:d,isCurrentUserPremium:(0,c.g29)(e),shouldForcePause:N,storyChangelogUserId:n.storyChangelogUserId,viewersExpirePeriod:n.storyExpirePeriod+n.storyViewersExpirePeriod,isChatExist:Boolean(a),arePeerSettingsLoaded:Boolean(r?.settings),stealthMode:e.stories.stealthMode,withHeaderAnimation:D,paidMessagesStars:T,isAccountFrozen:B}}))((function({peerId:e,storyId:t,peer:i,forwardSender:o,fromPeer:r,isMuted:c,isArchivedStories:d,isPrivateStories:h,story:m,orderedIds:p,isSingleStory:v,dimensions:g,shouldForcePause:A,storyChangelogUserId:b,viewersExpirePeriod:f,isChatExist:C,arePeerSettingsLoaded:S,getIsAnimating:y,isCurrentUserPremium:k,stealthMode:w,withHeaderAnimation:N,onDelete:P,onClose:F,onReport:T,paidMessagesStars:B,isAccountFrozen:R}){const{viewStory:L,setStoryViewerMuted:x,openPreviousStory:E,openNextStory:V,loadPeerSkippedStories:_,openForwardMenu:O,copyStoryLink:K,toggleStoryInProfile:J,openChat:G,showNotification:j,openStoryPrivacyEditor:z,loadPeerSettings:H,fetchChat:$,loadStoryViews:Q,toggleStealthModal:Z}=(0,n.ko)(),X=(0,ri.Fm)(),te=(0,M.A)(),ie=(0,Vi.A)(),{isMobile:ne}=(0,I.Ay)(),[oe,ae,re]=(0,Y.A)(!1),[de,he,ue]=(0,Y.A)(!1),[ve,ge,Ae]=(0,Y.A)(!1),[be,fe,Ce]=(0,Y.A)(!0),[Se,ye,ke]=(0,Y.A)(!1),[we,Ne]=(0,s.J0)(!1),[Ie,Pe,Ye]=(0,Y.A)(!1),[Fe,De,Me]=(0,Y.A)(!1),Te=(0,s.li)(),{isDeletedStory:Be,hasText:Re,hasForwardInfo:Le,thumbnail:xe,previewBlobUrl:Ee,isVideo:Ve,noSound:Ue,fullMediaData:Ke,altMediaHash:Je,altMediaData:Ge,hasFullData:je,hasThumb:He,canDownload:$e,downloadMediaData:qe}=ai(m,k,Fe),We=m&&"content"in m,Qe=e===b,Ze=(0,u.L8)(e),Xe=!Ze,et=Xe&&(0,l.WX)(i),tt=We&&m.isOut,it=(0,Ti.A)(tt?!m.isInProfile:void 0,!0),st=(0,Ti.A)(tt?m.isInProfile:void 0,!0),nt=Boolean(tt&&m.date+f<(0,ri.Fm)()),ot=o?(0,Yt.F9)(te,o):We&&m.forwardInfo?.fromName,at=Boolean(We&&m.isPublic&&!Qe&&i?.hasUsername),rt=Boolean(We&&m.isPublic&&!m.noForwards&&!Qe&&!Se),lt=Boolean(je&&!A&&be&&!oe&&!Se&&!we&&!Ie),ct=We&&m.content.video?.duration?m.content.video.duration:void 0,dt=!(tt&&Ze||Qe||et||R),ht=We&&!dt&&(tt||et),mt=ne&&N?"slideFade":"none",{shouldRender:ut,transitionClassNames:pt}=(0,Oe.A)(!je),{transitionClassNames:vt}=(0,Oe.A)(Boolean(Ke)),gt=(0,Ei.A)(xe,!He),At=(0,Ui.A)(Ee),{shouldRender:bt,transitionClassNames:ft}=(0,Oe.A)(dt),{shouldRender:Ct,transitionClassNames:St}=(0,Oe.A)(Re&&Se),{transitionClassNames:yt}=(0,Oe.A)(!0),{shouldRender:kt,transitionClassNames:wt}=(0,Oe.A)(Re||Le),Nt=(0,Oi.Y)(Te,Ke,xi.G);(0,Ji.A)(e,t),(0,s.vJ)((()=>{t&&L({peerId:e,storyId:t})}),[t,e]),(0,s.vJ)((()=>{_({peerId:e})}),[e]),(0,s.vJ)((()=>{const t=(0,u.L8)(e);!C&&t&&$({chatId:e})}),[C,e]),(0,s.vJ)((()=>{C&&!S&&H({peerId:e})}),[S,C,e]);const It=(0,D.A)((()=>{Ve&&Te.current?.pause(),Ae(),ue()})),Pt=(0,D.A)((()=>{lt&&(he(),Ve||ge())})),Mt=(0,D.A)((()=>{Pe()})),Tt=(0,D.A)((()=>{Ye()})),Bt=(0,D.A)((()=>{De(),It()})),Rt=(0,D.A)((()=>{Me(),Pt()})),{onMouseDown:xt,onMouseUp:Et,onMouseLeave:Vt,onTouchStart:Ut,onTouchEnd:Gt}=(0,_i.A)({onStart:Mt,onEnd:Tt}),jt=(0,_e.A)(Te,void 0,!Ve||!Ke||Nt),zt=Ke&&(!Je||Ge);(0,s.vJ)((()=>{zt&&!jt&&Pt()}),[zt,jt]),(0,Ki.Ay)(Ce,fe),(0,s.vJ)((()=>{zt&&Te.current?.load()}),[zt]),(0,s.vJ)((()=>{!We||Be||nt||(tt||et)&&Q({peerId:e,storyId:t})}),[Be,nt,We,e,t,tt,et]),(0,s.vJ)((()=>{A||!be||oe||Se||we||Ie?It():Pt()}),[Pt,be,Se,oe,A,we,Ie]),(0,s.vJ)((()=>{if(!(oe||A||Se))return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){32===e.keyCode&&(e.preventDefault(),Ne(!we))}}),[Se,oe,we,A]),(0,yi.A)((([e,t,i,s,n])=>{!we||Se||oe||A||!be||Ie||t===Se&&e===oe&&i===A&&s===be&&n===Ie||Ne(!1)}),[oe,Se,A,be,Ie,we]);const Wt=(0,D.A)((()=>{F(),G({id:e})})),ei=(0,D.A)((()=>{F(),G({id:o.id})})),ti=(0,D.A)((()=>{F(),G({id:r.id})})),ii=(0,D.A)((()=>{E()})),si=(0,D.A)((()=>{V()})),ni=(0,D.A)((e=>{const t=e.currentTarget;t.readyState>=ms?ge():Ae(),ct&&(0,pe.LI)(t.currentTime,2)>=(0,pe.LI)(ct,2)&&si()}));(0,s.vJ)((()=>y()||oe?void 0:(0,Bi.A)({onRight:si,onLeft:ii})),[y,oe]);const oi=(0,D.A)((()=>{K({peerId:e,storyId:t})})),li=(0,D.A)((()=>{J({peerId:e,storyId:t,isInProfile:!0})})),ci=(0,D.A)((()=>{J({peerId:e,storyId:t,isInProfile:!1})})),di=(0,D.A)((()=>{P(m)})),hi=(0,D.A)((()=>{T()})),mi=(0,D.A)((()=>{O({fromChatId:e,storyId:t})})),ui=(0,D.A)((()=>{z()})),pi=(0,D.A)((()=>{const e=!We||m.isPublic?void 0:m.isForContacts?"contacts":m.isForCloseFriends?"closeFriends":"nobody";let t;const s=(0,Yt.F9)(te,i);switch(e){case"nobody":t=te("StorySelectedContactsHint",s);break;case"contacts":t=te("StoryContactsHint",s);break;case"closeFriends":t=te("StoryCloseFriendsHint",s);break;default:return}j({message:t})})),vi=(0,D.A)((()=>{Ue?j({message:te("Story.TooltipVideoHasNoSound")}):(Te.current.muted=!Te.current.muted,x({isMuted:!c}))})),gi=(0,D.A)((()=>{if(w.activeUntil&&(0,ri.Fm)()<w.activeUntil){const e=w.activeUntil-(0,ri.Fm)();j({title:te("StealthModeOn"),message:te("Story.ToastStealthModeActiveText",(0,ze.QO)(e)),duration:4e3})}else Z({isOpen:!0})})),Ai=(0,D.A)((()=>{qe&&(0,Ri.A)(qe,`story-${e}-${t}.${Ve?"mp4":"jpg"}`)}));(0,s.vJ)((()=>{Be&&j({message:te("StoryNotFound")})}),[te,Be]);const bi=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.Y)(W.A,{round:!0,ripple:!ne,size:"tiny",color:"translucent-white",onClick:e,className:(0,me.A)(qt,t&&"active"),ariaLabel:te("AccDescrOpenMenu2"),children:(0,ee.Y)(q.A,{name:"more"})})),[ne,te]);const fi=B?ie("ComposerPlaceholderPaidReply",{amount:(0,Li.U2)(ie,B,{asFont:!0,className:"placeholder-star-icon"})},{withNodes:!0}):te(Xe?"ReplyToGroupStory":"ReplyPrivately");return(0,ee.FD)("div",{className:(0,me.A)(Ht,"component-theme-dark"),onMouseDown:xt,onMouseUp:Et,onMouseLeave:Vt,onTouchStart:Ut,onTouchEnd:Gt,children:[(0,ee.FD)("div",{className:(0,me.A)("e7HHuS1g",yt),children:[(0,ee.Y)("div",{className:"jGDd2sza",children:(v?[t]:p??[]).map((e=>(0,ee.Y)(hs,{isActive:e===m?.id,isVideo:Ve,isViewed:Boolean(m?.id&&(h||d?e>m?.id:e<m?.id)),isPaused:!ve,duration:ct,onImageComplete:si},`progress-${e}`)))}),(0,ee.FD)("div",{className:"eMYhXF_X",children:[(0,ee.Y)(se.Ay,{activeKey:Number(e),name:mt,className:"PXnfXZur",children:(0,ee.FD)("div",{className:"WpyVfrsc",children:[(0,ee.Y)(Dt.A,{peer:i,size:"tiny",onClick:Wt}),(0,ee.FD)("div",{className:"jmKI_lhC",children:[(0,ee.Y)("span",{onClick:Wt,className:"H1uod43o",children:(0,Ft.A)((0,Yt.F9)(te,i)||"")}),(0,ee.FD)("div",{className:"zimpR8Hz",children:[ot&&(0,ee.FD)("span",{className:(0,me.A)($t,"JJFtefb9",o&&"BsqMBS2I"),onClick:o?ei:void 0,children:[(0,ee.Y)(q.A,{name:"loop"}),(0,ee.Y)("span",{className:Xt,children:(0,Ft.A)(ot)})]}),r&&(0,ee.FD)("span",{className:(0,me.A)($t,"nJr8QgYX"),onClick:ti,children:[(0,ee.Y)(Dt.A,{peer:r,size:"micro"}),(0,ee.Y)("span",{className:Xt,children:(0,Ft.A)((0,Yt.F9)(te,r)||"")})]}),m&&"date"in m&&(0,ee.Y)("span",{className:$t,children:(0,ze.jy)(te,X,m.date)}),We&&m.isEdited&&(0,ee.Y)("span",{className:$t,children:te("Story.HeaderEdited")})]})]})]})}),(0,ee.FD)("div",{className:"GrsJNw3y",children:[function(){if(!Ze)return;let e="channel-filled";const t={"channel-filled":["#50ABFF","#007AFF"],"user-filled":["#C36EFF","#8B60FA"],"favorite-filled":["#88D93A","#30B73B"],"group-filled":["#FFB743","#F69A36"]};if(tt){const{visibility:t}=m&&"visibility"in m&&m.visibility||{};switch(t){case"everybody":e="channel-filled";break;case"contacts":e="user-filled";break;case"closeFriends":e="favorite-filled";break;case"nobody":e="group-filled"}}else{if(!m||!("content"in m)||m.isPublic)return;e=m.isForCloseFriends?"favorite-filled":m.isForContacts?"user-filled":"group-filled"}return(0,ee.FD)("div",{className:(0,me.A)("prxptFFf",tt&&"_MVsZpgB"),onClick:tt?ui:pi,style:`--color-from: ${t[e][0]}; --color-to: ${t[e][1]}`,children:[(0,ee.Y)(q.A,{name:e}),tt&&(0,ee.Y)(q.A,{name:"next"})]})}(),Ve&&(0,ee.Y)(W.A,{className:qt,round:!0,ripple:!ne,size:"tiny",color:"translucent-white",disabled:!je,onClick:vi,ariaLabel:te("Volume"),children:(0,ee.Y)(q.A,{name:c||Ue?"speaker-muted-story":"speaker-story"})}),(0,ee.FD)(le.A,{className:"K0_xAdzf",trigger:bi,positionX:"right",onOpen:Bt,onClose:Rt,children:[at&&(0,ee.Y)(ce.A,{icon:"copy",onClick:oi,children:te("CopyLink")}),it&&(0,ee.Y)(ce.A,{icon:"save-story",onClick:li,children:te(Ze?"StorySave":"SaveToPosts")}),st&&(0,ee.Y)(ce.A,{icon:"delete",onClick:ci,children:te(Ze?"ArchiveStory":"RemoveFromPosts")}),$e&&(0,ee.Y)(ce.A,{icon:"download",disabled:!qe,onClick:Ai,children:te("lng_media_download")}),!tt&&Ze&&(0,ee.Y)(ce.A,{icon:"eye-crossed-outline",onClick:gi,children:te("StealthMode")}),!tt&&(0,ee.Y)(ce.A,{icon:"flag",onClick:hi,children:te("lng_report_story")}),tt&&(0,ee.Y)(ce.A,{icon:"delete",destructive:!0,onClick:di,children:te("Delete")})]}),(0,ee.Y)(W.A,{className:(0,me.A)(qt,"WlLsjJ2Z"),round:!0,size:"tiny",color:"translucent-white",ariaLabel:te("Close"),onClick:F,children:(0,ee.Y)(q.A,{name:"close"})})]})]})]}),(0,ee.FD)("div",{className:"YiuvOPgT",style:`width: ${g.width}px; height: ${g.height}px`,children:[(0,ee.Y)("canvas",{ref:gt,className:Zt}),Ee&&(0,ee.Y)("img",{src:Ee,draggable:!1,alt:"",className:(0,me.A)(Ot,"lQfkulvp",At)},`preview-${t}`),ut&&(0,ee.Y)(zi.A,{className:(0,me.A)(pt,Lt)}),!Ve&&Ke&&(0,ee.Y)("img",{src:Ke,alt:"",className:(0,me.A)(Ot,vt),draggable:!1}),Ve&&Ke&&(0,ee.FD)(ji.A,{ref:Te,className:(0,me.A)(Ot,vt),canPlay:de,muted:c,width:720,height:1280,draggable:!1,playsInline:!0,disablePictureInPicture:!0,isPriority:!0,onPause:Ae,onWaiting:Ae,disableRemotePlayback:!0,onTimeUpdate:ni,children:[(0,ee.Y)("source",{src:Ke,type:xi.G,width:"720"}),Ge&&(0,ee.Y)("source",{src:Ge,type:xi.w,width:"480"})]},`video-${t}`),!Ie&&!oe&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("button",{type:"button",className:(0,me.A)(Qt,"SXpRZiax"),onClick:ii,"aria-label":te("Previous")}),(0,ee.Y)("button",{type:"button",className:(0,me.A)(Qt,"twOBFwUE"),onClick:si,"aria-label":te("Next")})]}),We&&Ke&&(0,ee.Y)(Hi.A,{story:m,isActive:!0,isStoryPlaying:Fe},`area-overlay-${t}-${e}`),!ne&&(0,ee.Y)("div",{className:_t,children:(0,ee.FD)("div",{className:Kt,children:[(0,ee.Y)(Dt.A,{peer:i,withStory:!0,storyViewerMode:"disabled"}),(0,ee.Y)("div",{className:Jt,children:(0,Ft.A)((0,Yt.F9)(te,i)||"")})]})})]}),ht&&(0,ee.Y)(ds,{story:m,className:yt}),Ct&&(0,ee.Y)("div",{tabIndex:0,role:"button",className:(0,me.A)("Jd1DYS6Y",St),onClick:()=>ke(),"aria-label":te("Close")}),Re&&(0,ee.Y)("div",{className:(0,me.A)("sHNAfxzf",wt)}),kt&&(0,ee.Y)(ns,{story:m,isExpanded:Se,onExpand:ye,onFold:ke,className:wt},`caption-${t}-${e}`),bt&&(0,ee.Y)(Gi.A,{type:"story",chatId:e,threadId:U.l3,storyId:t,isReady:!tt,messageListType:"thread",isMobile:(0,I.Ny)(),editableInputCssSelector:a.iKt,editableInputId:a.YVZ,inputId:"story-input-text",className:(0,me.A)("FXineBYO",ft),inputPlaceholder:fi,onForward:rt?mi:void 0,onFocus:ae,onBlur:re})]})}))),ps=(0,s.ph)((0,n.EK)(((e,{peer:t})=>{const{storyViewer:{lastViewedByPeerId:i,origin:s,storyList:n}}=(0,c.nTw)(e);return{lastViewedId:t?.id?i?.[t.id]:void 0,origin:s,storyIdsForViewer:t?.id?n?.storyIdsByPeerId[t.id]:void 0}}))((function({peer:e,peerStories:t,lastViewedId:i,storyIdsForViewer:o,origin:a}){const{openStoryViewer:r,loadPeerSkippedStories:c}=(0,n.ko)(),d=(0,M.A)(),h=(0,s.Kr)((()=>{if(!t)return;const{orderedIds:e,lastReadId:s,byId:n}=t,a=e[e.length-1]!==s,r=i&&o?.includes(i)?i??(a?s??-1:-1):-1;return n[n[r]?.id||o?.[0]||e[0]]}),[i,t,o]),m=h&&"content"in h;(0,s.vJ)((()=>{h&&!m&&c({peerId:h.peerId})}),[h,m]);const u=m?h.content.video:void 0,p=m?(0,l.EN)(h):void 0,v=(0,j.A)(p)||u?.thumbnail?.dataUri;if(e&&h&&!("isDeleted"in h))return(0,ee.FD)("div",{className:Ht,onClick:()=>{r({peerId:h.peerId,storyId:h.id,origin:a})},children:[v&&(0,ee.Y)("img",{src:v,alt:"",className:Ot,draggable:!1}),m&&(0,ee.Y)(Hi.A,{story:h}),(0,ee.Y)("div",{className:_t,children:(0,ee.FD)("div",{className:Kt,children:[(0,ee.Y)(Dt.A,{peer:e,withStory:!0,storyViewerMode:"disabled"}),(0,ee.Y)("div",{className:Jt,children:(0,Ft.A)((0,Yt.F9)(d,e)||"")})]})})]})})));var vs=function(e){return e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e}(vs||{});const gs=(0,s.ph)((0,n.EK)((e=>{const{storyViewer:{peerId:t,storyId:i,isSinglePeer:s,isSingleStory:n,isPrivate:o,isArchive:a,storyList:r}}=(0,c.nTw)(e),{byPeerId:l,orderedPeerIds:{active:d}}=e.stories;return{byPeerId:l,peerIds:r?.peerIds??d,currentPeerId:t,currentStoryId:i,isSinglePeer:s,isSingleStory:n,isPrivate:o,isArchive:a}}),(e=>(0,c.gd2)(e)))((function({peerIds:e,currentPeerId:t,currentStoryId:i,isOpen:o,isSinglePeer:d,isSingleStory:h,isPrivate:m,isArchive:u,byPeerId:p,isDeleteModalOpen:v,onDelete:g,onClose:A,onReport:f}){const{stopActiveReaction:C}=(0,n.ko)(),S=(0,s.li)(),[y,k]=(0,s.J0)(t),[w,N]=(0,s.J0)(i),P=(0,V.A)(t),Y=(0,Ti.A)(u,!0),F=(0,Ti.A)(m,!0),M=(0,Ti.A)(d,!0),T=(0,Ti.A)(h,!0),B=oi(),{height:R,width:L}=(0,ke.A)(),x=(0,s.li)(void 0),E=(0,s.li)(!1),{isMobile:_}=(0,I.Ay)(),U=(0,s.li)({}),[O,K]=(0,s.Ul)(!1);function J(e,t){e&&(U.current[t]?U.current[t].current=e:U.current[t]={current:e})}(0,fe.A)({isActive:o,onBack:A,shouldBeReplaced:!0});const G=(0,s.Kr)((()=>{if(y&&(M||T))return[y];const t=y?e.indexOf(y):-1;if(!y||-1===t)return[];const i=Math.max(t-4,0),s=Math.min(t+5,e.length);return e.slice(i,s)}),[T,M,y,e]),j=(0,s.Kr)((()=>G.length&&y?G.indexOf(y):-1),[y,G]),z=(0,s.Kr)((()=>G.length&&t?G.indexOf(t):-1),[t,G]);(0,s.vJ)((()=>{_&&k(t)}),[t,_]),(0,s.vJ)((()=>{y===t&&i!==w&&N(i)}),[t,i,y,w]),(0,s.vJ)((()=>{if(!_)return P&&P!==t&&K(!0),()=>{K(!1)}}),[P,t,K,_]),(0,s.vJ)((()=>()=>{i&&t&&C({containerId:(0,l.$_)(t,i)})}),[i,t]);const H=z-j,$=j>z,q=(0,D.A)((()=>e.reduce(((i,s,n)=>{if(s===y)i[s]=ni({scale:B.scale,slideAmount:H,isBackward:$,isActiveSlideSize:$});else{let o=!1;!$&&n>0&&e[n-1]===y&&(o=!0),$&&n<e.length-1&&e[n+1]===y&&(o=!0),i[s]=ni({scale:B.scale,slideAmount:H,isBackward:$,isActiveSlideSize:t===s&&!$,isMoveThroughActiveSlide:o})}return i}),{})));(0,s.vJ)((()=>{if(!S.current||!o)return;let e=0;const t=()=>y?U.current[y]?.current:void 0,i=i=>{if(E.current)return void(E.current=!1);const s=t();if(s)if(e<-50){const e=document.getElementById(a.YVZ);e&&(0,r.RK)((()=>{(0,Di.A)(e)}))}else e>50?(A(),"wheel"===i.type&&((0,Mi.M6)(),setTimeout(Mi.v5,1500))):(0,r.RK)((()=>{s.style.setProperty("--slide-translate-y","0px")}))};return(0,ue.wJ)(S.current,{isNotPassive:!0,withNativeDrag:!0,withWheelDrag:!0,excludedClosestSelector:".Composer",onDrag:(s,n,{dragOffsetX:o,dragOffsetY:a})=>{if(E.current)return;if(b.pz&&"touchstart"===n.type){const{pageX:e}=n.touches[0];if(e<=ue.h6||e>=L-ue.h6)return}if("mousemove"===s.type)return;const l=Math.abs(o),c=Math.abs(a),d=t();if(d&&(x.current===vs.Vertical||Math.abs(c)>ue.no||c/l>ue.fG)){x.current=vs.Vertical;const t=R;e=(0,pe.qE)(a,-t,t),e>0&&(0,r.RK)((()=>{d.style.setProperty("--slide-translate-y",e*(_?1:-1)+"px")})),"wheel"===s.type&&Math.abs(e)>100&&(i(s),E.current=!0)}},onRelease:i})}),[o,A,L,R,_,y]),(0,s.Nf)((()=>{if(_)return;const e=q();Object.entries(U.current).forEach((([i,{current:s}])=>{if(!s)return;if(!O())return s.classList.remove(Et,Vt,Ut),s.style.setProperty("--slide-translate-x","0px"),s.style.setProperty("--slide-translate-y","0px"),s.style.setProperty("--slide-translate-scale","1"),void s.style.setProperty("--slide-content-scale",String(B.toActiveScale));let n=0;i===y&&(n=-1.75*B.fromActiveScale,s.classList.add(Ut)),i===t&&(n=1.75,s.classList.add(Vt)),s.classList.add(Et),s.style.setProperty("--slide-translate-x",`${e[i]||0}px`),s.style.setProperty("--slide-translate-y",`${n}rem`),s.style.setProperty("--slide-translate-scale",t===i?String(B.toActiveScale):i===y?String(B.fromActiveScale):"1")}))}),[t,O,y,B,_]);const W=(0,D.A)((e=>{const s=e.target;s&&s.classList.contains(zt)&&(y!==t?(k(t),N(i)):i!==w&&N(i),K(!1))}));return _?(0,ee.Y)("div",{className:xt,ref:S,children:(0,ee.Y)("div",{className:jt,ref:e=>J(e,y),children:(0,ee.Y)(us,{peerId:y,storyId:w,onDelete:g,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:Y,isDeleteModalOpen:v,isSingleStory:h,getIsAnimating:O,onClose:A,onReport:f})})}):(0,ee.FD)("div",{className:xt,ref:S,style:`--story-viewer-scale: ${B.scale}`,onTransitionEnd:W,children:[(0,ee.Y)("div",{className:Lt,onClick:A}),G.length>1&&(0,ee.Y)("div",{className:"xe67dhtF",style:`height: ${B.slide.height}px`}),G.map(((e,t)=>e===y?function(e){const t=_?void 0:(0,Fi.A)(`width: ${B.activeSlide.width}px`,`--slide-media-height: ${B.activeSlide.height}px`);return(0,ee.Y)("div",{ref:t=>J(t,e),className:(0,me.A)(Gt,zt),style:t,children:(0,ee.Y)(us,{peerId:e,storyId:w,onDelete:g,dimensions:B.activeSlide,isPrivateStories:F,isArchivedStories:Y,isDeleteModalOpen:v,isSingleStory:h,getIsAnimating:O,onClose:A,onReport:f})},e)}(y):function(e,t,i){const s=(0,Fi.A)(`width: ${B.slide.width}px`,`height: ${B.slide.height}px`),o=(0,me.A)(Gt,"Sef28wEh",`slide-${i}`);return(0,ee.Y)("div",{ref:t=>J(t,e),className:o,style:s,children:(0,ee.Y)(ps,{peer:(0,c.PVB)((0,n.mS)(),e),peerStories:p?.[e]})},e)}(e,0,t-j)))]})})));function As(e=5){const[t,i]=(0,s.J0)(!0),[n,o]=(0,s.J0)(!0);return{isAtBeginning:t,isAtEnd:n,handleScroll:(0,D.A)((t=>{const{scrollHeight:s,scrollTop:n,clientHeight:a}=t.target;i(n<e),o(s-n-a<e)}))}}var bs=i(46222),fs=i(283),Cs=i(36393),Ss=i(51083),ys=i(17751),ks=i(17794);const ws={"views-list":"gpDY8bos",viewsList:"gpDY8bos","views-list-loading":"vuRAfQ5v",viewsListLoading:"vuRAfQ5v",info:"AOSUIChK",centeredInfo:"oGLhkkS7","view-reaction":"MLaabS6n",viewReaction:"MLaabS6n",header:"d3N2bktu",content:"QmRA3HZK","top-button":"Dkv8GAxf",topButton:"Dkv8GAxf","contact-filter":"YpB_9VxE",contactFilter:"YpB_9VxE",selected:"DoUlpdZJ",sort:"axDpgq9G","sort-button":"Bm5VA66f",sortButton:"Bm5VA66f","icon-sort":"YVQiH93R",iconSort:"YVQiH93R","icon-down":"NXP9aMD0",iconDown:"NXP9aMD0",search:"QQQqBLK6","bottom-info":"_CSv6suH",bottomInfo:"_CSv6suH",scrolled:"RYQ0liYe",footer:"dUK7rP37",closeButton:"abPzLiCH","opacity-fade-in":"cX8oY3zb",opacityFadeIn:"cX8oY3zb",fadeIn:"Sx_aeh1o",blocked:"L82sciL8",check:"UqGBKwjg",menuBubble:"dRqemuTA","with-colored-status":"GQ96fta9",withColoredStatus:"GQ96fta9"},Ns=1.5*p.$,Is=(0,s.ph)((0,n.EK)(((e,{storyView:t})=>({peer:(0,c.PVB)(e,t.peerId),availableReactions:e.reactions.availableReactions})))((({storyView:e,peer:t,availableReactions:i})=>{const{openChat:o,closeStoryViewer:a,unblockUser:r,blockUser:c,deleteContact:d,updateStoryView:h,focusMessage:m,openStoryViewer:p,closeStoryViewModal:v}=(0,n.ko)(),g=(0,M.A)(),A=(0,D.A)((()=>{const{type:t}=e;if("repost"===t)return v(),void p({peerId:e.peerId,storyId:e.storyId});a(),setTimeout((()=>{"user"===t?o({id:e.peerId}):"forward"===t&&m({chatId:e.peerId,messageId:e.messageId})}),100)})),b=(0,s.Kr)((()=>{if(!(0,u.L8)(e.peerId))return;const{peerId:i,areStoriesBlocked:s,isUserBlocked:n}=e,o=t,{isContact:a}=o||{},m=(0,l.Yg)(o),p=[];return n||(s?p.push({handler:()=>{r({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!1})},title:g("StoryShowBackTo",m),icon:"play-story"}):p.push({handler:()=>{c({userId:i,isOnlyStories:!0}),h({userId:i,areStoriesBlocked:!0})},title:g("StoryHideFrom",m),icon:"hand-stop"})),a?p.push({handler:()=>{d({userId:i})},title:g("DeleteContact"),icon:"delete-user",destructive:!0}):p.push({handler:()=>{n?(r({userId:i}),h({userId:i,isUserBlocked:!1})):(c({userId:i}),h({userId:i,isUserBlocked:!0}))},title:g(n?"Unblock":"BlockUser"),icon:n?"user":"delete-user",destructive:!n}),p}),[g,e,t]),f="user"===e.type?"message-read":"forward"===e.type?"forward":"loop",C="forward"===e.type||"repost"===e.type,S=(0,s.Kr)((()=>{const t="repost"===e.type&&e.story.forwardInfo?.isModified,i=[(0,ze.U)(g,1e3*e.date)];return t&&i.push(g("lng_edited")),i.join(" • ")}),[g,e]);return(0,ee.Y)(li.A,{className:(0,me.A)("chat-item-clickable small-icon",ws.opacityFadeIn,(e.isUserBlocked||e.areStoriesBlocked)&&ws.blocked),onClick:A,rightElement:"user"===e.type&&e.reaction?(0,ee.Y)(ks.A,{reaction:e.reaction,className:ws.viewReaction,size:Ns,availableReactions:i,withIconHeart:!0}):void 0,contextActions:b,withPortalForMenu:!0,menuBubbleClassName:ws.menuBubble,children:(0,u.L8)(e.peerId)?(0,ee.Y)(ys.A,{className:(0,me.A)(C&&ws.withColoredStatus),userId:e.peerId,noStatusOrTyping:!0,status:S,statusIcon:f,withStory:!0,forceShowSelf:!0}):(0,ee.Y)(Ss.A,{className:(0,me.A)(C&&ws.withColoredStatus),chatId:e.peerId,status:S,statusIcon:f,withStory:!0})},e.peerId)}))),Ps=(0,s.ph)((0,n.EK)((e=>{const{appConfig:t}=e,{storyViewer:{viewModal:i}}=(0,c.nTw)(e),{storyId:s,views:n,nextOffset:o,isLoading:a}=i||{},r=s?(0,c.Msb)(e,e.currentUserId,s):void 0;return{storyId:s,views:n,viewersExpirePeriod:t.storyExpirePeriod+t.storyViewersExpirePeriod,story:r&&"content"in r?r:void 0,nextOffset:o,isLoading:a,availableReactions:e.reactions.availableReactions,isCurrentUserPremium:(0,c.g29)(e)}}))((function({story:e,viewersExpirePeriod:t,views:i,nextOffset:o,isLoading:r,isCurrentUserPremium:l}){const{loadStoryViewList:c,closeStoryViewModal:d,clearStoryViews:h}=(0,n.ko)(),[m,u,p]=(0,Y.A)(!1),[v,g,A]=(0,Y.A)(!0),[b,f]=(0,s.J0)(""),C=(0,M.A)(),S=Boolean(e),y=Boolean(e?.date)&&e.date+t<(0,ri.Fm)(),{viewsCount:k=0,reactionsCount:w=0}=e?.views||{},N=e?.isPublic&&k>a.XQO,I=w>a.$4F,P=k>a.frj,F=N||I||P;(0,s.vJ)((()=>{S||(f(""),p(),g())}),[S]);const T=(0,Ae.A)((()=>{h({isLoading:!0})}),[],250,!0);(0,s.vJ)((()=>{T()}),[m,v,b,T]);const B=(0,s.Kr)((()=>i?.sort(function(e){return(t,i)=>{if(e){const e="user"===t.type&&t.reaction,s="user"===i.type&&i.reaction;if(e&&!s)return-1;if(!e&&s)return 1}return i.date-t.date}}(v))),[v,i]),R=B?.length?1:Math.min(k,8),L=Boolean(B?.length)&&B.length<k&&y,x=(0,D.A)((()=>{e?.id&&void 0!==o&&c({peerId:e.peerId,storyId:e.id,offset:o,areReactionsFirst:v||void 0,areJustContacts:m||void 0,query:b})})),{handleScroll:E,isAtBeginning:V}=As(),_=(0,D.A)((()=>{d()})),U=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.FD)(W.A,{fluid:!0,size:"tiny",color:"translucent",className:(0,me.A)(!t&&"active",ws.sortButton,ws.topButton),faded:t,onClick:e,ariaLabel:C("SortBy"),children:[(0,ee.Y)(q.A,{name:v?"heart-outline":"recent",className:ws.iconSort}),(0,ee.Y)(q.A,{name:"down",className:ws.iconDown})]})),[v,C]);return(0,ee.FD)(Z.A,{isOpen:S,onClose:_,className:"component-theme-dark",contentClassName:ws.viewsList,isSlim:!0,children:[F&&(0,ee.FD)("div",{className:ws.header,children:[N&&(0,ee.FD)("div",{className:ws.contactFilter,children:[(0,ee.Y)(W.A,{className:(0,me.A)(!m&&ws.selected,ws.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:p,children:C("AllViewers")}),(0,ee.Y)(W.A,{className:(0,me.A)(m&&ws.selected,ws.topButton),size:"tiny",color:"translucent-white",fluid:!0,onClick:u,children:C("Contacts")})]}),I&&(0,ee.FD)(le.A,{className:ws.sort,trigger:U,positionX:"right",children:[(0,ee.FD)(ce.A,{icon:"heart-outline",onClick:g,children:[C("SortByReactions"),v&&(0,ee.Y)(q.A,{name:"check",className:ws.check})]}),(0,ee.FD)(ce.A,{icon:"recent",onClick:A,children:[C("SortByTime"),!v&&(0,ee.Y)(q.A,{name:"check",className:ws.check})]})]}),P&&(0,ee.Y)(Cs.A,{className:ws.search,value:b,onChange:f})]}),(0,ee.FD)("div",{className:(0,me.A)(ws.content,!V&&ws.topScrolled,"custom-scroll"),onScroll:E,children:[y&&!r&&!b&&Boolean(!B?.length)&&(0,ee.Y)("div",{className:(0,me.A)(ws.info,ws.centeredInfo),children:(0,Ft.A)(C(l?"ServerErrorViewers":"ExpiredViewsStub"),["simple_markdown","emoji"])}),!r&&Boolean(b.length)&&!B?.length&&(0,ee.Y)("div",{className:ws.info,children:C("Story.ViewList.EmptyTextSearch")}),(0,ee.FD)(bs.A,{items:B,onLoadMore:x,children:[B?.map((e=>{const t="forward"===e.type?e.messageId:"repost"===e.type?e.storyId:"user";return(0,ee.Y)(Is,{storyView:e},`${e.peerId}-${e.date}-${t}`)})),r&&Array.from({length:R}).map(((e,t)=>(0,ee.Y)(li.A,{className:"chat-item-clickable contact-list-item scroll-item small-icon",disabled:!0,children:(0,ee.Y)(fs.A,{})},`placeholder-${t}`))),L&&(0,ee.Y)("div",{className:(0,me.A)(ws.info,ws.bottomInfo),children:C("Story.ViewList.NotFullyRecorded")},"not-all-available")]})]}),(0,ee.Y)("div",{className:(0,me.A)(ws.footer,"dialog-buttons"),children:(0,ee.Y)(W.A,{className:(0,me.A)("confirm-dialog-button",ws.close),isText:!0,onClick:_,children:C("Close")})})]})}))),Ys=(0,s.ph)((0,n.EK)((e=>{const{shouldSkipHistoryAnimations:t,storyViewer:{storyId:i,peerId:s,isPrivacyModalOpen:n,origin:o}}=(0,c.nTw)(e),a=s&&i?(0,c.Msb)(e,s,i):void 0,r=(0,c.xYJ)(e,"mediaViewerAnimations");return{isOpen:(0,c.gd2)(e),shouldSkipHistoryAnimations:t,peerId:s,storyId:i,story:a,origin:o,withAnimation:r,isPrivacyModalOpen:n}}))((function({isOpen:e,peerId:t,storyId:i,story:o,origin:l,shouldSkipHistoryAnimations:c,withAnimation:d,isPrivacyModalOpen:u}){const{closeStoryViewer:p,closeStoryPrivacyEditor:v,reportStory:g}=(0,n.ko)(),b=(0,M.A)(),[f,C]=(0,s.J0)(void 0),[S,k,w]=(0,Y.A)(!1),{bestImageData:N,thumbnail:I}=ai(o),P=oi(),F=(0,V.A)(e),T=(0,V.A)(N),B=(0,V.A)(t),R=(0,V.A)(l),L=Boolean(d&&!c);(0,s.vJ)((()=>{e||(C(void 0),w())}),[e]),(0,s.vJ)((()=>{if(!e)return;(0,m.FD)();const t=(0,_.w4)();return()=>{(0,m.wb)(),t()}}),[e]);const x=(0,s.hb)((()=>{p()}),[p]),E=(0,D.A)((e=>{C(e),k()})),U=(0,D.A)((()=>{w(),C(void 0)})),O=(0,D.A)((()=>{i&&g({storyId:i,peerId:t})}));return(0,s.vJ)((()=>e?(0,h.A)((()=>{x()})):void 0),[x,e]),(0,s.vJ)((()=>{L&&!F&&e&&t&&I&&void 0!==l&&((0,s.VK)(250+a.xB5),function(e,t,i,s,n){const{mediaEl:o}=si(t,e);if(!o)return;const{width:l,height:c}=y.A.get();let{width:d,height:h}=n;const m=l<=600;if(m){d=l-2*ti,h=c-ei-2*ti;const e=getComputedStyle(document.documentElement).getPropertyValue("--safe-area-bottom");e&&(h-=parseFloat(e))}const u=m?ti:(l-d)/2,p=m?ti:(c-(h+ei))/2,{top:v,left:g,width:b,height:f}=o.getBoundingClientRect(),C=g+b/2-(u+d/2),S=v+f/2-(p+h/2),k=b/d,w=f/h;(0,r.RK)((()=>{const e=ii(s||i,!s);(0,A.ZM)(e,{top:`${p}px`,left:`${u}px`,width:`${d}px`,height:`${h}px`,transform:`translate3d(${C}px, ${S}px, 0) scale(${k}, ${w})`});const t=document.getElementById("StoryViewer");t.appendChild(e),document.body.classList.add("ghost-animating"),(0,r.RK)((()=>{(0,A.ZM)(e,{transform:""}),setTimeout((()=>{(0,r.RK)((()=>{t.contains(e)&&t.removeChild(e),document.body.classList.remove("ghost-animating")}))}),200+a.xB5)}))}))}(t,l,I,N,P.activeSlide)),L&&F&&!e&&B&&T&&void 0!==R&&((0,s.VK)(250+a.xB5),function(e,t,i){const{mediaEl:s}=si(t,e),n=document.getElementById("StoryViewer").querySelector(`.${jt} .${Ot}, .${zt} .${Ot}`);if(!n||!s)return;const{top:o,left:l,width:c,height:d}=n.getBoundingClientRect(),{top:h,left:m,width:u,height:p}=s.getBoundingClientRect(),v=m+u/2-(l+c/2),g=h+p/2-(o+d/2),b=u/c,f=p/d;(0,r.RK)((()=>{const e=ii(i);(0,A.ZM)(e,{top:`${o}px`,left:`${l}px`,width:`${c}px`,height:`${d}px`});const t=ii(s.src,void 0,!0),n=o+d/2-c/2;(0,A.ZM)(t,{top:`${n}px`,left:`${l}px`,width:`${c}px`,height:`${c}px`});const h=document.getElementById("StoryViewer");h.appendChild(e),document.body.appendChild(t),document.body.classList.add("ghost-animating"),(0,r.RK)((()=>{(0,A.ZM)(e,{transform:`translate3d(${v}px, ${g}px, 0) scale(${b}, ${f})`}),(0,A.ZM)(t,{transform:`translate3d(${v}px, ${g}px, 0) scale(${b})`,opacity:"1"}),setTimeout((()=>{(0,r.RK)((()=>{h.contains(e)&&h.removeChild(e),document.body.contains(t)&&document.body.removeChild(t),document.body.classList.remove("ghost-animating")}))}),200+a.xB5)}))}))}(B,R,T))}),[L,N,T,e,F,P.activeSlide,I,t,B,l,R]),(0,ee.FD)(ie.A,{id:"StoryViewer",className:"bu_hGbaa",isOpen:e,shouldAnimateFirstRender:!0,noCloseTransition:c,children:[(0,ee.Y)("div",{className:"OFh6u50Q",onClick:x}),(0,ee.Y)(W.A,{className:"Mye8Dwxa",round:!0,size:"smaller",color:"translucent-white",ariaLabel:b("Close"),onClick:x,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)(gs,{isOpen:e,isDeleteModalOpen:S,onReport:O,onClose:x,onDelete:E}),(0,ee.Y)(vi,{isOpen:S,story:f,onClose:U}),(0,ee.Y)(Ps,{}),(0,ee.Y)(ui,{}),(0,ee.Y)(Yi,{isOpen:u,onClose:v})]})})));var Fs=i(79582),Ds=i(63527),Ms=i(96374),Ts=i(79174),Bs=i(10328),Rs=i(52745),Ls=i(34431),xs=i(38102),Es=i(45780);const Vs=2.75*p.$,_s="ChatOrUserPicker-item",Us=(0,s.ph)((({isOpen:e,currentUserId:t,chatOrUserIds:i,search:o,searchPlaceholder:r,className:d,loadMore:h,onSearchChange:m,onSelectChatOrUser:u,onClose:p,onCloseAnimationEnd:v,isLowStackPriority:g})=>{const{loadTopics:A}=(0,n.ko)(),b=(0,M.A)(),f=(0,s.li)(),C=(0,s.li)(),S=(0,s.li)(),y=(0,s.li)(),[k,w]=(0,Ms.A)(h,i,Boolean(o)),[N,I]=(0,s.J0)(void 0),[P,Y]=(0,s.J0)(""),F=N?1:0,T=i.indexOf(k[0]),B=(0,D.A)((()=>{m("")}));(0,Ts.A)(S,e&&0===F,B),(0,Ts.A)(y,e&&1===F);const R=(0,D.A)((e=>{if(N)return(0,c.pSx)(e,N)})),L=(0,Ds.A)(R),[x,E]=(0,s.Kr)((()=>{const e=(0,n.mS)(),t=e.chats.byId,i=e.chats.fullInfoById,s=t[N];if(!s||!L)return[void 0,void 0];const o=P.toLowerCase(),a=L?Object.values(L).reduce(((e,t)=>(!(0,l.__)(s,t,void 0,i[N])||o&&!t.title.toLowerCase().includes(o)||(e[t.id]=t),e)),{}):L;return[Object.keys(a).map(Number),a]}),[N,P,L]),V=(0,D.A)((()=>{I(void 0),Y("")})),_=(0,D.A)((e=>{m(e.currentTarget.value)})),U=(0,D.A)((e=>{Y(e.currentTarget.value)})),O=(0,Bs.A)(f,e,(e=>{if(k&&k.length>0){const t=(0,n.mS)().chats.byId,i=k[-1===e?0:e],s=t[i];s?.isForum?(L||A({chatId:i}),I(i)):u(i)}}),`.${_s}`,!0),K=(0,Bs.A)(C,e,(e=>{x?.length&&u(N,x[-1===e?0:e])}),`.${_s}`,!0),J=(0,D.A)((e=>{const t=(0,n.mS)().chats.byId,i=t?.[e];i?.isForum?(L||A({chatId:e}),I(e),B()):u(e)})),G=(0,s.hb)(((e,i)=>{const s=(0,n.mS)();let o=(0,c.PVB)(s,e);if(!o)return;const r=(0,c.k2W)(s,e);r&&(o=r);const d=o&&!(0,Yt.vj)(o)?o.isSelf:void 0,[h,m]=function(){if(!o)return;if(o.id===t)return[b("SavedMessagesInfo")];if((0,Yt.vj)(o))return[(0,l.sT)(b,o)];const e=(0,c.K0y)(s,o.id);return[(0,l.CD)(b,o,e),(0,me.A)((0,l.PF)(o,e,!0)&&"online")]}()||[];return(0,ee.Y)(Es.A,{className:_s,title:(0,ee.Y)("div",{className:"title-wrapper",children:(0,ee.Y)(Ls.A,{className:"item-title",peer:o,isMonoforum:Boolean(r),isSavedMessages:d})}),avatarElement:(0,ee.Y)(Dt.A,{peer:o,asMessageBubble:Boolean(r),isSavedMessages:d,size:"medium"}),subtitle:h,subtitleClassName:m,ripple:!0,style:`top: ${(T+i)*a.xw7}px;`,onClick:()=>J(e)},e)}),[t,b,T]);return(0,ee.Y)(Z.A,{isOpen:e,className:(0,me.A)("ChatOrUserPicker",d),onClose:p,onCloseAnimationEnd:v,isLowStackPriority:g,children:(0,ee.Y)(se.Ay,{activeKey:F,name:"slideFade",slideClassName:"ChatOrUserPicker_slide",children:()=>1===F?(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"modal-header",dir:b.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:b("Back"),onClick:V,children:(0,ee.Y)(q.A,{name:"arrow-left"})}),(0,ee.Y)(Q.A,{ref:y,value:P,onChange:U,onKeyDown:K,placeholder:r})]}),(0,ee.FD)(bs.A,{ref:C,className:"picker-list custom-scroll",items:x,withAbsolutePositioning:!0,maxHeight:56*(x?.length||0),onKeyDown:K,children:[!x&&(0,ee.Y)(Rs.A,{}),x?.map(((e,t)=>(0,ee.Y)(Es.A,{className:_s,onClick:()=>u(N,e),style:`top: ${56*(T+t)}px;`,avatarElement:(0,ee.Y)(xs.A,{size:Vs,topic:E[e],className:"topic-icon",letterClassName:"topic-icon-letter"}),title:(0,Ft.A)(E[e].title)},`${N}_${e}`)))]})]}):(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"modal-header",dir:b.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:b("Close"),onClick:p,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)(Q.A,{ref:S,value:o,onChange:_,onKeyDown:O,placeholder:r})]}),k?.length?(0,ee.Y)(bs.A,{ref:f,className:"picker-list custom-scroll",items:k,itemSelector:`.${_s}`,onLoadMore:w,withAbsolutePositioning:!0,maxHeight:i.length*a.xw7,onKeyDown:O,children:k.map(G)}):k&&!k.length?(0,ee.Y)("p",{className:"no-results",children:b("lng_blocked_list_not_found")}):(0,ee.Y)(Rs.A,{})]})})})})),Os=(0,s.ph)((0,n.EK)((e=>{const{chats:{listIds:t,orderedPinnedIds:i},currentUserId:s}=e;return{activeListIds:t.active,archivedListIds:t.archived,pinnedIds:i.active,contactIds:e.contactList?.userIds,currentUserId:s}}))((({isOpen:e,currentUserId:t,activeListIds:i,archivedListIds:o,pinnedIds:r,contactIds:d,filter:h=a.K_A,className:m,searchPlaceholder:u,loadMore:p,onSelectRecipient:v,onClose:g,onCloseAnimationEnd:A,isLowStackPriority:b,isForwarding:f})=>{const[C,S]=(0,s.J0)(""),y=(0,s.Kr)((()=>{if(!e)return;let s=r||[];t&&(s=(0,bi.Am)([t,...s]));const a=(0,n.mS)(),m=[...i||[],...C&&o||[]].filter((e=>{const t=(0,c.hds)(a,e),i=(0,c.mBe)(a,e),s=t&&(0,l.ub)(t,"postMessages"),n=t&&(0,l.WX)(t);if(f&&n&&!s)return!1;if(i&&!(0,l.PL)(i))return!0;if(!t)return!1;if(t.isMonoforum&&(0,c.ODG)(a,e))return!1;const o=(0,c.AWZ)(a,e);return!o||(0,l.__)(t,void 0,void 0,o)})),u=(0,Fs.A)((0,Yt.PU)({ids:(0,bi.Am)([...t?[t]:[],...m,...d||[]]),query:C}),void 0,s,t);return(0,c.yMZ)(a,u,h)}),[e,r,t,i,C,o,d,h,f]),k=(0,Ti.A)(y,!0);return(0,ee.Y)(Us,{isOpen:e,className:m,chatOrUserIds:k,currentUserId:t,searchPlaceholder:u,search:C,onSearchChange:S,loadMore:p,onSelectChatOrUser:v,onClose:g,onCloseAnimationEnd:A,isLowStackPriority:b})}))),Ks=(0,s.ph)((0,n.EK)((e=>{const{messageIds:t,storyId:i}=(0,c.nTw)(e).forwardMessages,s=t&&t.length>0;return{currentUserId:e.currentUserId,isManyMessages:(t?.length||0)>1,isStory:Boolean(i),isForwarding:s}}))((({isOpen:e,currentUserId:t,isManyMessages:i,isStory:o,isForwarding:a})=>{const{openChatOrTopicWithReplyInDraft:r,setForwardChatOrTopic:d,exitForwardMode:h,forwardToSavedMessages:m,forwardStory:p,showNotification:v}=(0,n.ko)(),g=(0,M.A)(),A=(0,V.A)(o,!0),[b,f,C]=(0,Y.A)();(0,s.vJ)((()=>{e&&f()}),[e,f]);const S=(0,s.hb)(((e,s)=>{const h=e===t;if(o){p({toChatId:e});const t=(0,n.mS)();if((0,u.L8)(e))v({message:h?g("Conversation.StoryForwardTooltip.SavedMessages.One"):g("StorySharedTo",(0,l.u0)((0,c.mBe)(t,e)))});else{const i=(0,c.hds)(t,e);if(!i)return;v({message:g("StorySharedTo",(0,l.Js)(g,i))})}}else if(h){const e=g(i?"Conversation.ForwardTooltip.SavedMessages.Many":"Conversation.ForwardTooltip.SavedMessages.One");m(),v({message:e})}else{const t=e,i=s?Number(s):void 0;a?d({chatId:t,topicId:i}):r({chatId:t,topicId:i})}}),[t,i,o,g,a]),y=(0,s.hb)((()=>{h()}),[h]);if(e||b)return(0,ee.Y)(Os,{isOpen:e,className:A?"component-theme-dark":void 0,searchPlaceholder:g(a?"ForwardTo":"ReplyToDialog"),onSelectRecipient:S,onClose:y,onCloseAnimationEnd:C,isForwarding:a})}))),Js=(0,s.ph)((({requestedDraft:e})=>{const t=Boolean(e&&!e.chatId),{openChatWithDraft:i,resetOpenChatWithDraft:o}=(0,n.ko)(),a=(0,M.A)(),[r,l,c]=(0,Y.A)();(0,s.vJ)((()=>{t&&l()}),[t,l]);const d=(0,s.hb)(((t,s)=>{i({chatId:t,threadId:s,text:e.text,files:e.files})}),[i,e]),h=(0,s.hb)((()=>{o()}),[o]);if(t||r)return(0,ee.Y)(Os,{isOpen:t,searchPlaceholder:a("ForwardTo"),filter:e?.filter,onSelectRecipient:d,onClose:h,onCloseAnimationEnd:c})})),Gs=(0,s.ph)((({requestedAttachBotInChat:e})=>{const{cancelAttachBotInChat:t,callAttachBot:i}=(0,n.ko)(),o=(0,M.A)(),a=Boolean(e),[r,l,c]=(0,Y.A)();(0,s.vJ)((()=>{a&&l()}),[a,l]);const{bot:d,filter:h,startParam:m}=e||{},u=(0,s.hb)((e=>{i({bot:d,chatId:e,startParam:m}),t()}),[d,i,t,m]);if(a||r)return(0,ee.Y)(Os,{isOpen:a,searchPlaceholder:o("Search"),filter:h,onSelectRecipient:u,onClose:t,onCloseAnimationEnd:c})}));var js=i(99375);function zs(e){return e.isSlowMode?"Slowmode enabled":e.hasErrorKey?"Something went wrong":"Telegram"}const Hs=(0,s.ph)((0,n.EK)((e=>({dialogs:(0,c.nTw)(e).dialogs,currentMessageList:(0,c.Xf0)(e)})))((({dialogs:e,currentMessageList:t})=>{const{dismissDialog:i,sendMessage:o}=(0,n.ko)(),[a,r,l]=(0,Y.A)(),c=(0,M.A)();var d,h,m;if((0,s.vJ)((()=>{e.length>0&&r()}),[e,r]),e.length)return Boolean(e.length)&&("phoneNumber"in(d=e[e.length-1])?(h=d,(0,ee.FD)(Z.A,{isOpen:a,onClose:l,className:"confirm",title:c("ShareYouPhoneNumberTitle"),onCloseAnimationEnd:i,children:[c("AreYouSureShareMyContactInfoBot"),(0,ee.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:()=>{t&&(o({contact:h,messageList:t}),l())},children:c("OK")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:c("Cancel")})]})]})):(m=d,(0,ee.FD)(Z.A,{isOpen:a,onClose:l,onCloseAnimationEnd:i,className:"error",title:zs(m),children:[m.hasErrorKey?(0,js.Ay)(m):(0,Ft.A)(m.message,["simple_markdown","emoji","br"]),(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:(0,ee.Y)(W.A,{isText:!0,onClick:l,children:c("OK")})})]})))})));var $s=i(17208);const qs=(0,s.ph)((0,n.EK)((e=>(0,bi.Up)((0,c.nTw)(e),["notifications"])))((({notifications:e})=>{if(e.length)return(0,ee.Y)("div",{id:"Notifications",children:e.map((e=>(0,ee.Y)($s.A,{notification:e},e.localId)))})})));var Ws=i(24585);const Qs=(0,s.ph)((({url:e})=>{const{toggleSafeLinkModal:t}=(0,n.ko)(),i=(0,Vi.A)(),o=(0,s.hb)((()=>{e&&(window.open((0,Ws.Tc)(e),"_blank","noopener noreferrer"),t({url:void 0}))}),[t,e]),a=(0,s.hb)((()=>{t({url:void 0})}),[t]),r=(0,Ti.A)(e);return(0,ee.Y)(pi.A,{isOpen:Boolean(e),onClose:a,title:i("OpenUrlTitle"),textParts:(0,Ft.A)(i("OpenUrlText",{url:r},{withNodes:!0,withMarkdown:!0})),confirmLabel:i("OpenUrlConfirm"),confirmHandler:o})}));var Zs=i(47526);const Xs=(0,s.ph)((({modal:e})=>{const{closeMapModal:t}=(0,n.ko)(),{point:i,zoom:o}=e||{},a=(0,M.A)(),r=Boolean(i),l=(0,D.A)((()=>{t()})),[c,d,h,m]=(0,s.Kr)((()=>{if(!i)return[];const e=(0,Zs.zS)("google",i,o),t=(0,Zs.zS)("bing",i,o),s=(0,Zs.zS)("osm",i,o);return[e,t,(0,Zs.zS)("apple",i,o),s]}),[i,o]),u=(0,D.A)((e=>{t(),window.open(e,"_blank","noopener")})),p=(0,D.A)((()=>{u(c)})),v=(0,D.A)((()=>{u(d)})),g=(0,D.A)((()=>{u(h)})),A=(0,D.A)((()=>{u(m)}));return(0,ee.FD)(Z.A,{contentClassName:"VJDwJpsF",title:a("OpenMapWith"),isOpen:r,onClose:l,isSlim:!0,children:[(0,ee.FD)("div",{className:"aYO2C2Hx",children:[(b.pz||b.MP)&&(0,ee.Y)(W.A,{fluid:!0,size:"smaller",onClick:g,children:"Apple Maps"}),(0,ee.Y)(W.A,{fluid:!0,size:"smaller",onClick:p,children:"Google Maps"}),(0,ee.Y)(W.A,{fluid:!0,size:"smaller",onClick:v,children:"Bing Maps"}),(0,ee.Y)(W.A,{fluid:!0,size:"smaller",onClick:A,children:"OpenStreetMap"})]}),(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:a("Cancel")})})]})}));var en=i(19806);const tn=(0,s.ph)((0,n.EK)((e=>({currentUser:(0,c.mBe)(e,e.currentUserId)})))((({modal:e,currentUser:t})=>{const{closeUrlAuthModal:i,acceptBotUrlAuth:o,acceptLinkUrlAuth:a}=(0,n.ko)(),[r,c]=(0,s.J0)(!0),[d,h]=(0,s.J0)(!0),m=(0,Ti.A)(e,!1),{domain:u,botId:p,shouldRequestWriteAccess:v}=m?.request||{},g=p?(0,n.mS)().users.byId[p]:void 0,A=(0,M.A)(),b=(0,s.hb)((()=>{e?.url&&r?(e.button?o:a)({isWriteAllowed:d}):m?.url&&window.open((0,Ws.Tc)(m.url),"_blank","noopener"),i()}),[e,r,i,o,a,d,m]),f=(0,s.hb)((()=>{i()}),[i]),C=(0,s.hb)((e=>{c(e),h(e)}),[c]);return(0,s.vJ)((()=>{u&&(c(!0),h(Boolean(v)))}),[v,u]),(0,ee.FD)(pi.A,{isOpen:Boolean(e?.url),onClose:f,title:A("OpenUrlTitle"),confirmLabel:A("OpenUrlTitle"),confirmHandler:b,children:[(0,Ft.A)(A("OpenUrlAlert2",m?.url),["links"]),u&&(0,ee.Y)(en.A,{className:"dialog-checkbox",checked:r,label:(0,ee.Y)(ee.FK,{children:(0,Ft.A)(A("Conversation.OpenBotLinkLogin",[u,(0,l.Yg)(t)]),["simple_markdown"])}),onCheck:C}),v&&(0,ee.Y)(en.A,{className:"dialog-checkbox",checked:d,label:(0,ee.Y)(ee.FK,{children:(0,Ft.A)(A("Conversation.OpenBotLinkAllowMessages",(0,l.Yg)(g)),["simple_markdown"])}),onCheck:h,disabled:!r})]})}))),sn=1e3*a.fRl,nn=["lng_weekday1","lng_weekday2","lng_weekday3","lng_weekday4","lng_weekday5","lng_weekday6","lng_weekday7"];function on(e,t,i,s,n){const o=new Date(e,t,i),a=s&&(0,ze.pU)(s),r=n&&(0,ze.pU)(n);return!!(r&&o>r)||!!(a&&o<a)}function an(e){return String(e).padStart(2,"0")}function rn(e,t,i){return`${e}-${t+1}-${i}`}const ln=(0,s.ph)((({selectedAt:e,minAt:t,maxAt:i,isFutureMode:n,isPastMode:o,isOpen:a,withTimePicker:r,submitButtonLabel:l,secondButtonLabel:c,description:d,onClose:h,onSubmit:m,onDateChange:u,onSecondButtonClick:p})=>{const v=(0,M.A)(),g=new Date,A=(0,s.Kr)((()=>n&&!t?new Date:new Date(Math.max(t||0,0))),[n,t]),b=(0,s.Kr)((()=>o&&!i?new Date:new Date(Math.min(i||sn,sn))),[o,i]),f=(0,s.Kr)((()=>e?new Date(e):new Date),[e]),C=(0,V.A)(a),[S,y]=(0,Y.A)(!1),[k,w]=(0,s.J0)(f),[N,I]=(0,s.J0)(new Date(k.getFullYear(),k.getMonth(),1)),[P,F]=(0,s.J0)(an(f.getHours())),[D,T]=(0,s.J0)(an(f.getMinutes())),B=rn(k.getFullYear(),k.getMonth(),k.getDate()),R=N.getFullYear(),L=N.getMonth(),x=n&&k.getTime()<A.getTime()||o&&k.getTime()>b.getTime();(0,s.vJ)((()=>{!C&&a&&(w(f),I(new Date(f.getFullYear(),f.getMonth(),1)),r&&(F(an(f.getHours())),T(an(f.getMinutes()))))}),[f,a,C,r]),(0,s.vJ)((()=>{n&&!S&&k.getTime()<A.getTime()&&(w(A),F(an(A.getHours())),T(an(A.getMinutes())))}),[n,S,A,k]),(0,s.vJ)((()=>{o&&!S&&k.getTime()>b.getTime()&&(w(b),F(an(b.getHours())),T(an(b.getMinutes())))}),[n,o,S,b,A,k]),(0,s.vJ)((()=>{if(e){const t=new Date(e);w(t),F(an(t.getHours())),T(an(t.getMinutes()))}}),[e]);const E=o&&R>=g.getFullYear()&&L>=g.getMonth()||b&&R>=b.getFullYear()&&L>=b.getMonth(),_=n&&R<=g.getFullYear()&&L<=g.getMonth(),{prevMonthGrid:U,currentMonthGrid:O,nextMonthGrid:K}=(0,s.Kr)((()=>function(e,t){const i=[],s=[],n=[],o=new Date;o.setDate(1),o.setMonth(t),o.setFullYear(e);const a=o.getDay()||7,r=new Date(e,t,0).getDate();for(let e=1;e<a;e++)i.push(r-a+e+1);for(;o.getMonth()===t;){const e=o.getDate();s.push(e),o.setDate(e+1)}const l=(s.length+i.length)%7;if(l>0)for(let e=1;e<=7-l;e++)n.push(e);return{prevMonthGrid:i,currentMonthGrid:s,nextMonthGrid:n}}(R,L)),[L,R]),J=(0,s.Kr)((()=>l||function(e,t){const i=(0,ze.A)(t,e.code);return i===(0,ze.A)(new Date,e.code)?e("Conversation.ScheduleMessage.SendToday",(0,ze.fU)(e,t)):e("Conversation.ScheduleMessage.SendOn",[i,(0,ze.fU)(e,t)])}(v,k)),[v,k,l]),G=(0,s.hb)((()=>{m(n&&k<A?A:o&&k>b?b:k)}),[n,o,A,b,m,k]),j=(0,s.hb)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return F(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),23)),s=new Date(k.getTime());s.setHours(i),w(s),u?.(s);const n=an(i);F(n),e.target.value=n}),[k,u]),z=(0,s.hb)((e=>{const t=e.target.value.replace(/[^\d]+/g,"");if(!t.length)return T(""),void(e.target.value="");const i=Math.max(0,Math.min(Number(t),59)),s=new Date(k.getTime());s.setMinutes(i),w(s),u?.(s);const n=an(i);T(n),e.target.value=n}),[k,u]);return(0,ee.FD)(Z.A,{isOpen:a,onClose:h,className:"CalendarModal",onEnter:G,children:[(0,ee.Y)("div",{className:"container",children:(0,ee.FD)("div",{className:"month-selector",children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:h,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.FD)("h4",{children:[v(`lng_month${L+1}`)," ",R]}),(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",disabled:_,onClick:_?void 0:function(){I((e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t}))},children:(0,ee.Y)(q.A,{name:"previous"})}),(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",disabled:E,onClick:E?void 0:function(){I((e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t}))},children:(0,ee.Y)(q.A,{name:"next"})})]})}),(0,ee.Y)("div",{className:"calendar-wrapper",children:(0,ee.FD)("div",{className:"calendar-grid",children:[nn.map((e=>(0,ee.Y)("div",{className:"day-button faded weekday",children:(0,ee.Y)("span",{children:v(e)})}))),U.map((e=>(0,ee.Y)("div",{className:"day-button disabled",children:(0,ee.Y)("span",{children:e})}))),O.map((e=>(0,ee.Y)("div",{role:"button",tabIndex:0,onClick:()=>{return t=e,void w((e=>{const i=new Date(e);return i.setDate(t),i.setMonth(L),i.setFullYear(R),u?.(i),i}));var t},className:(0,me.A)("day-button","div-button",on(R,L,e,A,b)?"disabled":e?"clickable":"",B===rn(R,L,e)&&"selected"),children:Boolean(e)&&(0,ee.Y)("span",{children:e})}))),K.map((e=>(0,ee.Y)("div",{className:"day-button disabled",children:(0,ee.Y)("span",{children:e})})))]})}),r&&(0,ee.FD)("div",{className:"timepicker",children:[(0,ee.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:P,onChange:j,onFocus:y}),":",(0,ee.Y)("input",{type:"text",className:"form-control",inputMode:"decimal",value:D,onChange:z,onFocus:y})]}),(0,ee.FD)("div",{className:"footer",children:[d&&(0,ee.Y)("div",{className:"description",children:d}),(0,ee.FD)("div",{className:"footer",children:[(0,ee.Y)(W.A,{onClick:G,disabled:x,children:J}),c&&(0,ee.Y)(W.A,{onClick:p,isText:!0,children:c})]})]})]})})),cn=(0,s.ph)((0,n.EK)((e=>({selectedAt:(0,c.nTw)(e).historyCalendarSelectedAt})))((({isOpen:e,selectedAt:t})=>{const{searchMessagesByDate:i,closeHistoryCalendar:o}=(0,n.ko)(),a=(0,s.hb)((e=>{i({timestamp:e.getTime()/1e3}),o()}),[o,i]),r=(0,M.A)();return(0,ee.Y)(ln,{isOpen:e,selectedAt:t,isPastMode:!0,submitButtonLabel:r("JumpToDate"),onClose:o,onSubmit:a})})));var dn=i(64713);const hn=(0,s.ph)((0,n.EK)(((e,{userId:t})=>({user:t?(0,c.mBe)(e,t):void 0,userStatus:t?(0,c.K0y)(e,t):void 0,phoneCodeList:e.countryList.phoneCodes})))((({isOpen:e,userId:t,isByPhoneNumber:i,user:o,userStatus:a,phoneCodeList:r})=>{const{updateContact:c,importContact:d,closeNewContactDialog:h}=(0,n.ko)(),m=(0,M.A)(),u=(0,Ti.A)(o),p=(0,Ti.A)(i),v=(0,s.li)(),[g,A,f]=(0,Y.A)(),[C,S]=(0,s.J0)(u?.firstName??""),[y,k]=(0,s.J0)(u?.lastName??""),[w,N]=(0,s.J0)(u?.phoneNumber??""),[I,P]=(0,s.J0)(!0),F=Boolean(C&&(!i||w));(0,s.vJ)((()=>{e&&(A(),S(u?.firstName??""),k(u?.lastName??""),N(u?.phoneNumber??""),P(!0))}),[e,A,u?.firstName,u?.lastName,u?.phoneNumber]),(0,s.vJ)((()=>{!b.TF&&g&&setTimeout((()=>{v.current?.focus()}),200)}),[g]);const D=(0,s.hb)((e=>{S(e.target.value)}),[]),T=(0,s.hb)((e=>{N((0,dn.Ox)(r,e.target.value))}),[r]),B=(0,s.hb)((e=>{k(e.target.value)}),[]),R=(0,s.hb)((()=>{h(),S(""),k(""),N("")}),[h]),L=(0,s.hb)((()=>{i||!t?d({firstName:C,lastName:y,phoneNumber:w}):c({userId:t,firstName:C,lastName:y,shouldSharePhoneNumber:I})}),[C,d,i,y,w,I,c,t]);if(e||g)return(0,ee.FD)(Z.A,{className:"NewContactModal",title:m("NewContact"),isOpen:e,onClose:R,onCloseAnimationEnd:f,children:[u&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"NewContactModal__profile",dir:m.isRtl?"rtl":void 0,children:[(0,ee.Y)(Dt.A,{size:"jumbo",peer:u,text:`${C} ${y}`}),(0,ee.FD)("div",{className:"NewContactModal__profile-info",children:[(0,ee.Y)("p",{className:"NewContactModal__phone-number",children:u?.phoneNumber?(0,dn.Ox)(r,u.phoneNumber):m("MobileHidden")}),(0,ee.Y)("span",{className:"NewContactModal__user-status",dir:"auto",children:(0,l.CD)(m,u,a)})]})]}),(0,ee.Y)(Q.A,{ref:v,value:C,label:m("FirstName"),tabIndex:0,onChange:D}),(0,ee.Y)(Q.A,{value:y,label:m("LastName"),tabIndex:0,onChange:B}),(0,ee.Y)("p",{className:"NewContactModal__help-text",children:(0,Ft.A)(m("NewContact.Phone.Hidden.Text",u?.firstName||""),["emoji","simple_markdown"])}),(0,ee.Y)(en.A,{className:"dialog-checkbox",checked:I,tabIndex:0,onCheck:P,label:m("lng_new_contact_share")}),(0,ee.Y)("p",{className:"NewContactModal__help-text NewContactModal__help-text__negative",children:(0,Ft.A)(m("AddContact.SharedContactExceptionInfo",u?.firstName))})]}),p&&(0,ee.FD)("div",{className:"NewContactModal__new-contact",dir:m.isRtl?"rtl":void 0,children:[(0,ee.Y)(Dt.A,{size:"jumbo",text:`${C} ${y}`}),(0,ee.FD)("div",{className:"NewContactModal__new-contact-fieldset",children:[(0,ee.Y)(Q.A,{ref:v,value:w,inputMode:"tel",label:m("lng_contact_phone"),tabIndex:0,onChange:T}),(0,ee.Y)(Q.A,{value:C,label:m("FirstName"),tabIndex:0,onChange:D}),(0,ee.Y)(Q.A,{value:y,label:m("LastName"),tabIndex:0,onChange:B})]})]}),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",disabled:!F,onClick:L,children:m("Done")}),(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:R,children:m("Cancel")})]})]})})));var mn=i(20179),un=i(30708),pn=i(48894),vn=i(71322),gn=i(32625),An=i(10722);let bn=function(e){return e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.TopLeft=4]="TopLeft",e[e.TopRight=5]="TopRight",e[e.BottomLeft=6]="BottomLeft",e[e.BottomRight=7]="BottomRight",e}({});const fn={top:bn.Top,bottom:bn.Bottom,left:bn.Left,right:bn.Right,topLeft:bn.TopLeft,topRight:bn.TopRight,bottomLeft:bn.BottomLeft,bottomRight:bn.BottomRight},Cn=Object.keys(fn);let Sn;const yn={x:0,y:0};var kn=i(36838);const wn=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e).webApps,{botId:i}=(0,c.ES7)(e)||{},{modalState:s,openedWebApps:n}=t||{},o="minimized"===s;return{activeTabBot:i?(0,c.mBe)(e,i):void 0,isMinimizedState:o,openedWebApps:n}}))((({activeTabBot:e,isMinimizedState:t,openedWebApps:i})=>{const{changeWebAppModalState:o,closeWebAppModal:a}=(0,n.ko)(),r=(0,M.A)(),l=(0,Vi.A)(),d=(0,s.li)(),h=(0,s.Kr)((()=>i&&Object.values(i)),[i]),m=h?.length,u=(0,s.Kr)((()=>{if(!m)return[];const t=(0,n.mS)(),i=e?.id;return(0,bi.Am)([i,...h.map((e=>e.botId))]).map((e=>e&&(0,c.mBe)(t,e))).filter(Boolean).slice(0,3)}),[m,e,h]),p=(0,D.A)((()=>{a()})),v=(0,D.A)((()=>{o({state:"maximized"})}));if(t)return(0,ee.FD)("div",{ref:d,className:(0,me.A)("kUZmBlnN"),children:[(0,ee.Y)(W.A,{className:"SMRJmUuE",round:!0,color:"translucent",size:"tiny",ariaLabel:r("Close"),onClick:p,children:(0,ee.Y)(q.A,{className:"P0P4gW6a",name:"close"})}),(0,ee.Y)(os.A,{className:"GP17QhNN",size:"mini",peers:u}),function(){const e=u.length>0&&u[0]?.firstName,t=m&&e&&m>1?l("MiniAppsMoreTabs",{botName:e,count:m-1},{pluralValue:m-1}):e;return(0,ee.Y)("div",{className:"TZFjRaG4",children:t})}(),(0,ee.Y)(W.A,{className:(0,me.A)("Rax9j_TK","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:v,children:(0,ee.Y)(q.A,{className:"sdbTXCxq",name:"expand-modal"})})]})})));var Nn=i(59852),In=i(84991);const Pn={container:"RFg0Ey2I","user-count-badge":"UZtJ6ZXb",userCountBadge:"UZtJ6ZXb","user-badge-icon":"pTiZFhsG",userBadgeIcon:"pTiZFhsG",name:"TzA5nqCC"},Yn=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>({user:(0,c.mBe)(e,t)})))((function({user:e,isPopularApp:t}){const{requestMainWebView:i}=(0,n.ko)(),s=(0,Vi.A)(),o=(0,D.A)((()=>{if(!e)return;const t=e?.id;if(!t)return;const s=(0,Nn.A)();i({botId:t,peerId:t,theme:s})}));if(!e)return;const a=e?.firstName,r=e?.botActiveUsers,l=r&&t?(0,He.Vw)(s,r):void 0;return(0,ee.Y)("div",{className:Pn.container,onClick:o,children:(0,ee.Y)(In.A,{className:(0,me.A)(Pn.avatarContainer,t&&"PopularAppGridItem"),textClassName:Pn.name,badgeClassName:Pn.userCountBadge,badgeIconClassName:Pn.userBadgeIcon,peer:e,text:a,badgeText:l,badgeIcon:"user-filled"})})}))),Fn={root:"BJV09FsC",search:"bdi8G7GR","section-title":"ex3kxgWX",sectionTitle:"ex3kxgWX","section-content":"uIZzLhEh",sectionContent:"uIZzLhEh",showMoreLink:"h_Zs9ypA"},Dn=(0,ve.nF)((e=>e()),500,!0),Mn=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}}))((({foundIds:e,recentBotIds:t})=>{const i=(0,M.A)(),a=(0,Vi.A)(),[r,l]=(0,s.J0)(!1),{searchPopularBotApps:c}=(0,n.ko)(),d=(0,D.A)((()=>{l((e=>!e))})),[h,m]=(0,s.J0)(""),u=(0,s.Kr)((()=>e?(0,Yt.PU)({ids:e,query:h,type:"user"}):[]),[e,h]),p=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&Dn((()=>{c()}))}),[]),v=(0,s.hb)((()=>{m("")}),[]);return(0,ee.FD)(bs.A,{className:(0,me.A)(Fn.root,"custom-scroll"),items:u,onLoadMore:p,itemSelector:".PopularAppGridItem",noFastList:!0,preloadBackwards:30,children:[(0,ee.Y)(Cs.A,{className:Fn.search,value:h,onChange:m,onReset:v,placeholder:a("SearchApps")}),t&&!h&&(0,ee.FD)("div",{className:Fn.section,children:[(0,ee.FD)("div",{className:Fn.sectionTitle,children:[(0,ee.Y)("span",{children:i("SearchAppsMine")}),(0,ee.Y)("span",{className:Fn.showMoreLink,onClick:d,children:i(r?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")})]}),(0,ee.Y)("div",{className:Fn.sectionContent,children:t.map(((e,t)=>{if(r||!(t>=5))return(0,ee.Y)(Yn,{chatId:e})}))})]}),(0,ee.FD)("div",{className:Fn.section,children:[(0,ee.Y)("div",{className:Fn.sectionTitle,children:a(h?"Apps":"PopularApps")}),(0,ee.Y)("div",{className:Fn.sectionContent,children:u&&u.map((e=>(0,ee.Y)(Yn,{chatId:e,isPopularApp:!h})))})]})]})}))),Tn=3.675*p.$,Bn="jEAibDyh",Rn="ablUg8HU",Ln="Wrl63uWL",xn="vOFiAq3l",En="KwI4XdkC",Vn="oq6HKJur",_n="a0AI_he5",Un="MvCwTbk_",On=250,Kn=["allow-scripts","allow-same-origin","allow-popups","allow-forms","allow-modals","allow-storage-access-by-user-activation"].join(" "),Jn={ok:"OK",cancel:"Cancel",close:"Close"},Gn=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:s}=i||{},n=t?.modalState,o=s?e.attachMenu.bots[s]:void 0,a=s?(0,c.mBe)(e,s):void 0,r=s?(0,c.vGo)(e,s):void 0,l=r?.botInfo?.appSettings,d=e.currentUserId?(0,c.mBe)(e,e.currentUserId):void 0,h=(0,c.SJA)(e),{isPaymentModalOpen:m,status:u}=(0,c.nTw)(e).payment,{status:p,inputInvoice:v}=(0,c.nTw)(e).starsPayment,g=a?(0,c.XOs)(e,a.id):void 0,A=p||u;return{attachBot:o,bot:a,currentUser:d,theme:h,isPaymentModalOpen:m||Boolean(v),paymentStatus:A,modalState:n,botAppPermissions:g,botAppSettings:l}}))((({modal:e,webApp:t,bot:i,theme:o,isPaymentModalOpen:r,paymentStatus:c,registerSendEventCallback:d,registerReloadFrameCallback:h,isTransforming:m,modalState:u,isMultiTabSupported:p,onContextMenuButtonClick:v,botAppPermissions:g,botAppSettings:A,modalHeight:f})=>{const{closeActiveWebApp:C,sendWebViewData:S,toggleAttachBot:y,openTelegramLink:k,setWebAppPaymentSlug:w,switchBotInline:N,sharePhoneWithBot:P,updateWebApp:F,resetPaymentStatus:T,openChatWithInfo:B,showNotification:R,openEmojiStatusAccessModal:L,openLocationAccessModal:x,changeWebAppModalState:E,closeWebAppModal:V,openPreparedInlineMessageModal:_}=(0,n.ko)(),[U,O]=(0,s.J0)(),[K,J]=(0,s.J0)(),[j,z,H]=(0,Y.A)(!1),[$,Q]=(0,s.J0)(),[X,te]=(0,s.J0)(!1),[ie,ne]=(0,s.J0)(!1),[oe,ae]=(0,s.J0)(),[re,le]=(0,s.J0)(),{unlockPopupsAt:ce,handlePopupOpened:de,handlePopupClosed:he}=function(){const[e,t]=(0,s.J0)(0),i=(0,s.li)(0),n=(0,s.li)(0),o=(0,D.A)((()=>{const e=Date.now();e-n.current>2e3&&(i.current=0),i.current+=1,i.current>=3&&t(e+2e3)})),a=(0,D.A)((()=>{e<Date.now()&&(n.current=Date.now())}));return{unlockPopupsAt:e,handlePopupOpened:o,handlePopupClosed:a}}(),ue=(0,s.li)(),pe=(0,s.li)(),ve=(0,s.li)(),ge="fullScreen"===u,Ae="minimized"===u,be=(0,D.A)((()=>{setTimeout((()=>{E({state:"maximized"})}),350)})),fe=(0,s.li)();(0,s.vJ)((()=>{fe.current=document.querySelector("#portals")}),[]);const[,Ce,Se]=(0,ye.Ay)(fe,be),we=e?.activeWebAppKey?e.openedWebApps[e.activeWebAppKey]:void 0,{appName:Ne,backgroundColor:Ie}=we||{},{url:Pe,buttonText:Ye,isBackButtonVisible:Fe}=t||{},{placeholderPath:De}=A||{},Me=Boolean(t?.isCloseModalOpen),Te=Boolean(t?.isRemoveModalOpen),Be=t&&(0,mn.rp)(t),Re=we&&(0,mn.rp)(we),Le=we&&t&&Re===Be,Ee=b.H$,Ve=void 0!==g?.geolocation,_e=Boolean(g?.geolocation),Ue=(0,D.A)((e=>{Be&&F({key:Be,update:e})})),Oe=(0,s.Kr)((()=>(0,Nn.A)()),[o]);(0,s.vJ)((()=>{le(Oe.secondary_bg_color)}),[Oe]);const Ke=Oe.bg_color,[Je,Ge]=(0,s.J0)(),je="light"===o?A?.backgroundColor:A?.backgroundDarkColor;(0,s.vJ)((()=>{Ue({backgroundColor:Je||je||Ke})}),[Ke,Je,je]);const ze=Oe.bg_color,[He,$e]=(0,s.J0)(),qe="light"===o?A?.headerColor:A?.headerDarkColor;(0,s.vJ)((()=>{Ue({headerColor:He||qe||ze})}),[ze,He,qe]);const We=(0,s.li)(),Ze=(0,M.A)(),Xe=(0,Vi.A)(),et=e?.isModalOpen||!1,tt=Boolean(Ye),{reloadFrame:it,sendEvent:st,sendFullScreenChanged:nt,sendViewport:ot,sendSafeArea:at,sendTheme:rt}=((e,t,i,o,a,r,c)=>{const{showNotification:d,setWebAppPaymentSlug:h,openInvoice:m,closeWebApp:u,openSuggestedStatusModal:p,updateWebApp:v,updateContentSettings:g}=(0,n.ko)(),A=(0,s.li)(!1),b=(0,s.li)(),f=(0,s.li)(!1),C=(0,s.li)(),S=(0,ke.A)();(0,s.vJ)((()=>{if(!e.current||!t)return;const i=()=>{c?.()},s=e.current;return s.addEventListener("load",i),()=>{s.removeEventListener("load",i)}}),[c,e,t]);const y=(0,s.hb)((t=>{e.current?.contentWindow&&e.current.contentWindow.postMessage(JSON.stringify(t),"*")}),[e]),k=(0,s.hb)((e=>{y({eventType:"fullscreen_changed",eventData:{is_fullscreen:e}})}),[y]),w=(0,D.A)((t=>{if(!e.current)return;const i=e.current;i.src="about:blank",i.addEventListener("load",(()=>{i.src=t}),{once:!0})})),N=(0,s.hb)((e=>{if(A.current)return y({eventType:"reload_iframe"}),void(b.current=setTimeout((()=>{w(e)}),500));w(e)}),[y]),I=(0,s.hb)((t=>{if(!e.current)return;const{width:i,height:s}=e.current.getBoundingClientRect();y({eventType:"viewport_changed",eventData:{width:i,height:s,is_expanded:!0,is_state_stable:!t}})}),[y,e]),P=(0,s.hb)((()=>{e.current&&(y({eventType:"safe_area_changed",eventData:{left:0,right:0,top:0,bottom:0}}),y({eventType:"content_safe_area_changed",eventData:{left:0,right:0,top:i?Tn:0,bottom:0}}))}),[y,i,e]),Y=(0,s.hb)((()=>{y({eventType:"theme_changed",eventData:{theme_params:(0,Nn.A)()}})}),[y]),F=(0,s.hb)((e=>{y({eventType:"set_custom_style",eventData:e})}),[y]),M=(0,s.hb)((t=>{if(f.current)return;const i=e.current?.contentWindow;if(i===t.source)try{const e=JSON.parse(t.data),{eventType:i,eventData:s}=e;if("web_app_ready"===i&&c?.(),"web_app_close"===i&&r){const e=(0,l.rp)(r);u({key:e,skipClosingConfirmation:!0})}if("web_app_request_viewport"===i&&I(S.isResizing),"web_app_request_safe_area"===i&&P(),"web_app_request_content_safe_area"===i&&P(),"web_app_request_theme"===i&&Y(),"iframe_ready"===i){const e=getComputedStyle(document.body).getPropertyValue("--color-scrollbar");F("* {\n scrollbar-width: thin;\n scrollbar-color: %SCROLLBAR_COLOR% transparent;\n}\n\n*::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n}\n\n*::-webkit-scrollbar-thumb {\n border-radius: 6px;\n background-color: %SCROLLBAR_COLOR%;\n}\n\n*::-webkit-scrollbar-corner {\n background-color: transparent;\n}".replace(/%SCROLLBAR_COLOR%/g,e)),A.current=Boolean(s.reload_supported)}if("iframe_will_reload"===i&&clearTimeout(b.current),"web_app_data_send"===i){if(!o)return;f.current=!0}if("web_app_read_text_from_clipboard"===i&&y({eventType:"clipboard_text_received",eventData:{req_id:s.req_id,data:null}}),"web_app_open_scan_qr_popup"===i&&d({message:"Scanning QR code is not supported in this client yet"}),"web_app_open_invoice"===i&&(h({slug:s.slug}),m({type:"slug",slug:s.slug})),"web_app_open_link"===i){const e=s.url;window.open(e,"_blank","noreferrer")}if("web_app_biometry_get_info"===i&&y({eventType:"biometry_info_received",eventData:{available:!1}}),"web_app_device_storage_clear"===i||"web_app_device_storage_get_key"===i||"web_app_device_storage_save_key"===i){const{req_id:e}=s;y({eventType:"device_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_secure_storage_clear"===i||"web_app_secure_storage_get_key"===i||"web_app_secure_storage_restore_key"===i||"web_app_secure_storage_save_key"===i){const{req_id:e}=s;y({eventType:"secure_storage_failed",eventData:{req_id:e,error:"UNSUPPORTED"}})}if("web_app_start_accelerometer"===i&&y({eventType:"accelerometer_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_gyroscope"===i&&y({eventType:"gyroscope_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_start_device_orientation"===i&&y({eventType:"device_orientation_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_add_to_home_screen"===i&&y({eventType:"home_screen_failed",eventData:{error:"UNSUPPORTED"}}),"web_app_check_home_screen"===i&&y({eventType:"home_screen_checked",eventData:{status:"unsupported"}}),"web_app_set_emoji_status"===i){const{custom_emoji_id:e,duration:t}=s;if(!e||"string"!=typeof e)return void y({eventType:"emoji_status_failed",eventData:{error:"SUGGESTED_EMOJI_INVALID"}});if(t)try{BigInt(t)}catch(e){return void y({eventType:"emoji_status_failed",eventData:{error:"DURATION_INVALID"}})}if(!r)return void y({eventType:"emoji_status_failed",eventData:{error:"UNKNOWN_ERROR"}});p({webAppKey:(0,l.rp)(r),customEmojiId:e,duration:Number(t),botId:r.botId})}if("web_app_verify_age"===i){const{passed:e}=s;e?(d({message:{key:"TitleAgeCheckSuccess"}}),g({isSensitiveEnabled:!0})):d({message:{key:"TitleAgeCheckFailed"}})}a(e)}catch(e){}}),[o,y,a,F,r,Y,I,P,c,S.isResizing,e]);return(0,s.vJ)((()=>{const{width:e,height:t,isResizing:i}=S;C.current&&C.current.width===e&&C.current.height===t&&!C.current.isResizing||(C.current={width:e,height:t,isResizing:i},I(i))}),[I,P,S]),(0,s.vJ)((()=>{r?.plannedEvents?.length&&(r.plannedEvents.forEach((e=>{y(e)})),v({key:(0,l.rp)(r),update:{plannedEvents:[]}}))}),[y,r]),(0,s.vJ)((()=>(window.addEventListener("message",M),()=>window.removeEventListener("message",M))),[M,e]),(0,s.vJ)((()=>{t&&e.current?.contentWindow?(I(),P(),f.current=!1):C.current=void 0}),[t,i,I,P,e]),{sendEvent:y,sendFullScreenChanged:k,reloadFrame:N,sendViewport:I,sendSafeArea:P,sendTheme:Y}})(We,et,ge,tt,(function(e){const{eventType:t,eventData:s}=e;if("web_app_request_fullscreen"===t&&((0,I.cB)()?E({state:"fullScreen"}):st({eventType:"fullscreen_failed",eventData:{error:"UNSUPPORTED"}})),"web_app_exit_fullscreen"===t&&ft(),"web_app_open_tg_link"===t){const e=a.jsp+s.path_full;k({url:e,shouldIgnoreCache:s.force_request}),C()}if("web_app_setup_back_button"===t&&Ue({isBackButtonVisible:s.is_visible}),"web_app_setup_settings_button"===t&&Ue({isSettingsButtonVisible:s.is_visible}),"web_app_set_background_color"===t&&Ge((0,Nn.To)(s.color)?s.color:void 0),"web_app_set_header_color"===t){const e=s.color_key;$e(s.color||(e?Oe[e]:void 0))}if("web_app_set_bottom_bar_color"===t&&le(s.color),"web_app_data_send"===t&&(C(),S({bot:i,buttonText:Ye,data:s.data})),"web_app_setup_main_button"===t){const e=s.color,t=s.text_color;O({isVisible:s.is_visible&&Boolean(s.text?.trim().length),isActive:s.is_active,text:s.text,color:e,textColor:t,isProgressVisible:s.is_progress_visible})}if("web_app_setup_secondary_button"===t){const e=s.color,t=s.text_color;J({isVisible:s.is_visible&&Boolean(s.text?.trim().length),isActive:s.is_active,text:s.text,color:e,textColor:t,isProgressVisible:s.is_progress_visible,position:s.position})}if("web_app_setup_closing_behavior"===t&&Ue({shouldConfirmClosing:!0}),"web_app_open_popup"===t){if($||!s.message.trim().length||!s.buttons?.length||s.buttons.length>3||X||ie||ce>Date.now())return void vt(void 0);Q(s),de()}if("web_app_switch_inline_query"===t){const e=s.chat_types?.map(l.Xj).filter(Boolean),t=!e?.length;N({botId:i.id,query:s.query,filter:e,isSamePeer:t}),C()}if("web_app_request_phone"===t){if($||ie||ce>Date.now())return void kt();te(!0),de()}if("web_app_request_write_access"===t){if($||X||ce>Date.now())return void It();!async function(){if(!i)return;const e=await(0,Qe.px)("fetchBotCanSendMessage",{bot:i});e&&st({eventType:"write_access_requested",eventData:{status:"allowed"}}),ne(!e)}(),de()}if("web_app_invoke_custom_method"===t){const{method:e,params:t,req_id:n}=s;!async function(e,t,s){const n=await(0,Qe.px)("invokeWebViewCustomMethod",{bot:i,customMethod:t,parameters:s});st({eventType:"custom_method_invoked",eventData:{req_id:e,...n}})}(n,e,JSON.stringify(t))}if("web_app_request_file_download"===t){if(oe||ce>Date.now())return void Nt();!async function(e,t){await(0,Qe.px)("checkBotDownloadFileParams",{bot:i,url:e,fileName:t})?(ae({url:e,fileName:t}),de()):st({eventType:"file_download_requested",eventData:{status:"cancelled"}})}(s.url,s.file_name)}if("web_app_send_prepared_message"===t){if(!i||!Be)return;const{id:e}=s;_({botId:i.id,messageId:e,webAppKey:Be})}if("web_app_request_emoji_status_access"===t){if(!i)return;L({bot:i,webAppKey:Be})}"web_app_check_location"===t&&st({eventType:"location_checked",eventData:{available:Ee,access_requested:Ve,access_granted:_e}}),"web_app_request_location"===t&&(async()=>{const e=await(0,b.Bu)(),{accessRequested:t,accessGranted:s,geolocation:n}=e;if(!s||!t)return st({eventType:"location_requested",eventData:{available:!1}}),R({message:Ze("PermissionNoLocationPosition")}),void vt(void 0);Ee?Ve?st({eventType:"location_requested",eventData:{available:Boolean(g?.geolocation),latitude:n?.latitude,longitude:n?.longitude,altitude:n?.altitude,course:n?.heading,speed:n?.speed,horizontal_accuracy:n?.accuracy,vertical_accuracy:n?.altitudeAccuracy}}):x({bot:i,webAppKey:Be}):(R({message:Ze("PermissionNoLocationPosition")}),vt(void 0))})(),"web_app_open_location_settings"===t&&Dt()}),t,z);(0,s.vJ)((()=>{Le&&d(st)}),[st,d,Le]),(0,s.vJ)((()=>{Le&&h(it)}),[it,h,Le]);const lt=j&&U?.isVisible&&U.text.trim().length>0,ct=j&&K?.isVisible&&K.text.trim().length>0,dt=(0,D.A)((()=>{Ue({isCloseModalOpen:!1})})),ht=(0,D.A)((()=>{Ue({shouldConfirmClosing:!1,isCloseModalOpen:!1}),setTimeout((()=>{C()}),400)})),mt=(0,D.A)((()=>{Ue({isRemoveModalOpen:!1})})),ut=(0,D.A)((()=>{st({eventType:"main_button_pressed"})})),pt=(0,D.A)((()=>{st({eventType:"secondary_button_pressed"})})),vt=(0,D.A)((e=>{Q(void 0),he(),st({eventType:"popup_closed",eventData:{button_id:e}})})),gt=(0,D.A)((()=>{vt()})),At=(0,D.A)((()=>{rt()}));(0,G.A)((()=>{setTimeout((()=>{At()}),400)}),[o]);const bt=(0,D.A)((()=>{!(0,ye.j9)()&&Le&&Ce?.()})),ft=(0,D.A)((()=>{(0,ye.j9)()&&Le&&Se?.()})),Ct=(0,D.A)((e=>{Le&&nt(e)}));(0,s.vJ)((()=>{ge?(bt(),Ct(!0)):(ft(),Ct(!1))}),[ge]);const St=(0,D.A)((e=>{st({eventType:"visibility_changed",eventData:{is_visible:e}})}));(0,s.vJ)((()=>{j&&St(Boolean(Le))}),[Le,j]),(0,yi.A)((([e])=>{"minimized"===u&&St(!1),u&&"minimized"===e&&St(!0)}),[u]),(0,G.A)((([e])=>{r!==e&&t?.slug&&!r&&c&&(st({eventType:"invoice_closed",eventData:{slug:t.slug,status:c}}),w({slug:void 0}),T())}),[r,c,st,t?.slug]);const yt=(0,D.A)((()=>{y({botId:i.id,isEnabled:!1}),C()})),kt=(0,D.A)((()=>{te(!1),he(),st({eventType:"phone_requested",eventData:{status:"cancelled"}})})),wt=(0,D.A)((()=>{P({botId:i.id}),te(!1),he(),st({eventType:"phone_requested",eventData:{status:"sent"}})})),Nt=(0,D.A)((e=>{e&&(ae(void 0),he()),st({eventType:"file_download_requested",eventData:{status:"cancelled"}})})),It=(0,D.A)((()=>{st({eventType:"write_access_requested",eventData:{status:"cancelled"}}),ne(!1),he()})),Pt=(0,D.A)((async()=>{i&&(await(0,Qe.px)("allowBotSendMessages",{bot:i})?(st({eventType:"write_access_requested",eventData:{status:"allowed"}}),ne(!1),he()):It())})),Yt=(0,D.A)((()=>{oe&&(ae(void 0),he(),(0,Ri.A)(oe.url,oe.fileName),st({eventType:"file_download_requested",eventData:{status:"downloading"}}))}));(0,s.vJ)((()=>{et||(Q(void 0),te(!1),ne(!1),O(void 0),J(void 0),Ue({isSettingsButtonVisible:!1,shouldConfirmClosing:!1,isBackButtonVisible:!1,isCloseModalOpen:!1,isRemoveModalOpen:!1}),H())}),[et]);const Dt=(0,D.A)((()=>{B({id:i.id})})),Mt=(0,Ti.A)(U?.color,!0),Tt=(0,Ti.A)(U?.textColor,!0),Bt=(0,Ti.A)(U&&Boolean(U.isActive),!0),Rt=(0,Ti.A)(U?.text,!0),Lt=(0,Ti.A)(K?.position,!0),xt=(0,Ti.A)(K?.color,!0),Et=(0,Ti.A)(K?.textColor,!0),Vt=(0,Ti.A)(K&&Boolean(K.isActive),!0),_t=(0,Ti.A)(K?.text,!0),[Ut,Ot]=(0,s.J0)(!1),[Kt,Jt]=(0,s.J0)(!0),[Gt,jt]=(0,s.J0)(!0),[zt,Ht]=(0,s.J0)(!1),[$t,qt]=(0,s.J0)(!1),[Wt,Qt]=(0,s.J0)(!1),[Zt,Xt]=(0,s.J0)(0);(0,G.A)((()=>{setTimeout((()=>{ot(),at()}),m?0:400)}),[$t,Gt,zt,zt,K?.position,ot,m,f,at]);const ei="top"===Lt||"bottom"===Lt,ti=ei&&zt&&$t?2:zt||$t?1:0,ii=ei||Kt||Gt?"vertical":"horizontal",si=(0,s.li)(),ni=(0,s.li)(),oi=(0,s.li)(),ai=(0,s.li)(),ri=(0,s.li)();(0,s.vJ)((()=>(ge&&et&&Boolean(Ne)?(Qt(!0),ri.current&&clearTimeout(ri.current),ri.current=setTimeout((()=>{Qt(!1),ri.current=void 0}),3800)):(Qt(!1),ri.current&&(clearTimeout(ri.current),ri.current=void 0)),()=>{ri.current&&clearTimeout(ri.current)})),[ge,et,Ne]),(0,s.vJ)((()=>{si.current&&clearTimeout(si.current),ni.current&&clearTimeout(ni.current),lt&&(ni.current=setTimeout((()=>{Ht(!0)}),35),Jt(!1),si.current=setTimeout((()=>{Ot(!0)}),On)),lt||(Ht(!1),si.current=setTimeout((()=>{Jt(!0)}),On))}),[lt]),(0,s.vJ)((()=>{oi.current&&clearTimeout(oi.current),ai.current&&clearTimeout(ai.current),ct&&(ai.current=setTimeout((()=>{qt(!0)}),35),jt(!1),oi.current=setTimeout((()=>{Ot(!0)}),On)),ct||(qt(!1),oi.current=setTimeout((()=>{jt(!0)}),On))}),[ct]),(0,s.vJ)((()=>{$t||zt||Ot(!1)}),[Ot,$t,zt]);const li=(0,Fi.A)(`background-color: ${Ie||"var(--color-background)"}`,m&&"pointer-events: none;"),ci=(0,D.A)((()=>{Fe?st({eventType:"back_button_pressed"}):(ft(),nt(!1),E({state:"maximized"}),V())})),di=(0,D.A)((()=>{ft()})),hi=(0,D.A)((e=>{v(e)})),mi=(0,me.A)("BvNtfigU",Fe&&"rC2wkMIk"),ui=Wt?Ne:Ze(Fe?"Back":"Close"),vi=ve?.current;return(0,s.vJ)((()=>{Xt(ve?.current?.clientWidth||0)}),[ui,vi]),(0,ee.FD)("div",{ref:ue,className:(0,me.A)("LeeJZdwH",!Le&&xn,p&&"ESsGT5OD"),children:[ge&&(0,I.cB)()&&(0,ee.FD)("div",{className:"eYrhewMy",children:[(0,ee.FD)("div",{ref:pe,className:Un,onClick:ci,children:[(0,ee.Y)("div",{className:"JXsuZ01s",children:(0,ee.Y)("div",{className:mi})}),(0,ee.Y)("span",{className:"dpZR3YT7",style:`width: ${Zt}px;`,children:(0,ee.Y)(se.Ay,{activeKey:Wt?0:Fe?1:2,name:"slideFade",children:(0,ee.Y)("div",{ref:ve,className:"dWDprnWa",children:ui})})})]}),(0,ee.FD)("div",{className:"Tl4_05AQ",children:[(0,ee.Y)("div",{className:(0,me.A)(Un,"emOpAMBm"),tabIndex:0,role:"button","aria-label":Xe("WebAppCollapse"),onClick:di,children:(0,ee.Y)(q.A,{name:"down",className:_n})}),(0,ee.Y)("div",{className:(0,me.A)(Un,"z4C5VD5o"),tabIndex:0,role:"button","aria-haspopup":"menu","aria-label":Xe("AriaMoreButton"),onClick:hi,children:(0,ee.Y)(q.A,{name:"more",className:(0,me.A)(_n,"T58ozRyW")})})]})]}),!Ae&&(De?(0,ee.Y)("svg",{className:(0,me.A)(Bn,j&&Ln),viewBox:"0 0 512 512",children:(0,ee.Y)("path",{className:"Gx1BIECZ",d:De})}):function(){const e=(0,me.A)(Bn,"Ig_t1R7i",j&&Ln);return(0,ee.FD)("div",{className:e,children:[(0,ee.Y)("div",{className:Rn}),(0,ee.Y)("div",{className:Rn}),(0,ee.Y)("div",{className:Rn}),(0,ee.Y)("div",{className:Rn})]})}()),(0,ee.Y)("iframe",{className:(0,me.A)("OmY14FFl",Ut&&"liDRl1xT",!j&&Ln),style:li,src:Pe,title:`${i?.firstName} Web App`,sandbox:Kn,allow:"camera; microphone; geolocation; clipboard-write;",allowFullScreen:!0,ref:We}),!Ae&&(0,ee.FD)("div",{style:`background-color: ${re};`,className:(0,me.A)("mR_hsBdT","left"===Lt&&"ntESqwQ_","right"===Lt&&"q6IUFEL0","top"===Lt&&"gb4iHJ9H","bottom"===Lt&&"R_bh3GF8","horizontal"===ii&&"oYaRA7u4",1===ti&&"YfQO314y",2===ti&&"gUldkEoy"),children:[(0,ee.FD)(W.A,{className:(0,me.A)("ypxiUCFQ",$t&&!Gt&&En,Gt&&xn),fluid:!0,style:`background-color: ${xt}; color: ${Et}`,disabled:!Vt&&!K?.isProgressVisible,nonInteractive:K?.isProgressVisible,onClick:pt,size:"smaller",children:[!K?.isProgressVisible&&_t,K?.isProgressVisible&&(0,ee.Y)(xe.A,{className:Vn,color:"blue"})]}),(0,ee.FD)(W.A,{className:(0,me.A)("U_ggDKn1",zt&&!Kt&&En,Kt&&xn),fluid:!0,style:`background-color: ${Mt}; color: ${Tt}`,disabled:!Bt&&!U?.isProgressVisible,nonInteractive:U?.isProgressVisible,onClick:ut,size:"smaller",children:[!U?.isProgressVisible&&Rt,U?.isProgressVisible&&(0,ee.Y)(xe.A,{className:Vn,color:"white"})]})]}),$&&(0,ee.FD)(Z.A,{isOpen:Boolean($),title:$.title||" ",onClose:gt,hasCloseButton:!0,className:(0,me.A)("YEOURXza",!$.title?.trim().length&&"gvljUzY9"),children:[$.message,(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:$.buttons.map((e=>(0,ee.Y)(W.A,{className:"confirm-dialog-button",color:"destructive"===e.type?"danger":"primary",isText:!0,size:"smaller",onClick:()=>vt(e.id),children:e.text||Ze(Jn[e.type])},e.id||e.type)))})]}),(0,ee.Y)(pi.A,{isOpen:X,onClose:kt,title:Ze("ShareYouPhoneNumberTitle"),text:Ze("AreYouSureShareMyContactInfoBot"),confirmHandler:wt,confirmLabel:Ze("ContactShare")}),(0,ee.Y)(pi.A,{isOpen:ie,onClose:It,title:Ze("lng_bot_allow_write_title"),text:Ze("lng_bot_allow_write"),confirmHandler:Pt,confirmLabel:Ze("lng_bot_allow_write_confirm")}),(0,ee.Y)(pi.A,{isOpen:Boolean(oe),title:Ze("BotDownloadFileTitle"),textParts:Xe("BotDownloadFileDescription",{bot:i?.firstName,filename:oe?.fileName},{withNodes:!0,withMarkdown:!0}),confirmLabel:Ze("BotDownloadFileButton"),onClose:Nt,confirmHandler:Yt}),(0,ee.Y)(pi.A,{isOpen:Me,onClose:dt,title:Ze("lng_bot_close_warning_title"),text:Ze("lng_bot_close_warning"),confirmHandler:ht,confirmIsDestructive:!0,confirmLabel:Ze("lng_bot_close_warning_sure")}),(0,ee.Y)(pi.A,{isOpen:Te,onClose:mt,title:Ze("BotRemoveFromMenuTitle"),textParts:(0,Ft.A)(Ze("BotRemoveFromMenu",i?.firstName),["simple_markdown"]),confirmHandler:yt,confirmIsDestructive:!0})]})}))),jn="oHX2d8Or",zn="O4NxErFX",Hn="dgdyQDsZ",$n="xGefqS93",qn="f7EicoVH",Wn="s6pBIYMI",Qn="txS0KiU0",Zn="XpHR_yo0",Xn="DoeOewUR",eo="YRMGpqUS",to="b13oE9uA",io={width:300,height:40},so={width:420,height:730},no={width:300,height:300},oo=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const i=t?.activeWebAppKey?(0,c.wtp)(e,t.activeWebAppKey):void 0,{botId:s}=i||{},n=s?e.attachMenu.bots[s]:void 0,o=s?(0,c.mBe)(e,s):void 0,a=(0,c.meB)(e),r=(0,c.SJA)(e),{miniAppsCachedPosition:l,miniAppsCachedSize:d}=(0,un.l)(e);return{attachBot:n,bot:o,chat:a,theme:r,cachedPosition:l,cachedSize:d}}))((({modal:e,chat:t,bot:i,attachBot:o,theme:r,cachedSize:l,cachedPosition:c})=>{const{closeActiveWebApp:d,closeWebAppModal:h,prolongWebView:m,toggleAttachBot:u,openChat:p,changeWebAppModalState:v,openWebAppTab:g,updateWebApp:A,openMoreAppsTab:b,closeMoreAppsTab:f,updateMiniAppCachedPosition:C,updateMiniAppCachedSize:S}=(0,n.ko)(),[k,w]=(0,s.Ul)(l||so);function N(){return"fullScreen"===e?.modalState?y.A.get():"maximized"===e?.modalState?k():io}const{openedWebApps:P,activeWebAppKey:F,openedOrderedKeys:T,sessionKeys:B,isMoreAppsTabActive:R}=e||{},L=F?P?.[F]:void 0,{isBackButtonVisible:x,headerColor:E,backgroundColor:V,isSettingsButtonVisible:_}=L||{},U=(0,s.Kr)((()=>T?.map((e=>{const t=P[e];return{bot:(0,n.mS)().users.byId[t.botId],webApp:t,isOpen:Boolean(L&&e===(0,mn.rp)(L))}}))),[T,P,L]),{isMobile:O}=(0,I.Ay)(),K=e?.isModalOpen||!1,J="maximized"===e?.modalState,G="minimized"===e?.modalState,j="fullScreen"===e?.modalState,z=!O,H=(0,s.li)(),$=(0,s.li)(),Q=(0,s.li)(),X=(0,D.A)((()=>H.current)),te=(0,D.A)((()=>H.current)),ie=(0,D.A)((()=>Q.current)),{isContextMenuOpen:se,contextMenuAnchor:ne,handleContextMenu:oe,handleContextMenuClose:ae,handleContextMenuHide:re}=(0,An.A)(H),[de,he]=(0,s.J0)(!1),pe=$.current,ve=H.current;(0,s.vJ)((()=>{he(Boolean(z&&pe&&ve&&!j))}),[z,pe,ve,j]),(0,s.vJ)((()=>{v({state:"maximized"})}),[z]);const{isDragging:ge,isResizing:Ae,style:be,size:fe,position:Ce}=function(e,t,i=!0,n,o=!1,r={width:0,height:0},l){const[c,d]=(0,s.J0)(l),[h,m]=(0,s.J0)(void 0),[u,p]=(0,s.Ul)({x:0,y:0}),[v,g]=(0,s.Ul)({width:0,height:0}),[A,b]=(0,s.Ul)({x:0,y:0}),f=u(),C=A(),S=e.current,y=t.current,[k,w]=(0,Y.A)(!1),[N,I]=(0,Y.A)(!1),[P,F,M]=(0,Y.A)(!1),[T,B,R]=(0,Y.A)(!1),[L,x,E]=(0,Y.A)(!1),[V,_]=(0,s.J0)(void 0);function U(){return{width:window.innerWidth,height:window.innerHeight}}const O=(0,D.A)((e=>{o||d({x:e.x,y:e.y})})),K=(0,D.A)((()=>o?yn:c)),J=(0,D.A)((()=>{if(!h)return;const{width:e,height:t}=h,i=U();return{x:(i.width-e)/2,y:(i.height-t)/2}}));(0,s.vJ)((()=>{S&&I()}),[S]),(0,s.vJ)((()=>{if(!k&&h){const e=J();if(!e)return;O(e),w()}}),[h,k,S]);const G=(0,D.A)((e=>{if(e instanceof MouseEvent&&0!==e.button)return;if(e.target.closest(".no-drag")||!S)return;const{x:t,y:i}=(0,Ve.A)(e),{left:s,top:n}=S.getBoundingClientRect();p({x:s,y:n}),b({x:t,y:i}),F()})),j=(0,D.A)((e=>{if(e instanceof MouseEvent&&0!==e.button)return;const t=e.target;if(!S||!t)return;const i=function(e){const t=t=>e.closest(t);if(t(a.cnh))for(const e of Cn)if(t(`.${e}`))return fn[e]}(t);if(void 0===i)return;_(i);const{x:s,y:n}=(0,Ve.A)(e),{left:o,right:r,top:l,bottom:c}=S.getBoundingClientRect();p({x:o,y:l}),g({width:r-o,height:c-l}),b({x:s,y:n}),B()})),z=(0,D.A)((()=>{M()})),H=(0,D.A)((()=>{R()}));(0,s.vJ)((()=>{i||M()}),[i]);const $=(e,t)=>{const i=U(),s=i.width,n=i.height,o=h.width,a=h.height;let r=e,l=t;return r<0&&(r=0),l<0&&(l=0),r+o>s&&(r=s-o),l+a>n&&(l=n-a),{x:r,y:l}},q=(0,D.A)((()=>{if(o)return;const e=N||l?c:J();if(!h||!e)return;const t=$(e.x,e.y);O(t)})),W=(0,D.A)((e=>{const t=e,i=U(),s=n.width,o=n.height;return t.width=Math.min(i.width,Math.max(s,t.width)),t.height=Math.min(i.height,Math.max(o,t.height)),t}));(0,s.vJ)((()=>{if(T)return;const e=W({width:n.width,height:n.height});e&&m(e)}),[n,T]);const Q=(0,D.A)((()=>{if(!h||T)return;const e=W(h);e&&m(e)}));(0,s.vJ)((()=>{T||q()}),[h,T]),(0,s.vJ)((()=>{const e=()=>{x(),Q(),q(),Sn&&(clearTimeout(Sn),Sn=void 0),Sn=window.setTimeout((()=>{Sn=void 0,E()}),250)};return window.addEventListener("resize",e),()=>{clearTimeout(Sn),Sn=void 0,window.removeEventListener("resize",e)}}),[q]);const Z=(0,D.A)((e=>{if(!P||!S)return;const{x:t,y:i}=(0,Ve.A)(e),s=t-C.x,n=i-C.y,o=f.x+s,a=f.y+n;h&&d($(o,a))})),X=(0,D.A)((e=>{if(!T||!S||void 0===V)return;const{x:t,y:i}=(0,Ve.A)(e),s=v(),n=Math.min(Math.max(0,t),U().width),o=Math.min(Math.max(0,i),U().height),a=n-C.x,l=o-C.y,c=f.x+s.width-r.width,h=f.y+s.height-r.height,u={x:f.x,y:f.y,width:s.width,height:s.height};V!==bn.Left&&V!==bn.TopLeft&&V!==bn.BottomLeft||(u.width=Math.max(s.width-a,r.width),u.x=Math.min(u.x+a,c)),V!==bn.Right&&V!==bn.TopRight&&V!==bn.BottomRight||(u.width=Math.max(s.width+a,r.width)),V!==bn.Top&&V!==bn.TopLeft&&V!==bn.TopRight||(u.height=Math.max(s.height-l,r.height),u.y=Math.min(u.y+l,h)),V!==bn.Bottom&&V!==bn.BottomLeft&&V!==bn.BottomRight||(u.height=Math.max(s.height+l,r.height)),m({width:u.width,height:u.height}),d({x:u.x,y:u.y})}));(0,s.vJ)((()=>{let e;return y&&i&&(e=(0,ue.wJ)(y,{onCapture:G,onDrag:Z,onRelease:z,onClick:z,onDoubleClick:z})),e}),[i,y]),(0,s.vJ)((()=>{const e=[];if(S&&i)for(const t of Cn){const i=S.querySelector(`.resizeHandle.${t}`);if(i){const t=(0,ue.wJ)(i,{onCapture:j,onDrag:X,onRelease:H,onClick:H,onDoubleClick:H});t&&e.push(t)}}return()=>{e.forEach((e=>e()))}}),[i,S]);const ee=P?"cursor: grabbing !important; ":"",te=K();if(!k||!h||!te)return{isDragging:!1,style:ee};const ie=(0,Fi.A)(`left: ${te.x}px;`,`top: ${te.y}px;`,!o&&`max-width: ${h.width}px;`,!o&&`max-height: ${h.height}px;`,"position: fixed;",(P||T||L)&&"transition: none !important;",ee);return{position:c,size:h,isDragging:P,isResizing:T,style:ie}}(H,$,de,N(),j,function(){if("maximized"===e?.modalState)return no}(),c),Se=Ce?.x,ye=Ce?.y;(0,s.vJ)((()=>{ge||void 0===Se||void 0===ye||C({position:{x:Se,y:ye}})}),[ge,Se,ye]),(0,s.vJ)((()=>{!ge&&fe&&J&&S({size:fe})}),[ge,J,fe]);const ke=fe||N(),we=ke.width,Ne=ke.height;(0,s.vJ)((()=>{Ae&&w({width:we,height:Ne})}),[Ne,we,Ae,w]);const Ie=(0,M.A)(),Pe=(0,Vi.A)(),{queryId:Ye}=L||{},Fe=P?Object.values(P).length:0;(0,gn.A)((()=>{P&&Object.keys(P).forEach((e=>{const i=P[e];i.queryId&&m({botId:i.botId,queryId:i.queryId,peerId:i.peerId||t.id,replyInfo:i.replyInfo})}))}),Ye?45e3:void 0,!0);const De=(0,s.li)(null),Me=(0,s.li)(null),Te=(0,D.A)((e=>{De.current=e})),Be=(0,D.A)((e=>{De.current&&De.current(e)})),Re=(0,D.A)((e=>{Me.current=e})),Le=(0,D.A)((e=>{Me.current&&Me.current(e)})),xe=(0,D.A)((()=>{Be({eventType:"settings_button_pressed"})})),Ee=(0,D.A)((()=>{Le(L.url)})),_e=(0,D.A)((()=>{h()})),Ue=(0,D.A)((()=>{f()})),Oe=(0,D.A)((()=>{Fe>1?d():h()})),Ke=(0,D.A)((()=>{if(o){const e=(0,mn.rp)(L);A({key:e,update:{isRemoveModalOpen:!0}})}else u({botId:i.id,isEnabled:!0})})),Je=(0,D.A)((()=>{x?Be({eventType:"back_button_pressed"}):_e()})),Ge=(0,D.A)((()=>{v({state:"minimized"})})),je=(0,D.A)((()=>{v({state:"fullScreen"})})),ze=(0,D.A)((()=>{b()})),He=(0,D.A)((e=>{g({webApp:e.webApp})})),qe=(0,D.A)((()=>{p({id:i.id})})),We=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.Y)(W.A,{className:(0,me.A)(z?"gkji2_RB":"kKPD09tc",t&&"active"),round:!0,ripple:!O,size:z?"tiny":"smaller",color:"translucent",onClick:e,ariaLabel:"More actions",children:(0,ee.Y)(q.A,{name:"more"})})),[O,z]);function Qe(){return(0,ee.FD)(ee.FK,{children:[t&&i&&t.id!==i.id&&(0,ee.Y)(ce.A,{icon:"bots",onClick:qe,children:Ie("BotWebViewOpenBot")}),(0,ee.Y)(ce.A,{icon:"reload",onClick:Ee,children:Ie("WebApp.ReloadPage")}),_&&(0,ee.Y)(ce.A,{icon:"settings",onClick:xe,children:Ie("Settings")}),i?.isAttachBot&&(0,ee.Y)(ce.A,{icon:o?"stop":"install",onClick:Ke,destructive:Boolean(o),children:Ie(o?"WebApp.RemoveBot":"WebApp.AddToAttachmentAdd")})]})}function Ze(){return(0,ee.Y)($e.A,{isOpen:se,anchor:ne,ref:Q,className:(0,me.A)(z?Qn:"web-app-more-menu","with-menu-transitions"),getTriggerElement:X,getMenuElement:ie,getRootElement:te,autoClose:!0,onClose:ae,onCloseAnimationEnd:re,children:Qe()})}const Xe=(0,me.A)("RuJ3d9N6",x&&"IWA50OWU"),et=(0,s.Kr)((()=>{if(R)return"color-text";if(!E)return;const{r:e,g:t,b:i}=(0,vn.E2)(E),s=(0,pn.LS)([e,t,i]);return("dark"===r?255-s:s)>128?"color-text":"color-background"}),[E,r,R]);function tt(e){return(0,ee.Y)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,ee.Y)("path",{className:"bOuMHiVw","fill-rule":"evenodd","clip-rule":"evenodd",d:"M16 16V0C16 12 12 16 0 16H16Z"})})}const it=(0,s.li)();function st(e){return(0,me.A)(a.jQ1,e)}return(0,kn.A)(it,!K||G||!it.current),(0,ee.FD)(Z.A,{dialogRef:H,className:(0,me.A)("XWfkIDLY",z&&"gBVR7Hec",G&&"dJ1Ld_PX",j&&"ciSTWz16"),dialogStyle:z?be:void 0,dialogContent:de&&!G?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{className:st("top")}),(0,ee.Y)("div",{className:st("bottom")}),(0,ee.Y)("div",{className:st("left")}),(0,ee.Y)("div",{className:st("right")}),(0,ee.Y)("div",{className:st("topLeft")}),(0,ee.Y)("div",{className:st("topRight")}),(0,ee.Y)("div",{className:st("bottomLeft")}),(0,ee.Y)("div",{className:st("bottomRight")})]}):void 0,isOpen:K,isLowStackPriority:!0,onClose:_e,header:(0,ee.Y)("div",{ref:$,children:z?J?(0,ee.FD)("div",{className:(0,me.A)("modal-header","multiTab"),style:(0,Fi.A)(et&&`--color-header-text: var(--${et})`),children:[(0,ee.Y)(W.A,{className:"GE5AkJOU",round:!0,color:"translucent",size:"tiny",ariaLabel:Ie(x?"Back":"Close"),onClick:Je,children:(0,ee.Y)("div",{className:Xe})}),(0,ee.FD)("div",{className:"X18WbDa5",ref:it,children:[U?.map((e=>e.isOpen?function(){const e=(0,Fi.A)(et&&`--color-header-text: var(--${et})`,E&&`--active-tab-background: ${E}`);return(0,ee.FD)("div",{className:jn,style:e,children:[tt(qn),(0,ee.FD)("div",{className:zn,children:[(0,ee.FD)("div",{className:"z39ojrWc",children:[(0,ee.Y)(Dt.A,{size:"mini",peer:i}),(0,ee.Y)(We,{onTrigger:oe,isOpen:se})]}),o?.shortName??i?.firstName,(0,ee.Y)("div",{className:Hn}),(0,ee.Y)(W.A,{className:$n,round:!0,color:"translucent",size:"tiny",ariaLabel:Ie("Close"),onClick:Oe,children:(0,ee.Y)(q.A,{className:Xn,name:"close"})})]}),tt(Wn)]})}():(0,ee.Y)(Dt.A,{className:"tI6TE6HP",size:"mini",peer:e.bot,onClick:()=>He(e)}))),R&&(0,ee.FD)("div",{className:jn,children:[tt(qn),(0,ee.FD)("div",{className:zn,children:[(0,ee.Y)("div",{className:"Obu3ui67",children:(0,ee.Y)(q.A,{className:to,name:"add"})}),Pe("OpenApp"),(0,ee.Y)("div",{className:Hn}),(0,ee.Y)(W.A,{className:$n,round:!0,color:"translucent",size:"tiny",ariaLabel:Ie("Close"),onClick:Ue,children:(0,ee.Y)(q.A,{className:Xn,name:"close"})})]}),tt(Wn)]})]}),Ze(),(0,ee.FD)("div",{className:"qK4q0Sat",children:[!R&&(0,ee.Y)(W.A,{className:(0,me.A)("cEuW1_hJ","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:ze,children:(0,ee.Y)(q.A,{className:to,name:"add"})}),!R&&(0,ee.Y)(W.A,{className:(0,me.A)(Zn,"otlJULGy","no-drag"),round:!0,color:"translucent",size:"tiny",onClick:je,children:(0,ee.Y)(q.A,{className:eo,name:"expand-modal"})}),(0,ee.Y)(W.A,{className:(0,me.A)(Zn,"no-drag"),round:!0,color:"translucent",size:"tiny",onClick:Ge,children:(0,ee.Y)(q.A,{className:eo,name:"collapse-modal"})})]})]}):(0,ee.Y)(wn,{}):(0,ee.FD)("div",{className:"modal-header",style:(0,Fi.A)(E&&`background-color: ${E}`,et&&`--color-header-text: var(--${et})`),children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:Ie(x?"Back":"Close"),onClick:Je,children:(0,ee.Y)("div",{className:Xe})}),(0,ee.Y)("div",{className:"modal-title",children:o?.shortName??i?.firstName}),!R&&(0,ee.Y)(le.A,{className:(0,me.A)(z?Qn:"web-app-more-menu","with-menu-transitions"),trigger:We,positionX:z?"left":"right",children:Qe()})]})}),style:`background-color: ${V||"var(--color-background)"}`,noBackdrop:!0,noBackdropClose:!0,children:[j&&Ze(),P&&B?.map((t=>(0,ee.Y)(Gn,{modal:e,registerSendEventCallback:Te,registerReloadFrameCallback:Re,webApp:P[t],isTransforming:ge||Ae,onContextMenuButtonClick:oe,isMultiTabSupported:z,modalHeight:Ne},t))),R&&(0,ee.Y)(Mn,{})]})}))),ao=(0,s.ph)((({bot:e,type:t,shouldRequestWriteAccess:i})=>{const{cancelBotTrustRequest:o,markBotTrusted:a}=(0,n.ko)(),[r,c]=(0,s.J0)(i||!1),d=(0,M.A)(),h=(0,s.hb)((()=>{a({botId:e.id,isWriteAllowed:r})}),[a,r,e]),m=(0,s.hb)((()=>{o()}),[]),u=d("game"===t?"AppName":"BotOpenPageTitle"),p=(0,s.Kr)((()=>{switch(t){case"game":return d("BotPermissionGameAlert",(0,l.Yg)(e));case"webApp":return d("BotOpenPageMessage",(0,l.Yg)(e));default:return d("BotWebViewStartPermission")}}),[e,t,d]);return(0,ee.FD)(pi.A,{isOpen:Boolean(e),onClose:m,title:u,confirmHandler:h,children:[(0,Ft.A)(p,["simple_markdown"]),i&&(0,ee.Y)(en.A,{className:"dialog-checkbox",checked:r,label:(0,Ft.A)(d("WebApp.AddToAttachmentAllowMessages",e?.firstName),["simple_markdown"]),onCheck:c})]})})),ro=(0,s.ph)((({modal:e})=>{const{confirmAttachBotInstall:t,cancelAttachBotInstall:i}=(0,n.ko)(),o=e?.bot,[r,l]=(0,s.J0)(!1),c=(0,M.A)(),d=(0,s.hb)((()=>{t({isWriteAllowed:Boolean(o?.shouldRequestWriteAccess)})}),[t,o]);(0,s.vJ)((()=>{o&&l(!1)}),[o]);const h=(0,s.Kr)((()=>{const e=c("lng_mini_apps_disclaimer_button").split("{link}"),t=c("lng_mini_apps_disclaimer_link");return[e[0],(0,ee.Y)("a",{href:a.Pje,target:"_blank",rel:"noopener noreferrer",children:t}),e[1]]}),[c]);return(0,ee.FD)(pi.A,{isOpen:Boolean(o),onClose:i,title:c("lng_mini_apps_disclaimer_title"),confirmHandler:d,isConfirmDisabled:!r,children:[(0,Ft.A)(c("lng_mini_apps_disclaimer_text",o?.shortName),["simple_markdown"]),(0,ee.Y)(en.A,{className:"dialog-checkbox",checked:r,label:h,onCheck:l}),(0,Ft.A)(c("WebBot.Account.Desclaimer.Desc",o?.shortName),["simple_markdown"])]})})),lo=(0,s.ph)((({folder:e})=>{const{closeDeleteChatFolderModal:t,deleteChatFolder:i,openDeleteChatFolderModal:o}=(0,n.ko)(),a=(0,M.A)(),r=Boolean(e),l=(0,V.A)(e)||e,c=l?.hasMyInvites,d=(0,s.hb)((()=>{t(),c?o({folderId:l.id,isConfirmedForChatlist:!0}):i({id:l.id})}),[c,l]);return(0,ee.Y)(pi.A,{isOpen:r,onClose:t,text:a(c?"FilterDeleteAlertLinks":"FilterDeleteAlert"),confirmLabel:a("Delete"),confirmHandler:d,confirmIsDestructive:!0})}));var co=i(64520),ho=i(17142),mo=i(87412),uo=i(2739);const po={root:"Wn7D2H1e",text:"IQ1U2TrZ",header:"F6qqXRvD",description:"ILLaH6qQ",icon:"DzGwbpu5","font-icon":"Pa9h5mh3",fontIcon:"Pa9h5mh3"},vo=["#F2862D","#EB7B4D","#E46D72","#DD6091","#CC5FBA","#B464E7","#9873FF","#768DFF","#55A5FC","#52B0C9","#4FBC93","#4CC663"].map(vn.E2),go=(0,s.ph)((({icon:e,isFontIcon:t,title:i,text:s,index:n,count:o,section:a,onClick:r})=>{const l=n/o*vo.length,c=vo[Math.floor(l)],d=vo[Math.ceil(l)]??c,{r:h,g:m,b:u}=(0,vn.dD)(c,d,.5),p=(0,D.A)((()=>{r?.(a)}));return(0,ee.FD)(li.A,{buttonClassName:po.root,onClick:p,inactive:!r,children:[t?(0,ee.Y)(q.A,{name:e,className:po.fontIcon,style:`--item-color: rgb(${h},${m},${u})`}):(0,ee.Y)("img",{src:e,className:po.icon,alt:"",style:`--item-color: rgb(${h},${m},${u})`,draggable:!1}),(0,ee.FD)("div",{className:po.text,children:[(0,ee.Y)("div",{className:po.title,children:(0,Ft.A)(i,["br"])}),(0,ee.Y)("div",{className:po.description,children:s})]})]})}));var Ao=i(57446);const bo="cqNhvdib",fo="wDzTWXzO",Co=(0,s.ph)((({length:e,active:t,onSelectSlide:i})=>{const n=Math.max(0,Math.min(e-8,t-4)),o=n===e-8-1,a=n===e-8,r=0===n,l=1===n,c=Math.min(e,8),d=(0,s.hb)((()=>{i(t+1)}),[t,i]),h=(0,s.hb)((()=>{i(t-1)}),[t,i]),m=Math.min(8,e);return(0,ee.FD)("div",{children:[!b.TF&&(0,ee.Y)(W.A,{className:(0,me.A)(bo,0===t&&fo),color:"translucent",disabled:0===t,round:!0,onClick:h,children:(0,ee.Y)(q.A,{name:"previous"})}),(0,ee.Y)("div",{className:"HmY1pYD9",style:`--start-from: ${n}; --length: ${e}; --count: ${m};`,children:Array(e).fill(void 0).map(((e,s)=>{const d=s,h=s===n+c-1&&!a&&!o,m=s===n+c-2&&!o&&!a||s===n+c-1&&o,u=s===n&&!r&&!l,p=s===n+1&&!r&&!l||s===n&&l,v=s<n||s>=n+c;return(0,ee.Y)("div",{onClick:()=>i(s),className:(0,me.A)("Ac0pMX9w",d===t&&"NYDxCNdz",(m||p)&&"yDo_8Y7X",(h||u||v)&&"bhODNwmU",v&&"O9pyrgj0")})}))}),!b.TF&&(0,ee.Y)(W.A,{className:(0,me.A)(bo,t===e-1&&fo,"hIgQCprt"),color:"translucent",round:!0,disabled:t===e-1,onClick:d,children:(0,ee.Y)(q.A,{name:"next"})})]})})),So="Hy5kWx0p",yo=(0,s.ph)((({leftValue:e,rightValue:t,className:i,floatingBadgeIcon:s,rightStyle:n})=>{const o=(0,M.A)();return(0,ee.FD)("div",{className:(0,me.A)("u84X0r2z",i),children:[s&&(0,ee.FD)("div",{className:"hPi4fICJ",children:[(0,ee.Y)(q.A,{name:s,className:"XkiOXdMP"}),(0,ee.Y)("div",{className:"iC3LJrvy",dir:o.isRtl?"rtl":void 0,children:e}),(0,ee.Y)("div",{className:"jufjjcX9",children:(0,ee.Y)("svg",{width:"26",height:"9",viewBox:"0 0 26 9",fill:"none",children:(0,ee.Y)("path",{d:"M0 0H26H24.4853C22.894 0 21.3679 0.632141 20.2426 1.75736L14.4142 7.58579C13.6332 8.36684 12.3668 8.36683 11.5858 7.58579L5.75736 1.75736C4.63214 0.632139 3.10602 0 1.51472 0H0Z",fill:"#7E85FF"})})})]}),(0,ee.FD)("div",{className:(0,me.A)(So,"scGr4JS9"),children:[(0,ee.Y)("div",{className:"OejVAPj6 YaiSoFKE YaiSoFKE",dir:o.isRtl?"rtl":void 0,children:o("LimitFree")}),!s&&(0,ee.Y)("div",{className:"RJosx238 YaiSoFKE",children:e})]}),(0,ee.FD)("div",{className:(0,me.A)(So,"nPaUalQf"),style:n,children:[(0,ee.Y)("div",{className:"COQdFBQk YaiSoFKE YaiSoFKE",dir:o.isRtl?"rtl":void 0,children:o("LimitPremium")}),(0,ee.Y)("div",{className:"BEq3jFlz YaiSoFKE YaiSoFKE",children:t})]})]})})),ko=[91,160,255],wo=[197,100,243],No=(0,s.ph)((({title:e,description:t,leftValue:i,rightValue:n,colorStepProgress:o})=>{const a=(0,s.Kr)((()=>ko.map(((e,t)=>(0,pe.Cc)(e,wo[t],o)))),[o]);return(0,ee.FD)("div",{className:"ZXp65Wgy",children:[(0,ee.Y)("div",{className:"W1xG3pjS",children:e}),(0,ee.Y)("div",{className:"b_CBXIkT",children:t}),(0,ee.Y)(yo,{leftValue:i,rightValue:n,rightStyle:`background: rgb(${a.join(",")})`})]})}));var Io=i(67054),Po=i(18104);const Yo=({size:e,realIndex:t,canPlay:i,sticker:n,index:o,maxLength:a,onClick:r,onEnded:l})=>{const c=(0,j.A)(`sticker${n.id}`),d=(0,j.A)(`sticker${n.id}?size=f`),h=0===o,[m,u,p]=(0,Y.A)(h),v=e-.6*e,g=3*v,A=3.2*v,b=o/a*(2*Math.PI),f=h?1:.66,C=Math.cos(b)*g-2.8*v,S=Math.sin(b)*A,y=(0,D.A)((()=>{r(t)})),k=(0,D.A)((()=>{p(),l(t)}));return(0,s.vJ)((()=>{h&&u()}),[h,u]),(0,ee.FD)(ee.FK,{children:[h&&(0,ee.Y)(Po.A,{className:"Stdz4UIW ogaoEAcn",tgsUrl:d,play:i,isLowPriority:!0,noLoop:!0,size:.8*e,style:`--x: calc(${C}px - 10%); --y: ${S}px;`}),(0,ee.Y)(Po.A,{className:"ogaoEAcn",tgsUrl:c,play:i&&m,noLoop:!0,size:.6*e,style:`--x: ${C}px; --y: ${S}px; --opacity: ${f}`,onClick:y,onEnded:k})]})},Fo=(0,s.ph)((0,n.EK)((e=>({stickers:e.stickers.premium.stickers})))((({stickers:e,isActive:t})=>{const i=(0,s.li)(),[n,o]=(0,s.J0)(0),[a,r]=(0,s.J0)(0),l=e?.slice(0,15),c=(0,D.A)((e=>{o(-e)})),d=(0,D.A)((e=>{0===(0,Io.A)(l.length,e+n)&&setTimeout((()=>{o((e=>(0,Io.A)(l.length,e+1)))}),150)}));return(0,s.vJ)((()=>{const e=i.current;e&&r(e.closest(".modal-dialog").clientWidth)}),[]),(0,ee.Y)("div",{className:"O1fqNCy0",ref:i,children:Boolean(a)&&l?.map(((e,i)=>(0,ee.Y)(Yo,{size:a,sticker:e,realIndex:i,index:(i+n+l.length)%l.length,maxLength:l.length,onClick:c,onEnded:d,canPlay:t})))})})));var Do=i(38691),Mo=i(88554);const To={stories_order:"PremiumStoriesPriority",stories_stealth:"PremiumStoriesStealth",stories_views:"PremiumStoriesViews",stories_timer:"lng_premium_stories_subtitle_expiration",stories_save:"PremiumStoriesSaveToGallery",stories_caption:"lng_premium_stories_subtitle_caption",stories_link:"lng_premium_stories_subtitle_links"},Bo={stories_order:"PremiumStoriesPriorityDescription",stories_stealth:"PremiumStoriesStealthDescription",stories_views:"PremiumStoriesViewsDescription",stories_timer:"PremiumStoriesExpirationDescription",stories_save:"PremiumStoriesSaveToGalleryDescription",stories_caption:"PremiumStoriesCaptionDescription",stories_link:"PremiumStoriesFormattingDescription"},Ro={stories_order:"story-priority",stories_stealth:"eye-crossed-outline",stories_views:"eye-outline",stories_timer:"timer",stories_save:"arrow-down-circle",stories_caption:"story-caption",stories_link:"link-badge"},Lo=Object.keys(To),xo=Dt.R.giant+.25*p.$,Eo=(0,s.ph)((0,n.EK)((e=>({currentUser:(0,c.mBe)(e,e.currentUserId)})))((({currentUser:e})=>{const t=(0,s.li)(),i=(0,M.A)(),n=(0,Do.A)();(0,s.Nf)((()=>{t.current&&(0,Mo.$)({canvas:t.current,size:xo*n,segmentsCount:8,color:"purple",readSegmentsCount:0,readSegmentColor:"transparent",dpr:n})}),[n]);const{handleScroll:o,isAtBeginning:a}=As(),r=xo;return(0,ee.FD)("div",{className:"mFElmm7a",children:[(0,ee.FD)("div",{className:"Jjbochk6",children:[(0,ee.Y)(Dt.A,{forPremiumPromo:!0,peer:e,size:"giant"}),(0,ee.Y)("canvas",{className:"ChteQ9C3",ref:t,style:`max-width: ${r}px; max-height: ${r}px`})]}),(0,ee.Y)("div",{className:"d2ayix6L",children:i("UpgradedStories")}),(0,ee.FD)("div",{className:(0,me.A)("ensyCeMe",!a&&"iN1T0a2Y","custom-scroll"),onScroll:o,children:[Lo.map(((e,t)=>(0,ee.Y)(go,{title:i(To[e]),text:i(Bo[e]),icon:Ro[e],isFontIcon:!0,index:t,count:Lo.length,section:e},e))),(0,ee.Y)("div",{className:"DFbZJafh",children:i("lng_premium_stories_about_mobile")})]})]})}))),Vo={root:"Ot0dA1yZ",wrapper:"yxSAGAc1",down:"Jcy6cDoc",frame:"Vn81yTTJ",video:"rrVJClLL"},_o=i.p+"DeviceFrame.79271ee0fa60a7b6a1aa.svg",Uo=(0,s.ph)((({videoId:e,isReverseAnimation:t,isDown:i,videoThumbnail:s,index:n,isActive:o})=>{const a=(0,j.A)(`document${e}`),r=(0,Ei.A)(s.dataUri),l=(0,Ui.A)(a);return(0,ee.Y)("div",{className:Vo.root,children:(0,ee.FD)("div",{className:(0,me.A)(Vo.wrapper,t&&Vo.reverse,i&&Vo.down),id:`premium_feature_preview_video_${n}`,children:[(0,ee.Y)("img",{src:_o,alt:"",className:Vo.frame,draggable:!1}),(0,ee.Y)("canvas",{ref:r,className:Vo.video}),(0,ee.Y)(ji.A,{canPlay:o,className:(0,me.A)(Vo.video,l),src:a,disablePictureInPicture:!0,playsInline:!0,muted:!0,loop:!0})]})})})),Oo="a7IoUtQG",Ko="gubS9KP1",Jo="iZLwcL8v",Go="A7YHY8qF",jo={double_limits:"PremiumPreviewLimits",infinite_reactions:"PremiumPreviewReactions2",premium_stickers:"PremiumPreviewStickers",animated_emoji:"PremiumPreviewEmoji",no_ads:"PremiumPreviewNoAds",voice_to_text:"PremiumPreviewVoiceToText",profile_badge:"PremiumPreviewProfileBadge",faster_download:"PremiumPreviewDownloadSpeed",more_upload:"PremiumPreviewUploads",advanced_chat_management:"PremiumPreviewAdvancedChatManagement",animated_userpics:"PremiumPreviewAnimatedProfiles",emoji_status:"PremiumPreviewEmojiStatus",translations:"PremiumPreviewTranslations",stories:"PremiumPreviewStories",saved_tags:"PremiumPreviewTags2",last_seen:"PremiumPreviewLastSeen",message_privacy:"PremiumPreviewMessagePrivacy",effects:"Premium.MessageEffects",todo:"PremiumPreviewTodo"},zo={double_limits:"PremiumPreviewLimitsDescription",infinite_reactions:"PremiumPreviewReactions2Description",premium_stickers:"PremiumPreviewStickersDescription",no_ads:"PremiumPreviewNoAdsDescription",animated_emoji:"PremiumPreviewEmojiDescription",voice_to_text:"PremiumPreviewVoiceToTextDescription",profile_badge:"PremiumPreviewProfileBadgeDescription",faster_download:"PremiumPreviewDownloadSpeedDescription",more_upload:"PremiumPreviewUploadsDescription",advanced_chat_management:"PremiumPreviewAdvancedChatManagementDescription",animated_userpics:"PremiumPreviewAnimatedProfilesDescription",emoji_status:"PremiumPreviewEmojiStatusDescription",translations:"PremiumPreviewTranslationsDescription",stories:"PremiumPreviewStoriesDescription",saved_tags:"PremiumPreviewTagsDescription2",last_seen:"PremiumPreviewLastSeenDescription",message_privacy:"PremiumPreviewMessagePrivacyDescription",effects:"Premium.MessageEffectsInfo",todo:"PremiumPreviewTodoDescription"},Ho={channels:"GroupsAndChannelsLimitTitle",dialogFolderPinned:"PinChatsLimitTitle",channelsPublic:"PublicLinksLimitTitle",savedGifs:"SavedGifsLimitTitle",stickersFaved:"FavoriteStickersLimitTitle",aboutLength:"BioLimitTitle",captionLength:"CaptionsLimitTitle",dialogFilters:"FoldersLimitTitle",dialogFiltersChats:"ChatPerFolderLimitTitle",recommendedChannels:"SimilarChannelsLimitTitle",moreAccounts:"ConnectedAccountsLimitTitle"},$o={channels:"GroupsAndChannelsLimitSubtitle",dialogFolderPinned:"PinChatsLimitSubtitle",channelsPublic:"PublicLinksLimitSubtitle",savedGifs:"SavedGifsLimitSubtitle",stickersFaved:"FavoriteStickersLimitSubtitle",aboutLength:"BioLimitSubtitle",captionLength:"CaptionsLimitSubtitle",dialogFilters:"FoldersLimitSubtitle",dialogFiltersChats:"ChatPerFolderLimitSubtitle",recommendedChannels:"SimilarChannelsLimitSubtitle",moreAccounts:"ConnectedAccountsLimitSubtitle"},qo=(0,s.ph)((({promo:e,initialSection:t,isPremium:i,limits:n,premiumPromoOrder:o,subscriptionOption:l,onBack:c,onClickSubscribe:d})=>{const h=(0,M.A)(),m=(0,Vi.A)(),u=(0,s.li)(),[p,v]=(0,s.J0)(a.O2i.indexOf(t)),[g,A]=(0,s.J0)(0),[b,f,C]=(0,Y.A)(),[S,y]=(0,s.J0)(!0),[k,w]=(0,s.J0)(!1),N=(0,V.A)(t),I=(0,s.Kr)((()=>o?o.filter((e=>a.O2i.includes(e))):a.O2i),[o]),P=(0,s.Kr)((()=>{if(!l)return;const{amount:e,months:t,currency:s}=l,n=Math.floor(e/t);return i?m("OK"):m("SubscribeToPremium",{price:(0,ho.vv)(m,n,s)},{withNodes:!0})}),[i,m,l]),F=(0,D.A)((()=>{d(t)}));function T(e){const{scrollTop:t,clientHeight:i,scrollHeight:s}=e.currentTarget;y(t<=20),w(t>=s-i-20)}(0,s.vJ)((()=>{const e=u.current;if(!e||N===t)return;const i=I.indexOf(t);v(i),f(),(0,Ao.A)(e,e.clientWidth*i,0).then(C)}),[p,I,t,N]);const B=(0,D.A)((async e=>{const t=u.current;t&&(v(e),f(),await(0,Ao.A)(t,t.clientWidth*e,800),C())})),R=I[p],L="double_limits"!==R&&"stories"!==R;return(0,ee.FD)("div",{className:"oyUTEj8I",children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",className:(0,me.A)("njYoMrKM",L&&"SB4pczOo"),color:L?"translucent-white":"translucent",onClick:c,ariaLabel:h("Back"),children:(0,ee.Y)(q.A,{name:"arrow-left"})}),(0,ee.Y)("div",{className:"dIVBSdWi"}),(0,ee.Y)("div",{className:(0,me.A)("sJubG84j","no-scrollbar"),onScroll:function(e){const t=e.currentTarget,{clientWidth:i,scrollLeft:s}=t,n=Math.round(s),o=n%i/i,a=Math.ceil((n+1)/i);A(a);const l=t.querySelector("#premium_feature_preview_video_"+(a-1)),c=t.querySelector(`#premium_feature_preview_video_${a}`);if((0,r.RK)((()=>{t.style.setProperty("--scroll-progress",o.toString()),t.style.setProperty("--abs-scroll-progress",Math.abs(o).toString()),l&&(0,$i.dH)(l,"reverse",!1),c&&(0,$i.dH)(c,"reverse",!0)})),b)return;const d=Math.round(n/i);v(d)},ref:u,children:I.map(((t,i)=>{if("double_limits"===t)return(0,ee.FD)("div",{className:(0,me.A)(Ko,"U7ePgVBR"),children:[(0,ee.Y)("h2",{className:(0,me.A)("mz2Hmd83",S&&"AgmNOqi7"),children:h(jo.double_limits)}),(0,ee.Y)("div",{className:(0,me.A)("n_rowVPI","custom-scroll"),onScroll:T,children:a.M$8.map(((e,t)=>{const i=n?.[e][0].toString(),s=n?.[e][1].toString();return(0,ee.Y)(No,{title:h(Ho[e]),description:h($o[e],s),leftValue:i,rightValue:s,colorStepProgress:t/(a.M$8.length-1)})}))})]});if("premium_stickers"===t)return(0,ee.FD)("div",{className:Ko,children:[(0,ee.Y)("div",{className:Oo,children:(0,ee.Y)(Fo,{isActive:p===i})}),(0,ee.Y)("h1",{className:Jo,children:h(jo.premium_stickers)}),(0,ee.Y)("div",{className:Go,children:(0,Ft.A)(h(zo.premium_stickers),["br"])})]});if("stories"===t)return(0,ee.Y)("div",{className:(0,me.A)(Ko,"J1M6fEdo"),children:(0,ee.Y)(Eo,{})});const s=e.videoSections.indexOf(t);if(-1===s)return;const o="todo"===e.videoSections[s];return(0,ee.FD)("div",{className:Ko,children:[(0,ee.Y)("div",{className:Oo,children:(0,ee.Y)(Uo,{isActive:p===i,videoId:e.videos[s].id,videoThumbnail:e.videos[s].thumbnail,isDown:a.jhT.includes(t),index:i,isReverseAnimation:i===g})}),(0,ee.Y)("h1",{className:Jo,children:o?m(jo[e.videoSections[s]],void 0,{withNodes:!0,renderTextFilters:["br"]}):h(jo[e.videoSections[s]])}),(0,ee.Y)("div",{className:Go,children:(0,Ft.A)(o?m(zo[e.videoSections[s]],void 0,{withNodes:!0,renderTextFilters:["br"]}):h(zo[e.videoSections[s]]),["br"])})]})}))}),(0,ee.FD)("div",{className:(0,me.A)("yN2611rA",(k||0!==p)&&"rCHMABcD"),children:[(0,ee.Y)(Co,{length:a.O2i.length,active:p,onSelectSlide:B}),Boolean(P)&&(0,ee.Y)(W.A,{className:(0,me.A)("EPfM7AgT"),isShiny:!i,withPremiumGradient:!i,onClick:i?c:F,children:P})]})]})})),Wo=(0,s.ph)((({option:e,checked:t,fullMonthlyAmount:i,onChange:n,className:o,isGiveaway:a})=>{const r=(0,M.A)(),{months:l,amount:c,currency:d}=e,h="users"in e?e.users:void 0,m=Math.floor(c/l),u=h?h>1:void 0,p=(0,s.Kr)((()=>i&&i>m?Math.ceil(100-m/(i/100)):void 0),[i,m]),v=(0,s.hb)((e=>{e.target.checked&&n(l)}),[l,n]);return(0,ee.FD)("label",{className:(0,me.A)(a?"PkseWxFK":"qZA6S2kc",t&&!a&&"EJOQwnRj",o),dir:r.isRtl?"rtl":void 0,children:[(0,ee.Y)("input",{className:"WOEkhx6R",type:"radio",name:"subscription_option",value:l,checked:t,onChange:v}),(0,ee.FD)("div",{className:"BHUCScsU",children:[(0,ee.FD)("div",{className:"DfYCMUkL",children:[Boolean(p)&&(0,ee.FD)("span",{className:(0,me.A)("ublijP0j","uqDlP3Zt"),title:r("GiftDiscount"),children:[" ","",p,"%"]}),r("Months",l)]}),(0,ee.Y)("div",{className:"poxOXJ2o",children:a||u?`${(0,ho.Ad)(c,d,r.code)} x ${h}`:r("PricePerMonth",(0,ho.Ad)(m,d,r.code))}),(0,ee.Y)("div",{className:"IGMrERf_",children:(0,ho.Ad)(c,d,r.code)})]})]})})),Qo="yKm9hKQP",Zo=i.p+"PremiumAds.a758f19ece91fe91318e.svg",Xo=i.p+"PremiumBadge.1c630afcfd1112ad16d0.svg",ea=i.p+"PremiumChats.89d9d315638e283ca895.svg",ta=i.p+"PremiumEffects.4eab9caad8e9c276842d.svg",ia=i.p+"PremiumEmoji.26515017c8f6dc4f3f67.svg",sa=i.p+"PremiumFile.884dd3865acfe594fc61.svg",na=i.p+"PremiumLastSeen.9575a548770d23785846.svg",oa=i.p+"PremiumLimits.08701cb6df3cf756c5f7.svg",aa=i.p+"PremiumMessagePrivacy.950cab3e87c60c5733a6.svg",ra=i.p+"PremiumReactions.7fee56ab6b58c82fd15e.svg",la=i.p+"PremiumSpeed.d0a43b6780c411c2f84a.svg",ca=i.p+"PremiumStatus.c42f9c4b68f9c2c4537a.svg",da=i.p+"PremiumStickers.7b5a8531a41b43d0da12.svg",ha=i.p+"PremiumTags.3b187054cc90f8e16cb7.svg",ma=i.p+"PremiumTranslate.cb2dcbb898d96cb35469.svg",ua=i.p+"PremiumVideo.288cb61931e33d913f0a.svg",pa=i.p+"PremiumVoice.b3a2893dbe481108ab94.svg",va=8*p.$,ga={stories:ca,double_limits:oa,infinite_reactions:ra,premium_stickers:da,animated_emoji:ia,no_ads:Zo,voice_to_text:pa,profile_badge:Xo,faster_download:la,more_upload:sa,advanced_chat_management:ea,animated_userpics:ua,emoji_status:ca,translations:ma,saved_tags:ha,last_seen:na,message_privacy:aa,effects:ta,todo:Xo},Aa=(0,s.ph)((0,n.EK)((e=>{const{premiumModal:t}=(0,c.nTw)(e),i=t?.fromUserId?(0,c.mBe)(e,t.fromUserId):void 0,s=i?.emojiStatus?e.customEmojis.byId[i.emojiStatus.documentId]:void 0,n=s?(0,c.ycM)(e,s.stickerSetInfo):void 0;return{currentUserId:e.currentUserId,promo:t?.promo,isSuccess:t?.isSuccess,isGift:t?.isGift,monthsAmount:t?.monthsAmount,fromUser:i,fromUserStatusEmoji:s,fromUserStatusSet:n,toUser:t?.toUserId?(0,c.mBe)(e,t.toUserId):void 0,initialSection:t?.initialSection,isPremium:(0,c.g29)(e),limitChannels:(0,co.B)(e,"channels"),limitFolders:(0,co.B)(e,"dialogFilters"),limitPins:(0,co.B)(e,"dialogFolderPinned"),limitLinks:(0,co.B)(e,"channelsPublic"),limits:e.appConfig?.limits,premiumSlug:e.appConfig?.premiumInvoiceSlug,premiumBotUsername:e.appConfig?.premiumBotUsername,premiumPromoOrder:e.appConfig?.premiumPromoOrder}}))((({isOpen:e,currentUserId:t,fromUser:i,fromUserStatusEmoji:o,fromUserStatusSet:r,promo:c,initialSection:d,isPremium:h,limitChannels:m,limitLinks:u,limitFolders:p,limitPins:v,limits:g,premiumSlug:A,premiumBotUsername:b,isSuccess:f,isGift:C,toUser:S,monthsAmount:y,premiumPromoOrder:k})=>{const w=(0,s.li)(),{closePremiumModal:N,openInvoice:I,requestConfetti:P,openTelegramLink:Y,loadStickers:F,openStickerSet:T}=(0,n.ko)(),B=(0,M.A)(),R=(0,Vi.A)(),[L,x]=(0,s.J0)(!0),[E,V]=(0,s.J0)(d),[_,U]=(0,s.J0)();(0,s.vJ)((()=>{e?d&&V(d):(x(!0),V(void 0))}),[e,d]);const O=(0,D.A)((e=>{V(e)})),K=(0,D.A)((()=>{V(void 0)})),J=(0,D.A)((e=>{w.current&&(A?I({type:"slug",slug:A}):b&&(Y({url:`${a.jsp}${b}?start=${e||"promo"}`}),N()))})),j=(0,D.A)((()=>{_?J(String(_.months)):J()})),z=(0,D.A)((e=>{const t=c?.options.find((t=>t.months===e));U(t)})),H=(0,D.A)((()=>{const t=w.current;if(t&&e){const{top:e,left:i,width:s,height:n}=t.querySelector(".modal-content").getBoundingClientRect();P({top:e,left:i,width:s,height:n,withStars:!0})}}));(0,s.vJ)((()=>{f&&H()}),[f,H]),(0,G.A)((([e])=>{e!==h&&H()}),[h,H]);const $=(0,s.Kr)((()=>k?k.filter((e=>a.O2i.includes(e))):a.O2i),[k]);(0,s.vJ)((()=>{o&&!r&&F({stickerSetInfo:o.stickerSetInfo})}),[F,o,r]),(0,s.vJ)((()=>{const[e]=c?.options??[];U(e)}),[c]);const Q=(0,D.A)((()=>{r&&T({stickerSetInfo:r})})),X=(0,s.Kr)((()=>{const e=c?.options.find((e=>1===e.months));if(e)return Number(e.amount)}),[c]),te=(0,s.Kr)((()=>{if(!_)return;const{amount:e,months:t,currency:i}=_,s=Math.floor(e/t);return(0,ho.vv)(R,s,i)}),[_,R]);if(c&&(!o||r))return(0,ee.Y)(Z.A,{className:"sfbpMFHM",onClose:N,isOpen:e,dialogRef:w,children:(0,ee.Y)(se.Ay,{name:"slide",activeKey:E?1:0,className:"ELNkgPve",children:E?(0,ee.Y)(qo,{initialSection:E,onBack:K,promo:c,onClickSubscribe:J,isPremium:h,limits:g,premiumPromoOrder:k,subscriptionOption:_}):(0,ee.FD)("div",{className:(0,me.A)("ZpOIPrhp","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;x(t<=150)},children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",className:"XyN3eWog",color:"translucent",onClick:()=>N(),ariaLabel:B("Close"),children:(0,ee.Y)(q.A,{name:"close"})}),o?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(mo.A,{className:"mQwvY9LA",onClick:Q,documentId:o.id,isBig:!0,size:va}),(0,ee.Y)("h2",{className:(0,me.A)("y71v6ECL",r&&"xw_GbDj7"),children:ie()}),(0,ee.Y)("div",{className:"cUcKXV3j",children:(0,Ft.A)(ne(),["simple_markdown","emoji"])})]}):(0,ee.Y)(uo.A,{model:"swaying-star",color:"purple",title:ie(),description:(0,Ft.A)(ne(),["simple_markdown","emoji"])}),!h&&!C&&(0,ee.Y)("div",{className:"xZC_Oajr",children:c?.options.map((e=>(0,ee.Y)(Wo,{className:"gygsbDbE",option:e,onChange:z,fullMonthlyAmount:X,checked:_?.months===e.months},e.amount)))}),(0,ee.Y)("div",{className:(0,me.A)("Bc_F0RKb",L&&"ltXo0Xi7"),children:(0,ee.Y)("h2",{className:"xysPdANX",children:B("TelegramPremium")})}),(0,ee.FD)("div",{className:(0,me.A)("c3Ee2oSo",h&&"yWEHoJOL"),children:[$.map(((e,t)=>{const i="todo"===e;return(0,ee.Y)(go,{title:i?R(jo[e]):B(jo[e]),text:"double_limits"===e?B(zo[e],[m,p,v,u,4]):i?R(zo[e]):B(zo[e]),icon:ga[e],index:t,count:$.length,section:e,onClick:O},e)})),(0,ee.FD)("div",{className:(0,me.A)(Qo,"l1WlNpmu"),dir:B.isRtl?"rtl":void 0,children:[(0,ee.Y)("p",{children:(0,Ft.A)(B("AboutPremiumDescription"),["simple_markdown"])}),(0,ee.Y)("p",{children:(0,Ft.A)(B("AboutPremiumDescription2"),["simple_markdown"])})]}),function(){if(c&&(!C||i?.id!==t))return(0,ee.Y)("div",{className:Qo,dir:B.isRtl?"rtl":void 0,children:(0,Zi.fd)({text:c.statusText,entities:c.statusEntities})})}()]}),!h&&_&&(0,ee.Y)("div",{className:"nCnlO9UZ",children:(0,ee.Y)(W.A,{className:"c1tMxuFH",isShiny:!0,withPremiumGradient:!0,onClick:j,children:B("SubscribeToPremium",te)})})]})})});function ie(){if(C)return(0,Ft.A)(i?.id===t?B("TelegramPremiumUserGiftedPremiumOutboundDialogTitle",[(0,l.Yg)(S),y]):B("TelegramPremiumUserGiftedPremiumDialogTitle",[(0,l.Yg)(i),y]),["simple_markdown","emoji"]);if(r&&i){const e=B("lng_premium_emoji_status_title").replace("{user}",(0,l.Yg)(i)),[t,s]=e.split("{link}"),n=r.thumbCustomEmojiId?(0,ee.Y)(mo.A,{className:"Y0jTcadE",documentId:r.thumbCustomEmojiId}):void 0,o=(0,ee.FD)("span",{className:"FLzl2ng5",onClick:Q,children:[n,(0,Ft.A)(r.title)]});return[(0,Ft.A)(t),o,(0,Ft.A)(s)]}return(0,Ft.A)(i?B("TelegramPremiumUserDialogTitle",(0,l.Yg)(i)):B(h?"TelegramPremiumSubscribedTitle":"TelegramPremium"),["simple_markdown","emoji"])}function ne(){return C?i?.id===t?B("TelegramPremiumUserGiftedPremiumOutboundDialogSubtitle",(0,l.Yg)(S)):B("TelegramPremiumUserGiftedPremiumDialogSubtitle"):B(r?"TelegramPremiumUserStatusDialogSubtitle":i?"TelegramPremiumUserDialogSubtitle":h?"TelegramPremiumSubscribedSubtitle":"TelegramPremiumSubtitle")}})));var ba=i(24956),fa=i(31722);const Ca="ItemPickerItem",Sa=(0,s.ph)((({className:e,isSearchable:t,searchInputId:i,items:n,filterValue:o,notFoundText:a,isLoading:l,noScrollRestore:c,filterPlaceholder:d,isViewOnly:h,itemInputType:m,itemClassName:u,withDefaultPadding:p,forceRenderAllItems:v,onFilterChange:g,onDisabledClick:A,onLoadMore:b,...f})=>{const C=(0,M.A)(),S=(0,s.li)(),y=f.allowMultiple,k=y?f.lockedSelectedValues:void 0,w=y?f.lockedUnselectedValues:void 0;(0,s.vJ)((()=>{if(!t)return;const e=window.setTimeout((()=>{(0,r.YS)((()=>{S.current?.focus()}))}),500);return()=>{window.clearTimeout(e)}}),[t]);const N=(0,s.Kr)((()=>y?f.selectedValues:f.selectedValue?[f.selectedValue]:fi.p),[y,f.selectedValue,f.selectedValues]),I=(0,s.Kr)((()=>new Set(k)),[k]),P=(0,s.Kr)((()=>new Set(w)),[w]),Y=(0,s.Kr)((()=>{if(o)return n.map((e=>e.value));const e=[],t=[],i=[];return n.forEach((s=>{I.has(s.value)?e.push(s):P.has(s.value)?i.push(s):t.push(s)})),e.concat(t,i).map((e=>e.value))}),[o,n,I,P]),F=(0,D.A)((e=>{if(y){const t=N.slice(),i=t.indexOf(e);return i>=0?t.splice(i,1):t.push(e),void f.onSelectedValuesChange?.(t)}f.onSelectedValueChange?.(e)})),[T,B]=(0,Ms.A)(b,Y,Boolean(v||o)),R=(0,D.A)((e=>{const{value:t}=e.currentTarget;g?.(t)})),L=(0,s.hb)((e=>{const t=n.find((t=>t.value===e));if(!t)return;const{label:i,subLabel:s,isLoading:o}=t,a=P.has(e),r=I.has(e),l=a||r,c=N.includes(e);return(0,ee.Y)(Es.A,{className:(0,me.A)(Ca,u),title:i,subtitle:s,disabled:l,inactive:h,ripple:!0,inputElement:l?(0,ee.Y)(q.A,{name:"lock-badge"}):"radio"===m?(0,ee.Y)(ba.A,{checked:c,disabled:l,isLoading:o,onlyInput:!0}):"checkbox"===m?(0,ee.Y)(en.A,{checked:c,disabled:l,isLoading:o,onlyInput:!0}):void 0,onClick:()=>F(e),onDisabledClick:A&&(()=>A(e,r))},e)}),[n,P,I,N,h,A,m,u]);return(0,ee.FD)("div",{className:(0,me.A)(fa.A.container,e),children:[t&&(0,ee.Y)("div",{className:(0,me.A)(fa.A.header,"custom-scroll"),dir:C.isRtl?"rtl":void 0,children:(0,ee.Y)(Q.A,{id:i,ref:S,value:o,onChange:R,placeholder:d||C("Search")})}),T?.length?(0,ee.Y)(bs.A,{className:(0,me.A)(fa.A.pickerList,p&&fa.A.padded,"custom-scroll"),items:T,itemSelector:`.${Ca}`,onLoadMore:B,noScrollRestore:c,children:T.map((e=>L(e)))}):l||!T||T.length?(0,ee.Y)(Rs.A,{}):(0,ee.Y)("p",{className:fa.A.noResults,children:a||C("SearchEmptyViewTitle")})]})})),ya={root:"wzzA3MFh",pickerSelector:"xhujrq9i",pickerTitle:"YuRK4e7S",picker:"YF9nLkCK",footer:"ATCZ2Q5G"},ka=(0,s.ph)((({isOpen:e,onClose:t,onSubmit:i,countryList:o,selectionLimit:a})=>{const{showNotification:r}=(0,n.ko)(),l=(0,M.A)(),[c,d]=(0,s.J0)([]),h=(0,V.A)(c)===c,m=(0,s.Kr)((()=>o?o.filter((e=>!e.isHidden&&"FT"!==e.iso2)).map((({iso2:e,defaultName:t})=>({value:e,label:t}))):[]),[o]),u=(0,D.A)((e=>{a&&e.length>a?r({message:l("BoostingSelectUpToWarningCountries",a)}):d(e)})),p=(0,D.A)((()=>{i(c),t()}));return(0,ee.FD)(Z.A,{className:ya.root,isOpen:e,onClose:t,onEnter:p,children:[(0,ee.Y)("div",{className:ya.container,children:(0,ee.FD)("div",{className:ya.pickerSelector,children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:t,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("h4",{className:ya.pickerTitle,children:l("BoostingSelectCountry")})]})}),(0,ee.Y)("div",{className:(0,me.A)(ya.main,"custom-scroll"),children:(0,ee.Y)(Sa,{className:ya.picker,items:m,selectedValues:c,onSelectedValuesChange:u,noScrollRestore:h,allowMultiple:!0,itemInputType:"checkbox"})}),(0,ee.Y)("div",{className:ya.footer,children:(0,ee.Y)(W.A,{size:"smaller",onClick:p,children:l("SelectCountries.OK")})})]})}));var wa=i(1526),Na=i(96530),Ia=i(11124),Pa=i(34642);const Ya=(0,s.ph)((({isOpen:e,giveawayChatId:t,selectionLimit:i,initialSelectedIds:o,onSelectedIdsConfirmed:a,onClose:r})=>{const{showNotification:c}=(0,n.ko)(),d=(0,M.A)(),[h,m]=(0,s.J0)(void 0),[u,p]=(0,s.J0)(""),[v,g,A]=(0,Y.A)(),[b,f]=(0,s.J0)(o);(0,s.vJ)((()=>{f(o)}),[o]);const C=(0,s.Kr)((()=>{const e=(0,n.mS)(),i=e.chats.byId,{active:s,archived:o}=e.chats.listIds,a=(s||[]).concat(o||[]);return(0,bi.Am)(a).map((e=>i[e])).filter((e=>e&&((0,l.WX)(e)||(0,l.Vs)(e))&&e.id!==t)).map((e=>e.id))}),[t]),S=(0,s.Kr)((()=>{const e=C?(0,Yt.PU)({ids:C,query:u,type:"chat"}):[];return(0,Fs.A)(e,!1,b)}),[C,u,b]),y=(0,D.A)((e=>{const t=(0,n.mS)().chats.byId,s=e.filter((e=>!b.includes(e))).find((e=>{const i=t[e];return i&&!(0,l.gA)(i)}));b?.length>=i?c({message:d("BoostingSelectUpToWarningChannelsPlural",i)}):s?(m(s),g()):f(e)})),k=(0,D.A)((()=>{h&&f((0,bi.Am)([...b,h])),A()})),w=(0,D.A)((()=>{a(b),r()}));return(0,ee.FD)(Pa.A,{isOpen:e,onClose:r,title:d("RequestPeer.ChooseChannelTitle"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:d("Save"),onConfirm:w,onEnter:w,children:[(0,ee.Y)(Ci.A,{itemIds:S,selectedIds:b,filterValue:u,filterPlaceholder:d("Search"),onSelectedIdsChange:y,onFilterChange:p,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"}),(0,ee.Y)(pi.A,{title:d("BoostingGiveawayPrivateChannel"),text:d("BoostingGiveawayPrivateChannelWarning"),confirmLabel:d("Add"),isOpen:v,onClose:A,confirmHandler:k})]})})),Fa=(0,s.ph)((({option:e,checked:t,name:i,text:s,img:n,isLink:o,onChange:a,onClickAction:r,className:l,userNames:c,selectedMemberIds:d})=>{const h=(0,M.A)();let m=h(s);o&&d?.length&&(m=d.length>2?d.length.toString():c);const u=(0,D.A)((t=>{t.target.checked&&a(e)})),p=(0,D.A)((()=>{r?.()}));return(0,ee.FD)("label",{className:(0,me.A)("w3OGYFKn",l),dir:h.isRtl?"rtl":void 0,role:"button",tabIndex:0,children:[(0,ee.Y)("input",{className:"xy4AclZa",type:"radio",name:"giveaway_option",value:e,checked:t,onChange:u,onClick:e=>e.stopPropagation()}),(0,ee.FD)("div",{className:"TTgSI7Xh",children:[(0,ee.Y)("img",{className:"lGhZJbMF",src:n,alt:"",draggable:!1}),(0,ee.FD)("div",{className:"sEt7TF59",children:[(0,ee.Y)("h3",{className:"u4NzVBBi",children:h(i)}),o?(0,ee.FD)("div",{className:"y7XfPOoG",onClick:p,children:[(0,ee.Y)("span",{children:m}),(0,ee.Y)(q.A,{name:"next"})]}):(0,ee.Y)("span",{className:"kt2ZKZ6j",children:m})]})]})]})})),Da=(0,s.ph)((0,n.EK)(((e,{giveawayChatId:t})=>{const i=t?(0,c.AWZ)(e,t):void 0;return i?{members:i.members,adminMembersById:i.adminMembersById}:{}}))((({isOpen:e,selectionLimit:t,members:i,adminMembersById:o,initialSelectedIds:a,onSelectedIdsConfirmed:r,onClose:c})=>{const{showNotification:d}=(0,n.ko)(),h=(0,M.A)(),[m,u]=(0,s.J0)(""),[p,v]=(0,s.J0)(a);(0,s.vJ)((()=>{v(a)}),[a]);const g=(0,s.Kr)((()=>{const e=(0,n.mS)(),{byId:t,statusesById:s}=e.users;if(!i?.length)return[];const a=o&&new Set(Object.keys(o)),r=(0,l.UB)(i.map((({userId:e})=>e)),t,s);return a?r.filter((e=>!a.has(e))):r}),[o,i]),A=(0,s.Kr)((()=>{const e=(0,n.mS)().users.byId,t=g?(0,Yt.PU)({ids:g,query:m,type:"user"}):[];return(0,Fs.A)((0,bi.Am)(t).filter((t=>{const i=e[t];return!i||!(0,l.tv)(i)})))}),[g,m]),b=(0,D.A)((e=>{e.length>t?d({message:h("BoostingSelectUpToWarningUsers",t)}):v(e)})),f=(0,D.A)((()=>{r(p),c()}));return(0,ee.Y)(Pa.A,{isOpen:e,onClose:c,title:h("BoostingAwardSpecificUsers"),hasCloseButton:!0,shouldAdaptToSearch:!0,withFixedHeight:!0,confirmButtonText:h("Save"),onConfirm:f,onEnter:f,children:(0,ee.Y)(Ci.A,{itemIds:A,selectedIds:p,filterValue:m,filterPlaceholder:h("Search"),onSelectedIdsChange:b,onFilterChange:u,isSearchable:!0,withDefaultPadding:!0,withStatus:!0,allowMultiple:!0,itemInputType:"checkbox"})})}))),Ma="rZRDMqUL",Ta="JjDLNrKG",Ba="p5Hn4Q6E",Ra="rniPcuiP",La="G9H3tm6D",xa="xKl2UeV8",Ea="HLx3wTBD",Va="Ftr7zf2v",_a="Ce0Ob2tg",Ua="rDFQAfTt",Oa="LZ3vPzak",Ka="Z9QJQ6IS",Ja="ldn4mh2T";var Ga=i(72078),ja=i(68153),za=i(65741),Ha=i(45318);const $a=i.p+"PremiumStar.39c1ff364d35554f4b80.svg",qa={3:ja,6:Ga,12:za},Wa=(0,s.ph)((0,n.EK)((e=>{const{giveawayModal:t}=(0,c.nTw)(e),i=t?.chatId,s=i?(0,c.hds)(e,i):void 0,n=s&&(0,l.WX)(s);return{chatId:i,gifts:t?.gifts,selectedMemberList:t?.selectedMemberIds,selectedChannelList:t?.selectedChannelIds,giveawayBoostPerPremiumLimit:e.appConfig?.giveawayBoostsPerPremium,isStarsGiftEnabled:e.appConfig?.isStarsGiftEnabled,userSelectionLimit:e.appConfig?.giveawayAddPeersMax,countrySelectionLimit:e.appConfig?.giveawayCountriesMax,countryList:e.countryList.general,prepaidGiveaway:t?.prepaidGiveaway,isChannel:n,starsGiftOptions:t?.starOptions}}))((({chatId:e,gifts:t,isOpen:i,isChannel:o,selectedMemberList:r,selectedChannelList:c,giveawayBoostPerPremiumLimit:d=a.CQG,countryList:h,prepaidGiveaway:m,countrySelectionLimit:u=a.y67,userSelectionLimit:p=a.qbC,isStarsGiftEnabled:v,starsGiftOptions:g})=>{const A=(0,s.li)(),{closeGiveawayModal:b,openInvoice:f,openPremiumModal:C,launchPrepaidGiveaway:S,launchPrepaidStarsGiveaway:y}=(0,n.ko)(),k=(0,M.A)(),[w,N,I]=(0,Y.A)(),[P,F,T]=(0,Y.A)(),[B,R,L]=(0,Y.A)(),[x,E,V]=(0,Y.A)(),[_,U,O]=(0,Y.A)(),K=[{name:"Premium.Title",text:"BoostingWinnersRandomly",value:"premium_giveaway",img:Ga,actions:"createPremiumGiveaway",isLink:!0,onClickAction:()=>{E()}}];v&&K.push({name:"TelegramStars",text:"BoostingWinnersRandomly",value:"stars_giveaway",img:Ha,actions:"createStarsGiveaway",isLink:!1});const[J,G]=(0,s.J0)(Date.now()+2592e5),[j,z]=(0,s.J0)(!0),[H,$]=(0,s.J0)(5),[te,ie]=(0,s.J0)(K[0].value),[se,ne]=(0,s.J0)(),[oe,ae]=(0,s.J0)("all"),[re,le]=(0,s.J0)(),[ce,de]=(0,s.J0)([]),[he,ue]=(0,s.J0)([]),[pe,ve]=(0,s.J0)([]),[ge,Ae]=(0,s.J0)(!1),[be,fe]=(0,s.J0)(!1),[Ce,Se]=(0,s.J0)(void 0),[ye,ke]=(0,s.J0)(void 0),[we,Ne]=(0,s.J0)(void 0),Ie="premium_giveaway"===te,Pe="stars_giveaway"===te,Ye=Ie&&!ce.length?H:ce.length,Fe=Ye*d,De=se?.yearlyBoosts,Me=(0,s.Kr)((()=>[{value:"all",label:k(o?"BoostingAllSubscribers":"BoostingAllMembers"),subLabel:pe&&pe.length>0?k("Giveaway.ReceiverType.Countries",pe.length):k("BoostingFromAllCountries")},{value:"new",label:k(o?"BoostingNewSubscribers":"BoostingNewMembers"),subLabel:pe&&pe.length>0?k("Giveaway.ReceiverType.Countries",pe.length):k("BoostingFromAllCountries")}]),[o,k,pe]),Te=k("Months",re),Be="starsGiveaway"===m?.type,Re="giveaway"===m?.type,Le=(0,s.Kr)((()=>t?.find((e=>e.months===re&&e.users===Ye))),[t,re,Ye]),xe=(0,s.Kr)((()=>g?.find((e=>Be&&e.stars===we?.stars))),[we,g,Be]),Ee=(0,s.Kr)((()=>t?.filter((e=>e.users===Ye&&e.currency!==a.OUy))),[t,Ye]),Ve=(0,s.Kr)((()=>{const e=Ee?.reduce(((e,t)=>t.amount<e.amount?t:e),Ee[0]);return e&&Math.floor(e.amount/e.months)}),[Ee]),_e=(0,s.Kr)((()=>(0,bi.Am)(t?.filter((e=>e.currency!==a.OUy))?.map((e=>e.users))||[]).sort(((e,t)=>e-t))),[t]),Ue=(0,s.Kr)((()=>(0,bi.Am)(se?.winners?.map((e=>e.users))||[]).sort(((e,t)=>e-t))),[se]);(0,s.vJ)((()=>{i&&t?.length&&!Be&&le(t?.[0].months)}),[i,t,Be]),(0,s.vJ)((()=>{i&&g?.length&&!Re&&ne(g?.[0])}),[i,g,Re]),(0,s.vJ)((()=>{i&&Be&&($(m.quantity),Ne(m))}),[i,Be,m]),(0,s.vJ)((()=>{i&&Re&&($(m.quantity),ke(m),le(m.months))}),[i,Re,m]),(0,s.vJ)((()=>{r&&de(r)}),[r]),(0,s.vJ)((()=>{c&&ue(c)}),[c]);const Oe=(0,D.A)((()=>{C()})),Ke=(0,D.A)((()=>{Ne(void 0),ke(void 0),ne(void 0),le(void 0),$(5),b()})),Je=(0,D.A)((()=>{f(Ie?ce?.length?{type:"giftcode",boostChannelId:e,userIds:ce,currency:Le.currency,amount:Le.amount,option:Le}:{type:"giveaway",chatId:e,additionalChannelIds:he,isOnlyForNewSubscribers:"new"===oe,countries:pe,areWinnersVisible:ge,prizeDescription:Ce,untilDate:J/1e3,currency:Le.currency,amount:Le.amount,option:Le}:{type:"starsgiveaway",chatId:e,additionalChannelIds:he,isOnlyForNewSubscribers:"new"===oe,countries:pe,areWinnersVisible:ge,prizeDescription:Ce,untilDate:J/1e3,currency:se.currency,amount:se.amount,stars:se.stars,users:H}),Ke()})),Ge=(0,D.A)((()=>{Be?y({chatId:e,giveawayId:we.id,paymentPurpose:{additionalChannelIds:he,countries:pe,prizeDescription:Ce,areWinnersVisible:ge,untilDate:J/1e3,stars:we.stars,currency:xe.currency,amount:xe.amount,users:we.quantity}}):S({chatId:e,giveawayId:ye.id,paymentPurpose:{additionalChannelIds:he,countries:pe,prizeDescription:Ce,areWinnersVisible:ge,untilDate:J/1e3,currency:Le.currency,amount:Le.amount}}),L(),Ke()})),je=(0,D.A)((e=>{$(e)})),He=(0,D.A)((e=>{$(e)})),$e=(0,D.A)((e=>{Se(e.target.value)})),qe=(0,s.Kr)((()=>{const e=(0,n.mS)().users.byId;return ce?.map((t=>(0,l.Yg)(e[t]))).join(", ")}),[ce]),We=(0,D.A)((e=>{ae(e)})),Qe=(0,D.A)((e=>{ie(e),de([]),$(5)})),Ze=(0,D.A)((e=>{G(e.getTime()),I()})),Xe=(0,D.A)((e=>{ve(e)})),et=(0,D.A)((e=>{de(e),e.length||ie("premium_giveaway")})),tt=(0,D.A)((e=>{ue(e)})),it=(0,D.A)((e=>{Ae(e.target.checked)})),st=(0,D.A)((e=>{fe(e.target.checked)})),nt=(0,D.A)((()=>{F()})),ot=(0,D.A)((e=>{ne(e)}));function at(){return(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:Ma,children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingChannelsGroupsIncludedGiveaway")}),(0,ee.Y)(li.A,{inactive:!0,className:"chat-item-clickable contact-list-item",children:(0,ee.Y)(Ss.A,{chatId:e,status:k(o?"BoostingChannelWillReceiveBoost":"BoostingGroupWillReceiveBoost",Fe||De,"i")})}),he?.map((e=>(0,ee.Y)(li.A,{ripple:!0,className:"chat-item-clickable contact-list-item",onClick:()=>function(e){const t=he.filter((t=>t!==e));ue(t)}(e),rightElement:(0,ee.Y)(q.A,{name:"close",className:"UZdErfVI"}),children:(0,ee.Y)(Ss.A,{chatId:e.toString()})},e))),he.length<9&&(0,ee.Y)(li.A,{icon:"add",ripple:!0,onClick:U,className:"sOXvh85b",iconClassName:"aGbyR60s",children:k("BoostingAddChannelOrGroup")})]}),(0,ee.FD)("div",{className:Ma,children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingEligibleUsers")}),(0,ee.Y)("div",{className:Ta,children:(0,ee.Y)(X.A,{name:"subscribers",options:Me,selected:oe,onChange:We,onClickAction:nt,subLabelClassName:"txXJxVFu",isLink:!0})})]}),(0,ee.Y)("div",{className:Ra,children:(0,Ft.A)(k(o?"BoostGift.LimitSubscribersInfo":"lng_giveaway_users_about_group"))}),(0,ee.FD)("div",{className:Ma,children:[(0,ee.FD)("div",{className:Ka,children:[(0,ee.Y)("h2",{className:Oa,children:k("BoostingGiveawayAdditionalPrizes")}),(0,ee.Y)(Ai.A,{label:k("BoostingGiveawayAdditionalPrizes"),checked:be,onChange:st})]}),be&&(0,ee.FD)("div",{className:"eQVP0Nx8",children:[(0,ee.Y)("h2",{className:Oa,children:H}),(0,ee.Y)(Q.A,{className:"qMYNwiUZ",value:Ce,onChange:$e,label:k("BoostingGiveawayEnterYourPrize")})]})]}),be?Pe||Be?void 0:(0,ee.Y)("div",{className:Ra,children:Ce?.length?(0,Ft.A)(k("BoostingGiveawayAdditionPrizeCountNameHint",ye?[ye.quantity,Ce,Te]:[Ye,Ce,Te],void 0,re),["simple_markdown"]):(0,Ft.A)(k("BoostingGiveawayAdditionPrizeCountHint",ye?[ye.quantity,Te]:[Ye,Te],void 0,re),["simple_markdown"])}):(0,ee.Y)("div",{className:Ra,children:(0,Ft.A)(k("BoostingGiveawayAdditionPrizeHint"))}),(0,ee.Y)("div",{className:Ma,children:(0,ee.FD)("div",{className:Ka,children:[(0,ee.Y)("h2",{className:Oa,children:k("BoostingGiveawayShowWinners")}),(0,ee.Y)(Ai.A,{label:k("BoostingGiveawayAdditionalPrizes"),checked:ge,onChange:it})]})}),(0,ee.Y)("div",{className:Ra,children:(0,Ft.A)(k("BoostingGiveawayShowWinnersHint"))}),(0,ee.FD)("div",{className:(0,me.A)(Ma,(ye||we||Pe)&&Ua),children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingDateWhenGiveawayEnds")}),(0,ee.FD)(W.A,{ariaLabel:k("BoostGift.DateEnds"),className:(0,me.A)("GeKqKRgP","expire-limit"),isText:!0,onClick:N,children:[(0,ee.Y)("h3",{className:Oa,children:k("BoostGift.DateEnds")}),(0,ze.L2)(J,k.code)]})]})]})}return(0,ee.FD)(Z.A,{className:"P0kLOw15",onClose:Ke,isOpen:i,dialogRef:A,onEnter:ye||we?R:Je,children:[(0,ee.FD)("div",{className:(0,me.A)("SqiN63Ef","custom-scroll"),onScroll:function(e){const{scrollTop:t}=e.currentTarget;z(t<=150)},children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",className:"OX6_HqAd",color:"translucent",onClick:Ke,ariaLabel:k("Close"),children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("img",{className:"Me2hCsMs",src:$a,alt:"",draggable:!1}),(0,ee.Y)("h2",{className:"UVDnB0Wq",children:(0,Ft.A)(k("BoostingBoostsViaGifts"))}),(0,ee.Y)("div",{className:"v5yGzV6v",children:(0,Ft.A)(k(o?"BoostingGetMoreBoost":"BoostingGetMoreBoostsGroup"))}),(0,ee.Y)("div",{className:(0,me.A)("U6XNIToQ",j&&"tDZc21ZC"),children:(0,ee.Y)("h2",{className:"v6hiGpEn",children:k("BoostingBoostsViaGifts")})}),ye||we?(0,ee.FD)("div",{className:"q1y2qUTn",children:[(0,ee.Y)("div",{children:we?(0,ee.Y)("img",{className:Ja,src:Ha,alt:""}):(0,ee.Y)("img",{className:Ja,src:qa[ye.months]||qa[3],alt:""})}),(0,ee.FD)("div",{className:"IsT38nlq",children:[(0,ee.Y)("h3",{className:Oa,children:we?k("Giveaway.Stars.Prepaid.Title",we?.stars):k("BoostingTelegramPremiumCountPlural",ye.quantity)}),(0,ee.Y)("p",{className:"TsGuei3B",children:we?k("Giveaway.Stars.Prepaid.Desc",we?.quantity):k("PrepaidGiveawayMonths",ye?.months)})]}),(0,ee.Y)("div",{className:La,children:(0,ee.FD)("div",{className:(0,me.A)(xa,Ea),children:[(0,ee.Y)(q.A,{name:"boost",className:Va}),(0,ee.Y)("div",{className:_a,dir:k.isRtl?"rtl":void 0,children:we?we?.boosts:ye.quantity*(d??a.CQG)})]})})]}):(0,ee.Y)("div",{className:(0,me.A)(Ma,"sQ5PkKEs"),children:(0,ee.Y)("div",{className:Ta,children:K.map((e=>(0,ee.Y)(Fa,{name:e.name,text:e.text,option:e.value,img:e.img,onChange:Qe,checked:te===e.value,isLink:e.isLink,userNames:qe,selectedMemberIds:ce,onClickAction:e.onClickAction},e.name)))})}),Ie&&!ce?.length&&(0,ee.FD)(ee.FK,{children:[!ye&&!we&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:Ma,children:[(0,ee.FD)("div",{className:La,children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingQuantityPrizes")}),(0,ee.FD)("div",{className:(0,me.A)(xa,Ea),children:[(0,ee.Y)(q.A,{name:"boost",className:Va}),(0,ee.Y)("div",{className:_a,dir:k.isRtl?"rtl":void 0,children:Fe})]})]}),(0,ee.Y)(Ia.A,{rangeCount:Ye,marks:_e,onChange:je})]}),(0,ee.Y)("div",{className:Ra,children:(0,Ft.A)(k("BoostingChooseHowMany"))})]}),at()]}),Pe&&(0,ee.FD)(ee.FK,{children:[!we&&!ye&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:Ma,children:[(0,ee.FD)("div",{className:La,children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingStarsOptions")}),(0,ee.FD)("div",{className:(0,me.A)(xa,Ea),children:[(0,ee.Y)(q.A,{name:"boost",className:Va}),(0,ee.Y)("div",{className:_a,dir:k.isRtl?"rtl":void 0,children:De})]})]}),(0,ee.Y)(wa.A,{className:"cLhNkYPB",options:g,selectedStarCount:H,selectedStarOption:se,onClick:ot})]}),(0,ee.Y)("div",{className:(0,me.A)(Ra,"bzRAETfR"),children:(0,Ft.A)(k("BoostGift.Stars.Info"))}),(0,ee.FD)("div",{className:Ma,children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingStarsQuantityPrizes")}),(0,ee.Y)(Ia.A,{rangeCount:H,marks:Ue,onChange:He}),(0,ee.Y)("div",{className:Ra,children:(0,Ft.A)(k("BoostingStarsQuantityPrizesInfo"))})]})]}),at()]}),!ye&&!we&&Ie&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:Ma,children:[(0,ee.Y)("h2",{className:Ba,children:k("BoostingDurationOfPremium")}),(0,ee.Y)("div",{className:Ta,children:Ee?.map((e=>(0,ee.Y)(Wo,{isGiveaway:!0,option:e,fullMonthlyAmount:Ve,checked:e.months===re,onChange:le},e.months)))})]}),(0,ee.Y)("div",{className:(0,me.A)(Ra,Ua),children:function(){const e=k("GiftPremiumListFeaturesAndTerms").match(/([^*]*)\*([^*]+)\*(.*)/);if(e&&!(e.length<4))return(0,ee.FD)("p",{className:"eNQ_nrKr",children:[e[1],(0,ee.Y)(Na.A,{isPrimary:!0,onClick:Oe,children:e[2]}),e[3]]})}()})]}),te&&(0,ee.Y)("div",{className:"hD_AEzjd",children:(0,ee.Y)(W.A,{className:"ILuhBsJG",onClick:ye||we?R:Je,children:k("BoostingStartGiveaway")})})]}),(0,ee.Y)(ln,{isOpen:w,isFutureMode:!0,withTimePicker:!0,onClose:I,onSubmit:Ze,selectedAt:J,submitButtonLabel:k("Save")}),(0,ee.Y)(ka,{isOpen:P,onClose:T,countryList:h,onSubmit:Xe,selectionLimit:u}),(0,ee.Y)(Da,{isOpen:x,onClose:V,onSelectedIdsConfirmed:et,initialSelectedIds:ce,selectionLimit:p,giveawayChatId:e}),(0,ee.Y)(Ya,{isOpen:_,onClose:O,initialSelectedIds:he,onSelectedIdsConfirmed:tt,selectionLimit:a.cgU,giveawayChatId:e}),(0,ee.Y)(pi.A,{title:k("BoostingStartGiveawayConfirmTitle"),text:k("BoostingStartGiveawayConfirmText"),confirmLabel:k("Start"),isOpen:B,onClose:L,confirmHandler:Ge})]})}))),Qa={dialogFiltersChats:"LimitReachedChatInFolders",uploadMaxFileparts:"LimitReachedFileSize",dialogFilters:"LimitReachedFolders",dialogFolderPinned:"LimitReachedPinDialogs",channelsPublic:"LimitReachedPublicLinks",channels:"LimitReachedCommunities",chatlistInvites:"LimitReachedFolderLinks",chatlistJoined:"LimitReachedSharedFolders",savedDialogsPinned:"LimitReachedPinSavedDialogs"},Za={dialogFiltersChats:"LimitReachedChatInFoldersLocked",uploadMaxFileparts:"LimitReachedFileSizeLocked",dialogFilters:"LimitReachedFoldersLocked",dialogFolderPinned:"LimitReachedPinDialogsLocked",channelsPublic:"LimitReachedPublicLinksLocked",channels:"LimitReachedCommunitiesLocked",chatlistInvites:"LimitReachedFolderLinksLocked",chatlistJoined:"LimitReachedSharedFoldersLocked",savedDialogsPinned:"LimitReachedPinSavedDialogsLocked"},Xa={dialogFiltersChats:"LimitReachedChatInFoldersPremium",uploadMaxFileparts:"LimitReachedFileSizePremium",dialogFilters:"LimitReachedFoldersPremium",dialogFolderPinned:"LimitReachedPinDialogsPremium",channelsPublic:"LimitReachedPublicLinksPremium",channels:"LimitReachedCommunitiesPremium",chatlistInvites:"LimitReachedFolderLinksPremium",chatlistJoined:"LimitReachedSharedFoldersPremium",savedDialogsPinned:"LimitReachedPinSavedDialogsPremium"},er={dialogFiltersChats:"chat-badge",uploadMaxFileparts:"file-badge",dialogFilters:"folder-badge",dialogFolderPinned:"pin-badge",channelsPublic:"link-badge",channels:"chats-badge",chatlistInvites:"link-badge",chatlistJoined:"folder-badge",savedDialogsPinned:"pin-badge"},tr={uploadMaxFileparts:(e,t)=>8e3===t?e("FileSize.GB","4"):4e3===t?e("FileSize.GB","2"):(0,He.v7)(e,t*a.dK5)},ir=(0,s.ph)((0,n.EK)(((e,{limit:t})=>{const{limits:i}=e.appConfig||{},s=(0,c.g29)(e);return{defaultValue:t?i?.[t][0]:void 0,premiumValue:t?i?.[t][1]:void 0,canBuyPremium:!(0,c.n_C)(e),isPremium:s}}))((({defaultValue:e,premiumValue:t,limit:i,isPremium:o,canBuyPremium:a})=>{const{closeLimitReachedModal:r,openPremiumModal:l}=(0,n.ko)(),c=(0,M.A)(),[d,h,m]=(0,Y.A)(),u=(0,s.hb)((()=>{l(),h()}),[l,h]);(0,s.vJ)((()=>{!i&&d&&m()}),[d,i,m]);const p=c("LimitReached"),v=i&&tr[i],g=function({lang:e,limitType:t,isPremium:i,canBuyPremium:s,defaultValue:n,premiumValue:o,valueFormatter:a}){if(!t)return;const r=a?a(e,n):n,l=a?a(e,o):o;return i?e(Xa[t],l):s?e(Qa[t],"channelsPublic"===t?l:[r,l]):e(Za[t],r)}({lang:c,limitType:i,isPremium:o,canBuyPremium:a,defaultValue:e,premiumValue:t,valueFormatter:v}),A=i&&er[i],b=a&&!o;return(0,ee.FD)(Z.A,{onClose:h,onCloseAnimationEnd:r,isOpen:Boolean(i)&&!d,title:p,className:"QAs_iFxO",children:[!b&&(0,ee.FD)("div",{className:"Q5d_7bB4",children:[(0,ee.Y)("i",{className:(0,me.A)("rbnU7JVX",A,"icon")}),(0,ee.Y)("div",{className:"ArEy3hhB",children:v?.(c,o?t:e)||(o?t:e)})]}),b&&(0,ee.Y)(yo,{className:"k0O6Rnjh",leftValue:v?.(c,e)||e?.toString(),rightValue:v?.(c,t)||t?.toString(),floatingBadgeIcon:A}),(0,ee.Y)("div",{children:(0,Ft.A)(g||"",["simple_markdown","br"])}),(0,ee.FD)("div",{className:"RVM_RSap",children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:h,color:"primary",children:c(b?"Cancel":"OK")}),b&&(0,ee.FD)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:u,color:"primary",children:[c("IncreaseLimit"),(0,ee.Y)(q.A,{name:"double-badge",className:"esB1OhAF"})]})]})]})})));var sr=i(93809),nr=i(81954),or=i(5912);const ar=350+a.xB5,rr=.5*p.$;function lr(e,t,i,n){const o=(0,s.li)([]),[a,r]=(0,s.J0)(0),{observe:l,freeze:c,unfreeze:d}=(0,or.BL)({rootRef:e},(e=>{const t=o.current;e.forEach((e=>{const s=Number(e.target.id.replace(`${i}-`,""));t[s]=e.isIntersecting}));const s=t.reduce(((e,t,i)=>t&&i<e?i:e),1/0);s!==1/0&&r(s)})),{observe:h,freeze:m,unfreeze:u}=(0,or.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:p}=(0,or.BL)({rootRef:e,throttleMs:200,margin:100}),{observe:v}=(0,or.BL)({rootRef:t});return(0,G.A)((()=>{n?(c(),m()):setTimeout((()=>{u(),d()}),ar)}),[c,m,n,d,u]),{activeSetIndex:a,observeIntersectionForSet:l,observeIntersectionForShowingItems:h,observeIntersectionForPlayingItems:p,observeIntersectionForCovers:v,selectStickerSet:(0,D.A)((t=>{r((s=>{const n=document.getElementById(`${i}-${t}`),o=1===Math.abs(s-t);return(0,nr.Ay)({container:e.current,element:n,position:"start",margin:rr,maxDistance:o?200:80}),t}))}))}}var cr=i(37479),dr=i(87094),hr=i(94519),mr=i(47483);const ur=(0,s.ph)((({stickerSet:e,size:t=a.TBj,noPlay:i,forcePlayback:o,observeIntersection:r,sharedCanvasRef:d})=>{const{loadStickers:h}=(0,n.ko)(),m=(0,s.li)(),{hasThumbnail:u,hasVideoThumb:p,hasAnimatedThumb:v,hasStaticThumb:g,thumbCustomEmojiId:A}=e,{customEmoji:f}=(0,mr.A)(A),C=f?.shouldUseTextColor,S=(0,dr.A)(m,void 0,!C),y=(0,cr.A)(S),k=(0,or.Vz)(m,r),w=k&&!i,N=!u||p&&!b.OF&&!v&&!g,I=N&&e.stickers?.[0]&&(0,l.Mw)(e.stickers[0],"preview"),P=(0,j.A)(I,!k),Y=(u&&!I||v)&&`stickerSet${e.id}`,F=(0,j.A)(Y,!k),D=A||F||P,M=(0,Ui.A)(D),T=(0,hr.A)(m,d);return(0,s.vJ)((()=>{k&&!e.stickers?.length&&h({stickerSetInfo:e})}),[k,h,e]),(0,ee.Y)("div",{ref:m,className:(0,me.A)("m6XpTzQX","sticker-set-cover"),style:`--_size: ${t}px`,children:D?A?(0,ee.Y)(mo.A,{documentId:A,size:t,observeIntersectionForPlaying:r,noPlay:i}):v?(0,ee.Y)(Po.A,{className:M,tgsUrl:F,size:t,play:w,isLowPriority:!(0,c.CzR)((0,n.mS)(),e),sharedCanvas:d?.current||void 0,sharedCanvasCoords:T,forceAlways:o}):p&&!N?(0,ee.Y)(ji.A,{className:(0,me.A)("OZHqKbDL",M),src:F,canPlay:w,style:y,isPriority:o,loop:!0,disablePictureInPicture:!0}):(0,ee.Y)("img",{src:F||P,style:y,className:(0,me.A)("enA6c8gc",M),alt:"",draggable:!1}):(0,He.Qh)(e.title,2)})}));var pr=i(54464),vr=i(85118),gr=i(82855);const Ar=[{title:"SetTimeoutFor.Hours",value:1,arg:3600},{title:"SetTimeoutFor.Hours",value:2,arg:7200},{title:"SetTimeoutFor.Hours",value:8,arg:28800},{title:"SetTimeoutFor.Days",value:1,arg:86400},{title:"SetTimeoutFor.Days",value:2,arg:172800}],br=(0,s.ph)((({sticker:e,size:t,noPlay:i,title:o,className:a,noContextMenu:r,isSavedMessages:l,isStatusPicker:c,canViewSet:d,observeIntersection:h,observeIntersectionForShowing:m,isSelected:u,isCurrentUserPremium:p,shouldIgnorePremium:v,noShowPremium:g,sharedCanvasRef:A,withTranslucentThumb:f,forcePlayback:C,onClick:S,clickArg:y,onFaveClick:k,onUnfaveClick:w,onRemoveRecentClick:N,onContextMenuOpen:I,onContextMenuClose:P,onContextMenuClick:Y,isEffectEmoji:F,withSparkles:T})=>{const{openStickerSet:B,openPremiumModal:R,setEmojiStatus:L}=(0,n.ko)(),x=(0,s.li)(),E=(0,s.li)(),V=(0,M.A)(),_=e.shouldUseTextColor,U=(0,dr.A)(x,void 0,!_),{id:O,stickerSetInfo:K}=e,J=!e.isFree&&F||e.hasEffect,G=e.isCustomEmoji||F,j=!p&&J&&!v,z=(0,or.Vz)(x,h),H=z,$=z&&!i,Q=(0,or.Vz)(x,m),{isContextMenuOpen:Z,contextMenuAnchor:X,handleBeforeContextMenu:te,handleContextMenu:ie,handleContextMenuClose:se,handleContextMenuHide:ne}=(0,An.A)(x),oe=Boolean(!r&&X),ae=(0,D.A)((()=>x.current)),re=(0,D.A)((()=>x.current.closest(".custom-scroll, .no-scrollbar"))),le=(0,D.A)((()=>c?E.current:x.current.querySelector(".sticker-context-menu .bubble"))),de=(0,D.A)((()=>({withPortal:c,shouldAvoidNegativePosition:!0})));(0,s.vJ)((()=>{Z?I?.():P?.()}),[Z,P,I]),(0,s.vJ)((()=>{z||se()}),[se,z]);const he=(0,D.A)((t=>{t.stopPropagation(),t.preventDefault(),N(e)})),ue=(0,D.A)((()=>{N(e)})),pe=(0,D.A)((()=>{w(e)})),ve=(0,D.A)((()=>{k(e)})),ge=(0,D.A)((()=>{S?.(y,!0)})),Ae=(0,D.A)((()=>{S?.(y,void 0,!0)})),be=(0,D.A)((()=>{B({stickerSetInfo:K})})),fe=(0,D.A)(((t,i=0)=>{t.preventDefault(),t.stopPropagation(),se(),Y?.(),L({emojiStatus:{type:"regular",documentId:e.id,until:(0,ri.Fm)()+i}})})),Ce=!b.TF&&N,Se=(0,me.A)("StickerButton",S&&"interactive",u&&"selected",G&&"custom-emoji",F&&"effect-emoji",a),ye=(0,s.Kr)((()=>{if(!oe||r||G&&!c)return[];const e=[];return G?(Ar.forEach((t=>{e.push((0,ee.Y)(ce.A,{onClick:fe,clickArg:t.arg,children:V(t.title,t.value,"i")}))})),e):(w&&e.push((0,ee.Y)(ce.A,{icon:"favorite",onClick:pe,children:V("Stickers.RemoveFromFavorites")})),k&&e.push((0,ee.Y)(ce.A,{icon:"favorite",onClick:ve,children:V("Stickers.AddToFavorites")})),!j&&S&&(l||e.push((0,ee.Y)(ce.A,{onClick:ge,icon:"muted",children:V("SendWithoutSound")})),e.push((0,ee.Y)(ce.A,{onClick:Ae,icon:"calendar",children:V(l?"SetReminder":"ScheduleMessage")}))),d&&e.push((0,ee.Y)(ce.A,{onClick:be,icon:"stickers",children:V("ViewPackPreview")})),N&&e.push((0,ee.Y)(ce.A,{icon:"delete",onClick:ue,children:V("DeleteFromRecent")})),e)}),[oe,r,G,c,w,k,j,S,d,N,fe,V,pe,ve,l,Ae,ge,be,ue]);return(0,ee.FD)("div",{ref:x,className:Se,title:o||e?.emoji,"data-sticker-id":O,onMouseDown:e=>{(0,pr.u)(e),te(e)},onClick:()=>{Z||(j?R(F?{initialSection:"effects"}:{initialSection:"premium_stickers"}):S?.(y))},onContextMenu:ie,children:[T&&(0,ee.Y)(vr.A,{preset:"button"}),Q&&(0,ee.Y)(gr.A,{containerRef:x,sticker:e,isSmall:!0,size:t,shouldLoop:!0,shouldPreloadPreview:!0,noLoad:!H,noPlay:!$,noVideoOnMobile:!0,withSharedAnimation:!0,sharedCanvasRef:A,withTranslucentThumb:f,customColor:U,forceAlways:C}),!g&&j&&(0,ee.Y)("div",{className:"sticker-locked",children:(0,ee.Y)(q.A,{name:"lock-badge"})}),!g&&J&&!j&&(0,ee.Y)("div",{className:"sticker-premium",children:(0,ee.Y)(q.A,{name:"star"})}),Ce&&(0,ee.Y)(W.A,{className:"sticker-remove-button",color:"dark",round:!0,noFastClick:!0,onClick:he,children:(0,ee.Y)(q.A,{name:"close"})}),Boolean(ye.length)&&(0,ee.Y)($e.A,{ref:E,isOpen:Z,anchor:X,getTriggerElement:ae,getRootElement:re,getMenuElement:le,getLayout:de,className:"sticker-context-menu",autoClose:!0,withPortal:c,onClose:se,onCloseAnimationEnd:ne,children:ye})]})}));var fr=i(93545),Cr=i(83108),Sr=i(64489);const yr=(0,s.ph)((({reaction:e,availableReactions:t,isSelected:i,loadAndPlay:n,observeIntersection:o,sharedCanvasRef:r,sharedCanvasHqRef:c,forcePlayback:d,onClick:h,onContextMenu:m})=>{const u=(0,s.li)(),p="custom"===e.type,v=(0,s.Kr)((()=>t?.find((t=>(0,l.a0)(t.reaction,e)))),[t,e]),g=v?.staticIcon?.thumbnail?.dataUri,A=v?.selectAnimation?.id,b=(0,hr.A)(u,r),f=(0,j.A)(v?.selectAnimation?(0,l.mr)(v.selectAnimation,"full"):void 0,!A),{isContextMenuOpen:C,handleBeforeContextMenu:S,handleContextMenu:y,handleContextMenuClose:k,handleContextMenuHide:w}=(0,An.A)(u,"paid"!==e.type,void 0,void 0,void 0,!0);(0,s.vJ)((()=>{C&&(m?.(e),k(),w())}),[k,m,w,C,e]);const N="paid"===e.type?Cr.w.StarReaction:f,I=(0,D.A)((()=>{h(e)})),P=(0,Ui.A)(f),Y=(0,me.A)("AVrrYEbM",i&&"QkdO_lz1",!p&&"sticker-reaction");return(0,ee.Y)("div",{ref:u,className:Y,onClick:I,title:v?.title,"data-sticker-id":p?e.documentId:void 0,onMouseDown:S,onContextMenu:y,children:p?(0,ee.Y)(mo.A,{ref:u,documentId:e.documentId,size:a.g0Q,noPlay:!n,observeIntersectionForPlaying:o,sharedCanvasRef:r,sharedCanvasHqRef:c,withTranslucentThumb:!0,forceAlways:d}):(0,ee.Y)(Sr.A,{tgsUrl:N,thumbDataUri:g,play:n,noLoop:!1,size:a.g0Q,isLowPriority:!0,className:P,sharedCanvas:r.current||void 0,sharedCanvasCoords:b,forceAlways:d})})}));var kr=i(38027);const wr=(0,s.ph)((0,n.EK)((e=>{const t=e.collectibleEmojiStatuses?.statuses;return{collectibleStatuses:t}}))((({stickerSet:e,loadAndPlay:t,index:i,idPrefix:o,isNearActive:r,favoriteStickers:d,availableReactions:h,isSavedMessages:m,isStatusPicker:u,isReactionPicker:p,isCurrentUserPremium:v,shouldHideHeader:g,withDefaultTopicIcon:A,selectedReactionIds:b,withDefaultStatusIcon:f,isChatEmojiSet:C,isChatStickerSet:S,isTranslucent:y,noContextMenus:k,forcePlayback:w,observeIntersection:N,observeIntersectionForPlayingItems:P,observeIntersectionForShowingItems:F,onReactionSelect:T,onReactionContext:B,onStickerSelect:R,onStickerUnfave:L,onStickerFave:x,onStickerRemoveRecent:E,onContextMenuOpen:V,onContextMenuClose:_,onContextMenuClick:U,collectibleStatuses:O})=>{const{clearRecentStickers:K,clearRecentCustomEmoji:J,clearRecentReactions:G,openPremiumModal:j,toggleStickerSet:z,loadStickers:H}=(0,n.ko)(),$=(0,s.li)(),Q=(0,s.li)(),Z=(0,s.li)(),X=(0,M.A)(),{width:te}=(0,ke.A)(),[ie,se,ne]=(0,Y.A)(),{isMobile:oe}=(0,I.Ay)(),[ae,re]=(0,s.J0)(Nr(te)),le=(0,or.Vz)($,N??F),ce=(0,Ui.A)(le),de=r||le,he=oe?8:4,ue=oe?8:10,pe=oe?8:4,ve=e.id===a.sR2,ge=e.id===a.j1l,Ae=e.id===a.tRH,be=e.id===a.EPW,fe=e.isEmoji,Ce=!ve&&(0,c.Q31)(e),Se=(0,D.A)((()=>{p?G():fe?J():K(),ne()})),ye=(0,D.A)((()=>{Ce&&!v?j({initialSection:"animated_emoji"}):z({stickerSetId:e.id})})),we=(0,D.A)((()=>{R?.({mediaType:"sticker",id:a.MyF,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})})),Ne=(0,D.A)((()=>{R?.({mediaType:"sticker",id:a.zNY,isLottie:!1,isVideo:!1,stickerSetInfo:{shortName:"dummy"}})})),Ie=fe?a.g0Q:a.bkT,Pe=fe?ue:he,Ye=fe?pe:he,Fe=(0,D.A)((e=>e?Math.floor((e+Pe)/(Ie+Pe)):Nr(te))),De=(0,D.A)((e=>{re(Fe(e.contentRect.width))}));(0,fr.A)($,De),(0,s.vJ)((()=>{$.current&&re(Fe($.current.clientWidth))}),[Fe]),(0,s.vJ)((()=>{de&&!e.stickers?.length&&!e.reactions?.length&&e.accessHash&&H({stickerSetInfo:{id:e.id,accessHash:e.accessHash}})}),[de,H,e]);const Me=!m&&!v&&Ce&&!C,Te=e.installedDate&&!e.isArchived,Be=!Te&&e.id!==a.sR2&&e.id!==a.EPW&&e.id!==a.hfH&&e.id!==a.Kp3&&!C&&!S,[Re,,Le]=(0,Y.A)(Be),xe=3*ae-1,Ee=A||f?e.count+1:e.count,Ve=Ie+Ye,_e=Math.ceil(Math.min(xe,Ee)/ae)*Ve-Ye,Ue=Re?_e:Math.ceil(Ee/ae)*Ve-Ye,Oe=(0,s.Kr)((()=>d?new Set(d.map((({id:e})=>e))):void 0),[d]),Ke=(0,s.Kr)((()=>O?new Set(O.map((({documentId:e})=>e))):void 0),[O]),Je=!g&&!ve&&!ge&&fe&&!be&&!C&&(!Te||!v&&!m),Ge=(0,s.Kr)((()=>X(Me?Te?"lng_emoji_premium_restore":"Unlock":"Add")),[Me,X,Te]);return(0,ee.FD)("div",{ref:$,id:`${o}-${i}`,className:(0,me.A)("symbol-set",Me&&"symbol-set-locked"),children:[!g&&(0,ee.FD)("div",{className:"symbol-set-header",children:[(0,ee.FD)("p",{className:(0,me.A)("symbol-set-title",Je&&"symbol-set-title-external"),children:[Me&&(0,ee.Y)(q.A,{name:"lock-badge",className:"symbol-set-locked-icon"}),(0,ee.Y)("span",{className:"symbol-set-name",children:e.title}),(C||S)&&(0,ee.Y)("span",{className:"symbol-set-chat",children:X(C?"GroupEmoji":"GroupStickers")}),Je&&Boolean(e.stickers)&&(0,ee.Y)("span",{className:"symbol-set-amount",children:X(fe?"EmojiCount":"Stickers",e.stickers.length,"i")})]}),ve&&(0,ee.Y)(q.A,{className:"symbol-set-remove",name:"close",onClick:se}),Je&&(0,ee.Y)(W.A,{className:"symbol-set-add-button",withPremiumGradient:Ce&&!v,onClick:ye,pill:!0,size:"tiny",fluid:!0,children:Ge})]}),(0,ee.FD)("div",{className:(0,me.A)("symbol-set-container shared-canvas-container",ce,e.id===a.hfH&&"effect-emojis"),style:`height: ${Ue}px;`,children:[(0,ee.Y)("canvas",{ref:Q,className:"shared-canvas",style:Be?`height: ${_e}px;`:void 0}),(ve||Ae||Be)&&(0,ee.Y)("canvas",{ref:Z,className:"shared-canvas"}),A&&(0,ee.Y)(W.A,{className:"StickerButton custom-emoji",color:"translucent",onClick:we,children:(0,ee.Y)("img",{src:kr,alt:"Reset",className:"sticker-media",draggable:!1})},"default-topic-icon"),f&&(0,ee.Y)(W.A,{className:"StickerButton custom-emoji status-default",color:"translucent",onClick:Ne,children:(0,ee.Y)(q.A,{name:"star"})},"default-status-icon"),de&&e.reactions?.map((i=>{const s=(0,l.Jj)(i),n=s?b?.includes(s):void 0;return(0,ee.Y)(yr,{reaction:i,isSelected:n,loadAndPlay:t,availableReactions:h,observeIntersection:P,onClick:T,onContextMenu:B,sharedCanvasRef:Q,sharedCanvasHqRef:Z,forcePlayback:w},`${e.id}_${s}`)})),de&&e.stickers?.slice(0,Re?xe:e.stickers.length).map(((i,s)=>{const o=(ve||Ae)&&(0,c.CzR)((0,n.mS)(),i.stickerSetInfo),r=Be&&s>=xe||o?Z:Q,l=i.isCustomEmoji?i.id:i.emoji,d=l?b?.includes(l):void 0,h=i.id===a.j1l||Ke?.has(i.id);return(0,ee.Y)(br,{sticker:i,size:Ie,observeIntersection:P,observeIntersectionForShowing:F,noPlay:!t,isSavedMessages:m,isStatusPicker:u,canViewSet:!0,noContextMenu:k,isCurrentUserPremium:v,shouldIgnorePremium:C,sharedCanvasRef:r,withTranslucentThumb:y,onClick:R,clickArg:i,isSelected:d,onUnfaveClick:Ae&&Oe?.has(i.id)?L:void 0,onFaveClick:Oe?.has(i.id)?void 0:x,onRemoveRecentClick:ve?E:void 0,onContextMenuOpen:V,onContextMenuClose:_,onContextMenuClick:U,forcePlayback:w,isEffectEmoji:e.id===a.hfH,noShowPremium:v&&(e.id===a.Kp3||e.id===a.hfH),withSparkles:h},i.id)})),Re&&Ee>xe&&(0,ee.FD)(W.A,{className:"StickerButton custom-emoji set-expand",round:!0,color:"translucent",onClick:Le,children:["+",Ee-xe]},"more")]}),ve&&(0,ee.Y)(pi.A,{text:X(p?"ClearRecentReactionsAlertMessage":"ClearRecentStickersAlertMessage"),isOpen:ie,onClose:ne,confirmHandler:Se,confirmIsDestructive:!0})]},e.id)})));function Nr(e){return e>440?8:e<362?6:7}const Ir="p7c8y0LH",Pr="zTGriBHY",Yr="Qn3lBUNs",Fr="HMspKpNp",Dr="YKO0Obwy",Mr="BZfaP1GD",Tr=2.5*p.$,Br=new Set([a.sR2,a.tRH,a.EPW]),Rr=new Set([a.sR2,a.tRH,a.EPW]),Lr=(0,s.ph)((0,n.EK)(((e,{chatId:t,isStatusPicker:i,isReactionPicker:s})=>{const{stickers:{setsById:n},customEmojis:{byId:o,featuredIds:a,statusRecent:{emojis:r}},recentCustomEmojis:l,reactions:{availableReactions:d,recentReactions:h,topReactions:m,defaultTags:u}}=e,p=Boolean(t&&(0,c.nZ4)(e,t)),v=t?(0,c.AWZ)(e,t):void 0,g=e.collectibleEmojiStatuses?.statuses;return{customEmojisById:o,recentCustomEmojiIds:i?void 0:l,recentStatusEmojis:i?r:void 0,collectibleStatuses:i?g:void 0,stickerSetsById:n,addedCustomEmojiIds:e.customEmojis.added.setIds,canAnimate:(0,c.BWX)(e),isSavedMessages:p,isCurrentUserPremium:(0,c.g29)(e),customEmojiFeaturedIds:a,defaultTopicIconsId:e.defaultTopicIconsId,defaultStatusIconsId:e.defaultStatusIconsId,topReactions:s?m:void 0,recentReactions:s?h:void 0,chatEmojiSetId:v?.emojiSet?.id,isWithPaidReaction:s&&v?.isPaidReactionAvailable,availableReactions:s?d:void 0,defaultTagReactions:s?u:void 0}}))((({className:e,pickerListClassName:t,isHidden:i,loadAndPlay:o,addedCustomEmojiIds:r,customEmojisById:d,recentCustomEmojiIds:h,selectedReactionIds:m,recentStatusEmojis:u,collectibleStatuses:p,stickerSetsById:v,chatEmojiSetId:g,topReactions:A,recentReactions:f,availableReactions:C,idPrefix:S="custom-emoji-set",customEmojiFeaturedIds:y,canAnimate:k,isReactionPicker:w,isStatusPicker:N,isTranslucent:P,isSavedMessages:Y,isCurrentUserPremium:F,withDefaultTopicIcons:T,defaultTopicIconsId:B,defaultStatusIconsId:R,defaultTagReactions:L,isWithPaidReaction:x,onCustomEmojiSelect:E,onReactionSelect:V,onReactionContext:_,onContextMenuOpen:U,onContextMenuClose:O,onContextMenuClick:K})=>{const J=(0,s.li)(),G=(0,s.li)(),j=(0,s.li)(),z=(0,s.li)(),{isMobile:H}=(0,I.Ay)(),{handleScroll:$,isAtBeginning:Q}=As(),Z=(0,s.Kr)((()=>N?u:Object.values((0,bi._E)(d,h))),[d,N,h,u]),X=(0,s.Kr)((()=>{const e=p?.map((e=>e.documentId));return d&&e?.map((e=>d[e])).filter(Boolean)}),[d,p]),te=`${S}-custom-emoji`,{activeSetIndex:ie,observeIntersectionForSet:se,observeIntersectionForPlayingItems:ne,observeIntersectionForShowingItems:oe,observeIntersectionForCovers:ae,selectStickerSet:re}=lr(J,G,te,i),le=(0,Wi.A)(o||void 0,a.jhd),ce=(0,M.A)(),de=(0,Vi.A)(),he=Boolean(r),ue=(0,s.Kr)((()=>{const e=[];if(w&&Y&&L?.length&&e.push({id:a.G3A,accessHash:"",title:ce("PremiumPreviewTags"),reactions:L,count:L.length,isEmoji:!0}),w&&!Y){const t=A?.slice(0,16)||[];x&&t.unshift({type:"paid"}),t?.length&&e.push({id:a.G3A,accessHash:"",title:ce("Reactions"),reactions:t,count:t.length,isEmoji:!0});const i=(f||[]).filter((e=>!t.some((t=>(0,l.a0)(t,e))))).slice(0,32),s=(C||[]).filter((({isInactive:e})=>!e)).map((({reaction:e})=>e)).filter((e=>!t.some((t=>(0,l.a0)(t,e)))&&!i.some((t=>(0,l.a0)(t,e)))));if(s?.length||i?.length){const t=!i?.length,n=i.concat(s);e.push({id:t?a.EPW:a.sR2,accessHash:"",title:ce(t?"PopularReactions":"RecentStickers"),reactions:n,count:n.length,isEmoji:!0})}}else if(N){const t=v[R];if(t?.stickers?.length){const i=(0,bi.Xd)(t.stickers.slice(0,7).concat(Z||[]),"id");e.push({...t,stickers:i,count:i.length,id:a.sR2,title:ce("RecentStickers"),isEmoji:!0})}X?.length&&e.push({id:a.j1l,accessHash:"",count:X.length,stickers:X,title:de("CollectibleStatusesCategory"),isEmoji:!0})}else if(T){const t=v[B];t.stickers?.length&&e.push({...t,id:a.sR2,title:ce("RecentStickers")})}else Z?.length&&e.push({id:a.sR2,accessHash:"0",title:ce("RecentStickers"),stickers:Z,count:Z.length,isEmoji:!0});const t=[...r||[]];g&&t.unshift(g);const i=(0,bi.Am)(t.concat(y||[])),s=Object.values((0,bi._E)(v,i));return[...e,...s]}),[r,w,N,T,Z,y,v,A,C,ce,f,R,B,Y,L,g,x,X,de]),pe=(0,s.Kr)((()=>he&&0===ue.filter((e=>e.stickers?.length)).length),[ue,he]),ve=(0,sr.A)([],a.jhd),ge=he&&ve&&!pe;(0,kn.A)(G,H||!ge),(0,s.vJ)((()=>{if(!he)return;const e=G.current;if(!e)return;const t=ie*Tr-(e.offsetWidth/2-Tr/2);(0,Ao.A)(e,t)}),[he,ie]);const Ae=(0,D.A)((e=>{E(e)})),be=(0,me.A)("StickerPicker","Qk9PEGRE",e);if(!ge)return(0,ee.Y)("div",{className:be,children:pe?(0,ee.Y)("div",{className:Mr,children:ce("NoStickers")}):(0,ee.Y)(Rs.A,{})});const fe=(0,me.A)(Yr,"no-scrollbar",!Q&&Fr),Ce=(0,me.A)(Ir,"U0BL1VvK",b.TF?"no-scrollbar":"custom-scroll",t,Pr);return(0,ee.FD)("div",{className:be,children:[(0,ee.Y)("div",{ref:G,className:fe,children:(0,ee.FD)("div",{className:"shared-canvas-container",children:[(0,ee.Y)("canvas",{ref:j,className:"shared-canvas"}),(0,ee.Y)("canvas",{ref:z,className:"shared-canvas"}),ue.map((function(e,t){const i=e.stickers?.[0],s=(0,me.A)(Dr,t===ie&&"WYeuJNQx"),o=t<a.j41,r=(0,c.CzR)((0,n.mS)(),e);if(e.id!==a.G3A){if(Rr.has(e.id)||e.hasThumbnail||!i){const i=e.id===a.sR2||e.id===a.EPW,n=Br.has(e.id);return(0,ee.Y)(W.A,{className:s,ariaLabel:e.title,round:!0,faded:n,color:"translucent",onClick:()=>re(i?0:t),children:i?(0,ee.Y)(q.A,{name:"recent"}):(0,ee.Y)(ur,{stickerSet:e,noPlay:!k||!le,forcePlayback:!0,observeIntersection:ae,sharedCanvasRef:o?r?z:j:void 0})},e.id)}return(0,ee.Y)(br,{sticker:i,size:a.TBj,title:e.title,className:s,noPlay:!k||!le,observeIntersection:ae,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:o?r?z:j:void 0,withTranslucentThumb:P,onClick:re,clickArg:t,forcePlayback:!0},e.id)}}))]})}),(0,ee.Y)("div",{ref:J,onScroll:$,className:Ce,children:ue.map(((e,t)=>{const i=e.id===a.G3A||e.id===a.sR2&&(T||N),s=e.id===g;return(0,ee.Y)(wr,{stickerSet:e,loadAndPlay:Boolean(k&&le),index:t,idPrefix:te,observeIntersection:se,observeIntersectionForPlayingItems:ne,observeIntersectionForShowingItems:oe,isNearActive:ie>=t-1&&ie<=t+1,isSavedMessages:Y,isStatusPicker:N,isReactionPicker:w,shouldHideHeader:i,withDefaultTopicIcon:T&&e.id===a.sR2,withDefaultStatusIcon:N&&e.id===a.sR2,isChatEmojiSet:s,isCurrentUserPremium:F,selectedReactionIds:m,availableReactions:C,isTranslucent:P,onReactionSelect:V,onReactionContext:_,onStickerSelect:Ae,onContextMenuOpen:U,onContextMenuClose:O,onContextMenuClick:K,forcePlayback:!0},e.id)}))})]})})));var xr=i(3325);const Er=(0,s.ph)((0,n.EK)((e=>({areFeaturedStickersLoaded:Boolean(e.customEmojis.featuredIds?.length),isTranslucent:(0,c.cwE)(e)})))((({isOpen:e,statusButtonRef:t,areFeaturedStickersLoaded:i,isTranslucent:o,onEmojiStatusSelect:a,onClose:r})=>{const{loadFeaturedEmojiStickers:l}=(0,n.ko)(),c=(0,s.li)(),[d,h,m]=(0,Y.A)();(0,s.vJ)((()=>{c.current=t.current.getBoundingClientRect().right}),[e,t]),(0,s.vJ)((()=>{e&&!i&&l()}),[i,e,l]);const u=(0,s.hb)((e=>{a(e),r()}),[r,a]);return(0,ee.Y)(xr.A,{children:(0,ee.Y)($e.A,{isOpen:e,noCompact:!0,positionX:"right",bubbleClassName:"hRzvfaRb",onClose:r,transformOriginX:c.current,noCloseOnBackdrop:d,children:(0,ee.Y)(Lr,{idPrefix:"status-emoji-set-",loadAndPlay:e,isHidden:!e,isStatusPicker:!0,isTranslucent:o,onContextMenuOpen:h,onContextMenuClose:m,onCustomEmojiSelect:u,onContextMenuClick:r})})})})));var Vr=i(10187);const _r=6*p.$,Ur=(0,s.ph)((0,n.EK)(((e,{modal:t})=>({currentUser:(0,c.mBe)(e,e.currentUserId),bot:t?.botId?(0,c.mBe)(e,t.botId):void 0})))((({modal:e,currentUser:t,bot:i})=>{const{setEmojiStatus:o,closeSuggestedStatusModal:a,sendWebAppEvent:r}=(0,n.ko)(),c=(0,Vi.A)(),d=Boolean(e),h=(0,Ti.A)(e),m=(0,s.Kr)((()=>{if(t&&h)return{...t,emojiStatus:{type:"regular",documentId:h.customEmojiId}}}),[t,h]),u=(0,s.Kr)((()=>{if(!h||!i)return;const e=(0,l.Yg)(i);return h.duration?c("BotSuggestedStatusFor",{bot:e,duration:(0,ze.A$)(c,h.duration)},{withNodes:!0,withMarkdown:!0}):c("BotSuggestedStatus",{bot:e},{withNodes:!0,withMarkdown:!0})}),[i,c,h]),p=(0,D.A)((()=>{const e=h?.webAppKey;e&&r({webAppKey:e,event:{eventType:"emoji_status_failed",eventData:{error:"USER_DECLINED"}}}),a()})),v=(0,D.A)((()=>{if(!h)return;const e=h.duration?(0,ri.Fm)()+h.duration:void 0;o({referrerWebAppKey:h.webAppKey,emojiStatus:{type:"regular",documentId:h.customEmojiId,until:e}}),a()}));return(0,ee.FD)(Z.A,{isOpen:d,contentClassName:"C9sWDINB",hasAbsoluteCloseButton:!0,isSlim:!0,onClose:p,children:[h&&(0,ee.Y)(mo.A,{className:"gdG3oY21",documentId:h.customEmojiId,size:_r,loopLimit:1,forceAlways:!0}),(0,ee.FD)("div",{children:[(0,ee.Y)("h3",{className:"KVpsce1g",children:c("BotSuggestedStatusTitle")}),(0,ee.Y)("p",{className:"p7S4AH8A",children:u})]}),m&&(0,ee.Y)(Vr.A,{mockPeer:m,withEmojiStatus:!0}),(0,ee.Y)(W.A,{size:"smaller",onClick:v,children:c("GeneralConfirm")})]})})));var Or=i(55317),Kr=i(20333);const Jr="j6xEoljc";function Gr(e,t){return e.find((e=>!e.chatId))||e.filter((e=>t&&e.chatId!==t)).sort(((e,t)=>e.date-t.date))[0]}const jr=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const i=t&&(0,c.hds)(e,t?.chatId),s=i&&(0,c.AWZ)(e,i.id),n=t?.myBoosts&&Gr(t.myBoosts,t.chatId);return{chat:i,chatFullInfo:s,prevBoostedChat:n?.chatId?(0,c.hds)(e,n?.chatId):void 0,isCurrentUserPremium:(0,c.g29)(e)}}))((({modal:e,chat:t,chatFullInfo:i,prevBoostedChat:o,isCurrentUserPremium:a})=>{const{applyBoost:r,closeBoostModal:c,requestConfetti:d,openPremiumModal:h,loadFullChat:m}=(0,n.ko)(),[u,p,v]=(0,Y.A)(),[g,A,b]=(0,Y.A)(),[f,C,S]=(0,Y.A)(),y=t&&(0,l.WX)(t),k=Boolean(e),w=(0,M.A)(),N=(0,Vi.A)();(0,s.vJ)((()=>{t&&!i&&m({chatId:t.id})}),[t,i]);const I=(0,s.Kr)((()=>{if(t)return(0,l.Js)(w,t)}),[t,w]),P=(0,s.Kr)((()=>{if(o)return(0,l.Js)(w,o)}),[o,w]),{isStatusLoaded:F,isBoosted:T,boost:B,title:R,leftText:L,rightText:x,value:E,progress:V,descriptionText:_,canBoostMore:U}=(0,s.Kr)((()=>{if(!e?.boostStatus||!t)return{isStatusLoaded:!1,title:w("Loading")};const{hasMyBoost:s}=e.boostStatus,n=e?.myBoosts&&Gr(e.myBoosts,t.id),o=e?.myBoosts&&(a=e.myBoosts,r=t.id,!a.every((e=>e.chatId===r)));var a,r;const{boosts:c,currentLevel:d,hasNextLevel:h,levelProgress:m,remainingBoosts:u,isMaxLevel:p}=(0,Or.z)(e.boostStatus,!0),v=s,g=w("BoostsLevel",d),A=h?w("BoostsLevel",d+1):void 0,b=w("ChannelBoost.MoreBoosts",u),f=w(y?"BoostChannel":"BoostGroup"),C=(i?.boostsToUnrestrict||0)-(i?.boostsApplied||0);let S;if(p)S=w("BoostsMaxLevelReached");else if(C>0&&!(0,l.SJ)(t)){const e=w("GroupBoost.BoostToUnrestrict.Times",C);S=w("GroupBoost.BoostToUnrestrict",[e,I])}else S=w("ChannelBoost.MoreBoostsNeeded.Text",[I,b]);return{isStatusLoaded:!0,title:f,leftText:g,rightText:A,value:c.toString(),progress:m,remainingBoosts:u,descriptionText:S,boost:n,isBoosted:v,canBoostMore:o&&!p}}),[t,I,e,w,i,y]),O=!e?.myBoosts?.length&&a,K=B?.chatId&&B.chatId!==e?.chatId,J=(0,D.A)((()=>{v(),r({chatId:t.id,slots:[B.slot]}),d({})})),G=(0,D.A)((()=>{h(),S(),c()})),j=(0,D.A)((()=>{if(!B)return a?void c():void C();U?B.cooldownUntil?A():K?p():J():c()})),z=(0,D.A)((()=>{c()}));return(0,ee.FD)(Z.A,{isOpen:k,title:R,className:"IK2mBqbm",contentClassName:"pUyNTysT",onClose:c,children:[F?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Kr.A,{leftText:L,rightText:x,progress:V,floatingBadgeText:E,floatingBadgeIcon:"boost"}),T&&(0,ee.Y)("div",{className:(0,me.A)(Jr,"hAA6B1lc"),children:w("ChannelBoost.YouBoostedChannelText",I)}),(0,ee.Y)("div",{className:Jr,children:(0,Ft.A)(_,["simple_markdown","emoji"])}),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",disabled:O,onClick:j,children:U?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(q.A,{name:"boost"}),w(y?"ChannelBoost.BoostChannel":"GroupBoost.BoostGroup")]}):w("OK")}),(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:z,children:w("Cancel")})]})]}):(0,ee.Y)(Rs.A,{className:"zjXCH3pT"}),K&&P&&(0,ee.FD)(Z.A,{isOpen:u,className:"GIFAjZPY",contentClassName:"Jxyz9TaL",onClose:v,children:[(0,ee.FD)("div",{className:"OKp6HS1U",children:[(0,ee.FD)("div",{className:"NU9itcIm",children:[(0,ee.Y)(Dt.A,{peer:o,size:"large"}),(0,ee.Y)(q.A,{name:"boostcircle",className:"upXvhNRY"})]}),(0,ee.Y)(q.A,{name:"next",className:"WSJdWV7L"}),(0,ee.Y)(Dt.A,{peer:t,size:"large"})]}),(0,ee.Y)("div",{children:(0,Ft.A)(w("ChannelBoost.ReplaceBoost",[P,I]),["simple_markdown","emoji"])}),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:J,children:w("Replace")}),(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:v,children:w("Cancel")})]})]}),Boolean(B?.cooldownUntil)&&(0,ee.Y)(pi.A,{isOpen:g,isOnlyConfirm:!0,confirmLabel:w("OK"),title:w("ChannelBoost.Error.BoostTooOftenTitle"),onClose:b,confirmHandler:b,children:(0,Ft.A)(w("ChannelBoost.Error.BoostTooOftenText",(0,ze.A$)(N,B.cooldownUntil-(0,ri.Fm)())),["simple_markdown","emoji"])}),!a&&(0,ee.Y)(pi.A,{isOpen:f,confirmLabel:w("Common.Yes"),title:w("PremiumNeeded"),onClose:S,confirmHandler:G,children:(0,Ft.A)(w("PremiumNeededForBoosting"),["simple_markdown","emoji"])})]})})));var zr=i(47058),Hr=i(70046);const $r="xVLGjLub",qr=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const{message:i}=t||{},s=i&&(0,c.O5q)(e,i.chatId,i.messageId),n=s&&(0,c.Y7C)(e,s);return{currentUserId:e.currentUserId,messageSender:n}}))((({currentUserId:e,modal:t,messageSender:i})=>{const{closeGiftCodeModal:o,applyGiftCode:r,focusMessage:l}=(0,n.ko)(),c=(0,M.A)(),d=Boolean(t),h=!(t?.info.toId&&t?.info.toId!==e||t?.info.usedAt),m=(0,D.A)((()=>{t&&t.info.giveawayMessageId&&(l({chatId:t.info.fromId,messageId:t.info.giveawayMessageId}),o())})),u=(0,D.A)((()=>{h?r({slug:t.slug}):o()})),p=(0,s.Kr)((()=>{if(!t)return;const{slug:e,info:s}=t,n=s.fromId||i?.id,o=(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("img",{src:$a,alt:"",className:"Mtx4SWww"}),(0,ee.Y)("p",{className:$r,children:(0,Ft.A)(c("lng_gift_link_about"),["simple_markdown"])}),(0,ee.Y)(zr.A,{title:"BoostingGiftLink",link:`${a.jsp}/giftcode/${e}`})]}),r=[[c("BoostingFrom"),n?{chatId:n}:c("BoostingNoRecipient")],[c("BoostingTo"),s.toId?{chatId:s.toId}:c("BoostingNoRecipient")],[c("BoostingGift"),c("BoostingTelegramPremiumFor",c("Months",s.months,"i"))]];return s.isFromGiveaway&&r.push([c("BoostingReason"),(0,ee.Y)("span",{className:(0,me.A)(s.giveawayMessageId&&"IzcASdzD"),onClick:m,children:s.isFromGiveaway&&!s.toId?c("BoostingIncompleteGiveaway"):c("BoostingGiveaway")})]),r.push([c("BoostingDate"),(0,ze.L2)(1e3*s.date,c.code,!0)]),{header:o,tableData:r,footer:(0,ee.Y)("span",{className:$r,children:(0,Ft.A)(s.usedAt?c("BoostingUsedLinkDate",(0,ze.L2)(1e3*s.usedAt,c.code,!0)):c("BoostingSendLinkToAnyone"),["simple_markdown"])})}}),[c,i?.id,t]);if(p)return(0,ee.Y)(Hr.A,{isOpen:d,title:c("lng_gift_link_title"),tableData:p.tableData,header:p.header,footer:p.footer,buttonText:c(h?"BoostingUseLink":"Close"),onButtonClick:u,onClose:o})})));function Wr(e,t){return e.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e))}const Qr=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const{selfDestructAccountDays:i}=t||{};return{selfDestructAccountDays:i}}))((({modal:e,selfDestructAccountDays:t})=>{const{closeGiftCodeModal:i,closeDeleteAccountModal:o,setAccountTTL:r}=(0,n.ko)(),l=(0,Vi.A)(),c=Boolean(e),[d,h]=(0,s.J0)(),m=(0,D.A)((e=>30*Number(e))),u=(0,s.Kr)((()=>{if(t)return Wr(a.WF4,t/30).toString()}),[t]);(0,s.vJ)((()=>{u&&h(u)}),[u]);const p=(0,s.Kr)((()=>a.WF4.map((e=>({value:String(e),label:l("Months",{count:e},{pluralValue:1})})))),[l]),v=(0,D.A)((e=>{h(e)})),g=(0,D.A)((()=>{d&&r({days:m(d)})})),A=(0,D.A)((()=>{o()}));return(0,ee.FD)(Z.A,{isOpen:c,title:l("SelfDestructTitle"),onClose:i,className:"X6K5oA8U",children:[(0,ee.Y)("p",{children:l("SelfDestructSessionsDescription")}),(0,ee.Y)(X.A,{className:"dialog-checkbox-group",name:"quick-reaction-settings",options:p,selected:d,onChange:v,withIcon:!0}),(0,ee.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:g,children:l("Save")}),(0,ee.Y)(W.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:A,children:l("Cancel")})]})]})}))),Zr={root:"OviJR58x",content:"BlpqzGYt",header:"b9RUzfpF",iconWrapper:"l1X5kBUM",icon:"qOoRnv_Y",mainText:"s2SOQSml",description:"wiKBjcl2"},Xr=(0,s.ph)((0,n.EK)((e=>{const t=e.appConfig,i=t?.verifyAgeBotUsername;return{verifyAgeBotUsername:i}}))((({modal:e,verifyAgeBotUsername:t})=>{const{closeAgeVerificationModal:i,openChatByUsername:s}=(0,n.ko)(),o=(0,Vi.A)(),a=Boolean(e),r=(0,D.A)((()=>{t&&s({shouldStartMainApp:!0,username:t}),i()})),l=(0,D.A)((()=>{i()}));return(0,ee.FD)(Z.A,{isOpen:a,onClose:l,className:Zr.root,children:[(0,ee.FD)("div",{className:Zr.content,children:[(0,ee.Y)("div",{className:Zr.header,children:(0,ee.Y)("div",{className:Zr.iconWrapper,children:(0,ee.Y)(q.A,{name:"user",className:Zr.icon})})}),(0,ee.Y)("h2",{className:Zr.title,children:o("TitleAgeVerificationModal")}),(0,ee.Y)("p",{className:Zr.mainText,children:o("TextAgeVerificationModal",{count:18},{withMarkdown:!0,withNodes:!0,pluralValue:18})}),(0,ee.Y)("p",{className:Zr.description,children:o("DescriptionAgeVerificationModal")})]}),(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:(0,ee.Y)(W.A,{onClick:r,children:o("ButtonAgeVerification")})})]})})));var el=i(34132),tl=i(24713);const il={description:"dl10exNi","picker-wrapper":"gxWY5c6x",pickerWrapper:"gxWY5c6x","picker-header":"h8N7eyob",pickerHeader:"h8N7eyob","picker-header-info":"Rth2Qu07",pickerHeaderInfo:"Rth2Qu07","selection-toggle":"B6eAugx8",selectionToggle:"B6eAugx8",foldersWrapper:"mwcvgD2S",folders:"LKavx8ww",folder:"qglLx5Dn","button-text":"bgaRuEMs",buttonText:"bgaRuEMs","button-badge":"rTe14Z22",buttonBadge:"rTe14Z22"},sl=(0,s.ph)((({invite:e,folder:t})=>{const{closeChatlistModal:i,joinChatlistInvite:o}=(0,n.ko)(),a=(0,Vi.A)(),r=(0,M.A)(),[l,c]=(0,s.J0)(e.missingPeerIds),d=Boolean(e.missingPeerIds.length),h=0===e.alreadyPeerIds.length,m=d?e.missingPeerIds.length:0,u=l.length?l.length.toString():void 0,p=h?a("FolderLinkSubtitleNew"):m?a("FolderLinkSubtitleAdd",{chats:a("FolderLinkSubtitleAddCount",{count:m},{pluralValue:m}),title:(0,Zi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations})},{withNodes:!0,withMarkdown:!0}):a("FolderLinkSubtitleAlready"),v=(0,s.hb)((()=>{i(),l.length&&o({invite:e,peerIds:l})}),[e,l]),g=(0,s.hb)((()=>{const t=l.length===e.missingPeerIds.length;c(t?[]:e.missingPeerIds)}),[e.missingPeerIds,l.length]);return(0,ee.FD)("div",{className:il.content,children:[(0,ee.Y)("div",{className:il.description,children:(0,Ft.A)(p,["simple_markdown","emoji"])}),(0,ee.FD)("div",{className:(0,me.A)(il.pickerWrapper,"custom-scroll"),children:[Boolean(e.missingPeerIds.length)&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:il.pickerHeader,children:[(0,ee.Y)("div",{className:il.pickerHeaderInfo,children:r("FolderLinkHeaderChatsJoin",l.length,"i")}),(0,ee.Y)("div",{className:il.selectionToggle,role:"button",tabIndex:0,onClick:g,children:l.length===e.missingPeerIds.length?r("DeselectAll"):r("SelectAll")})]}),(0,ee.Y)(Ci.A,{itemIds:e.missingPeerIds,onSelectedIdsChange:c,selectedIds:l,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ee.Y)("div",{className:il.pickerHeader,children:(0,ee.Y)("div",{className:il.pickerHeaderInfo,children:r("FolderLinkHeaderAlready")})}),(0,ee.Y)(Ci.A,{itemIds:e.alreadyPeerIds,lockedSelectedIds:e.alreadyPeerIds,selectedIds:e.alreadyPeerIds,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ee.Y)(W.A,{size:"smaller",onClick:v,children:(0,ee.FD)("div",{className:il.buttonText,children:[!l.length&&r("OK"),Boolean(l.length)&&(0,ee.FD)(ee.FK,{children:[r("FolderLinkButtonJoinPlural",l.length,"i"),(0,ee.Y)(tl.A,{className:il.buttonBadge,text:u,isAlternateColor:!0})]})]})})]})})),nl=(0,s.ph)((({folder:e,suggestedPeerIds:t=fi.p})=>{const{closeChatlistModal:i,leaveChatlist:o}=(0,n.ko)(),a=(0,M.A)(),[r,l]=(0,s.J0)([]),c=r.length?r.length.toString():void 0,d=(0,s.hb)((()=>{const e=r.length===t.length;l(e?[]:t)}),[t,r.length]),h=(0,s.hb)((()=>{i(),o({folderId:e.id,peerIds:r})}),[e.id,r]);return(0,ee.FD)("div",{className:il.content,children:[Boolean(t?.length)&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{className:il.description,children:(0,Ft.A)(a("FolderLinkSubtitleRemove"),["simple_markdown","emoji"])}),(0,ee.FD)("div",{className:(0,me.A)(il.pickerWrapper,"custom-scroll"),children:[(0,ee.FD)("div",{className:il.pickerHeader,children:[(0,ee.Y)("div",{className:il.pickerHeaderInfo,children:a("FolderLinkHeaderChatsQuit",r.length,"i")}),(0,ee.Y)("div",{className:il.selectionToggle,role:"button",tabIndex:0,onClick:d,children:r.length===t.length?a("DeselectAll"):a("SelectAll")})]}),(0,ee.Y)(Ci.A,{itemIds:t,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]})]}),(0,ee.Y)(W.A,{size:"smaller",onClick:h,children:(0,ee.FD)("div",{className:il.buttonText,children:[!r.length&&a("FolderLinkButtonRemove"),Boolean(r.length)&&(0,ee.FD)(ee.FK,{children:[a("FolderLinkButtonRemoveChats"),(0,ee.Y)(tl.A,{className:il.buttonBadge,text:c,isAlternateColor:!0})]})]})})]})})),ol=(0,s.ph)((({invite:e})=>{const{closeChatlistModal:t,joinChatlistInvite:i}=(0,n.ko)(),o=(0,Vi.A)(),a=(0,M.A)(),[r,l]=(0,s.J0)(e.peerIds),c=(0,s.Kr)((()=>{const t=(0,n.mS)().chats.byId;return e.peerIds.filter((e=>!t[e].isNotJoined))}),[e.peerIds]),d=r.length-c.length,h=d?d.toString():void 0,m=(0,s.hb)((()=>{t(),i({invite:e,peerIds:r})}),[e,r]),u=(0,s.hb)((()=>{const t=r.length===e.peerIds.length;l(t?c:e.peerIds)}),[e.peerIds,c,r.length]);return(0,ee.FD)("div",{className:il.content,children:[(0,ee.Y)("div",{className:il.description,children:o("FolderLinkSubtitleNew")}),(0,ee.FD)("div",{className:(0,me.A)(il.pickerWrapper,"custom-scroll"),children:[(0,ee.FD)("div",{className:il.pickerHeader,children:[(0,ee.Y)("div",{className:il.pickerHeaderInfo,children:a("FolderLinkHeaderChatsJoin",d,"i")}),(0,ee.Y)("div",{className:il.selectionToggle,role:"button",tabIndex:0,onClick:u,children:r.length===e.peerIds.length?a("DeselectAll"):a("SelectAll")})]}),(0,ee.Y)(Ci.A,{itemIds:e.peerIds,lockedSelectedIds:c,onSelectedIdsChange:l,selectedIds:r,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})]}),(0,ee.Y)(W.A,{onClick:m,size:"smaller",disabled:!r.length,children:(0,ee.FD)("div",{className:il.buttonText,children:[o("FolderLinkAddFolder"),(0,ee.Y)(tl.A,{className:il.buttonBadge,text:h,isAlternateColor:!0})]})})]})})),al=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const{invite:i,removal:s}=t||{},n=s?.folderId||(i&&"folderId"in i?i.folderId:void 0);return{folder:n?(0,c.$aQ)(e,n):void 0}}))((({modal:e,folder:t})=>{const{closeChatlistModal:i}=(0,n.ko)(),o=(0,M.A)(),a=Boolean(e),r=(0,V.A)(e)||e,l=(0,V.A)(t)||t,c=(0,s.Kr)((()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?e.missingPeerIds.length?o("FolderLinkTitleAddChats"):o("FolderLinkTitleAlready"):o("FolderLinkTitleAdd")}return r.removal?o("FolderLinkTitleRemove"):void 0}}),[o,r]),d=(0,s.Kr)((()=>l?(0,Zi.fd)({text:l.title.text,entities:l.title.entities,noCustomEmojiPlayback:l.noTitleAnimations}):r?.invite&&"title"in r.invite?(0,Zi.fd)({text:r.invite.title.text,entities:r.invite.title.entities,noCustomEmojiPlayback:r.invite.noTitleAnimations}):void 0),[l,r]),h=(0,s.Kr)((()=>{if(r?.invite)return"missingPeerIds"in r.invite?r.invite.missingPeerIds.length:void 0}),[r]),m=(0,s.hb)((()=>{if(r){if(r.invite){const e=r.invite;return"alreadyPeerIds"in e?(0,ee.Y)(sl,{invite:e,folder:l}):(0,ee.Y)(ol,{invite:e})}return r.removal?(0,ee.Y)(nl,{folder:l,suggestedPeerIds:r.removal.suggestedPeerIds}):void 0}}),[l,r]);return(0,ee.FD)(Z.A,{isOpen:a,title:c,onClose:i,isSlim:!0,hasCloseButton:!0,children:[d&&(u=d,(0,ee.Y)("div",{className:il.foldersWrapper,children:(0,ee.FD)("div",{className:il.folders,children:[(0,ee.Y)(el.A,{className:il.folder,title:o("FolderLinkPreviewLeft")}),(0,ee.Y)(el.A,{className:il.folder,isActive:!0,badgeCount:h,isBadgeActive:!0,title:u}),(0,ee.Y)(el.A,{className:il.folder,title:o("FolderLinkPreviewRight")})]})})),m()]});var u})));var rl=i(29886);const ll={content:"MZ0RCecx",title:"ar8XeydN",participantCount:"un00TXYY",participants:"YvkZ6c2D",participant:"DHJSBDeE",buttons:"KFtrPtNr"},cl=(0,s.ph)((({modal:e})=>{const{acceptChatInvite:t,closeChatInviteModal:i,showNotification:o}=(0,n.ko)(),a=(0,s.li)(),r=(0,M.A)(),d=(0,rl.A)(e),{hash:h,inviteInfo:m}=e||d||{},{about:u,isBroadcast:p,participantIds:v,participantsCount:g,photo:A,isRequestNeeded:b}=m||{},f=(0,D.A)((()=>{i()})),C=(0,D.A)((()=>{t({hash:h}),b&&o({message:r(p?"RequestToJoinChannelSentDescription":"RequestToJoinGroupSentDescription")}),f()})),S=p?"ProfileJoinChannel":"JoinGroup",y=p?"MemberRequests.RequestToJoinChannel":"MemberRequests.RequestToJoinGroup",k=(0,s.Kr)((()=>{if(m)return(0,l.nr)(m)}),[m]),w=(0,s.Kr)((()=>{if(!v)return;const e=(0,n.mS)();return v.map((t=>(0,c.mBe)(e,t))).filter(Boolean)}),[v]);return(0,kn.A)(a,!e||!w),(0,ee.FD)(Z.A,{isOpen:Boolean(e),contentClassName:ll.content,isSlim:!0,onClose:f,onEnter:C,children:[k&&(0,ee.Y)(Dt.A,{size:"jumbo",photo:A,peer:k,withVideo:!0}),k&&(0,ee.Y)(Ls.A,{className:ll.title,peer:k}),u&&(0,ee.Y)("p",{className:ll.about,children:u}),(0,ee.Y)("p",{className:ll.participantCount,children:r(p?"Subscribers":"Members",g,"i")}),w&&(0,ee.Y)("div",{ref:a,className:(0,me.A)(ll.participants,"no-scrollbar"),children:w.map((e=>(0,ee.Y)(In.A,{className:ll.participant,peer:e,text:(0,l.Yg)(e)})))}),(0,ee.FD)("div",{className:(0,me.A)("dialog-buttons",ll.buttons),children:[(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:C,children:r(b?y:S)}),(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:f,children:r("Cancel")})]})]})}));var dl=i(84685),hl=i(89873),ml=i(5463);const ul="La4sUYaq",pl="Bn5kz5br",vl=(0,s.ph)((0,n.EK)((e=>{const t=e.appConfig?.channelRestrictAdsLevelMin;return{minLevelToRestrictAds:t}}))((({modal:e,minLevelToRestrictAds:t})=>{const{closeAboutAdsModal:i}=(0,n.ko)(),o=(0,s.li)(),a=Boolean(e),r=(0,Ti.A)(e),{canReport:l,randomId:c,additionalInfo:d,sponsorInfo:h}=r||{},m=l,u=(0,Ti.A)(m),p=(0,M.A)(),v=(0,s.Kr)((()=>(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{children:p("SponsoredMessageInfoScreen.Title")}),(0,ee.Y)("p",{children:(0,Ft.A)(p("SponsoredMessageInfoDescription1"),["br"])}),(0,ee.Y)("p",{children:(0,Ft.A)(p("SponsoredMessageInfoDescription2"),["br"])}),(0,ee.Y)("p",{children:(0,Ft.A)(p("SponsoredMessageInfoDescription3"),["br"])}),(0,ee.Y)("p",{children:(0,ee.Y)(dl.A,{url:p("SponsoredMessageAlertLearnMoreUrl"),text:p("SponsoredMessageAlertLearnMoreUrl")})}),(0,ee.Y)("p",{children:(0,Ft.A)(p("SponsoredMessageInfoDescription4"),["br"])})]})),[p]),{isContextMenuOpen:g,contextMenuAnchor:A,handleContextMenu:b,handleContextMenuClose:f,handleContextMenuHide:C}=(0,An.A)(o,!u),S=(0,D.A)((()=>{i(),f(),C()})),y=(0,s.Kr)((()=>{if(a)return{header:(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{className:ul,children:p("AboutRevenueSharingAds")}),(0,ee.Y)("p",{className:(0,me.A)(pl,"hbsLlXSH"),children:p("RevenueSharingAdsAlertSubtitle")}),(0,ee.Y)(W.A,{ref:o,round:!0,size:"smaller",color:"translucent",className:"JdN5pGTw",onClick:b,children:(0,ee.Y)(q.A,{name:"more"})})]}),listItemData:[["lock",p("RevenueSharingAdsInfo1Title"),(0,Ft.A)(p("RevenueSharingAdsInfo1Subtitle"),["simple_markdown"])],["revenue-split",p("RevenueSharingAdsInfo2Title"),(0,Ft.A)(p("RevenueSharingAdsInfo2Subtitle"),["simple_markdown"])],["nochannel",p("RevenueSharingAdsInfo3Title"),(0,Ft.A)(p("RevenueSharingAdsInfo3Subtitle",t),["simple_markdown"])]],footer:(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{className:ul,children:(0,Ft.A)(p("RevenueSharingAdsInfo4Title"),["simple_markdown"])}),(0,ee.FD)("p",{className:pl,children:[(0,Ft.A)(p("RevenueSharingAdsInfo4Subtitle2",""),["simple_markdown"]),(0,ee.Y)(dl.A,{url:p("PromoteUrl"),text:p("LearnMoreArrow")})]})]})}}),[a,p,b,t]);return u?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(ml.A,{isOpen:a,listItemData:y?.listItemData,headerIconName:"channel",withSeparator:!0,header:y?.header,footer:y?.footer,buttonText:p("RevenueSharingAdsUnderstood"),onClose:S}),A&&c&&(0,ee.Y)(hl.A,{isOpen:g,anchor:A,triggerRef:o,randomId:c,additionalInfo:d,canReport:l,sponsorInfo:h,shouldSkipAbout:!0,onItemClick:S,onClose:f,onCloseAnimationEnd:C})]}):(0,ee.FD)(Z.A,{isOpen:a,className:"LFkgLoAk",contentClassName:"TZE15Pt_",onClose:S,children:[v,(0,ee.Y)(W.A,{size:"smaller",onClick:S,children:p("RevenueSharingAdsUnderstood")})]})}))),gl="t9iZUzOj",Al=(0,s.ph)((({isOpen:e,onClose:t})=>{const i=(0,M.A)(),n=(0,Vi.A)(),o=(0,s.Kr)((()=>{const e=i("LearnMore");return n("ChannelEarnLearnCoinAbout",{link:(0,ee.FD)(dl.A,{url:i("MonetizationInfoTONLink"),text:e,children:[e,(0,ee.Y)(q.A,{name:"next"})]})},{withNodes:!0})}),[n,i]),a=(0,s.Kr)((()=>n("MonetizationInfoTONTitle",void 0,{withNodes:!0,specialReplacement:{"💎":(0,ee.Y)(q.A,{className:"ATkOSqJ7",name:"toncoin"})}})),[n]),r=(0,s.Kr)((()=>{if(e)return{header:(0,ee.Y)("h3",{className:gl,children:i("lng_channel_earn_learn_title")}),listItemData:[["channel",i("lng_channel_earn_learn_in_subtitle"),(0,Ft.A)(i("lng_channel_earn_learn_in_about"),["simple_markdown"])],["revenue-split",i("lng_channel_earn_learn_split_subtitle"),(0,Ft.A)(i("Monetization.Intro.Split.Text"),["simple_markdown"])],["cash-circle",i("lng_channel_earn_learn_out_subtitle"),(0,Ft.A)(i("lng_channel_earn_learn_out_about"),["simple_markdown"])]],footer:(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{className:gl,children:a}),(0,ee.Y)("p",{className:"mjveZmdr",children:o})]})}}),[e,i,a,o]);if(r)return(0,ee.Y)(ml.A,{isOpen:e,listItemData:r.listItemData,headerIconName:"cash-circle",withSeparator:!0,header:r.header,footer:r.footer,buttonText:i("RevenueSharingAdsUnderstood"),onClose:t})}));var bl=i(15535);const fl="oofoCYlu",Cl=(0,s.ph)((0,n.EK)((e=>{const{twoFaSettings:{hint:t}}=e;return{passwordHint:t}}))((({modal:e,passwordHint:t})=>{const{closeMonetizationVerificationModal:i,clearMonetizationVerificationError:o,processMonetizationRevenueWithdrawalUrl:a}=(0,n.ko)(),r=Boolean(e),l=(0,Ti.A)(e),c=(0,Vi.A)(),[d,h]=(0,s.J0)(!1),m=(0,D.A)((e=>{l&&a({peerId:l.chatId,currentPassword:e})})),u=(0,D.A)((()=>{o()})),p=(0,D.A)((()=>{i()}));return(0,ee.Y)(Z.A,{isOpen:r,hasCloseButton:!0,title:c("CheckPasswordTitle"),className:"WqeWhMAS",contentClassName:fl,onClose:p,children:(0,ee.Y)("div",{className:(0,me.A)(fl,"settings-content password-form custom-scroll"),children:(0,ee.Y)("div",{className:"settings-item pt-0",children:(0,ee.Y)(bl.A,{shouldShowSubmit:!0,placeholder:c("CheckPasswordPlaceholder"),error:l?.errorKey&&c.withRegular(l.errorKey),description:c("CheckPasswordDescription"),clearError:u,isLoading:l?.isLoading,hint:t,isPasswordVisible:d,shouldResetValue:r,onChangePasswordVisibility:h,onSubmit:m})})})})}))),Sl={content:"MKdSUg2P",chatItem:"qEIwBtp0"},yl=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.mBe)(e,e.currentUserId),i=(0,c.g29)(e);return{currentUser:t,stickerSet:e.defaultStatusIconsId?(0,c.ycM)(e,e.defaultStatusIconsId):void 0,isPremium:i,isAccountFrozen:(0,c.trm)(e)}}))((({modal:e,currentUser:t,stickerSet:i,isPremium:o,isAccountFrozen:a})=>{const{closeEmojiStatusAccessModal:r,toggleUserEmojiStatusPermission:c,sendWebAppEvent:d,openPremiumModal:h,loadDefaultStatusIcons:m}=(0,n.ko)(),u=Boolean(e),p=(0,M.A)(),v=(0,Vi.A)(),g=(0,s.li)(),[A,b]=(0,s.J0)(0);(0,s.vJ)((()=>{!u||i?.stickers||a||m()}),[u,i,a]);const f=(0,s.Kr)((()=>{if(t&&i?.stickers)return{...t,emojiStatus:{type:"regular",documentId:i.stickers[A].id}}}),[t,i,A]),C=i?.stickers?.length;(0,gn.A)((()=>{C&&b((e=>(e+1)%C))}),C?3200:void 0);const S=(0,D.A)((()=>(0,ee.Y)(Vr.A,{withEmojiStatus:!0,className:Sl.chatItem,itemClassName:Sl.itemName,mockPeer:f}))),y=(0,D.A)((()=>{e?.bot?.id&&(r(),e?.webAppKey&&(o?(d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"allowed"}}}),c({botId:e.bot.id,isEnabled:!0,isBotAccessEmojiGranted:!0})):(h(),d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}))))})),k=(0,D.A)((()=>{e?.bot?.id&&(r(),e?.webAppKey&&d({webAppKey:e.webAppKey,event:{eventType:"emoji_status_access_requested",eventData:{status:"cancelled"}}}),o&&c({botId:e.bot.id,isEnabled:!1}))})),w=(0,D.A)((()=>{if(e?.bot)return v("EmojiStatusAccessText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})}));return(0,ee.FD)(Z.A,{className:(0,me.A)("confirm"),contentClassName:Sl.content,isOpen:u,onClose:k,children:[S(),(0,ee.FD)("div",{children:[w(),(0,ee.FD)("div",{className:"dialog-buttons mt-2",ref:g,children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:y,color:"primary",children:p("lng_bot_allow_write_confirm")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:k,children:v("Cancel")})]})]})]})}))),kl=(0,s.ph)((0,n.EK)((e=>({currentUser:(0,c.mBe)(e,e.currentUserId)})))((({modal:e,currentUser:t})=>{const{closeLocationAccessModal:i,toggleUserLocationPermission:o,sendWebAppEvent:a}=(0,n.ko)(),r=Boolean(e),c=(0,M.A)(),d=(0,Vi.A)(),h=(0,s.li)(),m=(0,D.A)((async()=>{const t=await(0,b.Bu)(),{geolocation:s}=t;e?.bot?.id&&(i(),e?.webAppKey&&(o({botId:e.bot.id,isAccessGranted:!0}),a({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!0,latitude:s?.latitude,longitude:s?.longitude,altitude:s?.altitude,course:s?.heading,speed:s?.speed,horizontal_accuracy:s?.accuracy,vertical_accuracy:s?.accuracy}}})))})),u=(0,D.A)((()=>{e?.bot?.id&&(i(),e?.webAppKey&&(o({botId:e.bot.id,isAccessGranted:!1}),a({webAppKey:e.webAppKey,event:{eventType:"location_requested",eventData:{available:!1}}})))})),p=(0,D.A)((()=>{if(e?.bot)return(0,ee.FD)("div",{className:"CGPoDaLo",children:[(0,ee.Y)(Dt.A,{size:"large",peer:t}),(0,ee.Y)(q.A,{name:"next",className:"pzERgD5x"}),(0,ee.Y)(Dt.A,{size:"large",peer:e.bot})]})})),v=(0,D.A)((()=>{if(e?.bot)return d("LocationPermissionText",{name:(0,l.Yg)(e?.bot)},{withNodes:!0,withMarkdown:!0})}));return(0,ee.FD)(Z.A,{className:(0,me.A)("confirm"),isOpen:r,onClose:u,children:[p(),(0,ee.FD)("div",{children:[v(),(0,ee.FD)("div",{className:"dialog-buttons mt-2",ref:h,children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:m,color:"primary",children:c("lng_bot_allow_write_confirm")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:u,children:d("Cancel")})]})]})]})}))),wl="qJDgUtjV",Nl=(0,s.ph)((({modal:e})=>{const{reportSponsored:t,closeReportAdModal:i,openPreviousReportAdModal:o}=(0,n.ko)(),a=(0,M.A)(),l=Boolean(e),c=(0,s.li)(),d=(0,D.A)(((i,s)=>{const{chatId:n,randomId:o}=e;t({peerId:n,randomId:o,option:s})})),[h,m]=(0,s.Kr)((()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e.sections[t],t]}),[e]),u=(0,D.A)((()=>{m?o():i()})),p=(0,s.Kr)((()=>{if(!e)return;const t=a("lng_report_sponsored_reported_learn").split("{link}");return[t[0],(0,ee.Y)(dl.A,{text:a("lng_report_sponsored_reported_link"),url:a("ReportAd.Help_URL")}),t[1]]}),[a,e]),v=(0,s.Kr)((()=>{if(!e)return;const t=Boolean(h?.subtitle);return(0,ee.FD)("div",{className:"modal-header-condensed",children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:a(m?"Back":"Close"),onClick:u,children:(0,ee.Y)(q.A,{name:m?"arrow-left":"close"})}),(0,ee.FD)("div",{className:(0,me.A)("modal-title","ZAdG13Ah",t&&"lVVyV0py"),children:[(0,ee.Y)("h3",{className:"mMmY6YR4",children:a("ReportAd")}),t&&(0,ee.Y)("span",{className:"gSkAFc4u",children:h.subtitle})]})]})}),[a,e,m,h?.subtitle]);(0,s.vJ)((()=>{if(!e)return;const t=document.querySelector(`.${se.uo} > .${wl}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)((()=>{c.current.style.height=`${i+56}px`}))}),[e]);const g=(0,D.A)((()=>{const e=document.querySelector(`.${se.VY} > .${wl}`);(0,r.YS)((()=>{const t=e.scrollHeight;(0,r.RK)((()=>{c.current.style.height=`${t+56}px`}))}))}));return(0,ee.Y)(Z.A,{isOpen:l,hasCloseButton:!0,className:"njPBcVYr",header:v,onClose:i,children:(0,ee.FD)(se.Ay,{name:"slide",className:"HjsGIG6e",ref:c,activeKey:m,onStart:g,children:[(0,ee.FD)("div",{className:wl,children:[(0,ee.Y)("h3",{className:"jrA2dOiw",children:h?.title}),h?.options.map((e=>(0,ee.Y)(li.A,{narrow:!0,secondaryIcon:"next",className:"aFbjDzNo",buttonClassName:"VbE0HzDs",clickArg:e.option,onClick:d,children:(0,ee.Y)("div",{className:"oWujoaSC",children:e.text})})))]}),(0,ee.Y)("p",{className:"k71Zrc_P",children:p})]})})}));var Il=i(94079);const Pl="kq9LwNTZ",Yl=(0,s.ph)((({modal:e})=>{const{reportMessages:t,reportStory:i,closeReportModal:o,openPreviousReportModal:a}=(0,n.ko)(),l=(0,M.A)(),c=Boolean(e),d=(0,s.li)(),[h,m]=(0,s.J0)(""),u=(0,D.A)(((s,n)=>{const{messageIds:o,subject:a,peerId:r,chatId:l}=e;if(o)switch(a){case"message":t({chatId:l,messageIds:o,option:n});break;case"story":i({storyId:o[0],peerId:r,option:n})}})),[p,v]=(0,s.Kr)((()=>{if(!e)return[void 0,0];const t=e.sections.length-1;return[e?.sections[t],t]}),[e]),g=(0,D.A)((()=>{a()})),A=(0,D.A)((()=>{o()})),b=(0,s.Kr)((()=>{if(!e)return;const t=Boolean(p?.subtitle);return(0,ee.FD)("div",{className:"modal-header-condensed",children:[v?(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Back"),onClick:g,children:(0,ee.Y)(q.A,{name:"arrow-left"})}):(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:l("Close"),onClick:A,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.FD)("div",{className:(0,me.A)("modal-title","Lj_ezEWU",t&&"OYFbu8fQ"),children:[(0,ee.Y)("h3",{className:(0,me.A)("QawchdxB",v&&"CV7kzv9H"),children:p?.options?l("story"===e?.subject?"ReportStory":"Report"):p?.title}),t&&(0,ee.Y)("span",{className:"OUFckTb7",children:p.subtitle})]})]})}),[l,e,v,p?.options,p?.subtitle,p?.title]),f=(0,D.A)((e=>{m(e.target.value)}));(0,s.vJ)((()=>{if(!e)return;const t=document.querySelector(`.${se.uo} > .${Pl}`);if(!t)return;const i=t.scrollHeight;(0,r.RK)((()=>{d.current.style.height=`${i}px`}))}),[e]);const C=(0,D.A)((()=>{const e=document.querySelector(`.${se.VY} > .${Pl}`);(0,r.YS)((()=>{const t=e.scrollHeight;(0,r.RK)((()=>{d.current.style.height=`${t+20}px`}))}))})),S=(0,D.A)((()=>{m(""),o()})),y=(0,D.A)((()=>{const{messageIds:s,subject:n,peerId:o,chatId:a}=e;switch(n){case"message":t({chatId:a,messageIds:s,option:p?.option,description:h});break;case"story":i({storyId:s?.[0],peerId:o,option:p?.option,description:h})}S()}));return(0,ee.Y)(Z.A,{isOpen:c,header:b,onClose:S,contentClassName:"tNysQgHL",className:(0,me.A)("E1bGWeON","story"===e?.subject&&"component-theme-dark"),children:(0,ee.Y)(se.Ay,{name:"slide",className:"n2VxPirU",ref:d,activeKey:v,onStart:C,children:(0,ee.FD)("div",{className:Pl,children:[p?.options?(0,ee.Y)("h3",{className:"GSfUuTet",children:p?.title}):void 0,p?.options?.map((e=>(0,ee.Y)(li.A,{narrow:!0,nonInteractive:!0,secondaryIcon:"next",className:"RoxwMzvA",buttonClassName:"Z6skYdvb",clickArg:e.option,onClick:u,children:(0,ee.Y)("div",{className:"FU8m6NUU",children:e.text})}))),p?.option?(0,ee.FD)("div",{className:"KpptZ3Mk",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Report,size:100,className:"kO8JC4gK",nonInteractive:!0,forceAlways:!0,noLoop:!1}),(0,ee.Y)(Il.A,{id:"option",className:"yc3szGcx",label:p.isOptional?l("Report2CommentOptional"):l("Report2Comment"),onChange:f,value:h,maxLength:512,maxLengthIndicator:(512-h.length).toString(),noReplaceNewlines:!0}),(0,ee.Y)(W.A,{size:"smaller",onClick:y,disabled:p.isOptional?void 0:!h.length,children:l("ReportSend")})]}):void 0]})})})}));var Fl=i(65632),Dl=i(9228);const Ml=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const i=(0,c.SJA)(e),{isBlurred:s,patternColor:n,background:o,backgroundColor:a}=(0,c.Gyz)(e,i)||{};return{theme:i,isBackgroundBlurred:s,patternColor:n,customBackground:o,backgroundColor:a,bot:t?(0,c.mBe)(e,t?.botId):void 0,currentUserId:e.currentUserId}}))((({modal:e,theme:t,isBackgroundBlurred:i,patternColor:o,customBackground:a,backgroundColor:r,bot:c})=>{const{closePreparedInlineMessageModal:d,sendWebAppEvent:h,openSharePreparedMessageModal:m}=(0,n.ko)(),u=(0,Vi.A)(),p=Boolean(e),{webAppKey:v,message:g,botId:A}=e||{},b=(0,s.li)(),f=(0,Fl.A)(t,a),C=(0,D.A)((()=>{v&&A&&g&&(m({webAppKey:v,message:g}),d())})),S=(0,D.A)((()=>{d(),v&&h({webAppKey:v,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})})),y=(0,s.Kr)((()=>{if(e)return(0,ee.FD)("div",{className:"P1fPh6h8",children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:u("Close"),onClick:S,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("h3",{className:(0,me.A)("modal-title","E42tgAwD"),children:u("BotShareMessage")})]})}),[u,e]),k=(0,s.Kr)((()=>{if(A&&g&&v)return(0,l.i7)(A,g)}),[A,g,v]),w=(0,me.A)("_6w75ldP","lElCwweL",a&&"CZkpv8n0",r&&"VJAYrDF_",a&&i&&"m8xzfVvU");return(0,ee.FD)(Z.A,{dialogRef:b,isOpen:p,header:y,onClose:S,className:"Rzj2LMLf",contentClassName:"Ve4u2KVI",children:[(0,ee.FD)("div",{className:(0,me.A)("McJgXCtB","MessageList"),inert:!0,style:(0,Fi.A)(`--pattern-color: ${o}`,r&&`--theme-background-color: ${r}`),children:[(0,ee.Y)("div",{className:w,style:f?`--custom-background: ${f}`:void 0}),k&&(0,ee.Y)(Dl.A,{message:k,threadId:U.l3,messageListType:"thread",noComments:!0,noReplies:!0,appearanceOrder:0,isJustAdded:!1,isFirstInGroup:!0,isLastInGroup:!0,isLastInList:!1,isFirstInDocumentGroup:!1,isLastInDocumentGroup:!1},A)]}),(0,ee.FD)("div",{className:"pNSCKAVN",children:[(0,ee.Y)("p",{className:"xWnXsG7q",children:u("WebAppShareMessageInfo",{user:(0,l.Yg)(c)})}),(0,ee.Y)(W.A,{size:"smaller",onClick:C,children:u("BotShareMessageShare")})]})]})})));var Tl=i(20247),Bl=i(48227);const Rl=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e),{isPaymentMessageConfirmDialogOpen:i}=t;return{isPaymentMessageConfirmDialogOpen:i,starsBalance:e.stars?.balance.amount||0,isStarsBalanceModalOpen:Boolean(t.starsBalanceModal)}}))((({modal:e,isPaymentMessageConfirmDialogOpen:t,isStarsBalanceModalOpen:i,starsBalance:o})=>{const{closeSharePreparedMessageModal:a,sendInlineBotResult:r,sendWebAppEvent:l,showNotification:d,updateSharePreparedMessageModalSendArgs:h}=(0,n.ko)(),m=(0,M.A)(),u=Boolean(e),[p,v,g]=(0,Y.A)();(0,s.vJ)((()=>{u&&v()}),[u,v]);const{message:A,filter:b,webAppKey:f,pendingSendArgs:C}=e||{},{starsForSendMessage:S}=C||{},{closeConfirmDialog:y,dialogHandler:k,shouldAutoApprove:w,setAutoApprove:N,handleWithConfirmation:I}=(0,Tl.A)(S||0,i,o),P=(0,D.A)((()=>{a(),f&&l({webAppKey:f,event:{eventType:"prepared_message_failed",eventData:{error:"USER_DECLINED"}}})})),F=(0,D.A)(((e,t)=>{if(A&&f){const i=(0,n.mS)(),s=(0,c.PVB)(i,e);r({chatId:e,threadId:t||U.l3,id:A.result.id,queryId:A.result.queryId}),S||d({message:m("BotSharedToOne",(0,Yt.F9)(m,s))}),l({webAppKey:f,event:{eventType:"prepared_message_sent"}}),a(),h({args:void 0})}})),T=(0,D.A)(((e,t)=>{h({args:{peerId:e,threadId:t}})})),B=(0,D.A)((()=>{C&&I(F,C.peerId,C.threadId)})),R=(0,D.A)((()=>{y(),h({args:void 0})}));(0,s.vJ)((()=>{C&&B()}),[C]);const L=(0,n.mS)(),x=C?(0,c.PVB)(L,C.peerId):void 0,E=x?(0,Yt.F9)(m,x):void 0;if(u||p)return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Os,{isOpen:u,searchPlaceholder:m("Search"),filter:b,onSelectRecipient:T,onClose:P,onCloseAnimationEnd:g,isLowStackPriority:!0}),(0,ee.Y)(Bl.A,{isOpen:t,onClose:R,userName:E,messagePriceInStars:S||0,messagesCount:1,shouldAutoApprove:w,setAutoApprove:N,confirmHandler:k})]})})));var Ll=i(19408);const xl={content:"iGABsB4C",modalHeader:"Ofq4u4pq",section:"k44LZ99u",form:"VhNBPaMY",label:"anDcU5bi",input:"kYxuUcwe",description:"A_JjwhXv",timeInputIcon:"pHne2E6K",offerButton:"d_PCM2tC",currencySelector:"genSNudF",currencyIcon:"fT5aRs0H"},El=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const i=e.stars?.balance,s=t?(0,c.PVB)(e,t.chatId):void 0,n=t?(0,Ll.GA)(e,t.chatId,U.l3):void 0,{appConfig:o}=e,r=o?.starsSuggestedPostAmountMax||a.PAU,l=o?.starsSuggestedPostAmountMin||a.tek,d=o?.starsSuggestedPostAgeMin||a.Qep,h=o?.starsSuggestedPostFutureMin||a.WHU,m=o?.starsSuggestedPostFutureMax||a.cX7,u=o?.tonSuggestedPostAmountMax||a.nqT,p=o?.tonSuggestedPostAmountMin||a.tOS,v=!!t&&(0,c.ODG)(e,t.chatId);return{peer:s,starBalance:i,tonBalance:e.ton?.balance?.amount,currentDraft:n,maxStarsAmount:r,minStarsAmount:l,tonMaxAmount:u,tonMinAmount:p,ageMinSeconds:d,futureMin:h,futureMax:m,isMonoforumAdmin:v}}))((({modal:e,starBalance:t,tonBalance:i,peer:o,currentDraft:r,maxStarsAmount:l,minStarsAmount:c,tonMaxAmount:d,tonMinAmount:h,ageMinSeconds:m,futureMin:u,futureMax:p,isMonoforumAdmin:v})=>{const{closeSuggestMessageModal:g,updateDraftSuggestedPostInfo:A,openStarsBalanceModal:b}=(0,n.ko)(),[f,C,S]=(0,Y.A)(),y=r?.suggestedPostInfo,k=r?.replyInfo,w=Boolean(k),[N,I]=(0,s.J0)(y?.price?.amount||void 0),[P,F]=(0,s.J0)(y?.price?.currency||a.OUy),[T,B]=(0,s.J0)(y?.scheduleDate?1e3*y.scheduleDate:void 0);(0,s.vJ)((()=>{const e=y?.price,t=e?.currency===a.ykW?(0,ho.wD)(e.amount):e?.amount;I(t),F(y?.price?.currency||a.OUy),B(y?.scheduleDate?1e3*y.scheduleDate:void 0)}),[y]);const R=(0,Vi.A)(),L=(0,M.A)(),x=P===a.OUy,E=Math.floor(Date.now()/1e3),V=1e3*(E+u),_=1e3*(E+p),U=1e3*(E+2*u),O=(0,D.A)((e=>{const t=e.target.value,i=parseFloat(t),s=""===t||Number.isNaN(i)?void 0:Math.min(Math.max(i,0),j);I(s)})),K=(0,D.A)((e=>{B(e.getTime()),S()})),J=(0,D.A)((()=>{B(void 0),S()})),G=x?c:(0,ho.wD)(h),j=x?l:(0,ho.wD)(d),z=Boolean(N)&&N<G,H=(0,D.A)((()=>{const e=N?x?N:(0,ho.tT)(N):0;if(!z){if(!v)if(x){if(e>(t?.amount||0))return void b({topup:{balanceNeeded:e}})}else if(e>(i||0))return void b({currency:a.ykW});A({price:{currency:P,amount:e,nanos:0},scheduleDate:T?T/1e3:void 0}),g()}}));return(0,ee.Y)(Z.A,{headerClassName:xl.modalHeader,isOpen:Boolean(e),onClose:g,isSlim:!0,isLowStackPriority:!0,hasCloseButton:!0,contentClassName:xl.content,title:R(w?"TitleSuggestedChanges":"TitleSuggestMessage"),children:(0,ee.FD)("div",{className:xl.form,children:[(0,ee.FD)("div",{className:xl.section,children:[(0,ee.FD)("div",{className:xl.currencySelector,children:[(0,ee.FD)(W.A,{className:xl.currencyButton,color:x?"primary":"translucent",pill:!0,fluid:!0,size:"tiny",noFastClick:!0,onClick:()=>F(a.OUy),children:[(0,ee.Y)(q.A,{name:"star",className:xl.currencyIcon}),R("CurrencyStars")]}),(0,ee.FD)(W.A,{className:xl.currencyButton,fluid:!0,color:x?"translucent":"primary",pill:!0,size:"tiny",noFastClick:!0,onClick:()=>F(a.ykW),children:[(0,ee.Y)(q.A,{name:"toncoin",className:xl.currencyIcon}),R("CurrencyTon")]})]}),(0,ee.Y)(Q.A,{label:R("InputPlaceholderPrice"),className:(0,me.A)(xl.input),value:N?.toString(),onChange:O,inputMode:"numeric",tabIndex:0,teactExperimentControlled:x}),(0,ee.Y)("div",{className:xl.description,children:void 0!==N&&N>0&&N<G?R("DescriptionSuggestedPostMinimumOffer",{amount:x?(0,Li.Kk)(R,G):(0,Li.QH)(R,G)},{withNodes:!0,withMarkdown:!0}):R(x?"SuggestMessagePriceDescriptionStars":"SuggestMessagePriceDescriptionTon")})]}),(0,ee.FD)("div",{className:xl.section,children:[(0,ee.FD)("div",{className:(0,me.A)(xl.input,"input-group","touched"),children:[(0,ee.Y)("input",{type:"text",className:(0,me.A)("form-control",f&&"focus"),value:T?(0,ze.e0)(T/1e3,R,L):R("SuggestMessageAnytime"),autoComplete:"off",onClick:C,onFocus:C,readOnly:!0}),(0,ee.Y)("label",{children:R("InputTitleSuggestMessageTime")}),(0,ee.Y)(q.A,{name:"down",className:xl.timeInputIcon})]}),(0,ee.Y)("div",{className:xl.description,children:R("SuggestMessageTimeDescription",{hint:R("SuggestMessageDateTimeHint"),duration:(0,ze.A$)(R,m,!0)})})]}),(0,ee.Y)(ln,{isOpen:f,isFutureMode:!0,withTimePicker:!0,minAt:V,maxAt:_,onClose:S,onSubmit:K,selectedAt:T||U,submitButtonLabel:R("Save"),secondButtonLabel:R("SuggestMessageAnytime"),onSecondButtonClick:J,description:R("SuggestMessageDateTimeHint")}),(0,ee.Y)(W.A,{className:xl.offerButton,onClick:H,size:"smaller",disabled:z,children:w?R("ButtonUpdateTerms"):N?R("ButtonOfferAmount",{amount:x?(0,Li.U2)(R,N,{asFont:!0}):(0,Li.Ms)(R,N,{asFont:!0})},{withNodes:!0,withMarkdown:!0}):R("ButtonOfferFree")})]})})}))),Vl="xqyFGV8R",_l=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const i=t&&(0,c.O5q)(e,t.chatId,t.messageId),s=i?(0,c.Y7C)(e,i):void 0,n=t&&(0,c.ODG)(e,t.chatId),{appConfig:o}=e,r=o?.starsSuggestedPostCommissionPermille||a.U$s,l=o?.tonSuggestedPostCommissionPermille||a.UdF,d=o?.starsSuggestedPostAgeMin||a.Qep,h=2*(o?.starsSuggestedPostFutureMin||a.WHU),m=o?.starsSuggestedPostFutureMax||a.cX7,u=i?.suggestedPostInfo?.scheduleDate;return{minAge:d,futureMin:h,futureMax:m,message:i,sender:s,isAdmin:n,commissionPermille:r,tonCommissionPermille:l,scheduleDate:u}}))((({modal:e,message:t,sender:i,isAdmin:o,commissionPermille:r,tonCommissionPermille:l,minAge:c,futureMin:d,futureMax:h,scheduleDate:m})=>{const{closeSuggestedPostApprovalModal:u,approveSuggestedPost:p}=(0,n.ko)(),v=(0,Vi.A)(),g=(0,M.A)(),[A,b,f]=(0,Y.A)(),C=Math.floor(Date.now()/1e3),S=1e3*(C+d),y=1e3*(C+h),k=C+2*d,[w,N]=(0,s.J0)(k),I=(0,D.A)((()=>{u()})),P=(0,D.A)((t=>{e&&(p({chatId:e.chatId,messageId:e.messageId,scheduleDate:t}),u())})),F=(0,D.A)((e=>{const t=Math.floor(e.getTime()/1e3);N(t)})),T=(0,D.A)((e=>{const t=Math.floor(e.getTime()/1e3);f(),P(t)})),B=(0,D.A)((()=>{f(),P()})),R=(0,D.A)((()=>{m?P(m):b()}));if(!e||!t)return;const L=i?(0,Yt.em)(g,i):"";return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(pi.A,{isOpen:Boolean(e)&&!A,onClose:I,title:v("SuggestedPostConfirmTitle"),confirmHandler:R,confirmLabel:v(m?"ButtonPublish":"Next"),children:(()=>{const e=t?.suggestedPostInfo?.price,i=e?.amount,s=e?.currency||a.OUy,n=v("SuggestedPostConfirmMessage",{peer:L},{withNodes:!0,withMarkdown:!0}),d=(0,Ft.A)(n);if(!i)return d;const h=(s===a.ykW?l:r)/10,u=i/100*h,p=s===a.ykW?(0,Li.QH)(v,(0,ho.wD)(u)):(0,Li.Kk)(v,u),A=c,b=(0,ze.A$)(v,A,!0);if(m){const e=(0,ze.e0)(m,v,g),t=o?"SuggestedPostConfirmDetailsWithTimeAdmin":"SuggestedPostConfirmDetailsWithTimeUser";return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{children:d}),(0,ee.Y)("div",{className:Vl,children:(0,Ft.A)(v(t,{amount:p,commission:h,duration:b,time:e},{withNodes:!0,withMarkdown:!0}))})]})}const f=o?"SuggestedPostConfirmDetailsAdmin":"SuggestedPostConfirmDetailsUser";return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{children:d}),(0,ee.Y)("div",{className:Vl,children:(0,Ft.A)(v(f,{amount:p,commission:h,duration:b},{withNodes:!0,withMarkdown:!0}))})]})})()}),(0,ee.Y)(ln,{isOpen:A,isFutureMode:!0,withTimePicker:!0,minAt:S,maxAt:y,onClose:f,onSubmit:T,onDateChange:F,selectedAt:1e3*w,submitButtonLabel:v("ButtonPublishAtTime",{time:(0,ze.e0)(w,v,g)}),secondButtonLabel:v("PublishNow"),onSecondButtonClick:B,description:v("SuggestMessageDateTimeHint")})]})}))),Ul=["embedLinks","sendPolls","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs","sendStickers","sendGifs"],Ol=[...Ul,"sendPlain"];function Kl(e){const[t,i]=(0,s.J0)({}),[n,o]=(0,s.J0)(!1),[a,r]=(0,s.J0)(!1);(0,s.vJ)((()=>{i(e||{}),o(!1),setTimeout((()=>{r(!1)}),250)}),[e]);const l=(0,s.hb)((s=>{const{name:n}=s.target,a=n;function r(e){return!e||void 0}const l=t;let c={...l,[a]:r(l[a]),..."sendStickers"===a&&{sendGifs:r(l[a])}};const d=()=>{const e=Ul.map((e=>c[e]));e.some((e=>!e))?c={...c,sendMedia:void 0}:e.every(Boolean)&&(c={...c,sendMedia:!0})};"sendMedia"!==a?d():c={...c,...Ul.reduce(((e,t)=>Object.assign(e,{[t]:c.sendMedia})),{})},"embedLinks"!==a&&!c.embedLinks&&c.sendPlain&&(c={...c,embedLinks:!0}),"sendPlain"!==a&&!c.embedLinks&&c.sendPlain&&(c={...c,sendPlain:void 0}),"sendMedia"!==a&&d();const h=Ol.every((e=>c[e]));c={...c,sendMessages:!!h||void 0},i(c),o(!e||Object.keys(c).some((t=>{const i=t;return Boolean(e[i])!==Boolean(c[i])})))}),[e,t]),c=(0,s.hb)((()=>{i(e||{}),o(!1)}),[e]);return{permissions:t,isLoading:a,havePermissionChanged:n,handlePermissionChange:l,setIsLoading:r,resetPermissions:c}}const Jl=["sendPhotos","sendVideos","sendStickers","sendAudios","sendDocs","sendVoices","sendRoundvideos","embedLinks","sendPolls"],Gl=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=t?(0,c.hds)(e,t):void 0,s=i&&(0,c.AWZ)(e,i.id);return{chat:i,hasLinkedChat:Boolean(s?.linkedChatId)}}))((({chat:e,isMediaDropdownOpen:t,setIsMediaDropdownOpen:i,hasLinkedChat:o,permissions:a,handlePermissionChange:r,className:c,shiftedClassName:d,dropdownClassName:h,withCheckbox:m,getControlIsDisabled:u,permissionGroup:p})=>{const{showNotification:v}=(0,n.ko)(),{isForum:g}=e||{},A=(0,M.A)(),b=(0,s.Kr)((()=>e&&(0,l.gA)(e)),[e]),C=o||b,S=(0,s.Kr)((()=>Jl.reduce(((e,t)=>(a[t]||(e+=1),e)),0)),[a]),y=(0,D.A)((e=>{(0,f.A)(e),i(!t)})),k=(0,D.A)((()=>{v({message:A("lng_rights_permission_unavailable")})}));return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendPlain",checked:!a.sendPlain,label:A("UserRestrictionsSend"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendPlain")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendMedia",checked:!a.sendMedia,label:A("UserRestrictionsSendMedia"),labelText:`${S}/${Jl.length}`,blocking:!0,permissionGroup:p,rightIcon:t?"up":"down",onChange:r,onClickLabel:y,disabled:u&&u("sendMedia")})}),(0,ee.Y)("div",{className:h,children:(0,ee.FD)("div",{className:c,children:[(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendPhotos",checked:!a.sendPhotos,label:A("UserRestrictionsSendPhotos"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendPhotos")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendVideos",checked:!a.sendVideos,label:A("UserRestrictionsSendVideos"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendVideos")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendStickers",checked:!a.sendStickers&&!a.sendGifs,label:A("UserRestrictionsSendStickers"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendStickers")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendAudios",checked:!a.sendAudios,label:A("UserRestrictionsSendMusic"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendAudios")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendDocs",checked:!a.sendDocs,label:A("UserRestrictionsSendFiles"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendDocs")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendVoices",checked:!a.sendVoices,label:A("UserRestrictionsSendVoices"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendVoices")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendRoundvideos",checked:!a.sendRoundvideos,label:A("UserRestrictionsSendRound"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendRoundvideos")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"embedLinks",checked:!a.embedLinks,label:A("UserRestrictionsEmbedLinks"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("embedLinks")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"sendPolls",checked:!a.sendPolls,label:A("UserRestrictionsSendPolls"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("sendPolls")})})]})}),(0,ee.FD)("div",{className:d,children:[(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"inviteUsers",checked:!a.inviteUsers,label:A("UserRestrictionsInviteUsers"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("inviteUsers")})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),onClick:C?k:void 0,children:(0,ee.Y)(en.A,{name:"pinMessages",checked:!a.pinMessages,label:A("UserRestrictionsPinMessages"),disabled:u?u("pinMessages"):C,blocking:!0,permissionGroup:p,onChange:r})}),(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),onClick:C?k:void 0,children:(0,ee.Y)(en.A,{name:"changeInfo",checked:!a.changeInfo,label:A("UserRestrictionsChangeInfo"),blocking:!0,permissionGroup:p,disabled:u?u("changeInfo"):C,onChange:r})}),g&&(0,ee.Y)("div",{className:(0,me.A)("ListItem",m&&"with-checkbox"),children:(0,ee.Y)(en.A,{name:"manageTopics",checked:!a.manageTopics,label:A("CreateTopicsPermission"),blocking:!0,permissionGroup:p,onChange:r,disabled:u&&u("manageTopics")})})]})]})})));var jl=i(77561);const zl="yGhFKTl5",Hl="goI3MITH",$l=(0,s.ph)((0,n.EK)((e=>{const{deleteMessageModal:t}=(0,c.nTw)(e),i=t?.messageIds,s=t?.chatId,{canDeleteForAll:n}=(0,c.jyG)(e,i),o=s?(0,c.hds)(e,s):void 0,a=o&&(0,c.AWZ)(e,o.id),r=a?.linkedChatId,d=Boolean(o)&&(0,l.WX)(o),h=Boolean(o)&&(0,l.Vs)(o),m=t?.isSchedule,p=t?.onConfirm,v=o&&(0,u.L8)(o.id)?(0,l.u0)((0,c.mBe)(e,(0,l.e7)(o))):void 0,g=Boolean(o&&!(0,l.DX)(o.id)&&(0,c.yps)(e,o.id)),A=a?.adminMembersById,b=o&&(0,l.ub)(o,"banUsers"),f=o?.isCreator,C=o?(0,c.ALW)(e,o):void 0,S=o&&(0,l.yn)(o)&&!n||C,y=o&&((0,l.Vs)(o)||d);return{chat:o,isChannel:d,isSuperGroup:h,messageIds:i,currentUserId:e.currentUserId,canDeleteForAll:!m&&n,contactName:v,willDeleteForCurrentUserOnly:S,willDeleteForAll:y,adminMembersById:A,chatBot:g,canBanUsers:b,linkedChatId:r,isSchedule:m,isCreator:f,onConfirm:p}}))((({isOpen:e,chat:t,isChannel:i,isSuperGroup:o,isSchedule:a,currentUserId:r,messageIds:l,isCreator:d,canDeleteForAll:h,contactName:m,willDeleteForCurrentUserOnly:u,willDeleteForAll:p,chatBot:v,adminMembersById:g,canBanUsers:A,linkedChatId:b,onConfirm:f})=>{const{closeDeleteMessageModal:C,deleteMessages:S,reportChannelSpam:y,deleteChatMember:k,deleteScheduledMessages:w,exitMessageSelectMode:N,updateChatMemberBannedRights:I,deleteParticipantHistory:P}=(0,n.ko)(),Y=(0,V.A)(e),F=(0,M.A)(),T=(0,Vi.A)(),{permissions:B,havePermissionChanged:R,handlePermissionChange:L,resetPermissions:x}=Kl(t?.defaultBannedRights),[E,_]=(0,s.J0)([]),[U,O]=(0,s.J0)([]),[K,J]=(0,s.J0)([]),[G,j]=(0,s.J0)(!1),[z,H]=(0,s.J0)(!1),[$,Q]=(0,s.J0)(!0),X=(0,s.Kr)((()=>{if(i||!l||!t)return fi.p;const e=(0,n.mS)(),s=(0,c.SpN)(e,t.id,l);return s?(0,bi.Am)(s).filter((e=>e?.id!==t?.id&&e?.id!==b&&e?.id!==t?.linkedMonoforumId)):fi.p}),[t,i,b,l]),te=(0,D.A)((()=>X.map((e=>({value:e.id,label:(0,Yt.F9)(T,e)||"",leftElement:(0,ee.Y)(Dt.A,{size:"small",peer:e})}))))),ie=(0,s.Kr)((()=>X.filter((e=>e.id!==b&&e.id!==t?.linkedMonoforumId&&e.id!==r))),[X,r,b,t?.linkedMonoforumId]),se=(0,s.Kr)((()=>X.filter((e=>e.id!==r&&e.id!==b&&e.id!==t?.linkedMonoforumId))),[X,r,b,t?.linkedMonoforumId]),ne=(0,s.Kr)((()=>{const e=X.some((e=>e.id===r));return!A||e||t?.isMonoforum?fi.p:X.filter((e=>{const t=g?.[e.id];return d||!t}))}),[X,d,r,A,g,t?.isMonoforum]),oe=(0,s.Kr)((()=>Boolean(ie.length||se.length||ne.length)),[ie,se,ne])&&!h&&!a&&o,ae=(0,s.Kr)((()=>!X||a?{}:(0,bi.pA)(X,(e=>[e.id,(0,Yt.F9)(T,e)]))),[a,T,X]),re=(0,s.Kr)((()=>[{value:l&&X.length>=2?"spam":X?.[0]?.id,label:F("ReportSpamTitle"),nestedOptions:l&&X.length>=2?[...te().filter((e=>e.value!==b&&e.value!==t?.linkedMonoforumId&&e.value!==r))]:void 0}]),[l,X,F,b,t?.linkedMonoforumId,r]),le=(0,s.Kr)((()=>[{value:l&&X.length>=2?"delete_all":X?.[0]?.id,label:l&&X.length>=2?F("DeleteAllFromUsers"):F("DeleteAllFrom",Object.values(ae)[0]),nestedOptions:l&&X.length>=2?[...te().filter((e=>e.value!==b&&e.value!==t?.linkedMonoforumId&&e.value!==r))]:void 0}]),[l,X,F,ae,b,t?.linkedMonoforumId,r]),ce=(0,s.Kr)((()=>[{value:l&&X.length>=2?"ban":X?.[0]?.id,label:l&&X.length>=2?F(z?"DeleteRestrictUsers":"DeleteBanUsers"):z?F("KickFromSupergroup"):F("DeleteBan",Object.values(ae)[0]),nestedOptions:l&&X.length>=2?[...te()]:void 0}]),[z,F,l,X,ae]),de=(0,D.A)((()=>{H((e=>!e))})),he=(0,D.A)(((e,i)=>{if(!t)return fi.p;const s=(0,n.mS)();return i.filter((i=>{const n=(0,c.LM$)(s,t.id,i);return n&&e.includes(n.id)}))})),ue=(0,D.A)((e=>{Object.entries(e).forEach((([e,i])=>{i.length&&y({participantId:e,chatId:t.id,messageIds:i})}))})),pe=(0,D.A)((e=>{S({messageIds:e,shouldDeleteForAll:!0})})),ve=(0,D.A)((e=>{t&&e.forEach((e=>{P({peerId:e,chatId:t.id})}))})),ge=(0,D.A)((e=>{e.forEach((e=>{k({chatId:t.id,userId:e})}))})),Ae=(0,D.A)((e=>{e.forEach((e=>{I({chatId:t.id,userId:e,bannedRights:B})}))})),be=(0,D.A)((()=>{if(t&&l){if(f?.(),a)w({messageIds:l});else if(oe){if(K?.length){const e=(0,n.mS)(),i=K.filter((e=>!Number.isNaN(Number(e)))),s=l.reduce(((s,n)=>{const o=(0,c.LM$)(e,t.id,n);return o&&i.includes(o.id)&&(s[o.id]||(s[o.id]=[]),s[o.id].push(Number(n))),s}),{});ue(s)}if(E?.length){const e=E.filter((e=>!Number.isNaN(Number(e))));ve(e)}if(U?.length&&!R){const e=U.filter((e=>!Number.isNaN(Number(e))));ge(e);const t=he(e,l);pe(t)}if(U?.length&&R){const e=U.filter((e=>!Number.isNaN(Number(e))));Ae(e)}K?.length&&E?.length&&U?.length||S({messageIds:l,shouldDeleteForAll:$})}else S({messageIds:l,shouldDeleteForAll:$});C(),N()}})),fe=(0,D.A)((()=>{C()}));return(0,s.vJ)((()=>{!e&&Y&&(J([]),_([]),O([]),Q(!0),j(!1),H(!1),x())}),[e,Y,x]),(0,ee.Y)(Z.A,{isOpen:e,onClose:fe,onEnter:h?void 0:be,className:"SeaF_shb",children:(0,ee.FD)("div",{className:"_YNfwDqt",children:[(0,ee.FD)("div",{className:oe&&"axa67kqo",dir:F.isRtl?"rtl":void 0,children:[oe&&(0,ee.Y)(os.A,{size:"small",peers:X}),(0,ee.Y)("h3",{className:(0,me.A)(oe?"U4IFhV0a":"qd6OFHiG"),children:F("Chat.DeleteMessagesConfirmation",l?.length)})]}),oe&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("p",{className:zl,children:F("DeleteAdditionalActions")}),(0,ee.FD)("div",{className:"b6847Kh3",children:[(0,ee.Y)(jl.A,{options:re,onChange:J,selected:K,nestedCheckbox:l&&X.length>=2}),ie?.length>0&&(0,ee.Y)(jl.A,{options:le,onChange:_,selected:E,nestedCheckbox:l&&X.length>=2}),ne?.length>0&&(0,ee.Y)(jl.A,{options:ce,onChange:O,selected:U,nestedCheckbox:l&&X.length>=2})]}),(0,ee.FD)("div",{className:(0,me.A)("iv0u9Zw6",z&&"qCQftA04"),children:[(0,ee.Y)("h3",{className:(0,me.A)(zl,"t3KOsBfm"),children:F("UserRestrictionsCanDoUsers",X.length)}),(0,ee.Y)(Gl,{withCheckbox:!0,chatId:t?.id,isMediaDropdownOpen:G,setIsMediaDropdownOpen:j,handlePermissionChange:L,permissions:B,className:(0,me.A)("czTjjKim",G&&"Ifpyv7Jp")})]}),U?.length&&A?(0,ee.FD)(li.A,{narrow:!0,buttonClassName:Hl,onClick:de,children:[F(z?"DeleteToggleBanUsers":"DeleteToggleRestrictUsers"),(0,ee.Y)(q.A,{name:z?"up":"down",className:(0,me.A)(Hl,"ml-2")})]}):H(!1)]}),(h||v||!oe)&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("p",{children:l&&l.length>1?T("AreYouSureDeleteFewMessages"):T("AreYouSureDeleteSingleMessage")}),u&&(0,ee.Y)("p",{children:F("lng_delete_for_me_chat_hint",1,"i")}),p&&(0,ee.Y)("p",{children:F("lng_delete_for_everyone_hint",1,"i")})]}),h&&(0,ee.Y)(en.A,{className:"dialog-checkbox",label:m?(0,Ft.A)(F("DeleteMessagesOptionAlso",m)):F("Conversation.DeleteMessagesForEveryone"),checked:$,onCheck:Q}),(0,ee.FD)("div",{className:(0,me.A)("dialog-buttons",G?"JTT_DIRv":"L4YzeG91"),children:[(0,ee.Y)(W.A,{color:"danger",className:"confirm-dialog-button",isText:!0,onClick:be,children:oe?F("DeleteProceedBtn"):T("Delete")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:fe,children:F("Cancel")})]})]})})}))),ql=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,u.L8)(t),s=(0,c.nZ4)(e,t),n=(0,c.hds)(e,t),o=Boolean(n)&&(0,l.WX)(n),a=Boolean(n)&&(0,l.yn)(n),r=Boolean(n)&&(0,l.Vs)(n);return{isPrivateChat:i,isChatWithSelf:s,isChannel:o,isGroup:a,isSuperGroup:r,canPinForAll:i&&!s||r||a,contactName:n&&(0,u.L8)(n.id)?(0,l.u0)((0,c.mBe)(e,(0,l.e7)(n))):void 0}}))((({isOpen:e,chatId:t,messageId:i,isChannel:o,isGroup:a,isSuperGroup:r,canPinForAll:l,contactName:c,onClose:d})=>{const{pinMessage:h}=(0,n.ko)(),[m,u]=(0,s.J0)(!0),p=(0,D.A)((()=>{h({chatId:t,messageId:i,isUnpin:!1,isOneSide:!m,isSilent:!m}),d()})),v=(0,M.A)();return(0,ee.FD)(Z.A,{isOpen:e,onClose:d,className:"pin",title:v("PinMessageAlertTitle"),children:[(0,ee.Y)("p",{children:v(o?"PinMessageAlertChannel":a||r?"PinMessageAlert":"PinMessageAlertChat")}),l&&(0,ee.Y)(en.A,{className:"dialog-checkbox",label:c?(0,Ft.A)(v("Conversation.PinMessagesFor",c)):v("Conversation.PinMessageAlert.PinAndNotifyMembers"),checked:m,onCheck:u}),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:p,children:v("DialogPin")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:v("Cancel")})]})]})}))),Wl=(0,s.ph)((({isOpen:e,pinnedMessagesCount:t=0,onClose:i,onUnpin:s})=>{const n=(0,M.A)();return(0,ee.FD)(Z.A,{isOpen:e,onClose:i,className:"unpin-all",title:n("Chat.PanelUnpinAllMessages"),children:[(0,ee.Y)("p",{children:n("Chat.UnpinAllMessagesConfirmation",t,"i")}),(0,ee.FD)("div",{className:"dialog-buttons mt-2",children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:s,children:n("DialogUnpin")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:i,children:n("Cancel")})]})]})}));var Ql=i(2178);const Zl=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e),{shouldWarnAboutSvg:i}=(0,un.l)(e),s=(0,c.meB)(e),{type:n,chatId:o}=(0,c.Xf0)(e)||{},a="scheduled"===n,{canDelete:r}=(0,c.jyG)(e),l=Boolean(!a&&(0,c.mDG)(e)),d=(0,c.ori)(e),{messageIds:h}=t.selectedMessages||{},m=!!o&&(0,c.o45)(e,o,h),u=!(a||!o)&&(0,c.Y8y)(e,o,h),p=!(!h||!o)&&(0,c.H_s)(e,o,h),v=t.isShareMessageModalShown,g=Boolean(v||t.requestedDraft||t.requestedAttachBotInChat||t.requestedAttachBotInstall||t.reportModal||t.deleteMessageModal);return{chat:s,isSchedule:a,selectedMessagesCount:(0,c.ZZ2)(e),canDeleteMessages:r,canReportMessages:l,canDownloadMessages:d,canForwardMessages:u,selectedMessageIds:h,hasProtectedMessage:m,isAnyModalOpen:g,shouldWarnAboutSvg:i,hasSvgs:p}}))((({chat:e,canPost:t,isActive:i,messageListType:o,isSchedule:a,selectedMessagesCount:r,canDeleteMessages:l,canReportMessages:c,canDownloadMessages:d,canForwardMessages:h,hasProtectedMessage:m,isAnyModalOpen:u,selectedMessageIds:p,shouldWarnAboutSvg:v,hasSvgs:g})=>{const{exitMessageSelectMode:A,openForwardMenuForSelectedMessages:b,downloadSelectedMessages:f,copySelectedMessages:C,showNotification:S,reportMessages:y,openDeleteMessageModal:k,setSharedSettingOption:w}=(0,n.ko)(),N=(0,M.A)();(e=>{function t(e){e.preventDefault(),(0,n.ko)().copySelectedMessages()}(0,Ql.v)((0,s.Kr)((()=>e?{"Mod+C":t}:void 0),[e]))})(i);const[I,P,F]=(0,Y.A)(),[T,B]=(0,s.J0)(!1),R=(0,D.A)((()=>{A()})),L=(0,D.A)((()=>{p&&e&&k({chatId:e.id,messageIds:p,isSchedule:a})}));(0,s.vJ)((()=>i&&!u?(0,Bi.A)({onBackspace:l?L:void 0,onDelete:l?L:void 0,onEsc:R}):void 0),[i,L,R,u,l]);const x=(0,D.A)((()=>{C(),S({message:N("Share.Link.Copied")}),A()})),E=(0,D.A)((()=>{f(),A()})),_=(0,D.A)((()=>{v&&g?P():E()})),U=(0,D.A)((()=>{w({shouldWarnAboutSvg:!T}),F(),E()})),O=(0,V.A)(r||void 0,!0),K=N("VoiceOver.Chat.MessagesSelected",i?r:O,"i"),J=(0,D.A)((()=>{p&&e&&(y({chatId:e.id,messageIds:p}),A())})),G=(0,me.A)("MessageSelectToolbar",t&&"with-composer",i&&"shown"),j=(e,t,i,s)=>(0,ee.Y)("div",{role:"button",tabIndex:0,className:(0,me.A)("div-button","item",s&&"destructive"),onClick:i,title:t,"aria-label":t,children:(0,ee.Y)(q.A,{name:e})});return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{className:G,children:(0,ee.FD)("div",{className:"MessageSelectToolbar-inner",children:[(0,ee.Y)(W.A,{color:"translucent",round:!0,onClick:R,ariaLabel:"Exit select mode",children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("span",{className:"MessageSelectToolbar-count",title:K,children:K}),Boolean(r)&&(0,ee.FD)("div",{className:"MessageSelectToolbar-actions",children:["scheduled"!==o&&h&&j("forward",N("Chat.ForwardActionHeader"),b),c&&j("flag",N("Conversation.ReportMessages"),J),d&&!m&&j("download",N("lng_media_download"),_),!m&&j("copy",N("lng_context_copy_selected_items"),x),l&&j("delete",N("EditAdminGroupDeleteMessages"),L,!0)]})]})}),(0,ee.FD)(pi.A,{isOpen:I,onClose:F,confirmHandler:U,children:[N("lng_launch_svg_warning"),(0,ee.Y)(en.A,{className:"dialog-checkbox",checked:T,label:N("lng_launch_exe_dont_ask"),onCheck:B})]})]})}))),Xl=(0,s.ph)((0,n.EK)((e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).seenByModal||{};return t&&i?{seenByDates:(0,c.O5q)(e,t,i)?.seenByDates}:{}}))((function({isOpen:e,seenByDates:t}){const{openChat:i,closeSeenByModal:o}=(0,n.ko)(),a=(0,M.A)(),r=(0,Ti.A)(t,!0),l=(0,s.Kr)((()=>{if(!r)return;const e=Object.keys(r);return e.sort(((e,t)=>r[t]-r[e])),e}),[r]),c=(0,D.A)((e=>{o(),setTimeout((()=>{i({id:e})}),100)})),d=(0,D.A)((()=>{o()}));return(0,ee.FD)(Z.A,{isOpen:e,onClose:o,className:(0,me.A)("slqA9gR2","narrow"),title:`Seen by ${l?.length} users`,children:[(0,ee.Y)("div",{dir:a.isRtl?"rtl":void 0,children:l&&l.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>c(e),children:(0,ee.Y)(ys.A,{userId:e,noStatusOrTyping:!0,status:(0,ze.U)(a,1e3*r[e]),statusIcon:"message-read"})},e)))}),(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:a("Close")})})]})})));var ec=i(32581);const tc="MQxuEIRA",ic="AEAN1Au4",sc="F7owtTHj",nc=Z.U+a.xB5,oc=(0,s.ph)((0,n.EK)((e=>{const{chatId:t,isReadDate:i}=(0,c.nTw)(e).privacySettingsNoticeModal||{};return{user:t?(0,c.mBe)(e,t):void 0,isReadDate:i}}))((({isOpen:e,isReadDate:t,user:i})=>{const s=(0,M.A)(),{updateGlobalPrivacySettings:o,openPremiumModal:a,closePrivacySettingsNoticeModal:r,showNotification:c,setPrivacyVisibility:d,loadUser:h}=(0,n.ko)(),m=(0,l.u0)(i),u=(0,D.A)((()=>{o({shouldHideReadMarks:!1}),r(),setTimeout((()=>{c({message:s("PremiumReadSet")})}),nc)})),p=(0,D.A)((()=>{d({privacyKey:"lastSeen",visibility:"everybody",onSuccess:()=>h({userId:i.id})}),r(),setTimeout((()=>{c({message:s("PremiumLastSeenSet")})}),nc)})),v=(0,D.A)((()=>{r(),setTimeout((()=>{a({initialSection:"last_seen"})}),nc)})),g=(0,D.A)((()=>{r()}));return(0,ee.Y)(Z.A,{isSlim:!0,isOpen:e,onClose:g,children:(0,ee.FD)("div",{className:"tauadiDm",dir:s.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{className:"i6iFv9YE",color:"translucent",round:!0,size:"smaller",onClick:g,ariaLabel:"Close",children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)(Sr.A,{tgsUrl:t?Cr.w.ReadTime:Cr.w.LastSeen,size:84,className:"i4wZg_0J",nonInteractive:!0,noLoop:!0}),(0,ee.Y)("h2",{className:tc,children:s(t?"PremiumReadHeader1":"PremiumLastSeenHeader1")}),(0,ee.Y)("p",{className:ic,children:(0,Ft.A)(s(t?"PremiumReadText1":"PremiumLastSeenText1Locked",m),["simple_markdown"])}),(0,ee.Y)(W.A,{size:"smaller",onClick:t?u:p,className:sc,children:s(t?"PremiumReadButton1":"PremiumLastSeenButton1")}),(0,ee.Y)(ec.A,{className:"sXXb5yOS",children:s("PremiumOr")}),(0,ee.Y)("h2",{className:tc,children:s("PremiumReadHeader2")}),(0,ee.Y)("p",{className:ic,children:(0,Ft.A)(s(t?"PremiumReadText2":"PremiumLastSeenText2",m),["simple_markdown"])}),(0,ee.Y)(W.A,{withPremiumGradient:!0,size:"smaller",onClick:v,className:sc,children:s("PremiumLastSeenButton2")})]})})}))),ac=(0,s.ph)((0,n.EK)((e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).reactorModal||{},s=t&&i?(0,c.O5q)(e,t,i):void 0;return{chatId:t,messageId:i,reactions:s?.reactions,reactors:s?.reactors,seenByDates:s?.seenByDates,availableReactions:e.reactions.availableReactions}}))((({isOpen:e,reactors:t,reactions:i,chatId:a,messageId:r,seenByDates:c,availableReactions:d})=>{const{loadReactors:h,closeReactorListModal:m,openChat:u}=(0,n.ko)(),p=(0,n.mS)().chats.byId,v=(0,n.mS)().users.byId,g=(0,M.A)(),A=(0,Vi.A)(),[b,f,C]=(0,Y.A)(!1),[S,y]=(0,s.J0)(void 0),k=t&&i&&t.count>=10&&i.results.length>1,w=(0,s.li)();(0,s.vJ)((()=>{e&&!b&&(w.current=void 0),b&&!e&&(C(),y(void 0))}),[b,e,C]);const N=(0,D.A)((()=>{w.current&&u({id:w.current}),m()})),I=(0,D.A)((()=>{f()})),P=(0,D.A)((e=>{w.current=e,I()})),F=(0,D.A)((()=>{h({chatId:a,messageId:r})})),T=(0,s.Kr)((()=>{const e=[];return t?.reactions?.forEach((({reaction:t})=>{e.some((e=>(0,l.a0)(e,t)))||e.push(t)})),e}),[t]),B=(0,s.Kr)((()=>{if(S)return t?.reactions.filter((({reaction:e})=>(0,l.a0)(e,S))).map((({peerId:e})=>e));const e=Object.keys(c||{});return(0,bi.Am)(t?.reactions.map((({peerId:e})=>e)).concat(e||[])||[])}),[S,t,c]),[R,L]=(0,Ms.A)(F,B,t&&void 0===t.nextOffset);return(0,s.vJ)((()=>{L?.({direction:o.TN.Backwards})}),[L]),(0,ee.FD)(Z.A,{isOpen:e&&!b,onClose:I,className:"ReactorListModal narrow",title:g("Reactions"),onCloseAnimationEnd:N,children:[k&&(0,ee.FD)("div",{className:"Reactions",dir:g.isRtl?"rtl":void 0,children:[(0,ee.FD)(W.A,{className:(0,me.A)(!S&&"chosen"),size:"tiny",ripple:!0,onClick:()=>y(void 0),children:[(0,ee.Y)(q.A,{name:"heart"}),Boolean(t?.count)&&(0,He.Vw)(A,t.count)]}),T.map((e=>{const t=i?.results.find((t=>(0,l.a0)(t.reaction,e)))?.count;return(0,ee.FD)(W.A,{className:(0,me.A)((0,l.a0)(S,e)&&"chosen"),size:"tiny",ripple:!0,onClick:()=>y(e),children:[(0,ee.Y)(ks.A,{reaction:e,className:"reaction-filter-emoji",availableReactions:d}),Boolean(t)&&(0,He.Vw)(A,t)]},(0,l.Jj)(e))}))]}),(0,ee.Y)("div",{dir:g.isRtl?"rtl":void 0,className:"reactor-list-wrapper",children:R?.length?(0,ee.Y)(bs.A,{className:"reactor-list custom-scroll",items:R,onLoadMore:L,children:R?.flatMap((e=>{const i=v[e]||p[e],s=t?.reactions.filter((t=>t.peerId===e)),n=[],o=c?.[e];return s?.forEach((t=>{S&&!(0,l.a0)(t.reaction,S)||n.push((0,ee.FD)(li.A,{className:"chat-item-clickable reactors-list-item",onClick:()=>P(e),children:[(0,ee.Y)(Dt.A,{peer:i,size:"medium"}),(0,ee.FD)("div",{className:"info",children:[(0,ee.Y)(Ls.A,{peer:i,withEmojiStatus:!0}),(0,ee.FD)("span",{className:"status",dir:"auto",children:[(0,ee.Y)(q.A,{name:"heart-outline",className:"status-icon"}),(0,ze.U)(g,1e3*t.addedDate)]})]}),t.reaction&&(0,ee.Y)(ks.A,{className:"reactors-list-emoji",reaction:t.reaction,availableReactions:d})]},`${e}-${(0,l.Jj)(t.reaction)}`))})),S||s?.length||n.push((0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>P(e),children:(0,ee.Y)(ys.A,{userId:e,noStatusOrTyping:!0,avatarSize:"medium",status:o?(0,ze.U)(g,1e3*o):void 0,statusIcon:"message-read"})},`${e}-seen-by`)),n}))}):(0,ee.Y)(Rs.A,{})}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:I,children:g("Close")})]})}))),rc=(0,s.ph)((0,n.EK)(((e,{activeEmojiInteraction:t})=>{const i=void 0!==t.animatedEffect&&(0,c.Nr8)(e,t.animatedEffect);return{effectAnimationId:i?i.id:void 0}}))((({effectAnimationId:e,activeEmojiInteraction:t})=>{const{stopActiveEmojiInteraction:i}=(0,n.ko)(),[o,a]=(0,Y.A)(!1),[r,l]=(0,Y.A)(!1),c=(0,s.li)(),d=(0,D.A)((()=>{a(),c.current&&clearTimeout(c.current),setTimeout((()=>{i({id:t.id})}),250)})),h=(0,D.A)((e=>{e.target?.closest(".AnimatedEmoji")||d()}));(0,s.vJ)((()=>(document.addEventListener("touchstart",h),document.addEventListener("touchmove",h),document.addEventListener("mousedown",h),document.addEventListener("wheel",h),()=>{document.removeEventListener("touchstart",h),document.removeEventListener("touchmove",h),document.removeEventListener("mousedown",h),document.removeEventListener("wheel",h)})),[h]),(0,s.Nf)((()=>{const e=(0,s.VK)();c.current=setTimeout((()=>{d(),e()}),3e3)}),[d]);const m=e&&`sticker${e}`,u=(0,j.A)(m,!e);if(!t.startSize)return;const p=(t.startSize||0)/309;return(0,ee.Y)("div",{className:(0,me.A)("EmojiInteractionAnimation",o&&"hiding",r&&"playing",t.isReversed&&"reversed"),style:`--scale: ${p}; --start-x: ${t.x}px; --start-y: ${t.y}px;`,children:(0,ee.Y)(Po.A,{size:309,tgsUrl:u,play:!0,quality:b.Ni?.5:void 0,forceAlways:!0,noLoop:!0,onLoad:l},`effect_${e}`)})}))),lc=(0,s.ph)((0,n.EK)((e=>{const{chatId:t,messageId:i}=(0,c.nTw)(e).chatLanguageModal||{},s=(0,c.wmb)(e);return{chatId:t,messageId:i,activeTranslationLanguage:t?i?(0,c.Rny)(e,t,i):(0,c.qZq)(e,t):void 0,currentLanguageCode:s}}))((({isOpen:e,chatId:t,messageId:i,activeTranslationLanguage:o,currentLanguageCode:r})=>{const{requestMessageTranslation:l,closeChatLanguageModal:c,setSettingOption:d,requestChatTranslation:h}=(0,n.ko)(),[m,u]=(0,s.J0)(""),p=(0,M.A)(),v=(0,D.A)((e=>{t&&(i?l({chatId:t,id:i,toLanguageCode:e}):(d({translationLanguage:e}),h({chatId:t,toLanguageCode:e})),c())})),g=(0,D.A)((e=>{u(e.target.value)})),A=(0,s.Kr)((()=>a.N89.map((e=>({langCode:e,translatedName:new Intl.DisplayNames([r],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)})))),[r]);(0,s.vJ)((()=>{e||u("")}),[e]);const b=(0,s.Kr)((()=>m.trim()?A.filter((({langCode:e,translatedName:t,originalName:i})=>t.toLowerCase().includes(m.toLowerCase())||i.toLowerCase().includes(m.toLowerCase())||e.toLowerCase().includes(m.toLowerCase()))):A),[A,m]);return(0,ee.FD)(Z.A,{className:"aMjNU9gm",isSlim:!0,isOpen:e,hasCloseButton:!0,title:p("Language"),onClose:c,children:[(0,ee.Y)(Q.A,{value:m,onChange:g,placeholder:p("Search"),teactExperimentControlled:!0},"search"),(0,ee.Y)("div",{className:(0,me.A)("r3YNWDQr","custom-scroll"),children:b.map((({langCode:e,originalName:t,translatedName:i})=>(0,ee.FD)(li.A,{className:(0,me.A)("T3An6Hoz","no-icon"),secondaryIcon:o===e?"check":void 0,disabled:o===e,multiline:!0,narrow:!0,onClick:()=>v(e),children:[(0,ee.Y)("span",{className:(0,me.A)("title","dQ9wwFu1"),children:(0,Ft.A)(t,["highlight"],{highlight:m})}),(0,ee.Y)("span",{className:(0,me.A)("subtitle","m_J41YYl"),children:(0,Ft.A)(i,["highlight"],{highlight:m})})]},e)))})]})})));var cc=i(85982),dc=i(24899);const hc={content:"WEJIbFQj",closeButton:"_vwPuDEM",icon:"BUiGM8qZ",title:"Q3NhXpNI",description:"frZbGQ0G"},mc=(0,s.ph)((0,n.EK)((e=>{const{countryList:t}=e;return{phoneCodeList:t.phoneCodes}}))((({modal:e,phoneCodeList:t})=>{const{closeCollectibleInfoModal:i,openChat:o,openUrl:a,showNotification:r}=(0,n.ko)(),l=(0,M.A)(),c="username"===e?.type,d=(0,D.A)((()=>{i()})),h=(0,D.A)((()=>{o({id:e.peerId}),d()})),m=(0,D.A)((()=>{a({url:e.url,shouldSkipModal:!0}),d()})),u=(0,D.A)((()=>{const i=c?(0,dc.A)(e.collectible):(0,dn.Ox)(t,e.collectible);(0,cc.eM)(i),r({message:l(c?"UsernameCopied":"PhoneCopied")}),d()})),p=(0,s.Kr)((()=>{if(!e)return;const i=c?"FragmentUsernameTitle":"FragmentPhoneTitle",s=c?(0,dc.A)(e.collectible):(0,dn.Ox)(t,e.collectible);return l(i,s)}),[e,c,t,l]),v=(0,s.Kr)((()=>{if(!e)return;const t=c?"FragmentUsernameMessage":"FragmentPhoneMessage",i=(0,ze.U)(l,1e3*e.purchaseDate),s=(0,ho.Ad)(e.amount,e.currency,l.code),n=(0,ho.Ad)(e.cryptoAmount,e.cryptoCurrency,l.code);return l(t,[i,`${n} (${s})`])}),[e,c,l]);return(0,ee.FD)(Z.A,{isOpen:Boolean(e),isSlim:!0,contentClassName:hc.content,onClose:i,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",className:hc.closeButton,ariaLabel:l("Close"),onClick:d,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:hc.icon,children:(0,ee.Y)(Sr.A,{tgsUrl:c?Cr.w.Mention:Cr.w.Fragment,size:60})}),(0,ee.Y)("h3",{className:hc.title,children:p&&(0,Ft.A)(p,["simple_markdown"])}),(0,ee.Y)(Vr.A,{className:hc.chip,peerId:e?.peerId,forceShowSelf:!0,clickArg:e?.peerId,onClick:h}),(0,ee.Y)("p",{className:hc.description,children:v&&(0,Ft.A)(v,["simple_markdown"])}),(0,ee.FD)("div",{className:"dialog-buttons dialog-buttons-centered",children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",onClick:m,children:l("FragmentUsernameOpen")}),(0,ee.Y)(W.A,{isText:!0,className:"confirm-dialog-button",onClick:u,children:l(c?"FragmentUsernameCopy":"FragmentPhoneCopy")})]})]})})));var uc=i(24680),pc=i(57309);function vc(e){return(t,i)=>{const s=(0,c.nTw)(t),{byId:n}=t.chats,{byId:o}=t.users,{fetchingStatus:a,resultsByType:r,chatId:l}=s.globalSearch,{shouldWarnAboutSvg:d}=(0,un.l)(t),h="audio"!==e?e:i?.isVoice?"voice":"audio",{byChatId:m}=t.messages,u=r?.[h]?.foundIds,p=s.activeDownloads;return{theme:(0,c.SJA)(t),isLoading:void 0===u||!!a&&Boolean(a.chats||a.messages),chatsById:n,usersById:o,globalMessagesByChatId:m,foundIds:u,searchChatId:l,activeDownloads:p,isChatProtected:l?(0,c.hds)(t,l)?.isProtected:void 0,shouldWarnAboutSvg:d}}}var gc=i(55429),Ac=i(65240),bc=i(42827);const fc=(0,ve.nF)((e=>e()),500,!0),Cc=(0,s.ph)((0,n.EK)(vc("audio"))((({theme:e,isVoice:t,searchQuery:i,isLoading:r,chatsById:c,usersById:d,globalMessagesByChatId:h,foundIds:m,activeDownloads:u})=>{const{searchMessagesGlobal:p,focusMessage:v,openAudioPlayer:g}=(0,n.ko)(),A=(0,M.A)(),b=t?"voice":"audio",f=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&fc((()=>{p({type:b})}))}),[b,p,i]),C=(0,s.Kr)((()=>m&&h?m.map((e=>{const[t,i]=(0,pc.a)(e);return h[t]?.byId[i]})).filter(Boolean):fi.p),[h,m]),S=(0,s.hb)((e=>{v({chatId:e.chatId,messageId:e.id})}),[v]),y=(0,s.hb)(((e,t)=>{g({chatId:t,messageId:e})}),[g]),k=(0,sr.A)([i],a.jhd)&&!r;return(0,ee.Y)("div",{className:"LeftSearch--content",children:(0,ee.FD)(bs.A,{className:"search-content documents-list custom-scroll",items:k?C:void 0,onLoadMore:f,noFastList:!0,children:[!k&&(0,ee.Y)(Rs.A,{}),k&&(!m||0===m.length)&&(0,ee.Y)(bc.A,{text:A("ChatList.Search.NoResults"),description:A("ChatList.Search.NoResultsDescription")}),k&&m&&m.length>0&&C.map(((t,i)=>{const s=0===i||(0,ze.$$)(t.date)!==(0,ze.$$)(C[i-1].date),n=(0,l.ed)(t);return(0,ee.FD)(ee.FK,{children:[s&&(0,ee.Y)("p",{className:"section-heading",dir:A.isRtl?"rtl":void 0,children:(0,ze.i6)(A,new Date(1e3*t.date))},t.date),(0,ee.Y)("div",{className:"ListItem small-icon",children:(0,ee.Y)(Ac.Ay,{theme:e,message:t,origin:o.d9.Search,senderTitle:(0,gc.N)(A,t,c,d),date:t.date,className:"scroll-item",onPlay:y,onDateClick:S,canDownload:!c[t.chatId]?.isProtected&&!t.isProtected,isDownloading:(0,l.$r)(u,n)},t.id)},t.id)]})}))]})})})));var Sc=i(27109),yc=i(47067);const kc=e=>{const t=(0,s.li)(),i=(0,s.hb)((i=>{"Enter"===i.key&&t.current===document.activeElement&&e()}),[e]);return(0,s.vJ)((()=>(window.addEventListener("keydown",i,!1),()=>window.removeEventListener("keydown",i,!1))),[i]),t};var wc=i(97967),Nc=i(97046);const Ic=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,user:(0,c.mBe)(e,t),isPinned:(0,c.D3D)(e,t),isMuted:i&&(0,Sc.If)(i,(0,c.K52)(e),(0,c.P5N)(e,i.id)),canChangeFolder:Boolean(e.chatFolders.orderedIds?.length)}}))((({chatId:e,withUsername:t,chat:i,user:a,isPinned:r,isMuted:l,canChangeFolder:c,withOpenAppButton:d,onClick:h})=>{const{requestMainWebView:m}=(0,n.ko)(),p=(0,M.A)(),[v,g,A]=(0,Y.A)(),[b,f,C]=(0,Y.A)(),[S,y,k]=(0,Y.A)(),[w,N,I]=(0,Y.A)(),P=(0,s.hb)((()=>{y(),f()}),[y,f]),F=(0,s.hb)((()=>{N(),g()}),[N,g]),T=(0,yc.A)({chat:i,user:a,isPinned:r,isMuted:l,canChangeFolder:c,handleMute:F,handleChatFolderChange:P},!0),B=(0,D.A)((()=>{h(e)})),R=(0,D.A)((t=>{t.stopPropagation();const i=(0,Nn.A)();m({botId:e,peerId:e,theme:i})})),L=kc(B);return(0,ee.FD)(li.A,{className:"chat-item-clickable search-result",onClick:B,contextActions:T,buttonRef:L,children:[(0,u.L8)(e)?(0,ee.Y)(ys.A,{userId:e,withUsername:t,withStory:!0,avatarSize:"medium",storyViewerOrigin:o.G9.SearchResult}):(0,ee.Y)(Ss.A,{chatId:e,withUsername:t,avatarSize:"medium",withStory:!0,storyViewerOrigin:o.G9.SearchResult}),d&&a?.hasMainMiniApp&&(0,ee.Y)(W.A,{className:"ChatBadge miniapp",pill:!0,fluid:!0,size:"tiny",onClick:R,children:p("BotOpen")}),w&&(0,ee.Y)(Nc.A,{isOpen:v,onClose:A,onCloseAnimationEnd:I,chatId:e}),S&&(0,ee.Y)(wc.A,{isOpen:b,onClose:C,onCloseAnimationEnd:k,chatId:e})]})}))),Pc=(0,ve.nF)((e=>e()),500,!0),Yc=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e).globalSearch,i=t.popularBotApps?.peerIds;return{isLoading:!i&&t.fetchingStatus?.botApps,foundIds:i,recentBotIds:e.topBotApps.userIds}}))((({searchQuery:e,isLoading:t,foundIds:i,recentBotIds:r})=>{const{searchPopularBotApps:l,openChatWithInfo:c}=(0,n.ko)(),d=(0,s.li)(),h=(0,M.A)(),[m,u]=(0,s.J0)(!1),p=(0,s.Kr)((()=>{if(!i)return[];const t=new Set(r),s=i.filter((e=>!t.has(e)));return(0,Yt.PU)({ids:s,query:e,type:"user"})}),[i,r,e]),v=(0,D.A)((e=>{c({id:e,shouldReplaceHistory:!0})})),g=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&Pc((()=>{l()}))}),[]),A=(0,D.A)((()=>{u((e=>!e))})),b=(0,sr.A)([e],a.jhd)&&!t;return(0,ee.Y)("div",{ref:d,className:"LeftSearch--content",children:(0,ee.FD)(bs.A,{className:"search-content custom-scroll",items:b?p:void 0,onLoadMore:g,noFastList:!0,children:[!b&&(0,ee.Y)(Rs.A,{}),b&&!p?.length&&(0,ee.Y)(bc.A,{text:h("ChatList.Search.NoResults"),description:h("ChatList.Search.NoResultsDescription")}),b&&!e&&Boolean(r?.length)&&(0,ee.FD)("div",{className:"search-section",children:[(0,ee.FD)("h3",{className:"section-heading",children:[r.length>5&&(0,ee.Y)(Na.A,{className:"Link",onClick:A,children:h(m?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")}),h("SearchAppsMine")]}),r.map(((e,t)=>{if(m||!(t>=5))return(0,ee.Y)(Ic,{chatId:e,onClick:v,withOpenAppButton:!0})}))]}),b&&Boolean(p?.length)&&(0,ee.FD)("div",{className:"search-section",children:[(0,ee.Y)("h3",{className:"section-heading",children:h("SearchAppsPopular")}),p.map((e=>(0,ee.Y)(Ic,{chatId:e,onClick:v,withOpenAppButton:!0})))]})]})})})));function Fc(e,t,i,s,n){if(!i)return(0,v.C)(e,t,void 0,s);const o=(0,l.y2)(t);return(0,ee.FD)("span",{className:"media-preview",children:[(0,ee.Y)("img",{src:i,alt:"",className:(0,me.A)("media-preview--image",n&&"round",o&&"media-preview-spoiler"),draggable:!1}),(0,l.zX)(t)&&(0,ee.Y)(q.A,{name:"play"}),(0,v.C)(e,t,!0,s)]})}const Dc=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t);if(!i)return{};const s=(0,l.e7)(i),n=s?(0,c.mBe)(e,s):void 0;return{chat:i,...s&&{privateChatUser:n}}}))((({message:e,searchQuery:t,chatId:i,chat:s,privateChatUser:o})=>{const{focusMessage:a}=(0,n.ko)(),{isMobile:r}=(0,I.Ay)(),c=(0,l.fP)(e)?void 0:(0,l.CI)(e),d=(0,j.A)((0,l.EO)(e,"micro")),h=Boolean((0,l.lk)(e)),m=(0,D.A)((()=>{a({chatId:i,messageId:e.id,shouldReplaceHistory:!0})})),u=(0,M.A)(),p=kc(m);if(!s)return;const v=o||s;return(0,ee.FD)(li.A,{className:"ChatMessage chat-item-clickable",ripple:!r,onClick:m,buttonRef:p,children:[(0,ee.Y)(Dt.A,{peer:v,isSavedMessages:o?.isSelf}),(0,ee.FD)("div",{className:"info",children:[(0,ee.FD)("div",{className:"info-row",children:[(0,ee.Y)(Ls.A,{peer:v,withEmojiStatus:!0,isSavedMessages:i===o?.id&&o?.isSelf}),(0,ee.Y)("div",{className:"message-date",children:(0,ee.Y)(Na.A,{className:"date",children:(0,ze.be)(u,1e3*e.date)})})]}),(0,ee.Y)("div",{className:"subtitle",children:(0,ee.Y)("div",{className:"message",dir:"auto",children:Fc(u,e,d||c,t,h)})})]})]})}))),Mc=(0,s.ph)((({searchDate:e,onSelect:t})=>{const i=(0,s.Kr)((()=>function(e){if(e.match(/^\d{2,4}-\d{2}-\d{2}$/g)){const t=new Date(e);return[{date:t,text:(0,ze.A)(t)}]}const t=[],i=new Date,s=i.getFullYear(),n=i.getTime()>new Date(`${s}-${e}`).getTime()?s:s-1;for(let i=0;i<8;i++){const s=new Date(`${n-i}-${e}`);t.push({date:s,text:(0,ze.A)(s)})}return t}(e)),[e]);return(0,ee.Y)("section",{className:"DateSuggest custom-scroll custom-scroll-x",children:i.map((({date:e,text:i})=>(0,ee.FD)("div",{onClick:()=>t(e),className:"date-item",children:[(0,ee.Y)(q.A,{name:"calendar"}),(0,ee.Y)("span",{children:i})]},i)))})})),Tc=2*p.$,Bc=(0,s.ph)((0,n.EK)(((e,{chatId:t,topicId:i})=>({topic:(0,c.S0q)(e,t,i)})))((({topicId:e,topic:t,onClick:i})=>{const n=(0,s.hb)((()=>{i(e)}),[e,i]),o=kc(n);if(t)return(0,ee.FD)(li.A,{className:"chat-item-clickable search-result",onClick:n,buttonClassName:"topic-item",buttonRef:o,children:[(0,ee.Y)(xs.A,{size:Tc,topic:t,className:"topic-icon",letterClassName:"topic-icon-letter"}),(0,ee.Y)("div",{dir:"auto",className:"fullName",children:(0,Ft.A)(t.title)})]})}))),Rc=(0,ve.nF)((e=>e()),500,!0),Lc=(0,s.ph)((0,n.EK)((e=>{const{byId:t}=e.chats,{currentUserId:i,messages:{byChatId:s}}=e,{fetchingStatus:n,resultsByType:o,foundTopicIds:a,chatId:r}=(0,c.nTw)(e).globalSearch,{foundIds:l}=o?.text||{};return{currentUserId:i,foundIds:l,globalMessagesByChatId:s,chatsById:t,fetchingStatus:n,foundTopicIds:a,searchChatId:r}}))((({searchQuery:e,dateSearchQuery:t,foundIds:i,globalMessagesByChatId:a,chatsById:r,fetchingStatus:l,foundTopicIds:c,searchChatId:d,onSearchDateSelect:h,onReset:m})=>{const{searchMessagesGlobal:u,openThread:p}=(0,n.ko)(),g=(0,M.A)(),{isMobile:A}=(0,I.Ay)(),b=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&Rc((()=>{u({type:"text"})}))}),[e]),f=(0,s.hb)((e=>{d&&(p({chatId:d,threadId:e,shouldReplaceHistory:!0}),A||m())}),[d,A,m]),C=(0,s.Kr)((()=>i&&0!==i.length?i.map((e=>{const[t,i]=(0,pc.a)(e);return a?.[t]?.byId[i]})).filter(Boolean).sort(((e,t)=>t.date-e.date)):fi.p),[i,a]),S=l&&!l.chats&&!l.messages&&!C.length&&!c?.length;return(0,ee.Y)("div",{className:"LeftSearch--content",children:(0,ee.FD)(bs.A,{className:"search-content custom-scroll chat-list",items:C,onLoadMore:b,noFastList:!0,children:[t&&(0,ee.Y)("div",{className:"chat-selection no-scrollbar",children:(0,ee.Y)(Mc,{searchDate:t,onSelect:h})}),S&&(0,ee.Y)(bc.A,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),Boolean(c?.length)&&(0,ee.FD)("div",{className:"pb-2",children:[(0,ee.Y)("h3",{className:"section-heading topic-search-heading",dir:g.isRtl?"auto":void 0,children:g("Topics")}),c.map((e=>(0,ee.Y)(Bc,{chatId:d,topicId:e,onClick:f})))]}),Boolean(C.length)&&(0,ee.FD)("div",{className:"pb-2",children:[(0,ee.Y)("h3",{className:"section-heading topic-search-heading",dir:g.isRtl?"auto":void 0,children:g("SearchMessages")}),C.map((function(t){const i=(0,v.C)(g,t),s=r[t.chatId];if(i&&s)return(0,ee.Y)(Dc,{chatId:t.chatId,message:t,searchQuery:e})}))]})]})})})));var xc=i(49763),Ec=i(81949);const Vc=(0,s.ph)((({sponsoredPeer:e,observeIntersection:t})=>{const i=(0,s.li)(),{clickSponsored:a,viewSponsored:r,openChat:l}=(0,n.ko)(),c=(0,Vi.A)(),{peerId:d,randomId:h,additionalInfo:m,sponsorInfo:p}=e;(0,or.mv)(i,t,(e=>{1===e.intersectionRatio&&r({randomId:h})}));const v=(0,D.A)((()=>{a({randomId:h}),l({id:d})})),{isContextMenuOpen:g,contextMenuAnchor:A,handleBeforeContextMenu:b,handleContextMenu:f,handleContextMenuClose:C,handleContextMenuHide:S}=(0,An.A)(i),{handleClick:y,handleMouseDown:k}=(0,Xi.Q)((e=>{e.stopPropagation(),f(e)})),w=kc(v);return(0,ee.FD)(li.A,{ref:i,className:"chat-item-clickable search-result",onClick:v,onMouseDown:b,onContextMenu:f,buttonRef:w,children:[(0,u.L8)(d)?(0,ee.Y)(ys.A,{userId:d,withUsername:!0,withStory:!0,avatarSize:"medium",storyViewerOrigin:o.G9.SearchResult}):(0,ee.Y)(Ss.A,{chatId:d,withUsername:!0,avatarSize:"medium",withStory:!0,storyViewerOrigin:o.G9.SearchResult}),(0,ee.FD)(Ec.A,{className:"search-sponsored-badge",onMouseDown:k,onClick:y,children:[c("SponsoredPeerBadge"),(0,ee.Y)(q.A,{name:"more"})]}),A&&(0,ee.Y)(hl.A,{isOpen:g,anchor:A,triggerRef:i,randomId:h,additionalInfo:m,canReport:!0,sponsorInfo:p,onClose:C,onCloseAnimationEnd:S})]})})),_c=(0,ve.nF)((e=>e()),6e4,!0),Uc=(0,s.ph)((0,n.EK)((e=>{const{userIds:t}=e.topPeers,i=e.users.byId,{recentlyFoundChatIds:s}=e;return{topUserIds:t,usersById:i,recentlyFoundChatIds:s}}))((({topUserIds:e,usersById:t,recentlyFoundChatIds:i,onReset:o})=>{const{loadTopUsers:a,openChat:r,addRecentlyFoundChatId:c,clearRecentlyFoundChats:d}=(0,n.ko)(),h=(0,s.li)();(0,s.vJ)((()=>{_c((()=>{a()}))}),[a]),(0,kn.A)(h,!e);const m=(0,s.hb)((e=>{r({id:e,shouldReplaceHistory:!0}),o(),setTimeout((()=>{c({id:e})}),250)}),[r,c,o]),u=(0,s.hb)((()=>{d()}),[d]),p=(0,M.A)();return(0,ee.FD)("div",{className:"RecentContacts custom-scroll",children:[e&&(0,ee.Y)("div",{className:"top-peers-section",dir:p.isRtl?"rtl":void 0,children:(0,ee.Y)("div",{ref:h,className:"top-peers",children:e.map((e=>(0,ee.FD)("div",{className:"top-peer-item",onClick:()=>m(e),dir:p.isRtl?"rtl":void 0,children:[(0,ee.Y)(Dt.A,{peer:t[e]}),(0,ee.Y)("div",{className:"top-peer-name",children:(0,Ft.A)((0,l.u0)(t[e])||" ")})]},e)))})}),i&&(0,ee.FD)("div",{className:"search-section pt-1",children:[(0,ee.FD)("h3",{className:(0,me.A)("section-heading mt-0 recent-chats-header",!e&&"without-border"),dir:p.isRtl?"rtl":void 0,children:[p("Recent"),(0,ee.Y)(W.A,{className:"clear-recent-chats",round:!0,size:"smaller",color:"translucent",ariaLabel:p("Clear"),onClick:u,isRtl:p.isRtl,children:(0,ee.Y)(q.A,{name:"close"})})]}),i.map((e=>(0,ee.Y)(Ic,{chatId:e,withOpenAppButton:!0,onClick:m})))]})]})}))),Oc=(0,ve.nF)((e=>e()),500,!1),Kc=(0,s.ph)((0,n.EK)(((e,{isChannelList:t})=>{const{userIds:i}=e.contactList||{},{currentUserId:s,messages:n}=e;if(!i)return{};const{fetchingStatus:o,globalResults:r,localResults:l,resultsByType:d,sponsoredPeer:h}=(0,c.nTw)(e).globalSearch,{peerIds:m}=r||{},{peerIds:u}=l||{},{byChatId:p}=n,v=d?.[t?"channels":"text"]?.foundIds,{similarChannelIds:g}=(0,c.dg4)(e,a.rBM)||{};return{currentUserId:s,contactIds:i,accountPeerIds:u,globalPeerIds:m,foundIds:v,globalMessagesByChatId:p,fetchingStatus:o,sponsoredPeer:h,suggestedChannelIds:g}}))((({isChannelList:e,searchQuery:t,searchDate:i,dateSearchQuery:r,currentUserId:c,contactIds:d,accountPeerIds:h,globalPeerIds:m,foundIds:u,globalMessagesByChatId:p,fetchingStatus:g,suggestedChannelIds:A,sponsoredPeer:b,onReset:f,onSearchDateSelect:C})=>{const{openChat:S,addRecentlyFoundChatId:y,searchMessagesGlobal:k,setGlobalSearchChatId:w,loadChannelRecommendations:N}=(0,n.ko)(),P=(0,s.li)(),Y=(0,s.li)(),F=(0,M.A)(),T=(0,Vi.A)(),{isMobile:B}=(0,I.Ay)(),[R,L]=(0,s.J0)(!1),[x,E]=(0,s.J0)(!1),[V,_]=(0,s.J0)("all"),U=(0,s.li)();(0,Ce.A)((()=>{e&&N({})}));const O=(0,s.hb)((({direction:t})=>{t===o.TN.Backwards&&Oc((()=>{k({type:e?"channels":"text",context:V})}))}),[t,V]),K=(0,s.hb)((e=>{S({id:e,shouldReplaceHistory:!0}),e!==c&&y({id:e}),B||f()}),[S,c,B,y,f]),J=(0,s.hb)((e=>{w({id:e})}),[w]);function G(e){return T("users"===e?"PrivateChatsSearchContext":"groups"===e?"GroupChatsSearchContext":"channels"===e?"ChannelsSearchContext":"AllChatsSearchContext")}const{isContextMenuOpen:j,contextMenuAnchor:z,handleContextMenu:H,handleContextMenuClose:$,handleContextMenuHide:W}=(0,An.A)(U),Q=(0,D.A)((()=>U.current)),Z=(0,D.A)((()=>U.current.querySelector(".chatResultsContextMenu .bubble"))),X=(0,D.A)((()=>U.current.querySelector(".menuTrigger"))),te=(0,D.A)((e=>{H(e)})),ie=(0,me.A)("icon","iconPlaceholder"),ne=(0,s.Kr)((()=>{if(!e&&(!t||t.startsWith("@")&&t.length<2))return fi.p;const i=(0,n.mS)().chats.byId,s=((0,xc.YA)(a.DSF)??[]).filter((t=>{if(!e)return!0;const s=i[t];return s&&(0,l.WX)(s)})),o=(0,Yt.PU)({ids:s,query:t,type:"chat"});if(e)return o;const r=[...c?[c]:[],...d||[]],m=[...(0,Yt.PU)({ids:r,query:t,type:"user"}),...o];return(0,bi.Am)([...(0,Fs.A)(m,void 0,c?[c]:void 0),...(0,Fs.A)(h||[])])}),[t,c,d,h,e]);(0,kn.A)(Y,!ne.length||e,!0);const oe=(0,s.Kr)((()=>{if(!t||t.length<4||!m)return fi.p;const i=(0,n.mS)().chats.byId,s=m.filter((t=>{if(!e)return!0;const s=i[t];return s&&(0,l.WX)(s)}));return(0,Fs.A)(s,!0)}),[m,e,t]),ae=(0,s.Kr)((()=>{if(!t&&!i||!u||0===u.length)return fi.p;const s=(0,n.mS)().chats.byId;return u.map((t=>{const[i,n]=(0,pc.a)(t),o=s[i];if(o&&(!e||(0,l.WX)(o)))return p?.[i]?.byId[n]})).filter(Boolean)}),[t,i,u,e,p]);(0,s.vJ)((()=>{t&&k({type:e?"channels":"text",context:V,shouldResetResultsByType:!0,shouldCheckFetchingMessagesStatus:!0})}),[V]);const re=(0,s.hb)((()=>{L(!R)}),[R]),le=(0,s.hb)((()=>{E(!x)}),[x]),de=ae,he="all"===V&&g&&!g.chats&&!g.messages&&!ne.length&&!oe.length&&!de.length,ue=g?.messages,pe=!t&&!i&&!e,{observe:ve}=(0,or.BL)({rootRef:P,throttleMs:200,isDisabled:!pe});if(pe)return(0,ee.Y)(Uc,{onReset:f});const ge="all"!==V||Boolean(de.length);return(0,ee.FD)(bs.A,{ref:P,className:"LeftSearch--content custom-scroll",items:de,onLoadMore:O,noScrollRestoreOnTop:!0,noFastList:!0,children:[r&&(0,ee.Y)("div",{className:"chat-selection no-scrollbar",children:(0,ee.Y)(Mc,{searchDate:r,onSelect:C})}),he&&(0,ee.Y)(bc.A,{text:F("ChatList.Search.NoResults"),description:F("ChatList.Search.NoResultsDescription")}),Boolean(ne.length)&&!e&&(0,ee.Y)("div",{className:"chat-selection no-scrollbar",dir:F.isRtl?"rtl":void 0,ref:Y,children:ne.map((e=>(0,ee.Y)(Vr.A,{peerId:e,className:"left-search-local-suggestion",onClick:J,clickArg:e})))}),Boolean(ne.length)&&(0,ee.FD)("div",{className:"search-section",children:[(0,ee.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[ne.length>5&&(0,ee.Y)(Na.A,{className:"Link",onClick:re,children:F(R?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")}),F(e?"SearchMyChannels":"DialogList.SearchSectionDialogs")]}),ne.map(((e,t)=>{if(R||!(t>=5))return(0,ee.Y)(Ic,{withOpenAppButton:!0,chatId:e,onClick:K})}))]}),Boolean(oe.length)&&(0,ee.FD)("div",{className:"search-section",children:[(0,ee.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[oe.length>5&&(0,ee.Y)(Na.A,{className:"Link",onClick:le,children:F(x?"ChatList.Search.ShowLess":"ChatList.Search.ShowMore")}),F("DialogList.SearchSectionGlobal")]}),b&&(0,ee.Y)(Vc,{sponsoredPeer:b,observeIntersection:ve}),oe.map(((e,t)=>{if(x||!(t>=5))return(0,ee.Y)(Ic,{chatId:e,withUsername:!0,onClick:K})}))]}),Boolean(A?.length)&&!t&&(0,ee.FD)("div",{className:"search-section",children:[(0,ee.Y)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:F("SearchRecommendedChannels")}),A.map((e=>(0,ee.Y)(Ic,{chatId:e,withUsername:!0,onClick:K})))]}),(0,ee.FD)("div",{className:"menuOwner",ref:U,children:[(0,ee.Y)($e.A,{isOpen:j,anchor:z,getTriggerElement:X,getRootElement:Q,getMenuElement:Z,className:"chatResultsContextMenu",onClose:$,onCloseAnimationEnd:W,autoClose:!0,children:(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(ce.A,{icon:"all"===V?"check":void 0,customIcon:"all"!==V?(0,ee.Y)("i",{className:ie}):void 0,onClick:()=>_("all"),children:G("all")}),(0,ee.Y)(ce.A,{icon:"users"===V?"check":void 0,customIcon:"users"!==V?(0,ee.Y)("i",{className:ie}):void 0,onClick:()=>_("users"),children:G("users")}),(0,ee.Y)(ce.A,{icon:"groups"===V?"check":void 0,customIcon:"groups"!==V?(0,ee.Y)("i",{className:ie}):void 0,onClick:()=>_("groups"),children:G("groups")}),(0,ee.Y)(ce.A,{icon:"channels"===V?"check":void 0,customIcon:"channels"!==V?(0,ee.Y)("i",{className:ie}):void 0,onClick:()=>_("channels"),children:G("channels")})]})}),ge&&(0,ee.FD)("div",{className:"search-section",children:[(0,ee.FD)("h3",{className:"section-heading",dir:F.isRtl?"auto":void 0,children:[!e&&(0,ee.FD)(Na.A,{className:"Link menuTrigger dropDownLink",onClick:te,children:[T("SearchContextCaption",{type:G(V)},{withNodes:!0}),(0,ee.FD)(se.Ay,{name:"fade",shouldCleanup:!0,activeKey:Number(ue),className:"iconContainer",slideClassName:"iconContainerSlide",children:[ue&&(0,ee.Y)(Rs.A,{}),!ue&&(0,ee.Y)(q.A,{name:"down"})]})]}),F("SearchMessages")]}),de.map((function(e){const i=(0,n.mS)().chats.byId,s=(0,v.C)(F,e),o=i[e.chatId];if(s&&o)return(0,ee.Y)(Dc,{chatId:e.chatId,message:e,searchQuery:t})}))]})]})]})})));var Jc=i(44589);const Gc="documents",jc=(0,ve.nF)((e=>e()),500,!0),zc=(0,s.ph)((0,n.EK)(vc(Gc))((({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:c,foundIds:d,activeDownloads:h,shouldWarnAboutSvg:m})=>{const{searchMessagesGlobal:u,focusMessage:p}=(0,n.ko)(),v=(0,s.li)(),g=(0,M.A)(),{observe:A}=(0,or.BL)({rootRef:v,throttleMs:500}),b=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&jc((()=>{u({type:Gc})}))}),[e]),f=(0,s.Kr)((()=>d&&c?d.map((e=>{const[t,i]=(0,pc.a)(e),s=c[t]?.byId[i];return s&&(0,l.zC)(s)?s:void 0})).filter(Boolean):fi.p),[c,d]),C=(0,s.hb)((e=>{p({chatId:e.chatId,messageId:e.id})}),[p]),S=(0,sr.A)([e],a.jhd)&&!t;return(0,ee.Y)("div",{ref:v,className:"LeftSearch--content",children:(0,ee.FD)(bs.A,{className:"search-content documents-list custom-scroll",items:S?f:void 0,onLoadMore:b,noFastList:!0,children:[!S&&(0,ee.Y)(Rs.A,{}),S&&(!d||0===d.length)&&(0,ee.Y)(bc.A,{text:g("ChatList.Search.NoResults"),description:g("ChatList.Search.NoResultsDescription")}),S&&d&&d.length>0&&f.map(((e,t)=>{const s=0===t||(0,ze.$$)(e.date)!==(0,ze.$$)(f[t-1].date);return(0,ee.FD)(ee.FK,{children:[s&&(0,ee.Y)("p",{className:"section-heading",dir:g.isRtl?"rtl":void 0,children:(0,ze.i6)(g,new Date(1e3*e.date))},e.date),(0,ee.Y)("div",{className:"ListItem small-icon",children:(0,ee.Y)(Jc.A,{document:(0,l.zC)(e),message:e,withDate:!0,datetime:e.date,smaller:!0,sender:(0,gc.N)(g,e,i,r),className:"scroll-item",isDownloading:(0,l.$r)(h,e.content.document),shouldWarnAboutSvg:m,observeIntersection:A,onDateClick:C})},e.id)]})}))]})})})));var Hc=i(37378);const $c="links",qc=(0,ve.nF)((e=>e()),500,!0),Wc=(0,s.ph)((0,n.EK)(vc($c))((({searchQuery:e,isLoading:t,chatsById:i,usersById:r,globalMessagesByChatId:l,foundIds:c,isChatProtected:d})=>{const{searchMessagesGlobal:h,focusMessage:m}=(0,n.ko)(),u=(0,s.li)(),p=(0,M.A)(),{observe:v}=(0,or.BL)({rootRef:u,throttleMs:500}),g=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&qc((()=>{h({type:$c})}))}),[e]),A=(0,s.Kr)((()=>c&&l?c.map((e=>{const[t,i]=(0,pc.a)(e);return l[t]?.byId[i]})).filter(Boolean):fi.p),[l,c]),b=(0,s.hb)((e=>{m({chatId:e.chatId,messageId:e.id})}),[m]),f=(0,sr.A)([e],a.jhd)&&!t;return(0,ee.Y)("div",{ref:u,className:"LeftSearch--content",children:(0,ee.FD)(bs.A,{className:"search-content documents-list custom-scroll",items:f?A:void 0,onLoadMore:g,noFastList:!0,children:[!f&&(0,ee.Y)(Rs.A,{}),f&&(!c||0===c.length)&&(0,ee.Y)(bc.A,{text:p("ChatList.Search.NoResults"),description:p("ChatList.Search.NoResultsDescription")}),f&&c&&c.length>0&&A.map(((e,t)=>{const s=0===t||(0,ze.$$)(e.date)!==(0,ze.$$)(A[t-1].date);return(0,ee.FD)(ee.FK,{children:[s&&(0,ee.Y)("p",{className:"section-heading",dir:p.isRtl?"rtl":void 0,children:(0,ze.i6)(p,new Date(1e3*e.date))},e.date),(0,ee.Y)("div",{className:"ListItem small-icon",dir:p.isRtl?"rtl":void 0,children:(0,ee.Y)(Hc.A,{message:e,senderTitle:(0,gc.N)(p,e,i,r),isProtected:d||e.isProtected,observeIntersection:v,onMessageClick:b},e.id)},e.id)]})}))]})})})));var Qc=i(81524);const Zc="media",Xc=(0,ve.nF)((e=>e()),500,!0),ed=(0,s.ph)((0,n.EK)(vc(Zc))((({searchQuery:e,isLoading:t,globalMessagesByChatId:i,foundIds:r,isChatProtected:l})=>{const{searchMessagesGlobal:c,openMediaViewer:d}=(0,n.ko)(),h=(0,s.li)(),m=(0,M.A)(),{observe:u}=(0,or.BL)({rootRef:h,throttleMs:500}),p=(0,s.hb)((({direction:e})=>{e===o.TN.Backwards&&Xc((()=>{c({type:Zc})}))}),[c,e]),v=(0,s.Kr)((()=>r&&i?r.map((e=>{const[t,s]=(0,pc.a)(e);return i[t]?.byId[s]})).filter(Boolean):fi.p),[i,r]),g=(0,s.hb)(((e,t)=>{d({chatId:t,messageId:e,origin:o.TQ.SearchResult})}),[d]),A=(0,sr.A)([e],a.jhd)&&!t,b=A&&r&&r.length>0&&!e,f=A&&r&&r.length>0&&e,C=(0,me.A)("search-content custom-scroll",f&&"chat-list");return(0,ee.Y)("div",{ref:h,className:"LeftSearch--content LeftSearch--media",children:(0,ee.FD)(bs.A,{className:C,items:A?v:void 0,itemSelector:e?".ListItem":".Media",onLoadMore:p,noFastList:!0,children:[!A&&(0,ee.Y)(Rs.A,{}),A&&(!r||0===r.length)&&(0,ee.Y)(bc.A,{text:m("ChatList.Search.NoResults"),description:m("ChatList.Search.NoResultsDescription")}),b&&(0,ee.Y)("div",{className:"media-list",dir:m.isRtl?"rtl":void 0,children:v.map((e=>(0,ee.Y)(Qc.A,{idPrefix:"search-media",message:e,isProtected:l||e.isProtected,observeIntersection:u,onClick:g},`${e.chatId}-${e.id}`)))}),f&&v.map((e=>(0,ee.Y)(Dc,{chatId:e.chatId,message:e},e.id)))]})})}))),td=[{type:o.$C.ChatList,key:"SearchTabChats"},{type:o.$C.ChannelList,key:"SearchTabChannels"},{type:o.$C.BotApps,key:"SearchTabApps"},{type:o.$C.Media,key:"SearchTabMedia"},{type:o.$C.Links,key:"SearchTabLinks"},{type:o.$C.Files,key:"SearchTabFiles"},{type:o.$C.Music,key:"SearchTabMusic"},{type:o.$C.Voice,key:"SearchTabVoice"}],id=[{type:o.$C.ChatList,key:"SearchTabMessages"},...td.slice(3)],sd=(0,s.ph)((0,n.EK)((e=>{const{currentContent:t,chatId:i}=(0,c.nTw)(e).globalSearch;return{currentContent:t,chatId:i}}))((({searchQuery:e,searchDate:t,isActive:i,currentContent:a=o.$C.ChatList,chatId:r,onReset:l})=>{const{setGlobalSearchContent:c,setGlobalSearchDate:d}=(0,n.ko)(),h=(0,Vi.A)(),[m,u]=(0,s.J0)(a),p=(0,s.Kr)((()=>(0,ze.Rm)(e)),[e]),v=(0,s.Kr)((()=>(r?id:td).map((e=>({...e,title:h(e.key)})))),[r,h]),g=(0,D.A)((e=>{const t=v[e];c({content:t.type}),u(e)})),A=(0,D.A)((e=>{d({date:e.getTime()/1e3})}));(0,fe.A)({isActive:i,onBack:l});const b=(0,s.li)(),f=(0,Bs.A)(b,i,void 0,".ListItem-button",!0);return(0,ee.FD)("div",{className:"LeftSearch",ref:b,onKeyDown:f,children:[(0,ee.Y)(uc.A,{activeTab:m,tabs:v,onSwitchTab:g}),(0,ee.Y)(se.Ay,{name:h.isRtl?"slideOptimizedRtl":"slideOptimized",renderCount:v.length,activeKey:a,children:(()=>{switch(a){case o.$C.ChatList:case o.$C.ChannelList:return r?(0,ee.Y)(Lc,{searchQuery:e,dateSearchQuery:p,onReset:l,onSearchDateSelect:A}):(0,ee.Y)(Kc,{isChannelList:a===o.$C.ChannelList,searchQuery:e,searchDate:t,dateSearchQuery:p,onReset:l,onSearchDateSelect:A});case o.$C.Media:return(0,ee.Y)(ed,{searchQuery:e});case o.$C.Links:return(0,ee.Y)(Wc,{searchQuery:e});case o.$C.Files:return(0,ee.Y)(zc,{searchQuery:e});case o.$C.Music:return(0,ee.Y)(Cc,{searchQuery:e},"audio");case o.$C.Voice:return(0,ee.Y)(Cc,{isVoice:!0,searchQuery:e},"voice");case o.$C.BotApps:return(0,ee.Y)(Yc,{searchQuery:e},"botApps");default:return}})()})]})})));var nd=i(42215);const od={currentPassword:"",password:"",hint:"",email:""},ad=(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 od;default:return e}};var rd=i(79307),ld=i(31880),cd=i(58968),dd=i(74984);const hd=(0,s.ph)((0,n.EK)((e=>({maxChats:(0,co.d)(e,"dialogFiltersChats")})))((({mode:e,state:t,dispatch:i,isActive:o,onReset:r,onSaveFilter:l,maxChats:c})=>{const d=(0,M.A)(),{openLimitReachedModal:h}=(0,n.ko)(),{chatFilter:m}=t,{selectedChatIds:u,selectedChatTypes:p}=(0,s.Kr)((()=>(0,ld.a)(t,e,!0)),[e,t]),v="included"===e?cd.V2:cd.LS,[g,A]=(0,s.J0)(!1),b=(0,dd.Rh)(a.DSF),f=(0,dd.Rh)(a._E9),C=t.folder.isChatList;(0,s.vJ)((()=>{o||A(!1)}),[o]);const S=(0,s.Kr)((()=>{const e=[...b||[],...f||[]];return(0,bi.Am)([...(0,Yt.PU)({ids:e,query:m,type:"chat"})])}),[b,f,m]),y=(0,D.A)((e=>{i({type:"setChatFilter",payload:e}),A(!0)})),k=(0,D.A)((s=>{if("included"===e){if(s.length>=c)return void h({limit:"dialogFiltersChats"});i({type:"setIncludeFilters",payload:{...t.includeFilters,includedChatIds:s}})}else i({type:"setExcludeFilters",payload:{...t.excludeFilters,excludedChatIds:s}});A(!0)})),w=(0,D.A)((t=>{const s={};t.forEach((e=>{s[e]=!0})),i("included"===e?{type:"setIncludeFilters",payload:{includedChatIds:u,...s}}:{type:"setExcludeFilters",payload:{excludedChatIds:u,...s}}),A(!0)}));return(0,fe.A)({isActive:o,onBack:r}),S?(0,ee.FD)("div",{className:"Picker settings-folders-chat-list",children:[(0,ee.Y)(Ci.A,{categories:C?void 0:v,itemIds:S,selectedIds:u,selectedCategories:p,filterValue:m,filterPlaceholder:d("Search"),categoryPlaceholderKey:"FilterChatTypes",searchInputId:"new-group-picker-search",isSearchable:!0,withDefaultPadding:!0,withPeerTypes:!0,allowMultiple:!0,itemInputType:"checkbox",onSelectedIdsChange:k,onSelectedCategoriesChange:w,onFilterChange:y}),(0,ee.Y)(ki.A,{isShown:g,onClick:l,ariaLabel:d("Save"),children:(0,ee.Y)(q.A,{name:"check"})})]}):(0,ee.Y)(Rs.A,{})}))),md="Please provide a title for this folder.",ud="ChatList.Filter.Error.Empty",pd=(0,s.ph)((0,n.EK)(((e,{state:t})=>{const{listIds:i}=e.chats,{byId:s,invites:n}=e.chatFolders,o=Object.values(s).reduce(((e,t)=>e+(t.isChatList?1:0)),0);return{loadedActiveChatIds:i.active,loadedArchivedChatIds:i.archived,invites:t.folderId?n[t.folderId]||fi.p:void 0,isRemoved:void 0!==t.folderId&&!s[t.folderId],maxInviteLinks:(0,co.d)(e,"chatlistInvites"),maxChatLists:(0,co.d)(e,"chatlistJoined"),chatListCount:o}}))((({state:e,dispatch:t,onAddIncludedChats:i,onAddExcludedChats:o,onShareFolder:r,onOpenInvite:l,isActive:d,onReset:h,isRemoved:m,onBack:p,loadedActiveChatIds:v,isOnlyInvites:g,loadedArchivedChatIds:A,invites:b,maxInviteLinks:f,maxChatLists:C,chatListCount:S,onSaveFolder:y})=>{const{loadChatlistInvites:k,openLimitReachedModal:w,showNotification:N}=(0,n.ko)(),I="create"===e.mode,P=e.folder.isChatList,[Y,F]=(0,s.J0)(!1),[D,T]=(0,s.J0)(!1);(0,s.vJ)((()=>{m&&h()}),[m,h]),(0,s.vJ)((()=>{d&&e.folderId&&e.folder.isChatList&&k({folderId:e.folderId})}),[d,e.folder.isChatList,e.folderId]);const{selectedChatIds:B,selectedChatTypes:R}=(0,s.Kr)((()=>(0,ld.a)(e,"included")),[e]),{selectedChatIds:L,selectedChatTypes:x}=(0,s.Kr)((()=>(0,ld.a)(e,"excluded")),[e]);(0,s.vJ)((()=>{F(!1),T(!1)}),[e.folderId]);const[E,V]=(0,s.Kr)((()=>{const e=new Set([...v||[],...A||[]]),t=(0,bi.$h)(B,e),i=(0,bi.$h)(L,e);return[Y?t:t.slice(0,5-R.length),D?i:i.slice(0,5-x.length)]}),[L,B,R,x,D,Y,v,A]),_=(0,M.A)();(0,fe.A)({isActive:d,onBack:p});const U=(0,s.hb)((e=>{const{currentTarget:i}=e;t({type:"setTitle",payload:i.value.trim()})}),[t]),O=(0,s.hb)((()=>{t({type:"setIsLoading",payload:!0}),y((()=>{setTimeout((()=>{h()}),500)}))}),[t,y,h]),K=(0,s.hb)((()=>{b?(0,c.w5O)((0,n.mS)(),e.folderId)?S>=C&&!e.folder.isChatList?w({limit:"chatlistJoined"}):b.length<f?e.isTouched?y(r):r():w({limit:"chatlistInvites"}):N({message:_("ChatList.Filter.InviteLink.IncludeExcludeError")}):I&&y(r)}),[b,e.folderId,e.isTouched,S,f,I,y,r,_,C,e.folder.isChatList]),J=(0,s.hb)(((t,i)=>{e.isTouched?y((()=>l(i))):l(i)}),[y,l,e.isTouched]);function G(e){const t="included"===e?R:x,i="included"===e?E:V,s="included"===e?Y:D,n=("included"===e?B:L).length-i.length,o="included"===e?()=>F(!0):()=>T(!0);return(0,ee.FD)(ee.FK,{children:[t.map((t=>function(e,t){const i="included"===t?cd.V2.find((({type:t})=>t===e)):cd.LS.find((({type:t})=>t===e));if(i)return(0,ee.Y)(li.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,ee.Y)(ys.A,{avatarSize:"small",customPeer:i})},i.type)}(t,e))),i.map((e=>(0,ee.Y)(li.A,{className:"settings-folders-list-item mb-1",narrow:!0,inactive:!0,children:(0,u.L8)(e)?(0,ee.Y)(ys.A,{avatarSize:"small",userId:e}):(0,ee.Y)(Ss.A,{avatarSize:"small",chatId:e})}))),!s&&n>0&&(0,ee.Y)(li.A,{className:"settings-folders-list-item",narrow:!0,onClick:o,icon:"down",children:_("FilterShowMoreChats",n,"i")},"load-more")]})}return(0,ee.FD)("div",{className:"settings-fab-wrapper",children:[(0,ee.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header",children:[(0,ee.Y)(Sr.A,{size:a.fwn,tgsUrl:Cr.w.FoldersNew,play:String(e.folderId),className:"settings-content-icon"}),I&&(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:_.isRtl?"rtl":void 0,children:_("FilterIncludeInfo")}),(0,ee.Y)(Q.A,{className:"mb-0",label:_("FilterNameHint"),value:e.folder.title.text,onChange:U,error:e.error&&e.error===md?md:void 0})]}),!g&&(0,ee.FD)("div",{className:"settings-item",children:[e.error&&e.error===ud&&(0,ee.Y)("p",{className:"settings-item-description color-danger mb-2",dir:_.isRtl?"rtl":void 0,children:_(e.error)}),(0,ee.Y)("h4",{className:"settings-item-header mb-3",dir:_.isRtl?"rtl":void 0,children:_("FilterInclude")}),(0,ee.Y)(li.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:i,children:_("FilterAddChats")}),G("included")]}),!g&&!P&&(0,ee.FD)("div",{className:"settings-item pt-3",children:[(0,ee.Y)("h4",{className:"settings-item-header mb-3",dir:_.isRtl?"rtl":void 0,children:_("FilterExclude")}),(0,ee.Y)(li.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:o,children:_("FilterAddChats")}),G("excluded")]}),(0,ee.FD)("div",{className:"settings-item pt-3",children:[(0,ee.Y)("h4",{className:"settings-item-header mb-3",dir:_.isRtl?"rtl":void 0,children:_("FolderLinkScreen.Title")}),(0,ee.Y)(li.A,{className:"settings-folders-list-item color-primary",icon:"add",narrow:!0,onClick:K,children:_("ChatListFilter.CreateLinkNew")}),b?.map((e=>(0,ee.FD)(li.A,{className:"settings-folders-list-item",icon:"link",narrow:!0,multiline:!0,onClick:J,clickArg:e.url,children:[(0,ee.Y)("span",{className:"title",dir:"auto",children:e.title||e.url}),(0,ee.Y)("span",{className:"subtitle",children:_("ChatListFilter.LinkLabelChatCount",e.peerIds.length,"i")})]})))]})]}),(0,ee.Y)(ki.A,{isShown:Boolean(e.isTouched),disabled:e.isLoading,onClick:O,ariaLabel:"edit"===e.mode?"Save changes":"Create folder",children:e.isLoading?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})})));var vd=i(80401);const gd=(0,ve.nF)((e=>e()),6e4,!0),Ad=(0,s.ph)((0,n.EK)((e=>{const{orderedIds:t,byId:i,recommended:s}=e.chatFolders;return{folderIds:t,foldersById:i,isPremium:(0,c.g29)(e),recommendedChatFolders:s,maxFolders:(0,co.d)(e,"dialogFilters")}}))((({isActive:e,onCreateFolder:t,onEditFolder:i,onReset:o,folderIds:r,foldersById:c,isPremium:d,recommendedChatFolders:h,maxFolders:m})=>{const{loadRecommendedChatFolders:u,addChatFolder:p,openLimitReachedModal:v,openDeleteChatFolderModal:g,sortChatFolders:A}=(0,n.ko)(),[b,f]=(0,s.J0)({orderedFolderIds:r,dragOrderIds:r,draggedIndex:void 0}),C=(0,V.A)(r);(0,s.vJ)((()=>{C!==r&&f({orderedFolderIds:r,dragOrderIds:r,draggedIndex:void 0})}),[C,r,b.orderedFolderIds?.length]),(0,s.vJ)((()=>{gd((()=>{u()}))}),[u]);const S=(0,s.hb)((()=>{Object.keys(c).length>=m-1?v({limit:"dialogFilters"}):t()}),[c,m,t,v]),y=(0,M.A)();(0,fe.A)({isActive:e,onBack:o});const k=(0,dd.g5)(),w=(0,s.Kr)((()=>{if(r)return r.length<=1?fi.p:r.map((e=>{const t=c[e];return e===a.DSF?{id:e,title:{text:y("FilterAllChats"),entities:[]}}:{id:t.id,title:t.title,subtitle:(0,l.A5)(y,t,k[t.id]),isChatList:t.isChatList,noTitleAnimations:t.noTitleAnimations}}))}),[r,c,y,k]),N=(0,s.hb)((e=>{Object.keys(c).length>=m-1?v({limit:"dialogFilters"}):p({folder:e})}),[c,m,p,v]),I=(0,s.hb)(((e,t)=>{const i=Math.round(e.y/56),s=b.orderedFolderIds?.indexOf(t)||0,n=b.orderedFolderIds?.filter((e=>e!==t));n&&(0,pe.Bt)(s+i,0,r?.length||0)&&(n.splice(s+i+(d?0:1),0,t),f((e=>({...e,draggedIndex:s,dragOrderIds:n}))))}),[r?.length,d,b.orderedFolderIds]),P=(0,s.hb)((()=>{f((e=>(A({folderIds:e.dragOrderIds}),{...e,orderedFolderIds:e.dragOrderIds,draggedIndex:void 0})))}),[A]),Y=(0,s.Kr)((()=>!d||Object.keys(c).length<m-1),[c,d,m]);return(0,ee.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header",children:[(0,ee.Y)(Sr.A,{size:a.fwn,tgsUrl:Cr.w.FoldersAll,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:y("CreateNewFilterInfo")}),Y&&(0,ee.FD)(W.A,{className:"settings-button with-icon",color:"primary",size:"smaller",pill:!0,fluid:!0,onClick:S,isRtl:y.isRtl,children:[(0,ee.Y)(q.A,{name:"add"}),y("CreateNewFilter")]})]}),(0,ee.FD)("div",{className:"settings-item pt-3",children:[(0,ee.Y)("h4",{className:"settings-item-header mb-3",dir:y.isRtl?"rtl":void 0,children:y("Filters")}),(0,ee.Y)("div",{className:"settings-sortable-container",style:`height: ${56*(r?.length||0)}px`,children:w?.length?w.map(((t,s)=>{const n=s>m-1,o=b.draggedIndex===s,r=56*(b.orderedFolderIds?.indexOf(t.id)??0),l=56*(b.dragOrderIds?.indexOf(t.id)??0);return t.id===a.DSF?(0,ee.Y)(vd.A,{id:t.id,onDrag:I,onDragEnd:P,style:`top: ${o?r:l}px;`,knobStyle:(y.isRtl?"left":"right")+": 0.375rem;",isDisabled:!d||!e,children:(0,ee.FD)(li.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,inactive:!0,multiline:!0,isStatic:!0,allowSelection:!0,children:[(0,ee.Y)("span",{className:"title",children:(0,Zi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations})}),(0,ee.Y)("span",{className:"subtitle",children:y("FoldersAllChatsDesc")})]},t.id)},t.id):(0,ee.Y)(vd.A,{id:t.id,onDrag:I,onDragEnd:P,style:`top: ${o?r:l}px;`,knobStyle:(y.isRtl?"left":"right")+": 3rem;",isDisabled:n||!e,children:(0,ee.FD)(li.A,{className:"drag-item no-icon settings-sortable-item",narrow:!0,secondaryIcon:"more",multiline:!0,contextActions:[{handler:()=>{g({folderId:t.id})},destructive:!0,title:y("Delete"),icon:"delete"}],onClick:()=>{n?v({limit:"dialogFilters"}):i(c[t.id])},children:[(0,ee.FD)("span",{className:"title",children:[(0,Zi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}),n&&(0,ee.Y)(q.A,{name:"lock-badge",className:"settings-folders-blocked-icon"})]}),(0,ee.FD)("span",{className:"subtitle",children:[t.isChatList&&(0,ee.Y)(q.A,{name:"link",className:"mr-1"}),t.subtitle]})]})},t.id)})):w&&!w.length?(0,ee.Y)("p",{className:"settings-item-description my-4",dir:"auto",children:"You have no folders yet."}):(0,ee.Y)(Rs.A,{})})]}),h&&Boolean(h.length)&&(0,ee.FD)("div",{className:"settings-item pt-3",children:[(0,ee.Y)("h4",{className:"settings-item-header mb-3",dir:y.isRtl?"rtl":void 0,children:y("FilterRecommended")}),h.map((e=>(0,ee.Y)(li.A,{narrow:!0,onClick:()=>N(e),children:(0,ee.FD)("div",{className:"settings-folders-recommended-item",children:[(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:(0,Zi.fd)({text:e.title.text,entities:e.title.entities,noCustomEmojiPlayback:e.noTitleAnimations})}),(0,ee.Y)("span",{className:"subtitle",children:e.description})]}),(0,ee.Y)(W.A,{className:"px-3",color:"primary",size:"tiny",pill:!0,fluid:!0,isRtl:y.isRtl,children:y("Add")})]})})))]})]})})));var bd=i(4438);const fd=(0,s.ph)((0,n.EK)((e=>{const{folderId:t,url:i,isLoading:s}=(0,c.nTw)(e).shareFolderScreen||{},n=t?(0,c.$aQ)(e,t):void 0,o=t?e.chatFolders.invites[t]?.find((e=>e.url===i)):void 0;return{folderId:t,folder:n,url:i,isLoading:s,peerIds:o?.peerIds}}))((({isActive:e,onReset:t,folderId:i,folder:o,peerIds:r,url:d,isLoading:h})=>{const{createChatlistInvite:m,deleteChatlistInvite:u,editChatlistInvite:p,showNotification:v}=(0,n.ko)(),g=(0,Vi.A)(),A=(0,M.A)(),[b,f]=(0,s.J0)(!1);(0,fe.A)({isActive:e,onBack:t}),(0,s.vJ)((()=>{h||f(!1)}),[h]),(0,s.vJ)((()=>{!d&&i&&e&&m({folderId:i})}),[i,e,d]);const C=(0,D.A)((()=>{d&&i&&(u({folderId:i,url:d}),t())})),S=(0,s.Kr)((()=>(o?.includedChatIds||[]).concat(o?.pinnedChatIds||[])),[o?.includedChatIds,o?.pinnedChatIds]),[y,k]=(0,s.Kr)((()=>{const e=(0,n.mS)();return(0,bi.jB)(S,(t=>(0,c.hXb)(e,t)))}),[S]),[w,N]=(0,s.J0)(r||[]),I=(0,s.li)(!0);(0,yi.A)((([e])=>{e!==d&&(I.current=!0),I.current&&(I.current=!1,d?r&&N(r):N(y))}),[d,y,r]);const P=(0,D.A)((e=>{const t=(0,n.mS)(),i=(0,c.mBe)(t,e),s=(0,c.hds)(t,e);i&&(0,l.tv)(i)?v({message:A("FolderLinkScreen.AlertTextUnavailableBot")}):i?v({message:A("FolderLinkScreen.AlertTextUnavailableUser")}):s&&(0,l.WX)(s)?v({message:A("FolderLinkScreen.AlertTextUnavailablePublicChannel")}):v({message:A("FolderLinkScreen.AlertTextUnavailablePublicGroup")})})),Y=(0,D.A)((e=>{N(e),f(!0)})),F=(0,D.A)((()=>{i&&d&&b&&p({folderId:i,peerIds:w,url:d})})),T=w.length,B=!T||h;return(0,ee.FD)("div",{className:"settings-content no-border custom-scroll SettingsFoldersChatsPicker",children:[(0,ee.FD)("div",{className:"settings-content-header",children:[(0,ee.Y)(bd.A,{size:a.fwn,tgsUrl:Cr.w.FoldersShare,className:"settings-content-icon"}),o&&(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:g("FolderLinkTitleDescription",{folder:(0,Zi.fd)({text:o.title.text,entities:o.title.entities,noCustomEmojiPlayback:o.noTitleAnimations}),chats:g("FolderLinkTitleDescriptionChats",{count:T},{pluralValue:T})},{withMarkdown:!0,withNodes:!0})})]}),(0,ee.Y)(zr.A,{className:"settings-item",link:d||A("Loading"),withShare:!0,onRevoke:C,isDisabled:!T||b}),(0,ee.Y)("div",{className:"settings-item settings-item-picker",children:(0,ee.Y)(Ci.A,{itemIds:S,lockedUnselectedIds:k,onSelectedIdsChange:Y,selectedIds:w,onDisabledClick:P,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"})}),(0,ee.Y)(ki.A,{isShown:h||b,disabled:B,onClick:F,ariaLabel:"Save changes",children:h?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})}))),Cd=(0,s.ph)((({currentScreen:e,shownScreen:t,state:i,dispatch:a,isActive:r,onReset:l})=>{const{openShareChatFolderModal:c,editChatFolder:d,addChatFolder:h,openSettingsScreen:m}=(0,n.ko)(),u=(0,s.hb)((()=>{e!==o.VS.FoldersCreateFolder&&e!==o.VS.FoldersEditFolder&&e!==o.VS.FoldersEditFolderFromChatList&&e!==o.VS.FoldersEditFolderInvites||setTimeout((()=>{a({type:"reset"})}),200),e!==o.VS.FoldersIncludedChats&&e!==o.VS.FoldersExcludedChats?l():"create"===i.mode?m({screen:o.VS.FoldersCreateFolder}):m({screen:o.VS.FoldersEditFolder})}),[i.mode,a,e,l]),p="create"===i.mode,v=(0,s.hb)((e=>{const{title:t}=e.folder;if(!t)return a({type:"setError",payload:md}),!1;const{selectedChatIds:i,selectedChatTypes:s}=(0,ld.a)(e,"included");return i.length||Object.keys(s).length?(p?h({folder:e.folder}):d({id:e.folderId,folderUpdate:e.folder}),a({type:"setError",payload:void 0}),a({type:"setIsTouched",payload:!1}),!0):(a({type:"setError",payload:ud}),!1)}),[a,p]),g=(0,s.hb)((e=>{v(i)&&e?.()}),[v,i]),A=(0,s.hb)((()=>{const e=a({type:"saveFilters"});u(),v(e)}),[a,u,v]),b=(0,s.hb)((()=>{a({type:"reset"}),m({screen:o.VS.FoldersCreateFolder})}),[a]),f=(0,s.hb)((e=>{a({type:"editFolder",payload:e}),m({screen:o.VS.FoldersEditFolder})}),[a]),C=(0,s.hb)((()=>{a({type:"editIncludeFilters"}),m({screen:e===o.VS.FoldersEditFolderFromChatList?o.VS.FoldersIncludedChatsFromChatList:o.VS.FoldersIncludedChats})}),[e,a]),S=(0,s.hb)((()=>{a({type:"editExcludeFilters"}),m({screen:e===o.VS.FoldersEditFolderFromChatList?o.VS.FoldersExcludedChatsFromChatList:o.VS.FoldersExcludedChats})}),[e,a]),y=(0,s.hb)((()=>{c({folderId:i.folderId,noRequestNextScreen:!0}),a({type:"setIsChatlist",payload:!0}),m({screen:o.VS.FoldersShare})}),[a,i.folderId]),k=(0,s.hb)((e=>{c({folderId:i.folderId,url:e,noRequestNextScreen:!0}),m({screen:o.VS.FoldersShare})}),[i.folderId]);switch(e){case o.VS.Folders:return(0,ee.Y)(Ad,{onCreateFolder:b,onEditFolder:f,isActive:r||[o.VS.FoldersCreateFolder,o.VS.FoldersEditFolder,o.VS.FoldersIncludedChats,o.VS.FoldersExcludedChats].includes(t),onReset:l});case o.VS.FoldersCreateFolder:case o.VS.FoldersEditFolder:case o.VS.FoldersEditFolderFromChatList:case o.VS.FoldersEditFolderInvites:return(0,ee.Y)(pd,{state:i,dispatch:a,onAddIncludedChats:C,onAddExcludedChats:S,onShareFolder:y,onOpenInvite:k,onReset:u,isActive:r||[o.VS.FoldersIncludedChats,o.VS.FoldersExcludedChats].includes(t),isOnlyInvites:e===o.VS.FoldersEditFolderInvites,onBack:l,onSaveFolder:g});case o.VS.FoldersIncludedChats:case o.VS.FoldersIncludedChatsFromChatList:return(0,ee.Y)(hd,{mode:"included",state:i,dispatch:a,onReset:u,onSaveFilter:A,isActive:r});case o.VS.FoldersExcludedChats:case o.VS.FoldersExcludedChatsFromChatList:return(0,ee.Y)(hd,{mode:"excluded",state:i,dispatch:a,onReset:u,onSaveFilter:A,isActive:r});case o.VS.FoldersShare:return(0,ee.Y)(fd,{isActive:r,onReset:u});default:return}}));var Sd=i(70934),yd=i(3178);const kd=(0,s.ph)((({isActive:e,onReset:t,error:i,isLoading:n,shouldDisablePasswordManager:o,expectedPassword:a,placeholder:r="Current Password",hint:l,submitLabel:c,clearError:d,onSubmit:h})=>{const[m,u]=(0,s.J0)(""),[p,v]=(0,s.J0)(!1),g=(0,s.hb)((e=>{a&&e!==a?u("Passwords Should Be Equal"):h(e)}),[h,a]),A=(0,s.hb)((()=>{d&&d(),u("")}),[d]),b=(0,M.A)();return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content password-form custom-scroll",children:[(0,ee.Y)("div",{className:"settings-content-header no-border",children:(0,ee.Y)(yd.A,{isBig:!0,isPasswordVisible:p})}),(0,ee.Y)("div",{className:"settings-item settings-group",children:(0,ee.Y)(bl.A,{error:m||i,hint:l,placeholder:r,shouldDisablePasswordManager:o,submitLabel:c||b("Next"),clearError:A,isLoading:n,isPasswordVisible:p,shouldResetValue:e,onChangePasswordVisibility:v,onSubmit:g})})]})})),wd=(0,s.ph)((({isActive:e,onReset:t})=>{const i=(0,M.A)(),n=(0,s.hb)((()=>{t(!0)}),[t]);return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(bd.A,{size:a.BYH,tgsUrl:Cr.w.Congratulations,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Congratulations!"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Now you can lock the app with a passcode so that others can't open it."})]}),(0,ee.Y)("div",{className:"settings-item settings-group",children:(0,ee.Y)(W.A,{onClick:n,children:i("Back")})})]})}));var Nd=i(89704);const Id=(0,s.ph)((({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,M.A)();return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Lock,previewUrl:Nd,size:160,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Local passcode is enabled."})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{icon:"edit",onClick:()=>i({screen:o.VS.PasscodeChangePasscodeCurrent}),children:s("Passcode.Change")}),(0,ee.Y)(li.A,{icon:"password-off",onClick:()=>i({screen:o.VS.PasscodeTurnOff}),children:s("Passcode.TurnOff")})]})]})})),Pd=(0,s.ph)((({isActive:e,onReset:t,onStart:i})=>{const s=(0,M.A)();return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content local-passcode custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Lock,previewUrl:Nd,size:a.BYH,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description",dir:"auto",children:"When you set up an additional passcode, a lock icon will appear on the chats page. Tap it to lock and unlock your Telegram Web A."}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:"Note: if you forget your local passcode, you'll need to log out of Telegram Web A and log in again."})]}),(0,ee.Y)("div",{className:"settings-item settings-group",children:(0,ee.Y)(W.A,{onClick:i,children:s("EnablePasscode")})})]})})),Yd=(0,s.ph)((0,n.EK)((e=>({...e.passcode})))((({passcode:e,currentScreen:t,shownScreen:i,error:a,isActive:r,isLoading:l,onSetPasscode:c,onReset:d})=>{const{setPasscode:h,clearPasscode:m,setPasscodeError:u,clearPasscodeError:p,openSettingsScreen:v}=(0,n.ko)(),g=(0,M.A)(),A=(0,s.hb)((()=>{c(""),v({screen:o.VS.PasscodeNewPasscode})}),[c]),b=(0,s.hb)((e=>{c(e),v({screen:o.VS.PasscodeNewPasscodeConfirm})}),[c]),f=(0,s.hb)((()=>{h({passcode:e}),c(""),v({screen:o.VS.PasscodeCongratulations})}),[c,e]),C=(0,s.hb)((e=>{c(""),(0,Sd.UQ)(e).then((()=>{v({screen:o.VS.PasscodeChangePasscodeNew})}),(()=>{u({error:g("PasscodeController.Error.Current")})}))}),[g,c]),S=(0,s.hb)((e=>{c(e),v({screen:o.VS.PasscodeChangePasscodeConfirm})}),[c]),y=(0,s.hb)((e=>{(0,Sd.UQ)(e).then((()=>{m(),v({screen:o.VS.Privacy})}),(()=>{u({error:g("PasscodeController.Error.Current")})}))}),[g]);switch(t){case o.VS.PasscodeDisabled:return(0,ee.Y)(Pd,{onStart:A,isActive:r||[o.VS.PasscodeNewPasscode,o.VS.PasscodeNewPasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeNewPasscode:return(0,ee.Y)(kd,{shouldDisablePasswordManager:!0,placeholder:g("EnterNewPasscode"),submitLabel:g("Continue"),onSubmit:b,isActive:r||[o.VS.PasscodeNewPasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeNewPasscodeConfirm:return(0,ee.Y)(kd,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:g("ReEnterYourPasscode"),submitLabel:g("Continue"),isLoading:l,onSubmit:f,isActive:r||[o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeCongratulations:return(0,ee.Y)(wd,{isActive:r,onReset:d});case o.VS.PasscodeEnabled:return(0,ee.Y)(Id,{isActive:r||[o.VS.PasscodeChangePasscodeCurrent,o.VS.PasscodeChangePasscodeNew,o.VS.PasscodeChangePasscodeConfirm,o.VS.PasscodeCongratulations,o.VS.PasscodeTurnOff].includes(i),onReset:d});case o.VS.PasscodeChangePasscodeCurrent:return(0,ee.Y)(kd,{shouldDisablePasswordManager:!0,error:a,clearError:p,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:C,isActive:r||[o.VS.PasscodeChangePasscodeNew,o.VS.PasscodeChangePasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeChangePasscodeNew:return(0,ee.Y)(kd,{shouldDisablePasswordManager:!0,placeholder:g("PleaseEnterNewFirstPassword"),onSubmit:S,isActive:r||[o.VS.PasscodeChangePasscodeConfirm,o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeChangePasscodeConfirm:return(0,ee.Y)(kd,{shouldDisablePasswordManager:!0,expectedPassword:e,placeholder:g("PasscodeController.ReEnterPasscode.Placeholder"),isLoading:l,onSubmit:f,isActive:r||[o.VS.PasscodeCongratulations].includes(i),onReset:d});case o.VS.PasscodeTurnOff:return(0,ee.Y)(kd,{shouldDisablePasswordManager:!0,error:a?g(a):void 0,clearError:p,placeholder:g("PasscodeController.Current.Placeholder"),onSubmit:y,isActive:r,onReset:d});default:return}}))),Fd=[50,100,500,1e3,2e3,5e3,1e4];function Dd(e,t){const i=e.findIndex((e=>t<=e)),s=e[i-1]||1,n=e[i]||e[e.length-1];return i+(t-s)/(n-s)}function Md(e,t){const i=Math.floor(t),s=e[i-1]||1,n=s+((e[i]||e[e.length-1])-s)*(t-i);return n<100?Math.round(n):10*Math.round(n/10)}const Td=(0,s.ph)((({min:e=0,max:t,value:i,disabled:n,readOnly:o,bold:a,className:r,defaultValue:l,onChange:c,canChangeChargeForMessages:d})=>{const h=(0,Vi.A)(),m=(0,s.Kr)((()=>{const e=[];for(let i=0;i<Fd.length;i++)if(Fd[i]<t&&e.push(Fd[i]),Fd[i]>=t){e.push(t);break}return e}),[t]),u=(0,D.A)((e=>{const t=Number(e.currentTarget.value);c(Md(m,t))})),p=(0,me.A)(r,"RangeSlider",n&&"disabled",o&&"readOnly",a&&"bold");return(0,ee.FD)("div",{className:p,children:[(0,ee.FD)("div",{className:"slider-top-row",dir:h.isRtl?"rtl":void 0,children:[(0,ee.Y)("span",{className:"value-min",dir:"auto",children:h.number(e)}),(0,ee.FD)("span",{className:"settings-range-value",children:[!d&&(0,ee.Y)(q.A,{name:"lock-badge"}),(0,Li.Kk)(h,Md(m,Dd(m,i)))]}),(0,ee.Y)("span",{className:"value-max",dir:"auto",children:h.number(t)})]}),(0,ee.FD)("div",{className:"slider-main",children:[(0,ee.Y)("div",{className:"slider-fill-track",style:`width: ${Dd(m,i)/m.length*100}%`}),(0,ee.Y)("input",{min:0,max:m.length,defaultValue:Dd(m,l),step:"any",type:"range",className:"RangeSlider__input",onChange:u})]})]})})),Bd=(0,s.ph)((0,n.EK)((e=>{const t=e.appConfig?.starsUsdWithdrawRateX1000,i=t?t/1e3:1,s=e.appConfig?.starsPaidMessageCommissionPermille;return{starsPaidMessageCommissionPermille:s?s/1e3:100,starsUsdWithdrawRate:i,starsPaidMessageAmountMax:e.appConfig?.starsPaidMessageAmountMax||a.$$v}}))((function({starsUsdWithdrawRate:e,starsPaidMessageAmountMax:t,starsPaidMessageCommissionPermille:i,canChangeChargeForMessages:s,isGroupChat:o,chargeForMessages:r,onChange:l}){const{openPremiumModal:c}=(0,n.ko)(),d=(0,Vi.A)(),h=(0,D.A)((e=>{l?.(e)})),m=(0,D.A)((()=>{c({initialSection:"message_privacy"})}));return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("SectionTitleStarsForForMessages")}),(0,ee.Y)(Td,{defaultValue:r,min:a.BSg,max:t,value:r,onChange:h,canChangeChargeForMessages:s,readOnly:!s}),!s&&(0,ee.Y)(W.A,{color:"primary",fluid:!0,size:"smaller",noForcedUpperCase:!0,className:"settings-unlock-button",onClick:m,children:(0,ee.FD)("span",{className:"settings-unlock-button-title",children:[d("UnlockButtonTitle"),(0,ee.Y)(q.A,{name:"lock-badge",className:"settings-unlock-button-icon"})]})}),s&&(0,ee.Y)("p",{className:"settings-item-description-larger",dir:d.isRtl?"rtl":void 0,children:d(o?"SetPriceGroupDescription":"SectionDescriptionStarsForForMessages",{percent:(0,He.l9)(100*i),amount:(0,ho.Ad)(r*e*i,"USD",d.code)},{withNodes:!0})})]})})));var Rd=i(9267);const Ld=(0,s.ph)((function({premiumSection:e}){const{openPremiumModal:t}=(0,n.ko)(),i=(0,M.A)(),s=(0,D.A)((()=>t({initialSection:e})));return(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{leftElement:(0,ee.Y)(Rd.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:s,children:i("PrivacyLastSeenPremium")}),(0,ee.Y)("p",{className:"settings-item-description-larger premium-info",dir:i.isRtl?"rtl":void 0,children:i("lng_messages_privacy_premium_about")})]})})),xd=(0,s.ph)((function({label:e,isChecked:t}){const i=(0,M.A)(),{showNotification:s}=(0,n.ko)();return(0,ee.FD)("div",{className:(0,me.A)("sBptmiga",t&&"U_6O1ebL"),onClick:()=>s({message:i("OptionPremiumRequiredMessage")}),children:[(0,ee.Y)("span",{children:e}),(0,ee.Y)(q.A,{name:"lock-badge",className:"jWxrRbkh"})]})})),Ed=(0,s.ph)((0,n.EK)((e=>{const{settings:{privacy:t}}=e,i=(0,c.Iv$)(e),s=e.settings.privacy.noPaidMessages?.allowUserIds.length||0;return{shouldNewNonContactPeersRequirePremium:(0,c.BSN)(e),shouldChargeForMessages:Boolean(i),nonContactPeersPaidStars:i||a.wZe,isCurrentUserPremium:(0,c.g29)(e),canLimitNewMessagesWithoutPremium:e.appConfig?.canLimitNewMessagesWithoutPremium,canChargeForMessages:e.appConfig?.starsPaidMessagesAvailable,noPaidReactionsForUsersCount:s,privacy:t}}))((function({isActive:e,canLimitNewMessagesWithoutPremium:t,canChargeForMessages:i,shouldNewNonContactPeersRequirePremium:a,shouldChargeForMessages:r,nonContactPeersPaidStars:l,isCurrentUserPremium:c,noPaidReactionsForUsersCount:d,onReset:h,privacy:m}){const{updateGlobalPrivacySettings:u,openSettingsScreen:p,showNotification:v}=(0,n.ko)(),g=(0,M.A)(),A=(0,Vi.A)(),b=c||t,f=c&&i,[C,S]=(0,s.J0)(l),[y,k]=(0,s.J0)(!1),w=(0,s.Kr)((()=>r?"charge_for_messages":a?"contacts_and_premium":"everybody"),[r,a]);(0,yi.A)((([e])=>{y||void 0===e||"everybody"===w||w===e||("everybody"===m.chatInvite?.visibility&&v({message:A("CheckPrivacyInviteText"),action:{action:"openSettingsScreen",payload:{screen:o.VS.PrivacyGroupChats}},actionText:{key:"Review"},duration:8e3}),"everybody"===m.phoneCall?.visibility&&v({message:A("CheckPrivacyCallsText"),action:{action:"openSettingsScreen",payload:{screen:o.VS.PrivacyPhoneCall}},actionText:{key:"Review"},duration:8e3}),k(!0))}),[w,r,m,A,y]);const N=(0,s.Kr)((()=>[{value:"everybody",label:g("P2PEverybody")},{value:"contacts_and_premium",label:b?g("PrivacyMessagesContactsAndPremium"):(0,ee.Y)(xd,{label:g("PrivacyMessagesContactsAndPremium"),isChecked:"contacts_and_premium"===w}),hidden:!b,isCanCheckedInDisabled:!0},{value:"charge_for_messages",label:f?A("PrivacyChargeForMessages"):(0,ee.Y)(xd,{label:A("PrivacyChargeForMessages"),isChecked:"charge_for_messages"===w}),hidden:!f,isCanCheckedInDisabled:!0}]),[g,A,b,f,w]),I=(0,D.A)((e=>{u({shouldNewNonContactPeersRequirePremium:"contacts_and_premium"===e,nonContactPeersPaidStars:"charge_for_messages"===e?C:null})})),P=(0,Ae.A)((e=>{u({nonContactPeersPaidStars:e})}),[u],300,!0),Y=(0,s.hb)((e=>{S(e),P(e)}),[S,P]);(0,fe.A)({isActive:e,onBack:h});const F=(0,s.Kr)((()=>A(r?"PrivacyDescriptionChargeForMessages":"PrivacyDescriptionMessagesContactsAndPremium")),[r,A]);return(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("PrivacyMessagesTitle")}),(0,ee.Y)(X.A,{name:"privacy-messages",options:N,onChange:I,selected:w}),(0,ee.Y)("p",{className:"settings-item-description-larger",dir:g.isRtl?"rtl":void 0,children:F})]}),"charge_for_messages"===w&&(0,ee.Y)("div",{className:"settings-item fluid-container",children:(0,ee.Y)(Bd,{canChangeChargeForMessages:f,chargeForMessages:C,onChange:Y})}),f&&"charge_for_messages"===w&&function(){const e=d?g("Users",d,"i"):A("SubtitlePrivacyAddUsers");return(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:A("RemoveFeeTitle")}),(0,ee.Y)(li.A,{narrow:!0,icon:"delete-user",onClick:()=>{p({screen:o.VS.PrivacyNoPaidMessages})},children:(0,ee.FD)("div",{className:"multiline-item full-size",children:[(0,ee.Y)("span",{className:"title",children:A("ExceptionTitlePrivacyChargeForMessages")}),(0,ee.Y)("span",{className:"subtitle",children:e})]})})]})}(),!c&&"charge_for_messages"!==w&&(0,ee.Y)(Ld,{premiumSection:"message_privacy"})]})})));function Vd(e){const t=e.platform.toLowerCase(),i=e.deviceModel.toLowerCase(),s=e.systemVersion.toLowerCase();return i.includes("xbox")?"xbox":i.includes("chrome")&&!i.includes("chromebook")?"chrome":i.includes("brave")?"brave":i.includes("vivaldi")?"vivaldi":i.includes("safari")?"safari":i.includes("firefox")?"firefox":i.includes("opera")?"opera":i.includes("samsungbrowser")?"samsung":t.includes("android")?"android":i.includes("iphone")||i.includes("ipad")||t.includes("ios")||t.includes("macos")||s.includes("macos")?"apple":t.includes("ubuntu")||s.includes("ubuntu")?"ubuntu":t.includes("linux")||s.includes("linux")?"linux":t.includes("windows")||s.includes("windows")?"windows":"unknown"}const _d={SettingsActiveSession:"M84mrPgu",settingsActiveSession:"M84mrPgu",iconDevice:"Add8P_K4",iconDevice__android:"onkXVGY4",iconDeviceAndroid:"onkXVGY4",iconDevice__apple:"xw13aT8u",iconDeviceApple:"xw13aT8u",iconDevice__brave:"HESrGUdv",iconDeviceBrave:"HESrGUdv",iconDevice__chrome:"Vpej7wm7",iconDeviceChrome:"Vpej7wm7",iconDevice__edge:"ueWE77x9",iconDeviceEdge:"ueWE77x9",iconDevice__firefox:"_lMTmvya",iconDeviceFirefox:"_lMTmvya",iconDevice__linux:"cDVfvyG_",iconDeviceLinux:"cDVfvyG_",iconDevice__opera:"nWqlTxZt",iconDeviceOpera:"nWqlTxZt",iconDevice__safari:"ldFLp1Gf",iconDeviceSafari:"ldFLp1Gf",iconDevice__samsung:"VHNORBGL",iconDeviceSamsung:"VHNORBGL",iconDevice__ubuntu:"QBVivtdu",iconDeviceUbuntu:"QBVivtdu",iconDevice__unknown:"GbjIgrwU",iconDeviceUnknown:"GbjIgrwU",iconDevice__vivaldi:"yieVnjoI",iconDeviceVivaldi:"yieVnjoI",iconDevice__windows:"_0dnTFOE",iconDeviceWindows:"_0dnTFOE",iconDevice__xbox:"fbCjjDpU",iconDeviceXbox:"fbCjjDpU",title:"c6edjhlh",note:"lRqTZAYn",date:"oLnN6crs",box:"wVEXuPlZ",actionHeader:"olQS2T1n",actionName:"KuX1APpO",headerButton:"VT8pZfMu"};function Ud(e){return[e.region,e.country].filter(Boolean).join(", ")}const Od=(0,s.ph)((0,n.EK)(((e,{hash:t})=>({session:t?e.activeSessions.byHash[t]:void 0})))((({isOpen:e,session:t,onClose:i})=>{const{changeSessionSettings:o,terminateAuthorization:a}=(0,n.ko)(),r=(0,M.A)(),l=(0,Ti.A)(t,!0),c=(0,s.hb)((()=>{o({hash:t.hash,areSecretChatsEnabled:!t.areSecretChatsEnabled})}),[o,t]),d=(0,s.hb)((()=>{o({hash:t.hash,areCallsEnabled:!t.areCallsEnabled})}),[o,t]),h=(0,s.hb)((()=>{a({hash:t.hash}),i()}),[i,t,a]);if(l)return(0,ee.FD)(Z.A,{header:(0,ee.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:r("Close"),onClick:i,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"modal-title",children:r("SessionPreview.Title")}),(0,ee.Y)(W.A,{color:"danger",onClick:h,className:(0,me.A)("modal-action-button",_d.headerButton),children:r("SessionPreview.TerminateSession")})]}),isOpen:e,hasCloseButton:!0,onClose:i,className:_d.SettingsActiveSession,children:[(0,ee.Y)("div",{className:(0,me.A)(_d.iconDevice,l&&_d[`iconDevice__${Vd(l)}`])}),(0,ee.Y)("h3",{className:_d.title,dir:"auto",children:l?.deviceModel}),(0,ee.Y)("div",{className:_d.date,"aria-label":r("PrivacySettings.LastSeen"),children:(0,ze.L2)(1e3*l.dateActive,r.code)}),(0,ee.FD)("dl",{className:_d.box,children:[(0,ee.Y)("dt",{children:r("SessionPreview.App")}),(0,ee.FD)("dd",{children:[l?.appName," ",l?.appVersion,","," ",l?.platform," ",l?.systemVersion]}),(0,ee.Y)("dt",{children:r("SessionPreview.Ip")}),(0,ee.Y)("dd",{children:l?.ip}),(0,ee.Y)("dt",{children:r("SessionPreview.Location")}),(0,ee.Y)("dd",{children:l&&Ud(l)})]}),(0,ee.Y)("p",{className:_d.note,children:r("SessionPreview.IpDesc")}),(0,ee.Y)("h4",{className:_d.actionHeader,children:r("AuthSessions.View.AcceptTitle")}),(0,ee.FD)(li.A,{onClick:c,children:[(0,ee.Y)("span",{className:_d.actionName,children:r("SessionPreview.Accept.Secret")}),(0,ee.Y)(Ai.A,{id:"accept_secrets",label:"On",checked:l.areSecretChatsEnabled})]}),(0,ee.FD)(li.A,{onClick:d,children:[(0,ee.Y)("span",{className:_d.actionName,children:r("SessionPreview.Accept.Calls")}),(0,ee.Y)(Ai.A,{id:"accept_calls",label:"On",checked:l.areCallsEnabled})]})]})})));function Kd(e){return[e.region,e.country].filter(Boolean).join(", ")}const Jd=(0,s.ph)((0,n.EK)((e=>e.activeSessions))((({isActive:e,onReset:t,byHash:i,orderedHashes:o,ttlDays:a})=>{const{terminateAuthorization:r,terminateAllAuthorizations:l,changeSessionTtl:c}=(0,n.ko)(),d=(0,M.A)(),[h,m,u]=(0,Y.A)(),[p,v]=(0,s.J0)(),[g,A,b]=(0,Y.A)(),f=(0,s.Kr)((()=>{if(void 0!==a)return a<=7?"7":a<=30?"30":a<=93?"90":a<=183?"183":a>183?"365":void 0}),[a]),C=(0,s.Kr)((()=>{const e=[{label:d("Weeks",1,"i"),value:"7"},{label:d("Months",1,"i"),value:"30"},{label:d("Months",3,"i"),value:"90"},{label:d("Months",6,"i"),value:"183"}];return a&&a>=365&&e.push({label:d("Years",1,"i"),value:"365"}),e}),[d,a]),S=(0,s.hb)((e=>{r({hash:e})}),[r]),y=(0,s.hb)((()=>{u(),l()}),[u,l]),k=(0,s.hb)((e=>{v(e),A()}),[A]),w=(0,s.hb)((()=>{v(void 0),b()}),[b]),N=(0,s.hb)((e=>{c({days:Number(e)})}),[c]),I=(0,s.Kr)((()=>{const e=o.find((e=>i[e].isCurrent));return e?i[e]:void 0}),[i,o]),P=(0,s.Kr)((()=>o.filter((e=>!i[e].isCurrent))),[i,o]),F=Boolean(P.length);return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content custom-scroll SettingsActiveSessions",children:[I&&(T=I,(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("AuthSessions.CurrentSession")}),(0,ee.Y)(li.A,{narrow:!0,inactive:!0,icon:`device-${Vd(T)}`,iconClassName:"icon-device",children:(0,ee.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ee.Y)("span",{className:"title",dir:"auto",children:T.deviceModel}),(0,ee.FD)("span",{className:"subtitle black tight",children:[T.appName," ",T.appVersion,","," ",T.platform," ",T.systemVersion]}),(0,ee.FD)("span",{className:"subtitle",children:[T.ip," ","-"," ",Kd(T)]})]})}),F&&(0,ee.Y)(li.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:m,children:d("TerminateAllSessions")})]})),F&&(D=P,(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("OtherSessions")}),D.map((function(e){const t=i[e];return(0,ee.Y)(li.A,{ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{S(t.hash)}}],icon:`device-${Vd(t)}`,iconClassName:"icon-device",onClick:()=>{k(t.hash)},children:(0,ee.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ee.Y)("span",{className:"date",children:(0,ze.be)(d,1e3*t.dateActive)}),(0,ee.Y)("span",{className:"title",children:t.deviceModel}),(0,ee.FD)("span",{className:"subtitle black tight",children:[t.appName," ",t.appVersion,","," ",t.platform," ",t.systemVersion]}),(0,ee.FD)("span",{className:"subtitle",children:[t.ip," ",Kd(t)]})]})},t.hash)}))]})),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:d.isRtl?"rtl":void 0,children:d("TerminateOldSessionHeader")}),(0,ee.Y)("p",{className:"settings-item-description-larger",children:d("IfInactiveFor")}),(0,ee.Y)(X.A,{name:"session_ttl",options:C,selected:f,onChange:N})]}),F&&(0,ee.Y)(pi.A,{isOpen:h,onClose:u,text:d("AreYouSureSessions"),confirmLabel:d("TerminateAllSessions"),confirmHandler:y,confirmIsDestructive:!0,areButtonsInColumn:!0}),(0,ee.Y)(Od,{isOpen:g,hash:p,onClose:w})]});var D,T}))),Gd="YRYk96ki",jd=(0,s.ph)((0,n.EK)(((e,{hash:t})=>{const i=t?e.activeWebSessions.byHash[t]:void 0;return{session:i,bot:i?e.users.byId[i.botId]:void 0}}))((({isOpen:e,session:t,bot:i,onClose:o})=>{const{terminateWebAuthorization:a}=(0,n.ko)(),r=(0,M.A)(),l=(0,Ti.A)(t,!0),c=(0,Ti.A)(i,!0),d=(0,s.hb)((()=>{a({hash:t.hash}),o()}),[o,t,a]);if(l)return(0,ee.FD)(Z.A,{header:(0,ee.FD)("div",{className:"modal-header-condensed",dir:r.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:r("Close"),onClick:o,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"modal-title",children:r("WebSessionsTitle")}),(0,ee.Y)(W.A,{color:"danger",onClick:d,className:(0,me.A)("modal-action-button","lUf0RJ2h"),children:r("AuthSessions.LogOut")})]}),isOpen:e,hasCloseButton:!0,onClose:o,className:"Wd0fmiSY",children:[(0,ee.Y)(Dt.A,{className:"OhZHdRsP",peer:c,size:"large"}),c&&(0,ee.Y)(Ls.A,{className:"EQ7__xGn",peer:c}),(0,ee.Y)("div",{className:Gd,children:l?.domain}),(0,ee.FD)("dl",{className:"kmCTIfvf",children:[(0,ee.Y)("dt",{children:r("AuthSessions.View.Browser")}),(0,ee.Y)("dd",{children:l?.browser}),(0,ee.Y)("dt",{children:r("SessionPreview.Ip")}),(0,ee.Y)("dd",{children:l?.ip}),(0,ee.Y)("dt",{children:r("SessionPreview.Location")}),(0,ee.Y)("dd",{children:l?.region})]}),(0,ee.Y)("p",{className:Gd,children:r("AuthSessions.View.LocationInfo")})]})}))),zd={avatar:"v0wP46TR","clear-help":"WnnxcARX",clearHelp:"WnnxcARX",subtitle:"uEUfjByC"},Hd=(0,s.ph)((0,n.EK)((e=>{const{byHash:t,orderedHashes:i}=e.activeWebSessions;return{byHash:t,orderedHashes:i}}))((({isActive:e,byHash:t,orderedHashes:i,onReset:o})=>{const{terminateWebAuthorization:a,terminateAllWebAuthorizations:r}=(0,n.ko)(),l=(0,M.A)(),[c,d,h]=(0,Y.A)(),[m,u]=(0,s.J0)(),[p,v,g]=(0,Y.A)(),A=(0,s.hb)((e=>{a({hash:e})}),[a]),b=(0,s.hb)((()=>{h(),r()}),[h,r]),f=(0,s.hb)((e=>{u(e),v()}),[v]),C=(0,s.hb)((()=>{u(void 0),g()}),[g]);var S;if((0,s.vJ)((()=>{i.length||o()}),[o,i]),(0,fe.A)({isActive:e,onBack:o}),i.length)return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{className:"destructive mb-0 no-icon",icon:"stop",ripple:!0,narrow:!0,onClick:d,children:l("AuthSessions.LogOutApplications")}),(0,ee.Y)("p",{className:(0,me.A)("settings-item-description",zd.clearHelp),children:l("ClearOtherWebSessionsHelp")})]}),(S=i,(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("WebSessionsTitle")}),S.map((function(e){const i=t[e],s=(0,n.mS)().users.byId[i.botId];return(0,ee.FD)(li.A,{ripple:!0,narrow:!0,contextActions:[{title:"Terminate",icon:"stop",destructive:!0,handler:()=>{A(i.hash)}}],onClick:()=>f(i.hash),children:[(0,ee.Y)(Dt.A,{className:zd.avatar,peer:s,size:"tiny"}),(0,ee.FD)("div",{className:"multiline-item full-size",dir:"auto",children:[(0,ee.Y)("span",{className:"date",children:(0,ze.be)(l,1e3*i.dateActive)}),s&&(0,ee.Y)(Ls.A,{className:zd.title,peer:s}),(0,ee.FD)("span",{className:(0,me.A)("subtitle","black","tight",zd.platform),children:[i.domain,",",i.browser,",",i.platform]}),(0,ee.FD)("span",{className:(0,me.A)("subtitle",zd.subtitle),children:[i.ip," ",i.region]})]})]},i.hash)}))]})),(0,ee.Y)(pi.A,{isOpen:c,onClose:h,title:l("AuthSessions.LogOutApplications"),text:l("AreYouSureWebSessions"),confirmHandler:b,confirmIsDestructive:!0}),(0,ee.Y)(jd,{isOpen:p,hash:m,onClose:C})]})}))),$d=(0,s.ph)((({stickerSet:e,noPlay:t,className:i,observeIntersection:s,onClick:n})=>{const o=(0,M.A)(),r=e?.stickers?.[0],l=(0,D.A)((()=>{r&&n(r)}));if(e?.stickers)return(0,ee.FD)(li.A,{className:(0,me.A)("StickerSetCard","chat-item-clickable small-icon",i),style:`height: ${a.yq1}px;`,inactive:!r,onClick:l,children:[function(){if(e)return e.hasThumbnail||!r?(0,ee.Y)(W.A,{ariaLabel:e.title,color:"translucent",isRtl:o.isRtl,children:(0,ee.Y)(ur,{stickerSet:e,size:a.RCH,noPlay:t,observeIntersection:s})}):(0,ee.Y)(br,{sticker:r,size:a.RCH,title:e.title,noPlay:t,observeIntersection:s,noContextMenu:!0,isCurrentUserPremium:!0,clickArg:void 0})}(),(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("div",{className:"title",children:e.title}),(0,ee.Y)("div",{className:"subtitle",children:o("StickerPack.StickerCount",e.count,"i")})]})]})})),qd=(0,s.ph)((0,n.EK)((e=>({...(0,bi.Up)(e.settings.byKey,["shouldSuggestCustomEmoji"]),customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,canPlayAnimatedEmojis:(0,c.BWX)(e)})))((({isActive:e,customEmojiSetIds:t,stickerSetsById:i,shouldSuggestCustomEmoji:o,canPlayAnimatedEmojis:a,onReset:r})=>{const{openStickerSet:l,setSettingOption:c}=(0,n.ko)(),d=(0,M.A)(),h=(0,s.li)(),{observe:m}=(0,or.BL)({rootRef:h});(0,fe.A)({isActive:e,onBack:r});const u=(0,s.hb)((e=>{l({stickerSetInfo:e.stickerSetInfo})}),[l]),p=(0,s.hb)((e=>{c({shouldSuggestCustomEmoji:e})}),[c]),v=(0,s.Kr)((()=>t&&Object.values((0,bi.Up)(i,t))),[t,i]);return(0,ee.Y)("div",{className:"settings-content custom-scroll",children:v&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(en.A,{label:d("SuggestAnimatedEmoji"),checked:o,onCheck:p}),(0,ee.Y)("div",{className:"mt-4",ref:h,children:v.map((e=>(0,ee.Y)($d,{stickerSet:e,observeIntersection:m,onClick:u,noPlay:!a},e.id)))}),(0,ee.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Ft.A)(d("EmojiBotInfo"),["links"])})]})})}))),Wd=(0,s.ph)((0,n.EK)((e=>(0,bi.Up)(e.settings.byKey,["canAutoLoadPhotoFromContacts","canAutoLoadPhotoInPrivateChats","canAutoLoadPhotoInGroups","canAutoLoadPhotoInChannels","canAutoLoadVideoFromContacts","canAutoLoadVideoInPrivateChats","canAutoLoadVideoInGroups","canAutoLoadVideoInChannels","canAutoLoadFileFromContacts","canAutoLoadFileInPrivateChats","canAutoLoadFileInGroups","canAutoLoadFileInChannels","autoLoadFileMaxSizeMb"])))((({isActive:e,onReset:t,canAutoLoadPhotoFromContacts:i,canAutoLoadPhotoInPrivateChats:o,canAutoLoadPhotoInGroups:r,canAutoLoadPhotoInChannels:l,canAutoLoadVideoFromContacts:c,canAutoLoadVideoInPrivateChats:d,canAutoLoadVideoInGroups:h,canAutoLoadVideoInChannels:m,canAutoLoadFileFromContacts:u,canAutoLoadFileInPrivateChats:p,canAutoLoadFileInGroups:v,canAutoLoadFileInChannels:g,autoLoadFileMaxSizeMb:A})=>{const{setSettingOption:b}=(0,n.ko)(),f=(0,Vi.A)();(0,fe.A)({isActive:e,onBack:t});const C=(0,s.hb)((e=>f("AutodownloadSizeLimitUpTo",{limit:f("FileSizeMB",{count:a.$gx[e]})})),[f]),S=(0,s.hb)((e=>{b({autoLoadFileMaxSizeMb:a.$gx[e]})}),[b]);function y(){const e=a.$gx.indexOf(A);return(0,ee.Y)("div",{className:"pt-5",children:(0,ee.Y)(qe.A,{label:f("AutoDownloadMaxFileSize"),min:0,max:5,value:-1!==e?e:2,renderValue:C,onChange:S})})}function k(e,t,i,s,n,o){return(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:f.isRtl?"rtl":void 0,children:e}),(0,ee.Y)(en.A,{label:f("AutoDownloadSettingsContacts"),checked:i,onCheck:e=>b({[`canAutoLoad${t}FromContacts`]:e})}),(0,ee.Y)(en.A,{label:f("AutoDownloadSettingsPrivateChats"),checked:s,onCheck:e=>b({[`canAutoLoad${t}InPrivateChats`]:e})}),(0,ee.Y)(en.A,{label:f("AutoDownloadSettingsGroupChats"),checked:n,onCheck:e=>b({[`canAutoLoad${t}InGroups`]:e})}),(0,ee.Y)(en.A,{label:f("AutoDownloadSettingsChannels"),checked:o,onCheck:e=>b({[`canAutoLoad${t}InChannels`]:e})}),"File"===t&&y()]})}return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[k(f("AutoDownloadPhotosTitle"),"Photo",i,o,r,l),k(f("AutoDownloadVideosTitle"),"Video",c,d,h,m),k(f("AutoDownloadFilesTitle"),"File",u,p,v,g)]})}))),Qd={root:"Ys1i4ssl",item:"skaVPMTF"},Zd=["af","als","am","an","ar","arz","as","ast","av","az","azb","ba","bar","bcl","be","bg","bh","bn","bo","bpy","br","bs","bxr","ca","cbk","ce","ceb","ckb","co","cs","cv","cy","da","de","diq","dsb","dty","dv","el","eml","en","eo","es","et","eu","fa","fi","fr","frr","fy","ga","gd","gl","gn","gom","gu","gv","he","hi","hif","hr","hsb","ht","hu","hy","ia","id","ie","ilo","io","is","it","ja","jbo","jv","ka","kk","km","kn","ko","krc","ku","kv","kw","ky","la","lb","lez","li","lmo","lo","lrc","lt","lv","mai","mg","mhr","min","mk","ml","mn","mr","mrj","ms","mt","mwl","my","myv","mzn","nah","nap","nds","ne","new","nl","nn","no","oc","or","os","pa","pam","pfl","pl","pms","pnb","ps","pt","qu","rm","ro","ru","rue","sa","sah","sc","scn","sco","sd","sh","si","sk","sl","so","sq","sr","su","sv","sw","ta","te","tg","th","tk","tl","tr","tt","tyv","ug","uk","ur","uz","vec","vep","vi","vls","vo","wa","war","wuu","xal","xmf","yi","yo","yue","zh"],Xd=a.N89.filter((e=>Zd.includes(e))),eh=(0,s.ph)((0,n.EK)((e=>{const{doNotTranslate:t}=e.settings.byKey;return{doNotTranslate:t}}))((({isActive:e,doNotTranslate:t,onReset:i})=>{const{setSettingOption:o}=(0,n.ko)(),a=(0,M.A)().code||"en",[r,l]=(0,s.J0)([]),[c,d]=(0,s.J0)(""),h=(0,s.Kr)((()=>{const e=Xd.map((e=>({langCode:e,translatedName:new Intl.DisplayNames([a],{type:"language"}).of(e),originalName:new Intl.DisplayNames([e],{type:"language"}).of(e)}))).filter(Boolean).map((({langCode:e,translatedName:t,originalName:i})=>({label:t,subLabel:i,value:e})));if(!c.trim()){const t=e.find((e=>e.value===a)),i=e.filter((e=>e.value!==a));return t?[t,...i]:e}return e?.filter((e=>e.label.toLowerCase().includes(c.toLowerCase())))}),[a,c]);(0,yi.A)((([i,s])=>{if(i===e&&s?.find((e=>e===a)))return;const[n]=(0,bi.jB)(h,(e=>t.includes(e.value)));l([...n.map((e=>e.value))])}),[e,t,r.length,a,h]);const m=(0,D.A)((e=>{l(e),o({doNotTranslate:e})}));return(0,fe.A)({isActive:e,onBack:i}),(0,ee.Y)("div",{className:(0,me.A)(Qd.root,"settings-content infinite-scroll"),children:(0,ee.Y)("div",{className:(0,me.A)(Qd.item),children:(0,ee.Y)(Sa,{className:Qd.picker,items:h,selectedValues:r,onSelectedValuesChange:m,filterValue:c,onFilterChange:d,isSearchable:!0,allowMultiple:!0,withDefaultPadding:!0,itemInputType:"checkbox",searchInputId:"lang-picker-search"})})})}))),th=(0,s.ph)((({chatId:e,usernames:t,onEditUsername:i})=>{const{showNotification:o,toggleUsername:a,toggleChatUsername:r,sortUsernames:l,sortChatUsernames:c}=(0,n.ko)(),d=(0,M.A)(),[h,m]=(0,s.J0)(),u=(0,s.Kr)((()=>t.map((({username:e})=>e))),[t]),p=(0,V.A)(u),[v,g]=(0,s.J0)({orderedUsernames:u,dragOrderUsernames:u,draggedIndex:void 0});(0,s.vJ)((()=>{p!==u&&g({orderedUsernames:u,dragOrderUsernames:u,draggedIndex:void 0})}),[p,u]);const A=(0,s.hb)((e=>{(0,cc.eM)(`@${e}`),o({message:d("UsernameCopied")})}),[d,o]),b=(0,s.hb)((e=>{e.isEditable?i(e.username):m(e)}),[i]),f=(0,s.hb)((()=>{m(void 0)}),[]),C=(0,s.hb)((()=>{h&&(e?r({chatId:e,username:h.username,isActive:!h.isActive}):a({username:h.username,isActive:!h.isActive}),f())}),[e,f,r,a,h]),S=(0,s.hb)(((e,t)=>{const i=Math.round(e.y/56),s=v.orderedUsernames?.indexOf(t)||0,n=v.orderedUsernames?.filter((e=>e!==t));n&&(0,pe.Bt)(s+i,0,u.length)&&(n.splice(s+i,0,t),g((e=>({...e,draggedIndex:s,dragOrderUsernames:n}))))}),[v.orderedUsernames,u.length]),y=(0,s.hb)((()=>{g((t=>(e?c({chatId:e,usernames:t.dragOrderUsernames}):l({usernames:t.dragOrderUsernames}),{...t,orderedUsernames:t.dragOrderUsernames,draggedIndex:void 0})))}),[e,c,l]);return(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"PaO1MMi5",children:[(0,ee.Y)("h4",{className:"wSswdVkR",dir:d.isRtl?"rtl":void 0,children:d("lng_usernames_subtitle")}),(0,ee.Y)("div",{className:"lAeeBh9K",style:`height: ${56*t.length}px`,children:t.map(((e,t)=>{const i=v.draggedIndex===t,s=56*(v.orderedUsernames?.indexOf(e.username)??0),n=56*(v.dragOrderUsernames?.indexOf(e.username)??0),o=e.isEditable?"lng_usernames_edit":e.isActive?"lng_usernames_active":"lng_usernames_non_active";return(0,ee.Y)(vd.A,{id:e.username,onDrag:S,onDragEnd:y,style:`top: ${i?s:n}px;`,knobStyle:(d.isRtl?"left":"right")+": 3rem;",isDisabled:!e.isActive,children:(0,ee.FD)(li.A,{className:(0,me.A)("drag-item no-icon","l04OwRBg"),narrow:!0,secondaryIcon:"more",icon:e.isActive?"link":"link-broken",multiline:!0,contextActions:[{handler:()=>{A(e.username)},title:d("Copy"),icon:"copy"}],onClick:()=>{b(e)},children:[(0,ee.FD)("span",{className:"title",children:["@",e.username]}),(0,ee.Y)("span",{className:"subtitle",children:d(o)})]},e.username)},e.username)}))}),(0,ee.Y)("p",{className:"oiJc22Aj",dir:d.isRtl?"rtl":void 0,children:d("lng_usernames_description")})]}),(0,ee.Y)(pi.A,{isOpen:Boolean(h),onClose:f,title:d(h?.isActive?"Username.DeactivateAlertTitle":"Username.ActivateAlertTitle"),text:d(h?.isActive?"Username.DeactivateAlertText":"Username.ActivateAlertText"),confirmLabel:d(h?.isActive?"Username.DeactivateAlertHide":"Username.ActivateAlertShow"),confirmHandler:C,confirmIsDestructive:!h?.isActive})]})}));var ih=i(11116);const sh=/https:\/\/t\.me\/?/i,nh=(0,ve.sg)((e=>e()),250,!1),oh=(0,s.ph)((({currentUsername:e,asLink:t,isLoading:i,isUsernameAvailable:o,checkedUsername:r,onChange:l})=>{const{checkUsername:c,checkPublicLink:d}=(0,n.ko)(),[h,m]=(0,s.J0)(e||""),u=(0,M.A)(),p=t?"SetUrl":"Username",v=u(t?"SetUrlPlaceholder":"Username"),g=(0,V.A)(o),A=e!==h?o??g:void 0,b=h&&e!==h&&r!==h,[f,C]=(0,s.Kr)((()=>h.length?h.length<ih.tX?[void 0,u(`${p}InvalidShort`)]:h.length>ih.Tk?[void 0,u(`${p}InvalidLong`)]:ih.Ny.test(h)?void 0===A||b?[]:[A?u(`${p}Available`,v):void 0,!1===A?u(`${p}InUse`):void 0]:[void 0,u(`${p}Invalid`)]:[]),[h,A,b,u,p,v]);(0,s.vJ)((()=>{m(e||"")}),[t,e]);const S=(0,s.hb)((i=>{const s=i.target.value.trim();if(t&&!s.match(sh))return void(s.length||(m(""),l?.("")));const n=s.replace(sh,"");m(n),(""===n||(0,ih.BU)(n,!0))&&(l?.(n),nh((()=>{n!==e&&(t?d:c)({username:n})})))}),[t,d,c,e,l]);return(0,ee.Y)(Q.A,{value:`${t?a.jsp:""}${h}`,onChange:S,label:b?u("Checking"):v,error:C,success:f,readOnly:i,teactExperimentControlled:!0})}));var ah=i(43434);const rh=(0,ve.nF)((e=>e()),6e4,!0),lh="Please provide your first name",ch=(0,s.ph)((0,n.EK)((e=>{const{currentUserId:t}=e,{progress:i,isUsernameAvailable:s,checkedUsername:n,error:o}=(0,c.nTw)(e).profileEdit||{},a=t?(0,c.mBe)(e,t):void 0,r=(0,co.d)(e,"aboutLength");if(!a)return{progress:i,checkedUsername:n,isUsernameAvailable:s,editUsernameError:o,maxBioLength:r};const{firstName:d,lastName:h,usernames:m}=a,u=t?(0,c.vGo)(e,t):void 0;return{currentAvatarHash:(0,l.cP)(a),currentFirstName:d,currentLastName:h,currentBio:u?.bio,progress:i,isUsernameAvailable:s,checkedUsername:n,editUsernameError:o,maxBioLength:r,usernames:m}}))((({isActive:e,currentAvatarHash:t,currentFirstName:i,currentLastName:r,currentBio:l,progress:c,checkedUsername:d,editUsernameError:h,isUsernameAvailable:m,maxBioLength:u,usernames:p,onReset:v})=>{const{loadCurrentUser:g,updateProfile:A}=(0,n.ko)(),b=(0,M.A)(),f=(0,s.Kr)((()=>p?.find((({isEditable:e})=>e))),[p]),C=f?.username||"",[S,y]=(0,s.J0)(!1),[k,w]=(0,s.J0)(!1),[N,I]=(0,s.J0)(),[P,Y]=(0,s.J0)(),[F,D]=(0,s.J0)(i||""),[T,B]=(0,s.J0)(r||""),[R,L]=(0,s.J0)(l||""),[x,E]=(0,s.J0)(C),_=(0,j.A)(t,!1,U.qZ.BlobUrl),O=c===o.DV.InProgress,K=!1===x,J=(0,V.A)(m),G=m??J,z=p&&p.length>1,H=(0,s.Kr)((()=>!K&&(Boolean(P)||k||S&&!0===G)),[K,P,k,S,G]);(0,fe.A)({isActive:e,onBack:v}),(0,s.vJ)((()=>{rh((()=>{g()}))}),[g]),(0,s.vJ)((()=>{Y(void 0)}),[_]),(0,s.vJ)((()=>{D(i||""),B(r||""),L(l||"")}),[i,r,l]),(0,s.vJ)((()=>{E(C||"")}),[C]),(0,s.vJ)((()=>{c===o.DV.Complete&&(w(!1),y(!1),I(void 0))}),[c]);const $=(0,s.hb)((e=>{Y(e)}),[]),W=(0,s.hb)((e=>{D(e.target.value),w(!0)}),[]),Z=(0,s.hb)((e=>{B(e.target.value),w(!0)}),[]),X=(0,s.hb)((e=>{L(e.target.value),w(!0)}),[]),te=(0,s.hb)((e=>{E(e),y(C!==e)}),[C]),ie=(0,s.hb)((()=>{const e=F.trim(),t=T.trim(),i=R.trim();x&&(e.length?A({photo:P,...k&&{firstName:e,lastName:t,bio:i},...S&&{username:x}}):I(lh))}),[P,F,T,R,k,x,S,A]);return(0,ee.FD)("div",{className:"settings-fab-wrapper",children:[(0,ee.FD)("div",{className:"settings-content no-border custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.FD)("div",{className:"settings-input",children:[(0,ee.Y)(ah.A,{currentAvatarBlobUrl:_,onChange:$,title:"Edit your profile photo",disabled:O}),(0,ee.Y)(Q.A,{value:F,onChange:W,label:b("FirstName"),disabled:O,error:N===lh?N:void 0}),(0,ee.Y)(Q.A,{value:T,onChange:Z,label:b("LastName"),disabled:O}),(0,ee.Y)(Il.A,{value:R,onChange:X,label:b("UserBio"),disabled:O,maxLength:u,maxLengthIndicator:u?(u-R.length).toString():void 0})]}),(0,ee.Y)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:(0,Ft.A)(b("lng_settings_about_bio"),["br","simple_markdown"])})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:b.isRtl?"rtl":void 0,children:b("Username")}),(0,ee.Y)("div",{className:"settings-input",children:(0,ee.Y)(oh,{currentUsername:C,isLoading:O,isUsernameAvailable:m,checkedUsername:d,onChange:te})}),h===a.Y3M&&function(){const e=`${a.jsp}${a.NjX}`;return(0,ee.Y)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:b("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map((t=>"PURCHASE_LINK"===t?(0,ee.Y)(dl.A,{url:e,text:`@${a.NjX}`}):t))})}(),(0,ee.Y)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:(0,Ft.A)(b("UsernameHelp"),["br","simple_markdown"])}),x&&(0,ee.FD)("p",{className:"settings-item-description",dir:b.isRtl?"rtl":void 0,children:[b("lng_username_link"),(0,ee.Y)("br",{}),(0,ee.FD)("span",{className:"username-link",children:[a.jsp,x]})]})]}),z&&(0,ee.Y)(th,{usernames:p,onEditUsername:E})]}),(0,ee.Y)(ki.A,{isShown:H,onClick:ie,disabled:O,ariaLabel:b("Save"),children:O?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})})));var dh=i(61182),hh=i(15006);const mh=(0,s.ph)((0,n.EK)((e=>{const{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}=(0,un.l)(e);return{shouldForceHttpTransport:t,shouldAllowHttpTransport:i,shouldCollectDebugLogs:s,shouldDebugExportedSenders:n}}))((({isActive:e,onReset:t,shouldForceHttpTransport:i,shouldAllowHttpTransport:o,shouldCollectDebugLogs:r,shouldDebugExportedSenders:l})=>{const{requestConfetti:c,setSharedSettingOption:d,requestWave:h}=(0,n.ko)(),m=(0,s.li)(),[u,p]=(0,s.J0)(!1),v=(0,M.A)(),[g,A]=(0,s.J0)(!1);(0,s.vJ)((()=>{window.electron?.getIsAutoUpdateEnabled().then(A)}),[]),(0,fe.A)({isActive:e,onBack:t});const f=(0,D.A)((()=>{const e=new File([(0,dh.F8)()],a.lFE,{type:"text/plain"}),t=URL.createObjectURL(e);(0,Ri.A)(t,a.lFE)})),C=(0,s.hb)((e=>{window.electron?.setIsAutoUpdateEnabled(e)}),[]),S=(0,D.A)((e=>{h({startX:e.clientX,startY:e.clientY})})),y=(0,D.A)((()=>{c({withStars:!0})})),k=(0,D.A)((()=>{const e=m.current;e&&(0,hh.U)(e)&&(p(!0),setTimeout((()=>{p(!1)}),1500))}));return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Experimental,size:200,className:"experimental-duck",nonInteractive:!0,noLoop:!1}),(0,ee.Y)("p",{className:"settings-item-description pt-3",dir:"auto",children:v("lng_settings_experimental_about")})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{onClick:y,icon:"animations",children:(0,ee.Y)("div",{className:"title",children:"Launch some confetti!"})}),(0,ee.Y)(li.A,{onClick:S,icon:"story-expired",disabled:!b.J6,children:(0,ee.Y)("div",{className:"title",children:"Start wave"})}),(0,ee.Y)(li.A,{ref:m,onClick:k,icon:"spoiler",disabled:!b.bW,style:u?"visibility: hidden":"",children:(0,ee.Y)("div",{className:"title",children:"Vaporize this button"})}),(0,ee.Y)(en.A,{label:"Allow HTTP Transport",checked:Boolean(o),onCheck:()=>d({shouldAllowHttpTransport:!o})}),(0,ee.Y)(en.A,{label:"Force HTTP Transport",disabled:!o,checked:Boolean(i),onCheck:()=>d({shouldForceHttpTransport:!i})}),(0,ee.Y)(en.A,{label:v("DebugMenuEnableLogs"),checked:Boolean(r),onCheck:()=>d({shouldCollectDebugLogs:!r})}),(0,ee.Y)(en.A,{label:"Enable exported senders debug",checked:Boolean(l),onCheck:()=>d({shouldDebugExportedSenders:!l})}),b.cp&&(0,ee.Y)(en.A,{label:"Enable autoupdates",checked:Boolean(g),onCheck:C}),(0,ee.Y)(li.A,{onClick:f,icon:"bug",children:(0,ee.Y)("div",{className:"title",children:"Download log"})})]})]})})));var uh=i(6e4),ph=i(84382);const vh=(0,s.ph)((0,n.EK)((e=>{const{theme:t,shouldUseSystemTheme:i,messageSendKeyCombo:s,messageTextSize:n,timeFormat:o}=(0,un.l)(e);return{messageSendKeyCombo:s,messageTextSize:n,timeFormat:o,theme:t,shouldUseSystemTheme:i}}))((({isActive:e,messageTextSize:t,messageSendKeyCombo:i,timeFormat:a,theme:r,shouldUseSystemTheme:l,onReset:c})=>{const{setSharedSettingOption:d,openSettingsScreen:h}=(0,n.ko)(),m=(0,Vi.A)(),{isMobile:u}=(0,I.Ay)(),p=u&&(b.pz||b.Ni),v=[{label:m("SettingsTimeFormat12"),value:"12h"},{label:m("SettingsTimeFormat24"),value:"24h"}],g=[{label:m("EmptyChatAppearanceLight"),value:"light"},{label:m("EmptyChatAppearanceDark"),value:"dark"},{label:m("EmptyChatAppearanceSystem"),value:"auto"}],A=p?void 0:[{value:"enter",label:m("SettingsSendEnter"),subLabel:m("SettingsSendEnterDescription")},{value:"ctrl-enter",label:m(b.MP||b.pz?"SettingsSendCmdenter":"SettingsSendCtrlenter"),subLabel:m("SettingsSendPlusEnterDescription")}],f=(0,s.hb)((e=>{document.documentElement.style.setProperty("--composer-text-size",`${Math.max(e,b.pz?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()),d({messageTextSize:e})}),[]),C=(0,s.hb)((e=>{const t="auto"===e?(0,ph.V)():e;d({theme:t}),d({shouldUseSystemTheme:"auto"===e})}),[]),S=(0,s.hb)((e=>{d({timeFormat:e}),d({wasTimeFormatSetManually:!0}),(0,uh.bV)(e)}),[]),y=(0,s.hb)((e=>{d({messageSendKeyCombo:e})}),[]),[k,w]=(0,s.J0)(!1);(0,s.vJ)((()=>{window.electron?.getIsTrayIconEnabled().then(w)}),[]);const N=(0,s.hb)((e=>{window.electron?.setIsTrayIconEnabled(e)}),[]);return(0,fe.A)({isActive:e,onBack:c}),(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("Settings")}),(0,ee.Y)(qe.A,{label:m("TextSize"),min:12,max:20,value:t,onChange:f}),(0,ee.Y)(li.A,{icon:"photo",narrow:!0,onClick:()=>h({screen:o.VS.GeneralChatBackground}),children:m("ChatBackground")}),b.cp&&b.H8&&(0,ee.Y)(en.A,{label:m("SettingsTray"),checked:Boolean(k),onCheck:N})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("Theme")}),(0,ee.Y)(X.A,{name:"theme",options:g,selected:l?"auto":r,onChange:C})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("SettingsTimeFormat")}),(0,ee.Y)(X.A,{name:"timeformat",options:v,selected:a,onChange:S})]}),A&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:m.isRtl?"rtl":void 0,children:m("SettingsKeyboard")}),(0,ee.Y)(X.A,{name:"keyboard-send-settings",options:A,onChange:y,selected:i})]})]})})));var gh=i(52844),Ah=i(74824);const bh=(0,s.ph)((({wallpaper:e,theme:t,isSelected:i,onClick:n})=>{const{slug:r,document:l}=e,c=`wallpaper${l.id}`,d=l.previewBlobUrl,h=(0,j.A)(`${c}?size=m`),m=(0,Ei.A)(l.thumbnail?.dataUri,Boolean(h),!0),{transitionClassNames:u}=(0,Oe.A)(Boolean(h||d),void 0,void 0,"slow"),p=(0,s.li)(!1),[v,g]=(0,s.J0)(!1),{mediaData:A,loadProgress:b}=(0,z.A)(c,!v),f=!1===(0,V.A)(v),{shouldRender:C,transitionClassNames:S}=(0,Oe.A)(v&&!A||r===o.Vw,void 0,f,"slow"),y=(0,s.li)();y.current=t;const k=(0,s.hb)((()=>{(async()=>{const e=await(0,K.sZ)(A);await Ah.save(a.nfi,y.current,e),n(r)})()}),[A,n,r]);(0,s.vJ)((()=>{A&&p.current&&(k(),p.current=!1)}),[A,k]);const w=(0,s.hb)((()=>{A?k():(p.current=!0,g((e=>!e)))}),[A,k]),N=(0,me.A)("WallpaperTile",i&&"selected");return(0,ee.Y)("div",{className:N,onClick:w,children:(0,ee.FD)("div",{className:"media-inner",children:[(0,ee.Y)("canvas",{ref:m,className:"thumbnail"}),(0,ee.Y)("img",{src:h||d,className:(0,me.A)("full-media",u),alt:"",draggable:!1}),C&&(0,ee.Y)("div",{className:(0,me.A)("spinner-container",S),children:(0,ee.Y)(de.A,{progress:b,onClick:w})})]})})})),fh=(0,ve.nF)((e=>e()),6e4,!0),Ch=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.SJA)(e),{background:i,isBlurred:s}=(0,c.Gyz)(e,t)||{},{loadedWallpapers:n}=e.settings;return{background:i,isBlurred:s,loadedWallpapers:n,theme:t}}))((({isActive:e,onReset:t,background:i,isBlurred:r,loadedWallpapers:l,theme:c})=>{const{loadWallpapers:d,uploadWallpaper:h,setThemeSettings:m,openSettingsScreen:u}=(0,n.ko)(),p=(0,s.li)();p.current=c,(0,s.vJ)((()=>{fh((()=>{d()}))}),[d]);const v=(0,s.hb)((e=>{const{files:t}=e.target,i=(0,K.kc)(t);i?.length&&h(i[0])}),[h]),g=(0,s.hb)((()=>{(0,gh.p)("image/jpeg",v,!0)}),[v]),A=(0,s.hb)((()=>{u({screen:o.VS.GeneralChatBackgroundColor})}),[]),b=(0,s.hb)((()=>{m({theme:c,background:void 0,backgroundColor:void 0,isBlurred:!0,patternColor:"dark"===c?a.MkD:a.be8})}),[m,c]),f=(0,s.hb)((e=>{m({theme:p.current,background:e});const t=l&&l.find((t=>t.slug===e));t?.document.thumbnail&&(0,pn.rX)(t.document.thumbnail.dataUri).then((e=>{const t=(0,pn.Yi)(e),i=`#${(0,pn.v2)(e)}`;m({theme:p.current,backgroundColor:i,patternColor:t})}))}),[l,m]),C=(0,s.hb)((e=>{m({theme:p.current,isBlurred:e.target.checked})}),[m]),S=(0,M.A)();(0,fe.A)({isActive:e,onBack:t});const y=l?.[0]&&l[0].slug===o.Vw;return(0,ee.FD)("div",{className:"SettingsGeneralBackground settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{icon:"camera-add",className:"mb-0",disabled:y,onClick:g,children:S("UploadImage")}),(0,ee.Y)(li.A,{icon:"colorize",className:"mb-0",onClick:A,children:S("SetColor")}),(0,ee.Y)(li.A,{icon:"favorite",onClick:b,children:S("ThemeResetToDefaults")}),(0,ee.Y)(en.A,{label:S("BackgroundBlurred"),checked:Boolean(r),onChange:C})]}),l?(0,ee.Y)("div",{className:"settings-wallpapers",children:l.map((e=>(0,ee.Y)(bh,{wallpaper:e,theme:c,isSelected:i===e.slug,onClick:f},e.slug)))}):(0,ee.Y)(Rs.A,{})]})}))),Sh=(0,pn.bM)((0,pn.xp)("e6ebee")),yh=["#e6ebee","#b2cee1","#008dd0","#c6e7cb","#c4e1a6","#60b16e","#ccd0af","#a6a997","#7a7072","#fdd7af","#fdb76e","#dd8851"];function kh(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 wh({colorPosition:e,huePosition:t},i){return[t/(i.hueRect.width-1),e[0]/(i.colorRect.width-1),1-e[1]/(i.colorRect.height-1)]}const Nh=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.SJA)(e),{backgroundColor:i}=(0,c.Gyz)(e,t)||{};return{backgroundColor:i,theme:t}}))((({isActive:e,onReset:t,theme:i,backgroundColor:o})=>{const{setThemeSettings:a}=(0,n.ko)(),r=(0,s.li)();r.current=i;const l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)(),h=(0,s.li)(!0),[m,u]=(0,s.J0)(function(e){return e&&e.startsWith("#")?(0,pn.bM)((0,pn.xp)(e.replace("#",""))):Sh}(o)),p=(0,s.li)(m);(0,s.vJ)((()=>{p.current=m}),[m]);const[v,g,A]=(0,Y.A)(),[b,f]=(0,s.J0)(""),[C,S]=(0,s.J0)(""),y=(0,s.li)(),k=(0,s.li)();(0,s.vJ)((()=>{const e={offsetLeft:c.current.offsetLeft,...(0,bi.Up)(c.current.getBoundingClientRect(),["top","width","height"])},t={offsetLeft:d.current.offsetLeft,...(0,bi.Up)(d.current.getBoundingClientRect(),["width"])};function i(t){const i=[Math.min(Math.max(0,t.pageX-e.offsetLeft),e.width-1),Math.min(Math.max(0,t.pageY-e.top+l.current.scrollTop),e.height-1)],{huePosition:s}=kh(p.current,y.current);return u(wh({colorPosition:i,huePosition:s},y.current)),g(),!0}function s(e){const{colorPosition:i}=kh(p.current,y.current),s=Math.min(Math.max(0,e.pageX-t.offsetLeft),t.width-1);return u(wh({colorPosition:i,huePosition:s},y.current)),g(),!0}y.current={colorRect:e,hueRect:t},(0,ue.wJ)(c.current,{onCapture:i,onDrag:i,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0}),(0,ue.wJ)(d.current,{onCapture:s,onDrag:s,onRelease:A,onClick:A,selectorToPreventScroll:".SettingsGeneralBackgroundColor",withCursor:!0})}),[g,A]);const{colorPosition:w=[0,0],huePosition:N=0}=y.current?kh(m,y.current):{},I=(0,pn.v2)((0,pn.Zf)(m)),P=m[0],F=(0,pn.v2)((0,pn.Zf)([P,1,1]));(0,s.vJ)((()=>{const e=(0,pn.Zf)(m),t=`#${(0,pn.v2)(e)}`;if(f(e.join(", ")),S(t),!h.current){const i=(0,pn.Yi)(e);a({theme:r.current,background:void 0,backgroundColor:t,patternColor:i})}h.current=!1}),[m,a]),(0,s.vJ)((()=>{!function(e,t,i,s){let n,o,a;i.current&&s.current?(n=s.current.colorRect.width,o=s.current.colorRect.height,a=i.current):(n=e.offsetWidth,o=e.offsetHeight,a=e.getContext("2d"),e.width=n,e.height=o,i.current=a);const r=a.createImageData(n,o),l=r.data,c=(0,pn.Zf)([t,1,1]);let d=0;for(let e=0;e<o;e++){const t=1-e/(o-1),i=[255*t,255*t,255*t],s=[c[0]*t,c[1]*t,c[2]*t];for(let e=0;e<n;e++){const t=e/(n-1);l[d++]=i[0]+(s[0]-i[0])*t,l[d++]=i[1]+(s[1]-i[1])*t,l[d++]=i[2]+(s[2]-i[2])*t,l[d++]=255}}a.putImageData(r,0,0)}(c.current.firstChild,P,k,y)}),[P]),(0,s.vJ)((()=>{!function(e){const t=e.offsetWidth;e.width=t,e.height=1;const i=e.getContext("2d"),s=i.createImageData(t,1),n=s.data;let o=0;for(let e=0;e<t;e++){const i=e/(t-1),s=(0,pn.Zf)([i,1,1]);n[o++]=s[0],n[o++]=s[1],n[o++]=s[2],n[o++]=255}i.putImageData(s,0,0)}(d.current.firstChild)}),[]);const D=(0,s.hb)((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())));u((0,pn.bM)(e))}e.currentTarget.value=t}),[]),M=(0,s.hb)((e=>{const t=e.currentTarget.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);t.match(/^#?[0-9a-fA-F]{6}$/)&&u((0,pn.bM)((0,pn.xp)(t.replace("#","")))),e.currentTarget.value=t}),[]),T=(0,s.hb)((e=>{u((0,pn.bM)((0,pn.xp)(e.currentTarget.dataset.color.replace("#",""))))}),[]),B=(0,me.A)("SettingsGeneralBackgroundColor settings-content custom-scroll",v&&"is-dragging");return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{ref:l,className:B,children:[(0,ee.FD)("div",{className:"settings-item pt-3",children:[(0,ee.FD)("div",{ref:c,className:"color-picker",children:[(0,ee.Y)("canvas",{}),(0,ee.Y)("div",{className:"handle",style:`transform: translate(${w[0]}px, ${w[1]}px); background-color: #${I};`})]}),(0,ee.FD)("div",{ref:d,className:"hue-picker",children:[(0,ee.Y)("canvas",{}),(0,ee.Y)("div",{className:"handle",style:`transform: translateX(${N}px); background-color: #${F};`})]}),(0,ee.FD)("div",{className:"tools",children:[(0,ee.Y)(Q.A,{value:C,label:"HEX",onChange:M}),(0,ee.Y)(Q.A,{value:b,label:"RGB",onChange:D})]})]}),(0,ee.Y)("div",{className:"predefined-colors",children:yh.map((e=>(0,ee.Y)("div",{className:(0,me.A)("predefined-color",e===`#${I}`?"active":void 0),"data-color":e,style:`background-color: ${e};`,onClick:T})))})]})}))),Ih=(0,s.ph)((({currentScreen:e,editedFolderId:t,onReset:i})=>{const{signOut:a,openDeleteChatFolderModal:r,openSettingsScreen:l}=(0,n.ko)(),{isMobile:c}=(0,I.Ay)(),[d,h]=(0,s.J0)(!1),m=function(e,t){const i=(0,s.li)(0),n=(0,s.li)();return(0,s.hb)((()=>{if(i.current++,5===i.current)return i.current=0,void t();n.current&&clearTimeout(n.current),n.current=setTimeout((()=>{i.current=0}),300)}),[5,t])}(0,(()=>{l({screen:o.VS.Experimental})})),u=(0,s.hb)((()=>{h(!0)}),[]),p=(0,s.hb)((()=>{h(!1)}),[]),v=(0,s.hb)((()=>{t&&r({folderId:t})}),[t,r]),g=(0,s.hb)((()=>{p(),a({forceInitApi:!0})}),[p,a]),A=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.Y)(W.A,{round:!0,ripple:!c,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",children:(0,ee.Y)(q.A,{name:"more"})})),[c]),b=(0,M.A)(),f=(0,Vi.A)();return(0,ee.FD)("div",{className:"left-header",children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:i,ariaLabel:b("AccDescrGoBack"),children:(0,ee.Y)(q.A,{name:"arrow-left"})}),function(){switch(e){case o.VS.EditProfile:return(0,ee.Y)("h3",{children:b("lng_settings_information")});case o.VS.General:return(0,ee.Y)("h3",{children:b("General")});case o.VS.QuickReaction:return(0,ee.Y)("h3",{children:b("DoubleTapSetting")});case o.VS.CustomEmoji:return(0,ee.Y)("h3",{children:b("Emoji")});case o.VS.Notifications:return(0,ee.Y)("h3",{children:b("Notifications")});case o.VS.DataStorage:return(0,ee.Y)("h3",{children:b("DataSettings")});case o.VS.Privacy:return(0,ee.Y)("h3",{children:b("PrivacySettings")});case o.VS.Language:return(0,ee.Y)("h3",{children:b("Language")});case o.VS.DoNotTranslate:return(0,ee.Y)("h3",{children:b("DoNotTranslate")});case o.VS.Stickers:return(0,ee.Y)("h3",{children:b("StickersName")});case o.VS.Experimental:return(0,ee.Y)("h3",{children:b("lng_settings_experimental")});case o.VS.GeneralChatBackground:return(0,ee.Y)("h3",{children:b("ChatBackground")});case o.VS.GeneralChatBackgroundColor:return(0,ee.Y)("h3",{children:b("SetColor")});case o.VS.PrivacyPhoneNumber:return(0,ee.Y)("h3",{children:b("PrivacyPhone")});case o.VS.PrivacyLastSeen:return(0,ee.Y)("h3",{children:b("PrivacyLastSeen")});case o.VS.PrivacyProfilePhoto:return(0,ee.Y)("h3",{children:b("Privacy.ProfilePhoto")});case o.VS.PrivacyBio:return(0,ee.Y)("h3",{children:b("PrivacyBio")});case o.VS.PrivacyBirthday:return(0,ee.Y)("h3",{children:b("PrivacyBirthday")});case o.VS.PrivacyGifts:return(0,ee.Y)("h3",{children:f("PrivacyGifts")});case o.VS.PrivacyForwarding:return(0,ee.Y)("h3",{children:b("PrivacyForwards")});case o.VS.PrivacyVoiceMessages:return(0,ee.Y)("h3",{children:b("PrivacyVoiceMessages")});case o.VS.PrivacyMessages:return(0,ee.Y)("h3",{children:b("PrivacyMessages")});case o.VS.PrivacyGroupChats:return(0,ee.Y)("h3",{children:b("AutodownloadGroupChats")});case o.VS.PrivacyPhoneCall:return(0,ee.Y)("h3",{children:b("Calls")});case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyGroupChatsAllowedContacts:return(0,ee.Y)("h3",{children:b("AlwaysShareWith")});case o.VS.PrivacyLastSeenDeniedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:case o.VS.PrivacyBioDeniedContacts:case o.VS.PrivacyGroupChatsDeniedContacts:return(0,ee.Y)("h3",{children:b("NeverShareWith")});case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneP2PAllowedContacts:return(0,ee.Y)("h3",{children:b("AlwaysAllow")});case o.VS.PrivacyPhoneNumberDeniedContacts:case o.VS.PrivacyBirthdayDeniedContacts:case o.VS.PrivacyGiftsDeniedContacts:case o.VS.PrivacyForwardingDeniedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:return(0,ee.Y)("h3",{children:b("NeverAllow")});case o.VS.PrivacyNoPaidMessages:return(0,ee.Y)("h3",{children:f("RemoveFeeTitle")});case o.VS.Performance:return(0,ee.Y)("h3",{children:f("MenuAnimations")});case o.VS.ActiveSessions:return(0,ee.Y)("h3",{children:b("SessionsTitle")});case o.VS.ActiveWebsites:return(0,ee.Y)("h3",{children:b("OtherWebSessions")});case o.VS.PrivacyBlockedUsers:return(0,ee.Y)("h3",{children:b("BlockedUsers")});case o.VS.TwoFaDisabled:case o.VS.TwoFaEnabled:return(0,ee.Y)("h3",{children:b("TwoStepVerification")});case o.VS.TwoFaNewPassword:case o.VS.TwoFaChangePasswordNew:case o.VS.TwoFaChangePasswordConfirm:return(0,ee.Y)("h3",{children:b("PleaseEnterCurrentPassword")});case o.VS.TwoFaNewPasswordConfirm:return(0,ee.Y)("h3",{children:b("PleaseReEnterPassword")});case o.VS.TwoFaNewPasswordHint:case o.VS.TwoFaChangePasswordHint:return(0,ee.Y)("h3",{children:b("PasswordHint")});case o.VS.TwoFaNewPasswordEmail:case o.VS.TwoFaRecoveryEmail:return(0,ee.Y)("h3",{children:b("RecoveryEmailTitle")});case o.VS.TwoFaNewPasswordEmailCode:case o.VS.TwoFaRecoveryEmailCode:return(0,ee.Y)("h3",{children:"Recovery Email Code"});case o.VS.TwoFaCongratulations:return(0,ee.Y)("h3",{children:b("TwoStepVerificationPasswordSet")});case o.VS.TwoFaChangePasswordCurrent:case o.VS.TwoFaTurnOff:case o.VS.TwoFaRecoveryEmailCurrentPassword:return(0,ee.Y)("h3",{children:b("PleaseEnterCurrentPassword")});case o.VS.PasscodeDisabled:case o.VS.PasscodeEnabled:case o.VS.PasscodeNewPasscode:case o.VS.PasscodeNewPasscodeConfirm:case o.VS.PasscodeCongratulations:return(0,ee.Y)("h3",{children:b("Passcode")});case o.VS.PasscodeTurnOff:return(0,ee.Y)("h3",{children:b("PasscodeController.Disable.Title")});case o.VS.PasscodeChangePasscodeCurrent:case o.VS.PasscodeChangePasscodeNew:return(0,ee.Y)("h3",{children:b("PasscodeController.Change.Title")});case o.VS.PasscodeChangePasscodeConfirm:return(0,ee.Y)("h3",{children:b("PasscodeController.ReEnterPasscode.Placeholder")});case o.VS.Folders:return(0,ee.Y)("h3",{children:b("Filters")});case o.VS.FoldersCreateFolder:return(0,ee.Y)("h3",{children:b("FilterNew")});case o.VS.FoldersShare:return(0,ee.Y)("h3",{children:b("FolderLinkScreen.Title")});case o.VS.FoldersEditFolder:case o.VS.FoldersEditFolderFromChatList:case o.VS.FoldersEditFolderInvites:return(0,ee.FD)("div",{className:"settings-main-header",children:[(0,ee.Y)("h3",{children:b("FilterEdit")}),Boolean(t)&&(0,ee.Y)(le.A,{className:"settings-more-menu",trigger:A,positionX:"right",children:(0,ee.Y)(ce.A,{icon:"delete",destructive:!0,onClick:v,children:b("Delete")})})]});case o.VS.FoldersIncludedChats:case o.VS.FoldersIncludedChatsFromChatList:case o.VS.FoldersExcludedChats:case o.VS.FoldersExcludedChatsFromChatList:return(0,ee.Y)("h3",{children:b(e===o.VS.FoldersIncludedChats||e===o.VS.FoldersIncludedChatsFromChatList?"FilterInclude":"FilterExclude")});default:return(0,ee.FD)("div",{className:"settings-main-header",children:[(0,ee.Y)("h3",{onClick:m,children:b("SETTINGS")}),(0,ee.Y)(W.A,{round:!0,ripple:!c,size:"smaller",color:"translucent",onClick:()=>l({screen:o.VS.EditProfile}),ariaLabel:b("lng_settings_information"),children:(0,ee.Y)(q.A,{name:"edit"})}),(0,ee.Y)(le.A,{className:"settings-more-menu",trigger:A,positionX:"right",children:(0,ee.Y)(ce.A,{icon:"logout",onClick:u,children:b("LogOutTitle")})})]})}}(),(0,ee.Y)(pi.A,{isOpen:d,onClose:p,text:b("lng_sure_logout"),confirmLabel:b("AccountSettings.Logout"),confirmHandler:g,confirmIsDestructive:!0})]})})),Ph=(0,s.ph)((0,n.EK)((e=>{const{canTranslate:t,canTranslateChats:i,doNotTranslate:s}=e.settings.byKey,{language:n,languages:o}=(0,un.l)(e);return{isCurrentUserPremium:(0,c.g29)(e),languages:o,language:n,canTranslate:t,canTranslateChats:i,doNotTranslate:s}}))((({isActive:e,isCurrentUserPremium:t,languages:i,language:a,canTranslate:r,canTranslateChats:l,doNotTranslate:c,onReset:d})=>{const{loadLanguages:h,setSettingOption:m,setSharedSettingOption:u,openPremiumModal:p,openSettingsScreen:v}=(0,n.ko)(),[g,A]=(0,s.J0)(a),[f,C,S]=(0,Y.A)(),y=t&&l,k=(0,M.A)();(0,s.vJ)((()=>{i?.length||h()}),[i]);const w=(0,D.A)((e=>{A(e),C(),(0,uh.wT)(e,(()=>{S(),u({language:e})}))})),N=(0,s.Kr)((()=>{if(!i)return;const e=(window.navigator.language||"en").toLowerCase(),t=e.substr(0,2);return i.map((({langCode:e,nativeName:t,name:i})=>({value:e,label:t,subLabel:i,isLoading:e===g&&f}))).sort((i=>!e||i.value!==e&&i.value!==t?0:-1))}),[f,i,g]),I=(0,D.A)((e=>{m({canTranslate:e})})),P=(0,D.A)((e=>{m({canTranslateChats:e})})),F=(0,D.A)((()=>{t||p({initialSection:"translations"})})),T=(0,s.Kr)((()=>{if(b.CM&&c.length)return 1===c.length?new Intl.DisplayNames([a],{type:"language"}).of(c[0]):k("Languages",c.length)}),[c,k,a]),B=(0,D.A)((()=>{v({screen:o.VS.DoNotTranslate})}));return(0,fe.A)({isActive:e,onBack:d}),(0,ee.FD)("div",{className:"settings-content settings-language custom-scroll",children:[b.CM&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(en.A,{label:k("ShowTranslateButton"),checked:r,onCheck:I}),(0,ee.Y)(en.A,{label:k("ShowTranslateChatButton"),checked:y,disabled:!t,rightIcon:t?void 0:"lock",onClickLabel:F,onCheck:P}),(r||y)&&(0,ee.FD)(li.A,{narrow:!0,onClick:B,children:[k("DoNotTranslate"),(0,ee.Y)("span",{className:"settings-item__current-value",children:T})]}),(0,ee.Y)("p",{className:"settings-item-description mb-0 mt-1",children:k("lng_translate_settings_about")})]}),(0,ee.FD)("div",{className:"settings-item settings-item-picker",children:[(0,ee.Y)("h4",{className:"settings-item-header",children:k("Localization.InterfaceLanguage")}),N?(0,ee.Y)(Sa,{items:N,selectedValue:g,forceRenderAllItems:!0,onSelectedValueChange:w,itemInputType:"radio",className:"settings-picker"}):(0,ee.Y)(Rs.A,{})]})]})})));var Yh=i(86046),Fh=i(44784),Dh=i(70195);const Mh=(0,s.ph)((0,n.EK)((e=>{const{currentUserId:t}=e,i=(0,c.hc)(e),s=e.stars?.balance,n=e.ton?.balance;return{sessionCount:e.activeSessions.orderedHashes.length,currentUserId:t,canBuyPremium:!(0,c.n_C)(e),isGiveawayAvailable:i,starsBalance:s,tonBalance:n}}))((({isActive:e,currentUserId:t,sessionCount:i,canBuyPremium:r,isGiveawayAvailable:l,starsBalance:c,tonBalance:d,onReset:h})=>{const{loadMoreProfilePhotos:m,openPremiumModal:u,openSupportChat:p,openUrl:v,openGiftRecipientPicker:g,openStarsBalanceModal:A,openSettingsScreen:b}=(0,n.ko)(),[f,C,S]=(0,Y.A)(!1),y=(0,Vi.A)();(0,s.vJ)((()=>{t&&m({peerId:t,isPreload:!0})}),[t]),(0,fe.A)({isActive:e,onBack:h});const k=(0,D.A)((()=>{p(),S()}));return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-main-menu self-profile",children:[t&&(0,ee.Y)(Dh.A,{peerId:t,canPlayVideo:Boolean(e),forceShowSelf:!0}),t&&(0,ee.Y)(Fh.A,{chatOrUserId:t,isInSettings:!0})]}),(0,ee.FD)("div",{className:"settings-main-menu",children:[(0,ee.Y)(li.A,{icon:"settings",narrow:!0,onClick:()=>b({screen:o.VS.General}),children:y("TelegramGeneralSettingsViewController")}),(0,ee.Y)(li.A,{icon:"animations",narrow:!0,onClick:()=>b({screen:o.VS.Performance}),children:y("MenuAnimations")}),(0,ee.Y)(li.A,{icon:"unmute",narrow:!0,onClick:()=>b({screen:o.VS.Notifications}),children:y("Notifications")}),(0,ee.Y)(li.A,{icon:"data",narrow:!0,onClick:()=>b({screen:o.VS.DataStorage}),children:y("DataSettings")}),(0,ee.Y)(li.A,{icon:"lock",narrow:!0,onClick:()=>b({screen:o.VS.Privacy}),children:y("PrivacySettings")}),(0,ee.Y)(li.A,{icon:"folder",narrow:!0,onClick:()=>b({screen:o.VS.Folders}),children:y("Filters")}),(0,ee.FD)(li.A,{icon:"active-sessions",narrow:!0,onClick:()=>b({screen:o.VS.ActiveSessions}),children:[y("SessionsTitle"),i>0&&(0,ee.Y)("span",{className:"settings-item__current-value",children:i})]}),(0,ee.FD)(li.A,{icon:"language",narrow:!0,onClick:()=>b({screen:o.VS.Language}),children:[y("Language"),(0,ee.Y)("span",{className:"settings-item__current-value",children:y.languageInfo.nativeName})]}),(0,ee.Y)(li.A,{icon:"stickers",narrow:!0,onClick:()=>b({screen:o.VS.Stickers}),children:y("MenuStickers")})]}),(0,ee.FD)("div",{className:"settings-main-menu",children:[r&&(0,ee.Y)(li.A,{leftElement:(0,ee.Y)(Rd.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),narrow:!0,onClick:()=>u(),children:y("TelegramPremium")}),(0,ee.FD)(li.A,{leftElement:(0,ee.Y)(Rd.A,{className:"icon ListItem-main-icon",type:"gold",size:"big"}),narrow:!0,onClick:()=>A({}),children:[y("MenuStars"),Boolean(c)&&(0,ee.Y)("span",{className:"settings-item__current-value",children:(0,Yh.ZF)(y,c)})]}),(0,ee.FD)(li.A,{leftElement:(0,ee.Y)(q.A,{className:"icon ListItem-main-icon",name:"toncoin"}),narrow:!0,onClick:()=>A({currency:a.ykW}),children:[y("MenuTon"),Boolean(d)&&(0,ee.Y)("span",{className:"settings-item__current-value",children:(0,ho.UL)(d.amount,d.currency)})]}),l&&(0,ee.Y)(li.A,{icon:"gift",narrow:!0,onClick:()=>g(),children:y("MenuSendGift")})]}),(0,ee.FD)("div",{className:"settings-main-menu",children:[(0,ee.Y)(li.A,{icon:"ask-support",narrow:!0,onClick:C,children:y("AskAQuestion")}),(0,ee.Y)(li.A,{icon:"help",narrow:!0,onClick:()=>v({url:a.r9K}),children:y("MenuTelegramFaq")}),(0,ee.Y)(li.A,{icon:"privacy-policy",narrow:!0,onClick:()=>v({url:a.pkx}),children:y("MenuPrivacyPolicy")})]}),(0,ee.Y)(pi.A,{isOpen:f,confirmLabel:y("OK"),title:y("AskAQuestion"),textParts:y("MenuAskText",void 0,{withNodes:!0,renderTextFilters:["br"]}),confirmHandler:k,onClose:S})]})})));var Th=i(5560),Bh=i(56133);const Rh=(0,s.ph)((0,n.EK)((e=>({hasContactJoinedNotifications:Boolean(e.settings.byKey.hasContactJoinedNotifications),hasWebNotifications:e.settings.byKey.hasWebNotifications,hasPushNotifications:e.settings.byKey.hasPushNotifications,notificationSoundVolume:e.settings.byKey.notificationSoundVolume})))((({isActive:e,onReset:t,notifyDefaults:i,hasContactJoinedNotifications:o,hasPushNotifications:a,hasWebNotifications:r,notificationSoundVolume:l})=>{const{loadNotificationSettings:c,updateContactSignUpNotification:d,updateNotificationSettings:h,updateWebNotificationSettings:m}=(0,n.ko)();(0,s.vJ)((()=>{c()}),[c]);const u=(0,Bh.A)(500,!0),p=(0,Th.M2)(),v=p&&!(0,Th.Ac)(),g=(0,s.hb)(((e,t,s)=>{const n=Boolean(i?.[t]?.mutedUntil),o=Boolean(i?.[t]?.shouldShowPreviews);h({peerType:t,isMuted:"mute"===s?!e.target.checked:n,shouldShowPreviews:"showPreviews"===s?e.target.checked:o})}),[i]),A=(0,s.hb)((e=>{const t=e.target.checked;m({hasWebNotifications:t,...!t&&{hasPushNotifications:!1}})}),[m]),b=(0,s.hb)((e=>{m({hasPushNotifications:e.target.checked})}),[m]),f=(0,s.hb)((e=>{g(e,"users","mute")}),[g]),C=(0,s.hb)((e=>{g(e,"users","showPreviews")}),[g]),S=(0,s.hb)((e=>{g(e,"groups","mute")}),[g]),y=(0,s.hb)((e=>{g(e,"groups","showPreviews")}),[g]),k=(0,s.hb)((e=>{g(e,"channels","mute")}),[g]),w=(0,s.hb)((e=>{g(e,"channels","showPreviews")}),[g]),N=(0,s.hb)((e=>{d({isSilent:!e.target.checked})}),[d]),I=(0,s.hb)((e=>{m({notificationSoundVolume:e}),u((()=>(0,Th.BA)(void 0,e)))}),[u,m]),P=(0,Vi.A)();return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0,children:P("NotificationsWeb")}),(0,ee.Y)(en.A,{label:P("NotificationsWeb"),subLabel:P(r?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:r,disabled:!p,onChange:A}),(0,ee.Y)(en.A,{label:P("NotificationsOffline"),disabled:!r||!v,subLabel:P(v?a?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled":"SettingsOfflineNotificationUnsupported"),checked:a,onChange:b}),(0,ee.Y)("div",{className:"settings-item-slider",children:(0,ee.Y)(qe.A,{label:P("NotificationsSound"),min:0,max:10,disabled:!p,value:l,onChange:I})})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0,children:P("AutodownloadPrivateChats")}),(0,ee.Y)(en.A,{label:P("NotificationsForPrivateChats"),subLabel:P(i?.users?.mutedUntil?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.users?.mutedUntil),onChange:f}),(0,ee.Y)(en.A,{label:P("MessagePreview"),disabled:!i?.users?.mutedUntil,subLabel:P(i?.users?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.users?.shouldShowPreviews),onChange:C})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0,children:P("FilterGroups")}),(0,ee.Y)(en.A,{label:P("NotificationsForGroups"),subLabel:P(i?.groups?.mutedUntil?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.groups?.mutedUntil),onChange:S}),(0,ee.Y)(en.A,{label:P("MessagePreview"),disabled:!i?.groups?.mutedUntil,subLabel:P(i?.groups?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.groups?.shouldShowPreviews),onChange:y})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0,children:P("FilterChannels")}),(0,ee.Y)(en.A,{label:P("NotificationsForChannels"),subLabel:P(i?.channels?.mutedUntil?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.channels?.mutedUntil),onChange:k}),(0,ee.Y)(en.A,{label:P("MessagePreview"),disabled:!i?.channels?.mutedUntil,subLabel:P(i?.channels?.shouldShowPreviews?"UserInfoNotificationsEnabled":"UserInfoNotificationsDisabled"),checked:Boolean(i?.channels?.shouldShowPreviews),onChange:w})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:P.isRtl?"rtl":void 0,children:P("PhoneOther")}),(0,ee.Y)(en.A,{label:P("ContactJoined"),checked:o,onChange:N})]})]})})));var Lh=i(20714),xh=i(22986);const Eh=["SettingsPerformanceSliderLow","SettingsPerformanceSliderMedium","SettingsPerformanceSliderHigh"],Vh=["SettingsPerformanceSliderLow","SettingsPerformanceSliderCustom","SettingsPerformanceSliderHigh"],_h=[["SettingsPerformanceInterfaceAnimations",[{key:"pageTransitions",label:"SettingsPerformancePageTransitions"},{key:"messageSendingAnimations",label:"SettingsPerformanceSending"},{key:"mediaViewerAnimations",label:"SettingsPerformanceMediaViewer"},{key:"messageComposerAnimations",label:"SettingsPerformanceComposer"},{key:"contextMenuAnimations",label:"SettingsPerformanceContextAnimation"},{key:"contextMenuBlur",label:"SettingsPerformanceContextBlur",disabled:!b.Fy},{key:"rightColumnAnimations",label:"SettingsPerformanceRightColumn"},{key:"snapEffect",label:"SettingsPerformanceThanos"}]],["SettingsPerformanceStickers",[{key:"animatedEmoji",label:"SettingsPerformanceAnimatedEmoji"},{key:"loopAnimatedStickers",label:"SettingsPerformanceLoopStickers"},{key:"reactionEffects",label:"SettingsPerformanceReactionEffects"},{key:"stickerEffects",label:"SettingsPerformanceStickerEffects"}]],["SettingsPerformanceMediaAutoplay",[{key:"autoplayGifs",label:"SettingsPerformanceAutoplayGif"},{key:"autoplayVideos",label:"SettingsPerformanceAutoplayVideo"}]]],Uh=(0,s.ph)((0,n.EK)((e=>({performanceSettings:(0,c.Cw0)(e)})))((function({isActive:e,performanceSettings:t,onReset:i}){const{setSharedSettingOption:o,updatePerformanceSettings:r}=(0,n.ko)();(0,fe.A)({isActive:e,onBack:i});const l=(0,Vi.A)(),[c,d]=(0,s.J0)({}),h=(0,s.Kr)((()=>_h.reduce(((e,[,i],s)=>(e[s]=i.every((({key:e})=>t[e])),e)),{})),[t]),m=(0,s.Kr)((()=>(0,xh.T)(t,Lh.LH)?a.zP3:(0,xh.T)(t,Lh.PI)?a.dnp:(0,xh.T)(t,Lh.PX)?a.zHL:a.M8B),[t]),u=(0,s.Kr)((()=>(m===a.M8B?Vh:Eh).map((e=>l(e)))),[m,l]),p=(0,s.hb)(((e,t)=>{e.preventDefault();const i=Number(t);d((e=>({...e,[i]:!e[i]})))}),[]),v=(0,s.hb)((e=>{const t=e===a.dnp?Lh.PI:e===a.zHL?Lh.PX:Lh.LH;o({animationLevel:e}),r(t)}),[]),g=(0,s.hb)((e=>{const{name:t,checked:i}=e.target,s=_h.find((([e])=>e===t));if(!s)return;const n=s[1].reduce(((e,{key:t})=>(e[t]=i,e)),{});r(n)}),[]),A=(0,s.hb)((e=>{const{name:t,checked:i}=e.target;r({[t]:i})}),[]);return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderTitle")}),(0,ee.Y)("p",{className:"settings-item-description",dir:l.isRtl?"rtl":void 0,children:l("SettingsPerformanceSliderSubtitle")}),(0,ee.Y)(qe.A,{options:u,value:m===a.M8B?a.zHL:m,onChange:v})]}),(0,ee.FD)("div",{className:"settings-item-simple settings-item__with-shifted-dropdown",children:[(0,ee.Y)("h3",{className:"settings-item-header",dir:"auto",children:"Resource-Intensive Processes"}),_h.map((([e,i],s)=>(0,ee.FD)("div",{className:"settings-dropdown-section",children:[(0,ee.Y)("div",{className:"ListItem with-checkbox",children:(0,ee.Y)(en.A,{name:e,value:s.toString(),checked:h[s],label:l(e),rightIcon:c[s]?"up":"down",onChange:g,onClickLabel:p})}),Boolean(c[s])&&(0,ee.Y)("div",{className:"DropdownList DropdownList--open",children:i.map((({key:e,label:i,disabled:s})=>{if("snapEffect"!==e||b.bW)return(0,ee.Y)(en.A,{name:e,checked:t[e],label:l(i),disabled:s,onChange:A},e)}))})]},e)))]})]})}))),Oh=(0,s.ph)((0,n.EK)((e=>{const{settings:{byKey:{hasPassword:t,isSensitiveEnabled:i,canChangeSensitive:s,shouldArchiveAndMuteNewNonContact:n,shouldNewNonContactPeersRequirePremium:o,nonContactPeersPaidStars:a},privacy:r,accountDaysTtl:l},blocked:d,passcode:{hasPasscode:h},appConfig:m}=e,{canDisplayChatInTitle:u}=(0,un.l)(e),p=Boolean(a),v=(0,c.trm)(e);return{isCurrentUserPremium:(0,c.g29)(e),hasPassword:t,hasPasscode:Boolean(h),blockedCount:d.totalCount,webAuthCount:e.activeWebSessions.orderedHashes.length,isSensitiveEnabled:i,canDisplayAutoarchiveSetting:Boolean(m?.canDisplayAutoarchiveSetting),shouldArchiveAndMuteNewNonContact:n,canChangeSensitive:s,shouldNewNonContactPeersRequirePremium:o,shouldChargeForMessages:p,needAgeVideoVerification:Boolean(m?.needAgeVideoVerification),privacy:r,canDisplayChatInTitle:u,canSetPasscode:(0,c.Ntz)(e),isCurrentUserFrozen:v,accountDaysTtl:l}}))((({isActive:e,isCurrentUserPremium:t,hasPassword:i,hasPasscode:r,blockedCount:l,webAuthCount:c,isSensitiveEnabled:d,canChangeSensitive:h,canDisplayAutoarchiveSetting:m,shouldArchiveAndMuteNewNonContact:u,shouldNewNonContactPeersRequirePremium:p,shouldChargeForMessages:v,canDisplayChatInTitle:g,canSetPasscode:A,needAgeVideoVerification:b,privacy:f,onReset:C,isCurrentUserFrozen:S,accountDaysTtl:y})=>{const{openDeleteAccountModal:k,loadPrivacySettings:w,loadBlockedUsers:N,updateContentSettings:I,loadGlobalPrivacySettings:P,updateGlobalPrivacySettings:Y,loadWebAuthorizations:F,setSharedSettingOption:T,openSettingsScreen:B,loadAccountDaysTtl:R,openAgeVerificationModal:L}=(0,n.ko)();(0,s.vJ)((()=>{S||(N(),w(),F())}),[S]),(0,s.vJ)((()=>{e&&!S&&(P(),R())}),[e,S,P]);const x=(0,M.A)(),E=(0,Vi.A)();(0,fe.A)({isActive:e,onBack:C});const V=(0,s.hb)((e=>{Y({shouldArchiveAndMuteNewNonContact:e})}),[Y]),_=(0,s.hb)((e=>{T({canDisplayChatInTitle:e})}),[]),U=(0,s.hb)((e=>{I({isSensitiveEnabled:e})}),[I]),O=(0,s.hb)((()=>{L()}),[L]),K=(0,D.A)((()=>{y&&k({days:y})})),J=(0,s.Kr)((()=>{if(y)return Wr(a.WF4,y/30).toString()}),[y]);function G(e){if(!e)return x("Loading");const{visibility:t,shouldAllowPremium:i,botsPrivacy:s}=e,n="everybody"===t,o="allow"===s&&!n,a=e.blockChatIds.length+e.blockUserIds.length,r=e.allowChatIds.length+e.allowUserIds.length,l=[];a&&l.push(`-${a}`),r&&!n&&l.push(`+${r}`);const c=[o?E("PrivacyValueBots"):"",E.conjunction(l)].filter(Boolean).join(" ");if(o&&!n)return c;if(i)return x(c?"ContactsAndPremium":"PrivacyPremium");switch(t){case"everybody":return`${x("P2PEverybody")} ${c}`;case"contacts":return`${x("P2PContacts")} ${c}`;case"nobody":return`${x("P2PNobody")} ${c}`}}return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.FD)(li.A,{icon:"delete-user",narrow:!0,onClick:()=>B({screen:o.VS.PrivacyBlockedUsers}),children:[x("BlockedUsers"),(0,ee.Y)("span",{className:"settings-item__current-value",children:l||""})]}),A&&(0,ee.Y)(li.A,{icon:"key",narrow:!0,onClick:()=>B({screen:r?o.VS.PasscodeEnabled:o.VS.PasscodeDisabled}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("Passcode")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:x(r?"PasswordOn":"PasswordOff")})]})}),(0,ee.Y)(li.A,{icon:"lock",narrow:!0,onClick:()=>B({screen:i?o.VS.TwoFaEnabled:o.VS.TwoFaDisabled}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("TwoStepVerification")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:x(i?"PasswordOn":"PasswordOff")})]})}),c>0&&(0,ee.FD)(li.A,{icon:"web",narrow:!0,onClick:()=>B({screen:o.VS.ActiveWebsites}),children:[x("PrivacySettings.WebSessions"),(0,ee.Y)("span",{className:"settings-item__current-value",children:c})]})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:x.isRtl?"rtl":void 0,children:x("PrivacyTitle")}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyPhoneNumber}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyPhoneTitle")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.phoneNumber)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyLastSeen}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("LastSeenTitle")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.lastSeen)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyProfilePhoto}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyProfilePhotoTitle")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.profilePhoto)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyBio}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyBio")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.bio)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyBirthday}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyBirthday")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.birthday)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyGifts}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:E("PrivacyGifts")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.gifts)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyForwarding}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyForwardsTitle")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.forwards)})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyPhoneCall}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("WhoCanCallMe")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.phoneCall)})]})}),(0,ee.Y)(li.A,{narrow:!0,allowDisabledClick:!0,rightElement:t&&(0,ee.Y)(Rd.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyVoiceMessages}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyVoiceMessagesTitle")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.voiceMessages)})]})}),(0,ee.Y)(li.A,{narrow:!0,rightElement:t&&(0,ee.Y)(Rd.A,{size:"big",type:"premium"}),className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyMessages}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("PrivacyMessagesTitle")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:v?E("PrivacyPaidMessagesValue"):x(p?"PrivacyMessagesContactsAndPremium":"P2PEverybody")})]})}),(0,ee.Y)(li.A,{narrow:!0,className:"no-icon",onClick:()=>B({screen:o.VS.PrivacyGroupChats}),children:(0,ee.FD)("div",{className:"multiline-item",children:[(0,ee.Y)("span",{className:"title",children:x("WhoCanAddMe")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:G(f.chatInvite)})]})})]}),h&&(0,ee.FD)("div",{className:"settings-item fluid-container",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:x.isRtl?"rtl":void 0,children:x("lng_settings_sensitive_title")}),(0,ee.Y)(en.A,{label:x("lng_settings_sensitive_disable_filtering"),subLabel:x("lng_settings_sensitive_about"),checked:Boolean(d),disabled:!h||!d&&b,onCheck:U}),!d&&b&&(0,ee.Y)(W.A,{color:"primary",fluid:!0,size:"smaller",noForcedUpperCase:!0,className:"settings-unlock-button",onClick:O,children:(0,ee.Y)("span",{className:"settings-unlock-button-title",children:E("ButtonAgeVerification")})})]}),m&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:x.isRtl?"rtl":void 0,children:x("NewChatsFromNonContacts")}),(0,ee.Y)(en.A,{label:x("ArchiveAndMute"),subLabel:x("ArchiveAndMuteInfo"),checked:Boolean(u),onCheck:V})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:x.isRtl?"rtl":void 0,children:x("lng_settings_window_system")}),(0,ee.Y)(en.A,{label:x("lng_settings_title_chat_name"),checked:Boolean(g),onCheck:_})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:x.isRtl?"rtl":void 0,children:E("DeleteMyAccount")}),(0,ee.FD)(li.A,{narrow:!0,onClick:K,children:[E("DeleteAccountIfAwayFor"),(0,ee.Y)("span",{className:"settings-item__current-value",children:E("Months",{count:J},{pluralValue:1})})]})]})]})}))),Kh=(0,s.ph)((0,n.EK)((e=>{const{users:{byId:t},blocked:{ids:i},contactList:s,currentUserId:n}=e;return{usersById:t,blockedIds:i,contactIds:s?.userIds,localContactIds:(0,c.nTw)(e).userSearch.localUserIds,currentUserId:n}}))((({usersById:e,blockedIds:t,contactIds:i,localContactIds:o,currentUserId:a,isOpen:r,onClose:c})=>{const{setUserSearchQuery:d,blockUser:h}=(0,n.ko)(),m=(0,M.A)(),[u,p]=(0,s.J0)("");(0,s.vJ)((()=>{d({query:u})}),[u,d]);const v=(0,s.Kr)((()=>{const s=(0,bi.Am)([...i||[],...o||[]].filter((e=>e!==a&&!t.includes(e))));return(0,Yt.PU)({ids:s,query:u,type:"user"}).sort(((t,i)=>{const s=(0,l.Yg)(e[t])||"",n=(0,l.Yg)(e[i])||"";return s.localeCompare(n)}))}),[t,i,a,u,o,e]),g=(0,s.hb)((e=>{h({userId:e}),c()}),[c]);return(0,ee.Y)(Us,{isOpen:r,chatOrUserIds:v,searchPlaceholder:m("BlockedUsers.BlockUser"),search:u,onSearchChange:p,onSelectChatOrUser:g,onClose:c})}))),Jh=(0,s.ph)((0,n.EK)((e=>{const{chats:{byId:t},users:{byId:i},blocked:{ids:s},countryList:{phoneCodes:n}}=e;return{chatsByIds:t,usersByIds:i,blockedIds:s,phoneCodeList:n}}))((({isActive:e,onReset:t,chatsByIds:i,usersByIds:o,blockedIds:r,phoneCodeList:c})=>{const{unblockUser:d}=(0,n.ko)(),h=(0,M.A)(),[m,p,v]=(0,Y.A)(),g=(0,s.hb)((e=>{d({userId:e})}),[d]);(0,fe.A)({isActive:e,onBack:t});const A=(0,s.Kr)((()=>r.reduce(((e,t)=>{const i=(0,u.L8)(t)?o[t]:void 0,s=i&&!i.phoneNumber&&(0,l.Kl)(i);return s&&(e[t]=s),e}),{})),[r,o]);return(0,ee.FD)("div",{className:"settings-fab-wrapper",children:[(0,ee.FD)("div",{className:"settings-content infinite-scroll",children:[(0,ee.Y)("div",{className:"settings-item no-border",children:(0,ee.Y)("p",{className:"settings-item-description-larger mt-0 mb-2",dir:h.isRtl?"rtl":void 0,children:h("BlockedUsersInfo")})}),(0,ee.Y)("div",{className:"chat-list custom-scroll",children:r?.length?(0,ee.Y)("div",{className:"scroll-container settings-item",children:r.map(((e,t)=>function(e,t){const s=(0,u.L8)(e),n=o[e],r=i[e],l=n||r,d=(0,me.A)("Chat chat-item-clickable blocked-list-item small-icon",s?"private":"group"),h=A[e];return(0,ee.FD)(li.A,{className:d,ripple:!0,narrow:!0,contextActions:[{title:"Unblock",icon:"unlock",handler:()=>{g(e)}}],style:`top: ${(0+t)*a.yq1}px;`,children:[(0,ee.Y)(Dt.A,{size:"medium",peer:l}),(0,ee.FD)("div",{className:"contact-info",dir:"auto",children:[l&&(0,ee.Y)(Ls.A,{peer:l}),n?.phoneNumber&&(0,ee.Y)("div",{className:"contact-phone",dir:"auto",children:(0,dn.Ox)(c,n.phoneNumber)}),h&&(0,ee.FD)("div",{className:"contact-username",dir:"auto",children:["@",h]})]})]},`blocked_${e}`)}(e,t)))}):r&&!r.length?(0,ee.Y)("div",{className:"no-results",dir:"auto",children:h("NoBlocked")}):(0,ee.Y)(Rs.A,{},"loading")})]}),(0,ee.Y)(ki.A,{isShown:!0,className:"block-user-button",onClick:p,ariaLabel:h("BlockContact"),children:(0,ee.Y)(q.A,{name:"add"})}),(0,ee.Y)(Kh,{isOpen:m,onClose:v})]})})));function Gh(e){switch(e){case o.VS.PrivacyPhoneNumber:case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyPhoneNumberDeniedContacts:return"phoneNumber";case o.VS.PrivacyLastSeen:case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyLastSeenDeniedContacts:return"lastSeen";case o.VS.PrivacyProfilePhoto:case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:return"profilePhoto";case o.VS.PrivacyBio:case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyBioDeniedContacts:return"bio";case o.VS.PrivacyBirthday:case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyBirthdayDeniedContacts:return"birthday";case o.VS.PrivacyGifts:case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyGiftsDeniedContacts:return"gifts";case o.VS.PrivacyForwarding:case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyForwardingDeniedContacts:return"forwards";case o.VS.PrivacyVoiceMessages:case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:return"voiceMessages";case o.VS.PrivacyGroupChats:case o.VS.PrivacyGroupChatsAllowedContacts:case o.VS.PrivacyGroupChatsDeniedContacts:return"chatInvite";case o.VS.PrivacyPhoneCall:case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:return"phoneCall";case o.VS.PrivacyPhoneP2P:case o.VS.PrivacyPhoneP2PAllowedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:return"phoneP2P";case o.VS.PrivacyAddByPhone:return"addByPhone";case o.VS.PrivacyNoPaidMessages:return"noPaidMessages"}}const jh=(0,s.ph)((0,n.EK)((e=>{const{settings:{byKey:{disallowedGifts:t}}}=e;return{disallowedGifts:t,isCurrentUserPremium:(0,c.g29)(e)}}))((({disallowedGifts:e,isCurrentUserPremium:t})=>{const{showNotification:i,updateGlobalPrivacySettings:s}=(0,n.ko)(),o=(0,Vi.A)(),a=(0,D.A)((()=>{i({message:o("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})})),r=(0,D.A)((()=>{t?s({disallowedGifts:{...e,shouldDisallowLimitedStarGifts:!e?.shouldDisallowLimitedStarGifts||void 0}}):a()})),l=(0,D.A)((()=>{t?s({disallowedGifts:{...e,shouldDisallowUnlimitedStarGifts:!e?.shouldDisallowUnlimitedStarGifts||void 0}}):a()})),c=(0,D.A)((()=>{t?s({disallowedGifts:{...e,shouldDisallowUniqueStarGifts:!e?.shouldDisallowUniqueStarGifts||void 0}}):a()})),d=(0,D.A)((()=>{t?s({disallowedGifts:{...e,shouldDisallowPremiumGifts:!e?.shouldDisallowPremiumGifts||void 0}}):a()}));return(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:o.isRtl?"rtl":void 0,children:o("PrivacyAcceptedGiftTitle")}),(0,ee.FD)(li.A,{onClick:r,children:[(0,ee.Y)("span",{children:o("PrivacyGiftLimitedEdition")}),(0,ee.Y)(Ai.A,{id:"limited_edition",label:o(e?.shouldDisallowLimitedStarGifts?"PrivacyDisableLimitedEditionStarGifts":"PrivacyEnableLimitedEditionStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowLimitedStarGifts})]}),(0,ee.FD)(li.A,{onClick:l,children:[(0,ee.Y)("span",{children:o("PrivacyGiftUnlimited")}),(0,ee.Y)(Ai.A,{id:"unlimited",label:o(e?.shouldDisallowUnlimitedStarGifts?"PrivacyDisableUnlimitedStarGifts":"PrivacyEnableUnlimitedStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowUnlimitedStarGifts})]}),(0,ee.FD)(li.A,{onClick:c,children:[(0,ee.Y)("span",{children:o("PrivacyGiftUnique")}),(0,ee.Y)(Ai.A,{id:"unique",label:o(e?.shouldDisallowUniqueStarGifts?"PrivacyDisableUniqueStarGifts":"PrivacyEnableUniqueStarGifts"),disabled:!t,checked:!t||!e?.shouldDisallowUniqueStarGifts})]}),(0,ee.FD)(li.A,{onClick:d,children:[(0,ee.Y)("span",{children:o("PrivacyGiftPremiumSubscription")}),(0,ee.Y)(Ai.A,{id:"premium_subscription",label:o(e?.shouldDisallowPremiumGifts?"PrivacyDisablePremiumGifts":"PrivacyEnablePremiumGifts"),disabled:!t,checked:!t||!e?.shouldDisallowPremiumGifts})]}),(0,ee.Y)("p",{className:"settings-item-description-larger",dir:o.isRtl?"rtl":void 0,children:o("PrivacyAcceptedGiftInfo")})]})}))),zh=(0,s.ph)((0,n.EK)((e=>({isCurrentUserPremium:(0,c.g29)(e),shouldHideReadMarks:Boolean((0,c.KIM)(e))})))((({isCurrentUserPremium:e,shouldHideReadMarks:t,visibility:i})=>{const{updateGlobalPrivacySettings:s,openPremiumModal:o}=(0,n.ko)(),a=(0,M.A)(),r="nobody"===i||"contacts"===i,l=(0,D.A)((e=>s({shouldHideReadMarks:e}))),c=(0,D.A)((()=>{o({initialSection:"last_seen"})}));return(0,ee.FD)(ee.FK,{children:[r&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(en.A,{label:a("HideReadTime"),checked:t,onCheck:l}),(0,ee.Y)("p",{className:"settings-item-description-larger",dir:a.isRtl?"rtl":void 0,children:(0,Ft.A)(a("HideReadTimeInfo"),["br"])})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{leftElement:(0,ee.Y)(Rd.A,{className:"icon ListItem-main-icon",type:"premium",size:"big"}),onClick:c,children:a(e?"PrivacyLastSeenPremiumForPremium":"PrivacyLastSeenPremium")}),(0,ee.Y)("p",{className:"settings-item-description-larger premium-info",dir:a.isRtl?"rtl":void 0,children:a(e?"PrivacyLastSeenPremiumInfoForPremium":"PrivacyLastSeenPremiumInfo")})]})]})})));var Hh=i(91356);const $h=(0,s.ph)((({currentUserId:e,hasCurrentUserFullInfo:t,currentUserFallbackPhoto:i})=>{const{loadFullUser:o,uploadProfilePhoto:a,deleteProfilePhoto:r,showNotification:l}=(0,n.ko)(),c=(0,M.A)(),[d,h,m]=(0,Y.A)(!1),u=(0,s.li)();(0,s.vJ)((()=>{t||o({userId:e})}),[t,e,o]);const p=(0,s.hb)((e=>{a({file:e,isFallback:!0}),l({message:c("Privacy.ProfilePhoto.PublicPhotoSuccess")})}),[c,l,a]),v=(0,s.hb)((()=>{m(),r({photo:i})}),[m,r,i]),g=(0,s.hb)((()=>{u.current?.click()}),[]);return(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.FD)(li.A,{narrow:!0,icon:"camera-add",onClick:g,children:[(0,ee.Y)(Hh.A,{onChange:p,inputRef:u}),c(i?"Privacy.ProfilePhoto.UpdatePublicPhoto":"Privacy.ProfilePhoto.SetPublicPhoto")]}),i&&(0,ee.FD)(li.A,{narrow:!0,leftElement:(0,ee.Y)(Dt.A,{photo:i,size:"mini",className:"Qvhl9Jjv"}),onClick:h,destructive:!0,children:[c(i.isVideo?"Privacy.ProfilePhoto.RemovePublicVideo":"Privacy.ProfilePhoto.RemovePublicPhoto"),(0,ee.Y)(pi.A,{isOpen:d,onClose:m,text:c("Privacy.ResetPhoto.Confirm"),confirmLabel:c("Delete"),confirmHandler:v,confirmIsDestructive:!0})]}),(0,ee.Y)("p",{className:"settings-item-description-larger",dir:c.isRtl?"rtl":void 0,children:c("Privacy.ProfilePhoto.PublicPhotoInfo")})]})}));function qh({screen:e,privacy:t,isPremiumRequired:i}){const{setPrivacyVisibility:a,openSettingsScreen:r}=(0,n.ko)(),l=(0,M.A)(),c=(0,Vi.A)(),d=(0,s.Kr)((()=>{const t=e!==o.VS.PrivacyAddByPhone,s=[{value:"everybody",label:l("P2PEverybody")},{value:"contacts",label:i?(0,ee.Y)(xd,{label:l("P2PContacts")}):l("P2PContacts"),hidden:i}];return t&&s.push({value:"nobody",label:i?(0,ee.Y)(xd,{label:l("P2PNobody")}):l("P2PNobody"),hidden:i}),s}),[l,e,i]),h=(0,s.Kr)((()=>e===o.VS.PrivacyAddByPhone?{shouldShowDenied:!1,shouldShowAllowed:!1}:{shouldShowDenied:"nobody"!==t?.visibility,shouldShowAllowed:"everybody"!==t?.visibility}),[t,e]),m=Gh(e),u=(0,s.Kr)((()=>{switch(e){case o.VS.PrivacyGifts:return c("PrivacyGiftsInfo");case o.VS.PrivacyLastSeen:return l("CustomHelp");case o.VS.PrivacyAddByPhone:return l("everybody"===t?.visibility?"PrivacyPhoneInfo":"PrivacyPhoneInfo3");case o.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesInfo");default:return}}),[l,c,e,t]),p=(0,s.Kr)((()=>{switch(e){case o.VS.PrivacyPhoneNumber:return l("PrivacyPhoneTitle");case o.VS.PrivacyAddByPhone:return l("PrivacyPhoneTitle2");case o.VS.PrivacyLastSeen:return l("LastSeenTitle");case o.VS.PrivacyProfilePhoto:return l("PrivacyProfilePhotoTitle");case o.VS.PrivacyBio:return l("PrivacyBioTitle");case o.VS.PrivacyBirthday:return l("PrivacyBirthdayTitle");case o.VS.PrivacyGifts:return c("PrivacyGiftsTitle");case o.VS.PrivacyForwarding:return l("PrivacyForwardsTitle");case o.VS.PrivacyVoiceMessages:return l("PrivacyVoiceMessagesTitle");case o.VS.PrivacyGroupChats:return l("WhoCanAddMe");case o.VS.PrivacyPhoneCall:return l("WhoCanCallMe");case o.VS.PrivacyPhoneP2P:return l("PrivacyP2P");default:return}}),[l,c,e]),v=(0,D.A)(((e,t,i,s)=>{const n=e?.length||0,o=t?.length||0,a="allow"===s;if(!n&&!o&&!a)return l(i?"PrivacyPremium":"EditAdminAddUsers");if(i)return l("ContactsAndPremium");const r=n>0?l("Users",n):void 0,d=o>0?l("Chats",o):void 0;return[a?c("PrivacyValueBots"):"",c.conjunction([r,d].filter(Boolean))].filter(Boolean).join(" ")})),g=(0,s.Kr)((()=>v(t?.allowUserIds,t?.allowChatIds,t?.shouldAllowPremium,t?.botsPrivacy)),[t]),A=(0,s.Kr)((()=>v(t?.blockUserIds,t?.blockChatIds)),[t]),b=(0,s.hb)((e=>{a({privacyKey:m,visibility:e})}),[m]),f=(()=>{switch(e){case o.VS.PrivacyPhoneNumber:return o.VS.PrivacyPhoneNumberAllowedContacts;case o.VS.PrivacyLastSeen:return o.VS.PrivacyLastSeenAllowedContacts;case o.VS.PrivacyProfilePhoto:return o.VS.PrivacyProfilePhotoAllowedContacts;case o.VS.PrivacyBio:return o.VS.PrivacyBioAllowedContacts;case o.VS.PrivacyBirthday:return o.VS.PrivacyBirthdayAllowedContacts;case o.VS.PrivacyGifts:return o.VS.PrivacyGiftsAllowedContacts;case o.VS.PrivacyForwarding:return o.VS.PrivacyForwardingAllowedContacts;case o.VS.PrivacyPhoneCall:return o.VS.PrivacyPhoneCallAllowedContacts;case o.VS.PrivacyPhoneP2P:return o.VS.PrivacyPhoneP2PAllowedContacts;case o.VS.PrivacyVoiceMessages:return o.VS.PrivacyVoiceMessagesAllowedContacts;default:return o.VS.PrivacyGroupChatsAllowedContacts}})(),C=(()=>{switch(e){case o.VS.PrivacyPhoneNumber:return o.VS.PrivacyPhoneNumberDeniedContacts;case o.VS.PrivacyLastSeen:return o.VS.PrivacyLastSeenDeniedContacts;case o.VS.PrivacyProfilePhoto:return o.VS.PrivacyProfilePhotoDeniedContacts;case o.VS.PrivacyBio:return o.VS.PrivacyBioDeniedContacts;case o.VS.PrivacyBirthday:return o.VS.PrivacyBirthdayDeniedContacts;case o.VS.PrivacyGifts:return o.VS.PrivacyGiftsDeniedContacts;case o.VS.PrivacyForwarding:return o.VS.PrivacyForwardingDeniedContacts;case o.VS.PrivacyPhoneCall:return o.VS.PrivacyPhoneCallDeniedContacts;case o.VS.PrivacyPhoneP2P:return o.VS.PrivacyPhoneP2PDeniedContacts;case o.VS.PrivacyVoiceMessages:return o.VS.PrivacyVoiceMessagesDeniedContacts;default:return o.VS.PrivacyGroupChatsDeniedContacts}})();return(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:p}),(0,ee.Y)(X.A,{name:`visibility-${m}`,options:d,onChange:b,selected:t?.visibility}),u&&(0,ee.Y)("p",{className:"settings-item-description-larger",dir:l.isRtl?"rtl":void 0,children:u})]}),!i&&(h.shouldShowAllowed||h.shouldShowDenied)&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:l.isRtl?"rtl":void 0,children:l("PrivacyExceptions")}),h.shouldShowAllowed&&(0,ee.Y)(li.A,{narrow:!0,icon:"add-user",onClick:()=>{r({screen:f})},children:(0,ee.FD)("div",{className:"multiline-item full-size",children:[(0,ee.Y)("span",{className:"title",children:l("AlwaysAllow")}),(0,ee.Y)("span",{className:"subtitle",children:g})]})}),h.shouldShowDenied&&(0,ee.Y)(li.A,{narrow:!0,icon:"delete-user",onClick:()=>{r({screen:C})},children:(0,ee.FD)("div",{className:"multiline-item full-size",children:[(0,ee.Y)("span",{className:"title",children:l("NeverAllow")}),(0,ee.Y)("span",{className:"subtitle",children:A})]})})]}),i&&(0,ee.Y)(Ld,{})]})}const Wh=(0,s.ph)((0,n.EK)(((e,{screen:t})=>{let i,s;const{currentUserId:n,settings:{privacy:a,byKey:{shouldDisplayGiftsButton:r}}}=e,l=(0,c.vGo)(e,n);switch(t){case o.VS.PrivacyPhoneNumber:i=a.phoneNumber,s=a.addByPhone;break;case o.VS.PrivacyLastSeen:i=a.lastSeen;break;case o.VS.PrivacyProfilePhoto:i=a.profilePhoto;break;case o.VS.PrivacyBio:i=a.bio;break;case o.VS.PrivacyBirthday:i=a.birthday;break;case o.VS.PrivacyGifts:i=a.gifts;break;case o.VS.PrivacyPhoneP2P:case o.VS.PrivacyPhoneCall:i=a.phoneCall,s=a.phoneP2P;break;case o.VS.PrivacyForwarding:i=a.forwards;break;case o.VS.PrivacyVoiceMessages:i=a.voiceMessages;break;case o.VS.PrivacyGroupChats:i=a.chatInvite}return i?{primaryPrivacy:i,secondaryPrivacy:s,currentUserId:n,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto,isPremiumRequired:t===o.VS.PrivacyVoiceMessages&&!(0,c.g29)(e),shouldDisplayGiftsButton:r,isCurrentUserPremium:(0,c.g29)(e)}:{currentUserId:n,hasCurrentUserFullInfo:Boolean(l),currentUserFallbackPhoto:l?.fallbackPhoto}}))((({screen:e,isActive:t,primaryPrivacy:i,secondaryPrivacy:a,currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c,isPremiumRequired:d,onReset:h,shouldDisplayGiftsButton:m,isCurrentUserPremium:u})=>{const{updateGlobalPrivacySettings:p,showNotification:v}=(0,n.ko)(),g=(0,Vi.A)();(0,fe.A)({isActive:t,onBack:h});const A=(0,D.A)((()=>{u?p({shouldDisplayGiftsButton:!m}):v({message:g("PrivacySubscribeToTelegramPremium"),action:{action:"openPremiumModal",payload:{}},actionText:{key:"Open"},icon:"star"})})),b=(0,s.Kr)((()=>{switch(e){case o.VS.PrivacyPhoneCall:return o.VS.PrivacyPhoneP2P;case o.VS.PrivacyPhoneNumber:return"nobody"===i?.visibility?o.VS.PrivacyAddByPhone:void 0;default:return}}),[i,e]);return(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[e===o.VS.PrivacyGifts&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.FD)(li.A,{onClick:A,children:[(0,ee.Y)("span",{children:g("PrivacyDisplayGiftsButton")}),(0,ee.Y)(Ai.A,{id:"gift",disabled:!u,label:g(m?"HideGiftsButton":"DisplayGiftsButton"),checked:m})]}),(0,ee.Y)("p",{className:"settings-item-description-larger",dir:g.isRtl?"rtl":void 0,children:g("PrivacyDisplayGiftIconInChats",{icon:(0,ee.Y)(q.A,{name:"gift",className:"gift-icon"}),gift:g("PrivacyDisplayGift")},{withNodes:!0})})]}),(0,ee.Y)(qh,{screen:e,privacy:i,isPremiumRequired:d}),e===o.VS.PrivacyProfilePhoto&&"everybody"!==i?.visibility&&(0,ee.Y)($h,{currentUserId:r,hasCurrentUserFullInfo:l,currentUserFallbackPhoto:c}),e===o.VS.PrivacyLastSeen&&(0,ee.Y)(zh,{visibility:i?.visibility}),e===o.VS.PrivacyGifts&&(0,ee.Y)(jh,{}),Boolean(b)&&(0,ee.Y)(qh,{screen:b,privacy:a})]})}))),Qh=[cd.lw];function Zh(e,t){const{privacy:i}=e.settings;switch(t){case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyPhoneNumberDeniedContacts:return i.phoneNumber;case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyLastSeenDeniedContacts:return i.lastSeen;case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:return i.profilePhoto;case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyBioDeniedContacts:return i.bio;case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyBirthdayDeniedContacts:return i.birthday;case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyGiftsDeniedContacts:return i.gifts;case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:return i.phoneCall;case o.VS.PrivacyPhoneP2PAllowedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:return i.phoneP2P;case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyForwardingDeniedContacts:return i.forwards;case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:return i.voiceMessages;case o.VS.PrivacyGroupChatsDeniedContacts:case o.VS.PrivacyGroupChatsAllowedContacts:return i.chatInvite;case o.VS.PrivacyNoPaidMessages:return i.noPaidMessages}}const Xh=(0,s.ph)((0,n.EK)(((e,{screen:t})=>({currentUserId:e.currentUserId,settings:Zh(e,t)})))((({isAllowList:e,withPremiumCategory:t,withMiniAppsCategory:i,screen:o,isActive:r,currentUserId:c,settings:d,usersOnly:h=!1,onReset:m})=>{const{setPrivacySettings:u}=(0,n.ko)(),p=(0,M.A)(),v=(0,Vi.A)(),g=(0,s.Kr)((()=>({isCustomPeer:!0,type:"bots",title:v("PrivacyValueBots"),avatarIcon:"bots",isAvatarSquare:!0,peerColorId:6})),[v]),A=(0,s.Kr)((()=>[g]),[g]),b=(0,s.Kr)((()=>d?e?[...d.allowUserIds,...d.allowChatIds]:[...d.blockUserIds,...d.blockChatIds]:[]),[e,d]),f=(0,s.Kr)((()=>d?d.shouldAllowPremium?[cd.lw.type]:"allow"===d.botsPrivacy&&e?[g.type]:[]:[]),[d,e,g]),[C,S]=(0,s.J0)(""),[y,k]=(0,s.J0)(!1),[w,N]=(0,s.J0)(b),[I,P]=(0,s.J0)(f);(0,s.vJ)((()=>{r||(N(b),P(f))}),[r,f,b]);const Y=(0,dd.Rh)(a.DSF),F=(0,dd.Rh)(a._E9),D=(0,s.Kr)((()=>{const e=(0,n.mS)().chats.byId,t=(0,n.mS)().users.byId,i=(0,bi.Am)([...Y||[],...F||[]]).filter((i=>{const s=e[i],n=t[i],o=n&&(0,l.PL)(n),r=s&&(0,l.WX)(s);return(!h||n)&&i!==c&&i!==a.zv8&&!r&&!o})),s=(0,Yt.PU)({ids:i,query:C});return C?s:(0,bi.Am)([...b,...i])}),[Y,F,b,C,c,h]),T=(0,s.hb)((e=>{P(e),k(!0)}),[]),B=(0,s.hb)((e=>{N(e),k(!0)}),[]),R=(0,s.hb)((()=>{u({privacyKey:Gh(o),isAllowList:Boolean(e),updatedIds:w,isPremiumAllowed:I.includes(cd.lw.type)||void 0,botsPrivacy:i?I.includes(g.type)?"allow":"disallow":"none"}),m()}),[e,i,I,w,m,o,g]);return(0,fe.A)({isActive:r,onBack:m}),(0,ee.FD)("div",{className:"NewChat-inner step-1",children:[(0,ee.Y)(Ci.A,{categories:t?Qh:i&&e?A:void 0,itemIds:D||[],selectedIds:w,selectedCategories:I,filterValue:C,filterPlaceholder:p(e?"AlwaysAllowPlaceholder":"NeverAllowPlaceholder"),categoryPlaceholderKey:"PrivacyUserTypes",searchInputId:"new-group-picker-search",isSearchable:!0,onSelectedIdsChange:B,onSelectedCategoriesChange:T,onFilterChange:S,allowMultiple:!0,itemInputType:"checkbox",withDefaultPadding:!0,withStatus:!0}),(0,ee.Y)(ki.A,{isShown:y,onClick:R,ariaLabel:p(e?"AlwaysAllow":"NeverAllow"),children:(0,ee.Y)(q.A,{name:"check"})})]})}))),em=(0,s.ph)((0,n.EK)((e=>{const{config:t,reactions:i}=e;return{availableReactions:i.availableReactions,selectedReaction:t?.defaultReaction}}))((({isActive:e,availableReactions:t,selectedReaction:i,onReset:o})=>{const{setDefaultReaction:a}=(0,n.ko)();(0,fe.A)({isActive:e,onBack:o});const r=(0,s.Kr)((()=>(t||[]).filter((e=>!e.isInactive)).map((e=>({label:(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(ks.A,{reaction:e.reaction,availableReactions:t}),e.title]}),value:e.reaction.emoticon})))),[t]),l=(0,s.hb)((e=>{a({reaction:{type:"emoji",emoticon:e}})}),[a]);return(0,ee.Y)("div",{className:"settings-content settings-item custom-scroll settings-quick-reaction",children:(0,ee.Y)(X.A,{name:"quick-reaction-settings",options:r,selected:i,onChange:l,withIcon:!0})})}))),tm=1.5*p.$,im=(0,s.ph)((0,n.EK)((e=>({...(0,bi.Up)(e.settings.byKey,["shouldSuggestStickers","shouldUpdateStickerSetOrder"]),addedSetIds:e.stickers.added.setIds,customEmojiSetIds:e.customEmojis.added.setIds,stickerSetsById:e.stickers.setsById,defaultReaction:e.config?.defaultReaction,availableReactions:e.reactions.availableReactions,canPlayAnimatedEmojis:(0,c.BWX)(e)})))((({isActive:e,addedSetIds:t,customEmojiSetIds:i,stickerSetsById:a,defaultReaction:r,shouldSuggestStickers:l,shouldUpdateStickerSetOrder:c,availableReactions:d,canPlayAnimatedEmojis:h,onReset:m})=>{const{setSettingOption:u,openStickerSet:p,openSettingsScreen:v}=(0,n.ko)(),g=(0,M.A)(),A=(0,s.li)(),{observe:b}=(0,or.BL)({rootRef:A}),f=(0,s.hb)((e=>{p({stickerSetInfo:e.stickerSetInfo})}),[p]),C=(0,s.hb)((e=>{u({shouldUpdateStickerSetOrder:e})}),[u]),S=(0,s.hb)((e=>{u({shouldSuggestStickers:e})}),[u]),y=(0,s.Kr)((()=>t&&Object.values((0,bi.Up)(a,t))),[t,a]);return(0,fe.A)({isActive:e,onBack:m}),(0,ee.FD)("div",{className:"settings-content custom-scroll",children:[(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(en.A,{label:g("SuggestStickers"),checked:l,onCheck:S}),(0,ee.FD)(li.A,{narrow:!0,onClick:()=>v({screen:o.VS.CustomEmoji}),icon:"smile",children:[g("StickersList.EmojiItem"),i&&(0,ee.Y)("span",{className:"settings-item__current-value",children:i.length})]}),r&&(0,ee.FD)(li.A,{className:"SettingsDefaultReaction",narrow:!0,onClick:()=>v({screen:o.VS.QuickReaction}),children:[(0,ee.Y)(ks.A,{reaction:r,className:"current-default-reaction",size:tm,availableReactions:d}),(0,ee.Y)("div",{className:"title",children:g("DoubleTapSetting")})]})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("InstalledStickers.DynamicPackOrder")}),(0,ee.Y)(en.A,{label:g("InstalledStickers.DynamicPackOrder"),checked:c,onCheck:C}),(0,ee.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:g("InstalledStickers.DynamicPackOrderInfo")})]}),y&&(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)("h4",{className:"settings-item-header",dir:g.isRtl?"rtl":void 0,children:g("ChooseStickerMyStickerSets")}),(0,ee.Y)("div",{ref:A,children:y.map((e=>(0,ee.Y)($d,{stickerSet:e,observeIntersection:b,onClick:f,noPlay:!h},e.id)))}),(0,ee.Y)("p",{className:"settings-item-description mt-3",dir:"auto",children:(0,Ft.A)(g("StickersBotInfo"),["links"])})]})]})}))),sm=(0,s.ph)((({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,M.A)(),r=(0,D.A)((()=>{i({screen:o.VS.Privacy})}));return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(bd.A,{size:a.r2x,tgsUrl:Cr.w.Congratulations,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("TwoStepVerificationPasswordSetInfo")})]}),(0,ee.Y)("div",{className:"settings-item settings-group",children:(0,ee.Y)(W.A,{onClick:r,children:s("TwoStepVerificationPasswordReturnSettings")})})]})}));var nm=i(79577);const om=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e).recoveryEmail;return{animatedEmoji:(0,c.oei)(e,"💌"),codeLength:e.twoFaSettings.waitingEmailCodeLength,recoveryEmail:t}}))((({animatedEmoji:e,codeLength:t,isLoading:i,error:n,clearError:o,onSubmit:a,isActive:r,onReset:l,recoveryEmail:c})=>{const d=(0,s.li)(),{isMobile:h}=(0,I.Ay)(),m=h?550:400,[u,p]=(0,s.J0)("");(0,s.vJ)((()=>{b.TF||setTimeout((()=>{d.current.focus()}),m)}),[m]);const v=(0,M.A)();(0,fe.A)({isActive:r,onBack:l});const g=(0,s.hb)((e=>{n&&o&&o();const i=e.target.value.slice(0,t);i.length===t&&a(i),p(i),e.target.value=i}),[o,t,n,a]);return(0,ee.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(nm.A,{sticker:e,size:160,className:"settings-content-icon"}),c&&(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:v("TwoStepAuth.ConfirmEmailDescription",c)})]}),(0,ee.FD)("div",{className:"settings-item settings-group",children:[(0,ee.Y)(Q.A,{value:u,ref:d,inputMode:"decimal",label:v("YourEmailCode"),error:n,onChange:g}),i&&(0,ee.Y)(Rs.A,{})]})]})}))),am=(0,s.ph)((({isActive:e,onReset:t})=>{const{openSettingsScreen:i}=(0,n.ko)(),s=(0,M.A)();return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Lock,previewUrl:Nd,size:160,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:(0,Ft.A)(s("EnabledPasswordText"),["br"])})]}),(0,ee.FD)("div",{className:"settings-item",children:[(0,ee.Y)(li.A,{icon:"edit",onClick:()=>i({screen:o.VS.TwoFaChangePasswordCurrent}),children:s("ChangePassword")}),(0,ee.Y)(li.A,{icon:"password-off",onClick:()=>i({screen:o.VS.TwoFaTurnOff}),children:s("TurnPasswordOff")}),(0,ee.Y)(li.A,{icon:"email",onClick:()=>i({screen:o.VS.TwoFaRecoveryEmailCurrentPassword}),children:s("SetRecoveryEmail")})]})]})})),rm=(0,s.ph)((0,n.EK)(((e,{icon:t})=>({animatedEmoji:(0,c.oei)(e,"email"===t?"💌":"💡")})))((({animatedEmoji:e,type:t="text",isLoading:i,error:n,placeholder:o,shouldConfirm:a,clearError:r,onSubmit:l,isActive:c,onReset:d})=>{const h=(0,s.li)(),{isMobile:m}=(0,I.Ay)(),u=m?550:400,[p,v]=(0,s.J0)(""),[g,A,f]=(0,Y.A)(!1);(0,s.vJ)((()=>{b.TF||setTimeout((()=>{h.current.focus()}),u)}),[u]);const C=(0,s.hb)((e=>{n&&r&&r(),v(e.target.value)}),[r,n]),S=(0,s.hb)((()=>{l()}),[l]),y=(0,s.hb)((()=>{f(),l()}),[l,f]),k=(0,M.A)();return(0,fe.A)({isActive:c,onBack:d}),(0,ee.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(nm.A,{sticker:e,size:160,className:"settings-content-icon"}),"email"===t&&(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:k("RecoveryEmailSubtitle")})]}),(0,ee.FD)("div",{className:"settings-item settings-group",children:[(0,ee.FD)("form",{action:"",onSubmit:e=>{e.preventDefault(),h.current&&l(p)},children:[(0,ee.Y)(Q.A,{ref:h,value:p,inputMode:t,label:o,error:n,onChange:C}),p?(0,ee.Y)(W.A,{type:"submit",isLoading:i,ripple:!0,children:k("Continue")}):(0,ee.Y)(W.A,{isText:!0,isLoading:i,ripple:!0,onClick:a?A:S,children:k("YourEmailSkip")})]}),a&&(0,ee.FD)(Z.A,{className:"narrow",isOpen:g,title:k("YourEmailSkipWarning"),onClose:f,children:[(0,Ft.A)(k("YourEmailSkipWarningText"),["br","simple_markdown"]),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{color:"danger",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:y,children:k("YourEmailSkip")}),(0,ee.Y)(W.A,{color:"primary",ripple:!0,isText:!0,className:"confirm-dialog-button",onClick:f,children:k("Cancel")})]})]})]})]})}))),lm=(0,s.ph)((({isActive:e,onReset:t,onStart:i})=>{const s=(0,M.A)();return(0,fe.A)({isActive:e,onBack:t}),(0,ee.FD)("div",{className:"settings-content two-fa custom-scroll",children:[(0,ee.FD)("div",{className:"settings-content-header no-border",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Lock,previewUrl:Nd,size:160,className:"settings-content-icon"}),(0,ee.Y)("p",{className:"settings-item-description mb-3",dir:"auto",children:s("SetAdditionalPasswordInfo")})]}),(0,ee.Y)("div",{className:"settings-item settings-group",children:(0,ee.Y)(W.A,{onClick:i,children:s("EditAdminTransferSetPassword")})})]})})),cm=(0,s.ph)((0,n.EK)((e=>({...e.twoFaSettings})))((({currentScreen:e,shownScreen:t,state:i,hint:a,isLoading:r,errorKey:l,waitingEmailCodeLength:c,dispatch:d,isActive:h,onReset:m})=>{const{updatePassword:u,checkPassword:p,clearTwoFaError:v,updateRecoveryEmail:g,provideTwoFaEmailCode:A,clearPassword:b,openSettingsScreen:f}=(0,n.ko)(),C=(0,Vi.A)(),S=(0,M.A)();(0,s.vJ)((()=>{c&&(e===o.VS.TwoFaNewPasswordEmail?f({screen:o.VS.TwoFaNewPasswordEmailCode}):e===o.VS.TwoFaRecoveryEmail&&f({screen:o.VS.TwoFaRecoveryEmailCode}))}),[e,c,f]);const y=(0,s.hb)((()=>{d({type:"reset"}),f({screen:o.VS.TwoFaNewPassword})}),[d,f]),k=(0,s.hb)((e=>{d({type:"setPassword",payload:e}),f({screen:o.VS.TwoFaNewPasswordConfirm})}),[d,f]),w=(0,s.hb)((()=>{f({screen:o.VS.TwoFaNewPasswordHint})}),[f]),N=(0,s.hb)((e=>{d({type:"setHint",payload:e}),f({screen:o.VS.TwoFaNewPasswordEmail})}),[d,f]),I=(0,s.hb)((e=>{d({type:"setEmail",payload:e}),u({...i,email:e,onSuccess:()=>{f({screen:o.VS.TwoFaCongratulations})}})}),[d,i,u,f]),P=(0,s.hb)((e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{f({screen:o.VS.TwoFaChangePasswordNew})}})}),[p,d,f]),Y=(0,s.hb)((e=>{d({type:"setPassword",payload:e}),f({screen:o.VS.TwoFaChangePasswordConfirm})}),[d,f]),F=(0,s.hb)((()=>{f({screen:o.VS.TwoFaChangePasswordHint})}),[f]),D=(0,s.hb)((e=>{d({type:"setHint",payload:e}),u({...i,hint:e,onSuccess:()=>{f({screen:o.VS.TwoFaCongratulations})}})}),[d,i,u,f]),T=(0,s.hb)((e=>{b({currentPassword:e,onSuccess:()=>{f({screen:o.VS.Privacy})}})}),[b,f]),B=(0,s.hb)((e=>{d({type:"setCurrentPassword",payload:e}),p({currentPassword:e,onSuccess:()=>{f({screen:o.VS.TwoFaRecoveryEmail})}})}),[p,d,f]),R=(0,s.hb)((e=>{d({type:"setEmail",payload:e}),g({...i,email:e,onSuccess:()=>{f({screen:o.VS.TwoFaCongratulations})}})}),[d,i,g,f]),L=(0,s.hb)((e=>{A({code:e})}),[A]);switch(e){case o.VS.TwoFaDisabled:return(0,ee.Y)(lm,{onStart:y,isActive:h||[o.VS.TwoFaNewPassword,o.VS.TwoFaNewPasswordConfirm,o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaNewPassword:return(0,ee.Y)(kd,{placeholder:S("PleaseEnterPassword"),submitLabel:S("Continue"),onSubmit:k,isActive:h||[o.VS.TwoFaNewPasswordConfirm,o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaNewPasswordConfirm:return(0,ee.Y)(kd,{expectedPassword:i.password,placeholder:S("PleaseReEnterPassword"),submitLabel:S("Continue"),onSubmit:w,isActive:h||[o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaNewPasswordHint:return(0,ee.Y)(rm,{icon:"hint",placeholder:S("PasswordHintPlaceholder"),onSubmit:N,isActive:h||[o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaNewPasswordEmail:return(0,ee.Y)(rm,{icon:"email",type:"email",isLoading:r,error:l&&C.withRegular(l),clearError:v,placeholder:S("RecoveryEmailTitle"),shouldConfirm:!0,onSubmit:I,isActive:h||[o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaNewPasswordEmailCode:return(0,ee.Y)(om,{isLoading:r,error:l&&C.withRegular(l),clearError:v,onSubmit:L,isActive:h||t===o.VS.TwoFaCongratulations,onReset:m});case o.VS.TwoFaCongratulations:return(0,ee.Y)(sm,{isActive:h,onReset:m});case o.VS.TwoFaEnabled:return(0,ee.Y)(am,{isActive:h||[o.VS.TwoFaChangePasswordCurrent,o.VS.TwoFaChangePasswordNew,o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaTurnOff,o.VS.TwoFaRecoveryEmailCurrentPassword,o.VS.TwoFaRecoveryEmail,o.VS.TwoFaRecoveryEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaChangePasswordCurrent:return(0,ee.Y)(kd,{isLoading:r,error:l&&C.withRegular(l),clearError:v,hint:a,onSubmit:P,isActive:h||[o.VS.TwoFaChangePasswordNew,o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaChangePasswordNew:return(0,ee.Y)(kd,{placeholder:S("PleaseEnterNewFirstPassword"),onSubmit:Y,isActive:h||[o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaChangePasswordConfirm:return(0,ee.Y)(kd,{expectedPassword:i.password,placeholder:S("PleaseReEnterPassword"),onSubmit:F,isActive:h||[o.VS.TwoFaChangePasswordHint,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaChangePasswordHint:return(0,ee.Y)(rm,{isLoading:r,error:l&&C.withRegular(l),clearError:v,icon:"hint",placeholder:S("PasswordHintPlaceholder"),onSubmit:D,isActive:h||t===o.VS.TwoFaCongratulations,onReset:m});case o.VS.TwoFaTurnOff:return(0,ee.Y)(kd,{isLoading:r,error:l&&C.withRegular(l),clearError:v,hint:a,onSubmit:T,isActive:h,onReset:m});case o.VS.TwoFaRecoveryEmailCurrentPassword:return(0,ee.Y)(kd,{isLoading:r,error:l&&C.withRegular(l),clearError:v,hint:a,onSubmit:B,isActive:h||[o.VS.TwoFaRecoveryEmail,o.VS.TwoFaRecoveryEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaRecoveryEmail:return(0,ee.Y)(rm,{icon:"email",type:"email",placeholder:S("RecoveryEmailTitle"),onSubmit:R,isActive:h||[o.VS.TwoFaRecoveryEmailCode,o.VS.TwoFaCongratulations].includes(t),onReset:m});case o.VS.TwoFaRecoveryEmailCode:return(0,ee.Y)(om,{isLoading:r,error:l&&C.withRegular(l),clearError:v,onSubmit:L,isActive:h||t===o.VS.TwoFaCongratulations,onReset:m});default:return}}))),dm=Object.keys(o.VS).length/2,hm=[o.VS.TwoFaDisabled,o.VS.TwoFaNewPassword,o.VS.TwoFaNewPasswordConfirm,o.VS.TwoFaNewPasswordHint,o.VS.TwoFaNewPasswordEmail,o.VS.TwoFaNewPasswordEmailCode,o.VS.TwoFaCongratulations,o.VS.TwoFaEnabled,o.VS.TwoFaChangePasswordCurrent,o.VS.TwoFaChangePasswordNew,o.VS.TwoFaChangePasswordConfirm,o.VS.TwoFaChangePasswordHint,o.VS.TwoFaTurnOff,o.VS.TwoFaRecoveryEmailCurrentPassword,o.VS.TwoFaRecoveryEmail,o.VS.TwoFaRecoveryEmailCode],mm=[o.VS.PasscodeDisabled,o.VS.PasscodeEnabled],um=[o.VS.Folders,o.VS.FoldersCreateFolder,o.VS.FoldersEditFolder,o.VS.FoldersEditFolderFromChatList,o.VS.FoldersEditFolderInvites,o.VS.FoldersIncludedChats,o.VS.FoldersIncludedChatsFromChatList,o.VS.FoldersExcludedChats,o.VS.FoldersExcludedChatsFromChatList,o.VS.FoldersShare],pm=[o.VS.PrivacyBlockedUsers,o.VS.ActiveWebsites],vm=[o.VS.PrivacyPhoneNumberAllowedContacts,o.VS.PrivacyPhoneNumberDeniedContacts],gm=[o.VS.PrivacyLastSeenAllowedContacts,o.VS.PrivacyLastSeenDeniedContacts],Am=[o.VS.PrivacyProfilePhotoAllowedContacts,o.VS.PrivacyProfilePhotoDeniedContacts],bm=[o.VS.PrivacyBioAllowedContacts,o.VS.PrivacyBioDeniedContacts],fm=[o.VS.PrivacyBirthdayAllowedContacts,o.VS.PrivacyBirthdayDeniedContacts],Cm=[o.VS.PrivacyGiftsAllowedContacts,o.VS.PrivacyGiftsDeniedContacts],Sm=[o.VS.PrivacyPhoneCallAllowedContacts,o.VS.PrivacyPhoneCallDeniedContacts],ym=[o.VS.PrivacyPhoneP2PAllowedContacts,o.VS.PrivacyPhoneP2PDeniedContacts],km=[o.VS.PrivacyForwardingAllowedContacts,o.VS.PrivacyForwardingDeniedContacts],wm=[o.VS.PrivacyVoiceMessagesAllowedContacts,o.VS.PrivacyVoiceMessagesDeniedContacts],Nm=[o.VS.PrivacyGroupChatsAllowedContacts,o.VS.PrivacyGroupChatsDeniedContacts],Im=[o.VS.PrivacyNoPaidMessages],Pm=(0,s.ph)((({isActive:e,currentScreen:t,foldersState:i,foldersDispatch:a,onReset:r,shouldSkipTransition:l})=>{const{closeShareChatFolderModal:d,openSettingsScreen:h}=(0,n.ko)(),m=(0,s.li)(),[u,p]=(0,nd.A)(ad,od),[v,g]=(0,s.J0)("");(0,rd.A)({containerRef:m,selector:".settings-content"},[t]);const A=(0,D.A)((e=>{const s=(0,c.nTw)((0,n.mS)()).shareFolderScreen?.isFromSettings;t===o.VS.FoldersShare&&d(),!0===e||void 0!==s&&!s?r(!0):(t!==o.VS.FoldersCreateFolder&&t!==o.VS.FoldersEditFolder&&t!==o.VS.FoldersEditFolderFromChatList&&t!==o.VS.FoldersEditFolderInvites||setTimeout((()=>{a({type:"reset"})}),200),t!==o.VS.FoldersIncludedChats&&t!==o.VS.FoldersExcludedChats?r():"create"===i.mode?h({screen:o.VS.FoldersCreateFolder}):h({screen:o.VS.FoldersEditFolder}))}));function f(s,n){const r={[o.VS.PrivacyPhoneNumber]:vm.includes(n),[o.VS.PrivacyLastSeen]:gm.includes(n),[o.VS.PrivacyProfilePhoto]:Am.includes(n),[o.VS.PrivacyBio]:bm.includes(n),[o.VS.PrivacyBirthday]:fm.includes(n),[o.VS.PrivacyGifts]:Cm.includes(n),[o.VS.PrivacyPhoneCall]:Sm.includes(n),[o.VS.PrivacyPhoneP2P]:ym.includes(n),[o.VS.PrivacyForwarding]:km.includes(n),[o.VS.PrivacyVoiceMessages]:wm.includes(n),[o.VS.PrivacyGroupChats]:Nm.includes(n),[o.VS.PrivacyMessages]:Im.includes(n)},l=hm.includes(n),c=mm.includes(n),d=um.includes(n),h=pm.includes(n)||l||c||Object.keys(r).map(Number).includes(n)||Object.values(r).includes(!0);switch(t){case o.VS.Main:return(0,ee.Y)(Mh,{isActive:e,onReset:A});case o.VS.EditProfile:return(0,ee.Y)(ch,{isActive:e&&s,onReset:A});case o.VS.General:return(0,ee.Y)(vh,{isActive:s||n===o.VS.GeneralChatBackgroundColor||n===o.VS.GeneralChatBackground||n===o.VS.QuickReaction||n===o.VS.CustomEmoji||h||d,onReset:A});case o.VS.QuickReaction:return(0,ee.Y)(em,{isActive:s,onReset:A});case o.VS.CustomEmoji:return(0,ee.Y)(qd,{isActive:s,onReset:A});case o.VS.Notifications:return(0,ee.Y)(Rh,{isActive:s,onReset:A});case o.VS.DataStorage:return(0,ee.Y)(Wd,{isActive:s,onReset:A});case o.VS.Privacy:return(0,ee.Y)(Oh,{isActive:s||h,onReset:A});case o.VS.Language:return(0,ee.Y)(Ph,{isActive:s||n===o.VS.DoNotTranslate,onReset:A});case o.VS.DoNotTranslate:return(0,ee.Y)(eh,{isActive:s,onReset:A});case o.VS.Stickers:return(0,ee.Y)(im,{isActive:s,onReset:A});case o.VS.Experimental:return(0,ee.Y)(mh,{isActive:s,onReset:A});case o.VS.GeneralChatBackground:return(0,ee.Y)(Ch,{isActive:s||n===o.VS.GeneralChatBackgroundColor,onReset:A});case o.VS.GeneralChatBackgroundColor:return(0,ee.Y)(Nh,{isActive:s,onReset:A});case o.VS.ActiveSessions:return(0,ee.Y)(Jd,{isActive:s,onReset:A});case o.VS.ActiveWebsites:return(0,ee.Y)(Hd,{isActive:s,onReset:A});case o.VS.PrivacyBlockedUsers:return(0,ee.Y)(Jh,{isActive:s,onReset:A});case o.VS.PrivacyPhoneNumber:case o.VS.PrivacyLastSeen:case o.VS.PrivacyProfilePhoto:case o.VS.PrivacyBio:case o.VS.PrivacyBirthday:case o.VS.PrivacyGifts:case o.VS.PrivacyPhoneCall:case o.VS.PrivacyForwarding:case o.VS.PrivacyVoiceMessages:case o.VS.PrivacyGroupChats:return(0,ee.Y)(Wh,{screen:t,isActive:s||r[t],onReset:A});case o.VS.PrivacyPhoneNumberAllowedContacts:case o.VS.PrivacyLastSeenAllowedContacts:case o.VS.PrivacyProfilePhotoAllowedContacts:case o.VS.PrivacyBioAllowedContacts:case o.VS.PrivacyBirthdayAllowedContacts:case o.VS.PrivacyGiftsAllowedContacts:case o.VS.PrivacyPhoneCallAllowedContacts:case o.VS.PrivacyPhoneP2PAllowedContacts:case o.VS.PrivacyForwardingAllowedContacts:case o.VS.PrivacyVoiceMessagesAllowedContacts:case o.VS.PrivacyGroupChatsAllowedContacts:case o.VS.PrivacyNoPaidMessages:return(0,ee.Y)(Xh,{isAllowList:!0,usersOnly:t===o.VS.PrivacyNoPaidMessages,withPremiumCategory:t===o.VS.PrivacyGroupChatsAllowedContacts,withMiniAppsCategory:t===o.VS.PrivacyGiftsAllowedContacts,screen:t,isActive:s||r[t],onReset:A});case o.VS.PrivacyPhoneNumberDeniedContacts:case o.VS.PrivacyLastSeenDeniedContacts:case o.VS.PrivacyProfilePhotoDeniedContacts:case o.VS.PrivacyBioDeniedContacts:case o.VS.PrivacyBirthdayDeniedContacts:case o.VS.PrivacyGiftsDeniedContacts:case o.VS.PrivacyPhoneCallDeniedContacts:case o.VS.PrivacyPhoneP2PDeniedContacts:case o.VS.PrivacyForwardingDeniedContacts:case o.VS.PrivacyVoiceMessagesDeniedContacts:case o.VS.PrivacyGroupChatsDeniedContacts:return(0,ee.Y)(Xh,{screen:t,isActive:s,onReset:A});case o.VS.PrivacyMessages:return(0,ee.Y)(Ed,{isActive:s,onReset:A});case o.VS.Folders:case o.VS.FoldersCreateFolder:case o.VS.FoldersEditFolder:case o.VS.FoldersEditFolderFromChatList:case o.VS.FoldersEditFolderInvites:case o.VS.FoldersIncludedChats:case o.VS.FoldersIncludedChatsFromChatList:case o.VS.FoldersExcludedChats:case o.VS.FoldersExcludedChatsFromChatList:case o.VS.FoldersShare:return(0,ee.Y)(Cd,{currentScreen:t,shownScreen:n,state:i,dispatch:a,isActive:s,onReset:A});case o.VS.TwoFaDisabled:case o.VS.TwoFaNewPassword:case o.VS.TwoFaNewPasswordConfirm:case o.VS.TwoFaNewPasswordHint:case o.VS.TwoFaNewPasswordEmail:case o.VS.TwoFaNewPasswordEmailCode:case o.VS.TwoFaCongratulations:case o.VS.TwoFaEnabled:case o.VS.TwoFaChangePasswordCurrent:case o.VS.TwoFaChangePasswordNew:case o.VS.TwoFaChangePasswordConfirm:case o.VS.TwoFaChangePasswordHint:case o.VS.TwoFaTurnOff:case o.VS.TwoFaRecoveryEmailCurrentPassword:case o.VS.TwoFaRecoveryEmail:case o.VS.TwoFaRecoveryEmailCode:return(0,ee.Y)(cm,{currentScreen:t,state:u,dispatch:p,shownScreen:n,isActive:s,onReset:A});case o.VS.PasscodeDisabled:case o.VS.PasscodeNewPasscode:case o.VS.PasscodeNewPasscodeConfirm:case o.VS.PasscodeChangePasscodeCurrent:case o.VS.PasscodeChangePasscodeNew:case o.VS.PasscodeChangePasscodeConfirm:case o.VS.PasscodeCongratulations:case o.VS.PasscodeEnabled:case o.VS.PasscodeTurnOff:return(0,ee.Y)(Yd,{currentScreen:t,passcode:v,onSetPasscode:g,shownScreen:n,isActive:s,onReset:A});case o.VS.Performance:return(0,ee.Y)(Uh,{isActive:s,onReset:A});default:return}}return(0,ee.Y)(se.Ay,{ref:m,id:"Settings",name:l?"none":b.Uh,activeKey:t,renderCount:dm,shouldWrap:!0,withSwipeControl:!0,children:function(e,s,n,o){return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Ih,{currentScreen:t,onReset:A,editedFolderId:i.folderId}),f(e,o)]})}})})),Ym=(0,s.ph)((0,n.EK)((e=>{const{userIds:t}=e.contactList||{},{byId:i,statusesById:s}=e.users;return{usersById:i,userStatusesById:s,contactIds:t}}))((({isActive:e,filter:t,usersById:i,userStatusesById:a,contactIds:r,onReset:c})=>{const{openChat:d,openNewContactDialog:h}=(0,n.ko)(),m=(0,M.A)(),{isMobile:u}=(0,I.Ay)();(0,fe.A)({isActive:e,onBack:c});const p=(0,s.hb)((e=>{d({id:e,shouldReplaceHistory:!0})}),[d]),v=(0,s.Kr)((()=>{if(!r)return;const e=(0,Yt.PU)({ids:r,query:t,type:"user"});return(0,l.UB)(e,i,a)}),[r,t,i,a]),[g,A]=(0,Ms.A)(void 0,v,Boolean(t));return(0,ee.FD)(bs.A,{items:g,onLoadMore:A,className:"chat-list custom-scroll",children:[g?.length?g.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable contact-list-item",onClick:()=>p(e),children:(0,ee.Y)(ys.A,{userId:e,forceShowSelf:!0,avatarSize:"large",withStory:!0,storyViewerOrigin:o.G9.ChatList,ripple:!u})},e))):g&&!g.length?(0,ee.Y)("p",{className:"no-results",dir:"auto",children:t.length?"No contacts matched your search.":"Contact list is empty."},"no-results"):(0,ee.Y)(Rs.A,{},"loading"),(0,ee.Y)(ki.A,{isShown:!0,onClick:h,ariaLabel:m("CreateNewContact"),children:(0,ee.Y)(q.A,{name:"add-user-filled"})},"create-new-contact")]})}))),Fm=(0,s.ph)((0,n.EK)((e=>{const{userIds:t}=e.contactList||{},{query:i,fetchingStatus:s,globalResults:n,localResults:o}=(0,c.nTw)(e).globalSearch,{peerIds:a}=n||{},{peerIds:r}=o||{};return{localContactIds:t,searchQuery:i,isSearching:s?.chats,globalPeerIds:a,localPeerIds:r}}))((({isChannel:e,isActive:t,selectedMemberIds:i,localContactIds:o,searchQuery:a,isSearching:r,localPeerIds:c,globalPeerIds:d,onSelectedMemberIdsChange:h,onNextStep:m,onReset:u})=>{const{setGlobalSearchQuery:p}=(0,n.ko)(),v=(0,M.A)();(0,fe.A)({isActive:t,onBack:u});const g=(0,s.hb)((e=>{p({query:e})}),[]),A=(0,s.Kr)((()=>{const e=(0,n.mS)().users.byId,t=o?(0,Yt.PU)({ids:o,query:a,type:"user"}):[];return(0,Fs.A)((0,bi.Am)([...t,...c||[],...d||[]]).filter((t=>{const i=e[t];return i&&!i.isSelf&&(i.canBeInvitedToGroup||!(0,l.tv)(i))})),!1,i)}),[o,a,c,d,i]),b=(0,s.hb)((()=>{p({query:""}),m()}),[m]);return(0,ee.FD)("div",{className:"NewChat step-1",children:[(0,ee.FD)("div",{className:"left-header",children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:u,ariaLabel:"Return to Chat List",children:(0,ee.Y)(q.A,{name:"arrow-left"})}),(0,ee.Y)("h3",{children:v("GroupAddMembers")})]}),(0,ee.FD)("div",{className:"NewChat-inner step-1",children:[(0,ee.Y)(Ci.A,{itemIds:A,selectedIds:i,filterValue:a,filterPlaceholder:v("SendMessageTo"),searchInputId:"new-group-picker-search",isLoading:r,isSearchable:!0,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox",withDefaultPadding:!0,onSelectedIdsChange:h,onFilterChange:g}),(0,ee.Y)(ki.A,{isShown:!0,onClick:b,ariaLabel:e?"Continue To Channel Info":"Continue To Group Info",children:(0,ee.Y)(q.A,{name:"arrow-right"})})]})]})}))),Dm=(0,s.ph)((0,n.EK)((e=>{const{progress:t,error:i}=(0,c.nTw)(e).chatCreation||{};return{creationProgress:t,creationError:i,maxGroupSize:e.config?.maxGroupSize}}))((({isChannel:e,isActive:t,memberIds:i,maxGroupSize:a,creationProgress:r,creationError:c,onReset:d})=>{const{createGroupChat:h,createChannel:m}=(0,n.ko)(),u=(0,M.A)();(0,fe.A)({isActive:t,onBack:d});const[p,v]=(0,s.J0)(""),[g,A]=(0,s.J0)(""),[b,f]=(0,s.J0)(),[C,S]=(0,s.J0)(),y="Chat title can't be empty",k="Channel title can't be empty",w=r===o.n7.InProgress;(0,s.vJ)((()=>{if(e)return;if(!i.length||i.length>4)return void v("");const t=(0,n.mS)(),s=t.users.byId,o=[t.currentUserId,...i].map((e=>(0,l.u0)(s[e]))).filter(Boolean),a=o.slice(0,-1).join(", ")+u("CreateGroup.PeersTitleLastDelimeter")+o[o.length-1];v(a)}),[e,i,u]);const N=(0,s.hb)((e=>{const{value:t}=e.currentTarget,i=t.replace(/^\s+/,"");v(i),i!==t&&(e.currentTarget.value=i)}),[]),I=(0,s.hb)((e=>{A(e.currentTarget.value)}),[]),P=(0,s.hb)((()=>{p.length?a&&i.length>=a?S("Sorry, creating supergroups is not yet supported"):h({title:p,photo:b,memberIds:i}):S(y)}),[p,i,a,h,b]),Y=(0,s.hb)((()=>{p.length?m({title:p,about:g,photo:b,memberIds:i,isChannel:!0}):S(k)}),[p,m,g,b,i,k]);(0,s.vJ)((()=>{r===o.n7.Complete&&d(!0)}),[r,d]);const F=c&&u(c)||(C!==y&&C!==k?C:void 0);return(0,ee.FD)("div",{className:"NewChat",children:[(0,ee.FD)("div",{className:"left-header",children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>d(),ariaLabel:"Return to member selection",children:(0,ee.Y)(q.A,{name:"arrow-left"})}),(0,ee.Y)("h3",{children:u(e?"NewChannel":"NewGroup")})]}),(0,ee.FD)("div",{className:"NewChat-inner step-2",children:[(0,ee.Y)(ah.A,{onChange:f,title:u("AddPhoto")}),(0,ee.Y)(Q.A,{value:p,onChange:N,label:u(e?"EnterChannelName":"GroupName"),error:C===y||C===k?C:void 0}),e&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Q.A,{value:g,onChange:I,label:u("DescriptionOptionalPlaceholder")}),(0,ee.Y)("p",{className:"note",children:u("DescriptionInfo")})]}),F&&(0,ee.Y)("p",{className:"error",children:F}),i.length>0&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{className:"chat-members-heading",children:u("GroupInfo.ParticipantCount",i.length,"i")}),(0,ee.Y)("div",{className:"chat-members-list custom-scroll",children:i.map((e=>(0,ee.Y)(li.A,{inactive:!0,className:"chat-item-clickable",children:(0,ee.Y)(ys.A,{userId:e})})))})]})]}),(0,ee.Y)(ki.A,{isShown:0!==p.length,onClick:e?Y:P,disabled:w,ariaLabel:e?u("ChannelIntro.CreateChannel"):"Create Group",children:w?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"arrow-right"})})]})}))),Mm=Object.keys(o.Bn).length/2,Tm=(0,s.ph)((({isActive:e,isChannel:t=!1,content:i,onReset:a})=>{const{openLeftColumnContent:r,setGlobalSearchQuery:l}=(0,n.ko)(),[c,d]=(0,s.J0)([]),h=(0,s.hb)((()=>{r({contentKey:t?o.Bn.NewChannelStep2:o.Bn.NewGroupStep2})}),[t]),m=(0,D.A)((e=>{const t=e.length>c.length;d(e),t&&l({query:""})}));return(0,ee.Y)(se.Ay,{id:"NewChat",name:b.Uh,renderCount:Mm,activeKey:i,children:s=>{switch(i){case o.Bn.NewChannelStep1:case o.Bn.NewGroupStep1:return(0,ee.Y)(Fm,{isChannel:t,isActive:e,selectedMemberIds:c,onSelectedMemberIdsChange:m,onNextStep:h,onReset:a});case o.Bn.NewChannelStep2:case o.Bn.NewGroupStep2:return(0,ee.Y)(Dm,{isChannel:t,isActive:s&&e,memberIds:c,onReset:a});default:return}}})}));var Bm=i(34458),Rm=i(11462),Lm=i(24920),xm=i(75343),Em=i(40175),Vm=i(41118),_m=i(90054);const Um=(0,s.ph)((({isActive:e,isForumPanelOpen:t,archiveSettings:i,isStoryRibbonShown:s,onReset:o,onTopicSearch:r,foldersDispatch:l})=>{const{updateArchiveSettings:c}=(0,n.ko)(),d=(0,M.A)();(0,fe.A)({isActive:e,onBack:o});const h=(0,D.A)((()=>{c({isHidden:!1})})),{shouldDisableDropdownMenuTransitionRef:m,handleDropdownMenuTransitionEnd:u}=(0,Lm.A)(t),{shouldRender:p,transitionClassNames:v}=(0,Oe.A)(!t,void 0,void 0,!1),{shouldRenderForumPanel:g,handleForumPanelAnimationEnd:A,handleForumPanelAnimationStart:b,isAnimationStarted:f}=(0,Rm.A)(t),C=t&&f,{shouldRender:S,transitionClassNames:y,isClosing:k}=(0,Oe.A)(s,void 0,void 0,"",!1,Bm.UG+a.xB5);return(0,ee.FD)("div",{className:"ArchivedChats",children:[(0,ee.FD)("div",{className:(0,me.A)("left-header",!S&&"left-header-shadow"),children:[d.isRtl&&(0,ee.Y)("div",{className:"DropdownMenuFiller"}),(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:o,ariaLabel:"Return to chat list",className:(0,me.A)(d.isRtl&&"rtl",C&&d.isRtl&&"right-aligned",m.current&&d.isRtl&&"disable-transition"),onTransitionEnd:u,children:(0,ee.Y)(q.A,{name:"arrow-left"})}),p&&(0,ee.Y)("h3",{className:v,children:d("ArchivedChats")}),(0,ee.Y)("div",{className:"story-toggler-wrapper",children:(0,ee.Y)(Em.A,{canShow:!0,isArchived:!0})}),i.isHidden&&(0,ee.Y)(le.A,{className:"archived-chats-more-menu",positionX:"right",onTransitionEnd:d.isRtl?u:void 0,children:(0,ee.Y)(ce.A,{icon:"archive-from-main",onClick:h,children:d("lng_context_archive_to_list")})})]}),(0,ee.FD)("div",{className:(0,me.A)("chat-list-wrapper",S&&"with-story-ribbon",y),children:[S&&(0,ee.Y)(xm.A,{isArchived:!0,className:"left-header-shadow",isClosing:k}),(0,ee.Y)(Vm.A,{folderType:"archived",isActive:e,isForumPanelOpen:C,isMainList:!0,foldersDispatch:l,archiveSettings:i})]}),g&&(0,ee.Y)(_m.A,{isOpen:t,onTopicSearch:r,onOpenAnimationStart:b,onCloseAnimationEnd:A})]})})),Om=(0,s.ph)((0,n.EK)((e=>{const{byId:t,orderedIds:i}=e.chatFolders;return{foldersById:t,folderOrderedIds:i}}))((({isOpen:e,chatId:t,foldersById:i,folderOrderedIds:o,onClose:r,onCloseAnimationEnd:l})=>{const{editChatFolders:c}=(0,n.ko)(),d=(0,M.A)(),h=(0,s.Kr)((()=>i?Object.keys(i).reduce(((e,s)=>{const{includedChatIds:n,pinnedChatIds:o}=i[Number(s)];return(n.includes(t)||o?.includes(t))&&e.push(s),e}),[]):[]),[t,i]),[m,u]=(0,s.J0)(h),p=(0,s.Kr)((()=>o?.filter((e=>e!==a.DSF)).map((e=>{const t=i?i[e]:void 0;return{label:t?(0,Zi.fd)({text:t.title.text,entities:t.title.entities,noCustomEmojiPlayback:t.noTitleAnimations}):"",value:String(e)}}))||[]),[o,i]),v=(0,s.hb)((()=>{const e=h.filter((e=>!m.includes(e))).map(Number),i=m.filter((e=>!h.includes(e))).map(Number);c({chatId:t,idsToRemove:e,idsToAdd:i}),r()}),[t,c,h,r,m]);if(i&&o)return(0,ee.FD)(Z.A,{isOpen:e,onClose:r,onCloseAnimationEnd:l,onEnter:v,className:(0,me.A)("_fJBBCCE","delete"),contentClassName:"EG5lPWY1",title:d("FilterAddTo"),children:[(0,ee.Y)("div",{className:(0,me.A)("heYMHiUt","custom-scroll"),children:(0,ee.Y)(jl.A,{options:p,selected:m,onChange:u})}),(0,ee.Y)("div",{className:"_jtqAaUU",children:(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:v,children:d("FilterAddTo")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:r,children:d("Cancel")})]})})]})})));var Km=function(e){return e.OneHour="3600",e.FourHours="14400",e.EightHours="28800",e.OneDay="86400",e.ThreeDays="259200",e.Forever="-1",e}(Km||{});const Jm=(0,s.ph)((({isOpen:e,chatId:t,topicId:i,onClose:o,onCloseAnimationEnd:r})=>{const[l,c]=(0,s.J0)(Km.Forever),{updateChatMutedState:d,updateTopicMutedState:h}=(0,n.ko)(),m=(0,M.A)(),u=(0,s.Kr)((()=>[{label:m("MuteFor.Hours",1),value:Km.OneHour},{label:m("MuteFor.Hours",4),value:Km.FourHours},{label:m("MuteFor.Hours",8),value:Km.EightHours},{label:m("MuteFor.Days",1),value:Km.OneDay},{label:m("MuteFor.Days",3),value:Km.ThreeDays},{label:m("MuteFor.Forever"),value:Km.Forever}]),[m]),p=(0,s.hb)((()=>{let e;e=l===Km.Forever?a.fRl:Math.floor(Date.now()/1e3)+Number(l),i?h({chatId:t,topicId:i,mutedUntil:e}):d({chatId:t,mutedUntil:e}),o()}),[t,l,o,i]);return(0,ee.FD)(Z.A,{isOpen:e,onClose:o,onCloseAnimationEnd:r,onEnter:p,className:"delete",title:m("Notifications"),children:[(0,ee.Y)(X.A,{className:"dialog-checkbox-group",name:"muteFor",options:u,selected:l,onChange:c}),(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(W.A,{color:"primary",className:"confirm-dialog-button",isText:!0,onClick:p,children:m("Common.Done")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:o,children:m("Cancel")})]})]})}));var Gm=i(99515),jm=i(24531);const zm=(0,s.ph)((0,n.EK)(((e,{fromSticker:t,stickerSetShortName:i})=>{const s=(0,c.Xf0)(e),{chatId:n,threadId:o}=s||{},a=n&&(0,c.hds)(e,n),r=n?(0,c.AWZ)(e,n):void 0,d=n&&(0,c.yps)(e,n),h=n?(0,c.nZ4)(e,n):void 0,m=a?(0,l.Q_)(a,r,Boolean(d),h):void 0,u=n&&o?(0,c.Vw0)(e,n,o):void 0,p=Boolean(!u?.isCommentsInfo&&u?.fromChannelId),v=n&&o?(0,c.S0q)(e,n,o):void 0,g=Boolean(a&&o&&(0,l.__)(a,v,p,r)&&m?.canSendStickers),A=t?t.stickerSetInfo:i?{shortName:i}:void 0,b=A?(0,c.ycM)(e,A):void 0,f=n?(0,c.WA9)(e,n):void 0;return{canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),canSendStickers:g,isSavedMessages:h,shouldSchedule:!f&&(0,c.PIP)(e),stickerSet:b,isCurrentUserPremium:(0,c.g29)(e),shouldUpdateStickerSetOrder:e.settings.byKey.shouldUpdateStickerSetOrder,currentMessageList:s}}))((({isOpen:e,fromSticker:t,stickerSetShortName:i,stickerSet:o,canSendStickers:r,canScheduleUntilOnline:l,shouldSchedule:c,isSavedMessages:d,isCurrentUserPremium:h,shouldUpdateStickerSetOrder:m,currentMessageList:u,onClose:p})=>{const{loadStickers:v,toggleStickerSet:g,sendMessage:A,showNotification:b}=(0,n.ko)(),f=(0,s.li)(),C=(0,s.li)(),S=(0,M.A)(),{isMobile:y}=(0,I.Ay)(),k=(0,V.A)(o),w=o||k,N=Boolean(!w?.isArchived&&w?.installedDate),P=w?.isEmoji,[Y,F]=(0,jm.A)(l),{handleScroll:D,isAtBeginning:T}=As(),{observe:B}=(0,or.BL)({rootRef:f,throttleMs:200,isDisabled:!e});(0,s.vJ)((()=>{e&&!w?.stickers&&v({stickerSetInfo:t?t.stickerSetInfo:{shortName:i}})}),[e,t,v,i,w]);const R=(0,s.hb)(((e,t,i)=>{u&&(e={...e,isPreloadedGlobally:!0},c||i?Y((i=>{A({messageList:u,sticker:e,isSilent:t,scheduledAt:i}),p()})):(A({messageList:u,sticker:e,isSilent:t,shouldUpdateStickerSetOrder:m&&N}),p()))}),[u,c,Y,p,m,N]),L=(0,s.hb)((()=>{w&&(g({stickerSetId:w.id}),p())}),[p,w,g]),x=(0,s.hb)((()=>{if(!w)return;const{shortName:e}=w,t=P?"addemoji":"addstickers",i=`${a.jsp}${t}/${e}`;(0,cc.eM)(i),b({message:S("LinkCopied")})}),[P,S,w,b]),E=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.Y)(W.A,{round:!0,ripple:!y,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",children:(0,ee.Y)(q.A,{name:"more"})})),[y]);return(0,ee.FD)(Z.A,{className:(0,me.A)("StickerSetModal",P&&"custom-emoji"),isOpen:e,onClose:p,header:function(){const e=(0,me.A)("modal-header",!T&&"with-top-border");return(0,ee.FD)("div",{className:e,dir:S.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:S("Close"),onClick:p,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"modal-title",children:w?(0,Ft.A)(w.title,["emoji","links"]):S("AccDescrStickerSet")}),(0,ee.Y)(le.A,{className:"stickers-more-menu with-menu-transitions",trigger:E,positionX:"right",children:(0,ee.Y)(ce.A,{icon:"copy",onClick:x,children:S("StickersCopy")})})]})}(),children:[w?.stickers?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{ref:f,className:"stickers custom-scroll",onScroll:D,children:(0,ee.FD)("div",{className:"shared-canvas-container stickers-grid",children:[(0,ee.Y)("canvas",{ref:C,className:"shared-canvas"}),w.stickers.map((e=>(0,ee.Y)(br,{sticker:e,size:P?a.$nk:a.GhT,observeIntersection:B,onClick:r&&!P?R:void 0,clickArg:e,isSavedMessages:d,isCurrentUserPremium:h,sharedCanvasRef:C})))]})}),(0,ee.Y)("div",{className:"button-wrapper",children:(0,ee.Y)(W.A,{size:"smaller",fluid:!0,color:N?"danger":"primary",onClick:L,children:(()=>{if(!w)return S("Loading");const e=P?"Emoji":"Sticker";return S(N?`StickerPack.Remove${e}Count`:`StickerPack.Add${e}Count`,w.count,"i")})()})})]}):(0,ee.Y)(Rs.A,{}),F]})}))),Hm={root:"nZYT4vJ3",sets:"JzkmXjFF"},$m=(0,s.ph)((0,n.EK)((e=>({canPlayAnimatedEmojis:(0,c.BWX)(e)})))((({customEmojiSetIds:e,canPlayAnimatedEmojis:t,onClose:i})=>{const{openStickerSet:o}=(0,n.ko)(),a=(0,M.A)(),r=(0,s.Kr)((()=>e?.map((e=>(0,n.mS)().stickers.setsById[e]))),[e]),l=(0,s.li)(),{observe:c}=(0,or.BL)({rootRef:l,isDisabled:!r}),d=(0,V.A)(r),h=r||d,m=(0,D.A)((e=>{o({stickerSetInfo:e.stickerSetInfo})}));return(0,ee.Y)(Z.A,{isOpen:Boolean(r),className:Hm.root,onClose:i,hasCloseButton:!0,title:a("lng_custom_emoji_used_sets"),children:(0,ee.Y)("div",{className:(0,me.A)(Hm.sets,"custom-scroll"),ref:l,teactFastList:!0,children:h?.map((e=>(0,ee.Y)($d,{className:Hm.setCard,stickerSet:e,onClick:m,observeIntersection:c,noPlay:!t},e.id)))})})})));var qm=i(54314),Wm=i(60859);const Qm={settings:{icon:"bots",label:"BotSettings"},help:{icon:"help",label:"BotHelp"}},Zm=(0,s.ph)((0,n.EK)(((e,{chatId:t,threadId:i})=>{const s=(0,c.hds)(e,t),n=(0,c._ls)(e,t);if(!s||n)return{};const o=(0,u.L8)(s.id),a=o?(0,c.mBe)(e,t):void 0,r=a&&(0,l.Gh)(a),d=i===U.l3,h=(0,c.nZ4)(e,t),{chatId:m,threadId:p}=(0,c.Xf0)(e)||{},v=d&&!a&&((0,l.WX)(s)||(0,l.YE)(s))&&!(0,l.SJ)(s),g=(0,l.DX)(t)?void 0:(0,c.yps)(e,t),A=o?(0,c.vGo)(e,t):void 0,b=o?void 0:(0,c.AWZ)(e,t),f=A||b,C=(0,c.X2D)(e,t),S=(0,c.S0q)(e,t,i),y=s.isForum&&(s.isCreator||!(0,l.Sq)(s,"manageTopics")||(0,l.ub)(s,"manageTopics")),k=S&&(0,l.l1)(s,S),w=(0,c.e5V)(e,t),N=(0,c.jGY)(e,t)&&f?.isTranslationDisabled,I=(0,l.cG)(t,i,e.currentUserId)?(0,c.hds)(e,String(i)):void 0,P=(0,c.trm)(e);return{chat:s,isMuted:(0,Sc.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),isPrivate:o,isTopic:s?.isForum&&!d,isForum:s?.isForum,isForumAsMessages:s?.isForumAsMessages,canAddContact:r,canDeleteChat:(0,l.IC)(s),canReportChat:v,canGift:C,hasLinkedChat:Boolean(b?.linkedChatId),botCommands:g?A?.botInfo?.commands:void 0,botPrivacyPolicyUrl:g?A?.botInfo?.privacyPolicyUrl:void 0,isChatInfoShown:(0,c.nTw)(e).isChatInfoShown&&m===t&&p===i,canCreateTopic:y,canEditTopic:k,canManage:w,isRightColumnShown:(0,c.gjV)(e),canTranslate:N,isBlocked:A?.isBlocked,isBot:Boolean(g),isChatWithSelf:h,savedDialog:I,disallowedGifts:A?.disallowedGifts,isAccountFrozen:P}}))((({chatId:e,threadId:t,isOpen:i,withExtraActions:o,anchor:a,isChannel:r,botCommands:l,botPrivacyPolicyUrl:c,withForumActions:d,isTopic:h,isForum:m,isForumAsMessages:u,isChatInfoShown:p,canStartBot:v,canSubscribe:g,canReportChat:A,canSearch:b,canCall:f,canMute:C,canViewStatistics:S,canViewMonetization:y,canViewBoosts:k,pendingJoinRequests:w,canLeave:N,canEnterVoiceChat:P,canCreateVoiceChat:F,chat:T,isPrivate:B,isMuted:R,canDeleteChat:L,canGift:x,hasLinkedChat:E,canAddContact:V,canCreateTopic:_,canEditTopic:U,canManage:O,isRightColumnShown:K,canTranslate:J,isBlocked:G,isBot:j,isChatWithSelf:z,savedDialog:H,canShowBoostModal:$,disallowedGifts:q,isAccountFrozen:W,channelMonoforumId:Q,onJoinRequestsClick:Z,onSubscribeChannel:X,onSearchClick:te,onAsMessagesClick:ie,onClose:se,onCloseAnimationEnd:ne})=>{const{updateChatMutedState:oe,enterMessageSelectMode:ae,sendBotCommand:re,restartBot:le,requestMasterAndJoinGroupCall:de,createGroupCall:he,openLinkedChat:me,openAddContactDialog:ue,openFrozenAccountModal:pe,requestMasterAndRequestCall:ve,toggleStatistics:ge,openMonetizationStatistics:Ae,openBoostStatistics:be,openGiftModal:fe,openThreadWithInfo:Ce,openCreateTopicPanel:Se,openEditTopicPanel:ye,openChat:ke,openUrl:we,toggleManagement:Ne,togglePeerTranslations:Ie,blockUser:Pe,unblockUser:Ye,setViewForumAsMessages:Fe,openBoostModal:De,reportMessages:Me,showNotification:Te}=(0,n.ko)(),Be=(0,M.A)(),Re=(0,Vi.A)(),{isMobile:Le}=(0,I.Ay)(),[xe,Ee]=(0,s.J0)(!0),[Ve,_e]=(0,s.J0)(!1),[Ue,Ke]=(0,s.J0)(!1),[Je,Ge]=(0,s.J0)(!1),[je,ze,He]=(0,Y.A)(),{x:qe,y:We}=a;(0,Oe.A)(i,ne,void 0,!1);const Qe=(0,Wi.A)(!(p||!m)||void 0,200),Ze=(0,s.Kr)((()=>{if(q)return Object.values(q).every(Boolean)}),[q]),Xe=(0,D.A)((()=>{Ge(!1),se()})),et=(0,D.A)((()=>{W?pe():(Ee(!1),Me({chatId:e,messageIds:[]})),se()})),tt=(0,D.A)((()=>{W?(pe(),se()):Ke(!0),Ee(!1)})),it=(0,D.A)((()=>{Ee(!1),se()})),st=(0,D.A)((()=>{Ce({chatId:e,threadId:t}),_e(!K),it()})),nt=(0,D.A)((()=>{Ke(!1),se()})),ot=(0,D.A)((()=>{W?pe():re({command:"/start"})})),at=(0,D.A)((()=>{W?pe():le({chatId:e})})),rt=(0,D.A)((()=>{W?pe():oe({chatId:e,isMuted:!1}),it()})),lt=(0,D.A)((()=>{W?(pe(),it()):(ze(),Ge(!0)),Ee(!1)})),ct=(0,D.A)((()=>{W?pe():(Se({chatId:e}),_e(!K)),it()})),dt=(0,D.A)((()=>{W?pe():(Ne({force:!0}),_e(!K)),it()})),ht=(0,D.A)((()=>{W?pe():(ye({chatId:e,topicId:Number(t)}),_e(!K)),it()})),mt=(0,D.A)((()=>{ke({id:void 0}),Fe({chatId:e,isEnabled:!1}),it()})),ut=(0,D.A)((()=>{W?pe():F?he({chatId:e}):de({chatId:e}),it()})),pt=(0,D.A)((()=>{me({id:e}),it()})),vt=(0,D.A)((()=>{Ze&&T?Te({message:Re("SendDisallowError")}):(fe({forUserId:e}),W?pe():fe({forUserId:e}),it())})),gt=(0,D.A)((()=>{W?pe():ue({userId:e}),it()})),At=(0,D.A)((()=>{W?pe():X(),it()})),bt=(0,D.A)((()=>{W?pe():ve({userId:e,isVideo:!0}),it()})),ft=(0,D.A)((()=>{W?pe():ve({userId:e}),it()})),Ct=(0,D.A)((()=>{te(),it()})),St=(0,D.A)((()=>{ge(),_e(!K),it()})),yt=(0,D.A)((()=>{Ae({chatId:e}),_e(!K),it()})),kt=(0,D.A)((()=>{W?pe():k?(be({chatId:e}),_e(!K)):De({chatId:e}),it()})),wt=(0,D.A)((()=>{Ie({chatId:e,isEnabled:!0}),it()})),Nt=(0,D.A)((()=>{W?pe():ae(),it()})),It=(0,D.A)((()=>{ie(),it()})),Pt=(0,D.A)((()=>{W?pe():Pe({userId:e}),it()})),Yt=(0,D.A)((()=>{W?pe():Ye({userId:e}),it()})),Ft=(0,D.A)((()=>{ke({id:Q}),it()}));(0,s.vJ)(Mi.M6,[]);const Dt=(0,s.Kr)((()=>{const e=l?.map((({command:e})=>{const t=Qm[e];if(t)return(0,ee.Y)(ce.A,{icon:t.icon,onClick:()=>{re({command:`/${e}`}),it()},children:Be(t.label)},e)})),t=l?.some((({command:e})=>"privacy"===e));return[...e||[],j&&(0,ee.Y)(ce.A,{icon:"privacy-policy",onClick:()=>{t&&!c?re({command:"/privacy"}):we({url:c||Be("BotDefaultPrivacyPolicy")}),it()},children:Be("BotPrivacyPolicy")})].filter(Boolean)}),[l,Be,c,j]),Mt=(0,s.Kr)((()=>{if(T)return Be(H?"Delete":B?"DeleteChatUser":L?"GroupInfo.DeleteAndExit":r?"LeaveChannel":"Group.LeaveGroup")}),[L,T,r,B,H,Be]);return(0,ee.Y)(xr.A,{children:(0,ee.FD)("div",{className:"HeaderMenuContainer",children:[(0,ee.FD)($e.A,{isOpen:xe,positionX:"right",style:`left: ${qe}px;top: ${We}px;`,onClose:it,shouldCloseFast:Ve,children:[Le&&b&&(0,ee.Y)(ce.A,{icon:"search",onClick:Ct,children:Be("Search")}),d&&_&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(ce.A,{icon:"comments",onClick:ct,children:Be("lng_forum_create_topic")}),(0,ee.Y)(Wm.A,{})]}),Q&&(0,ee.Y)(ce.A,{icon:"message",onClick:Ft,children:Re("ChannelSendMessage")}),Qe&&(0,ee.Y)(ce.A,{icon:"info",onClick:st,children:Be(h?"lng_context_view_topic":"lng_context_view_group")}),O&&!U&&(0,ee.Y)(ce.A,{icon:"edit",onClick:dt,children:Be("Edit")}),U&&(0,ee.Y)(ce.A,{icon:"edit",onClick:ht,children:Be("lng_forum_topic_edit")}),Le&&!d&&m&&!h&&(0,ee.Y)(ce.A,{icon:"forums",onClick:mt,children:Be("Chat.ContextViewAsTopics")}),d&&Boolean(w)&&(0,ee.FD)(ce.A,{icon:"user",onClick:Z,children:[Be(r?"SubscribeRequests":"MemberRequests"),(0,ee.Y)("div",{className:"right-badge",children:w})]}),d&&!h&&!u&&(0,ee.Y)(ce.A,{icon:"message",onClick:It,children:Be("lng_forum_view_as_messages")}),o&&v&&(0,ee.Y)(ce.A,{icon:"bots",onClick:ot,children:Be("BotStart")}),o&&g&&(0,ee.Y)(ce.A,{icon:r?"channel":"group",onClick:At,children:Be(r?"ProfileJoinChannel":"ProfileJoinGroup")}),$&&!k&&(0,ee.Y)(ce.A,{icon:"boost-outline",onClick:kt,children:Be(r?"BoostingBoostChannelMenu":"BoostingBoostGroupMenu")}),V&&(0,ee.Y)(ce.A,{icon:"add-user",onClick:gt,children:Be("AddContact")}),Le&&f&&(0,ee.Y)(ce.A,{icon:"phone",onClick:ft,children:Be("Call")}),f&&(0,ee.Y)(ce.A,{icon:"video-outlined",onClick:bt,children:Be("VideoCall")}),C&&(R?(0,ee.Y)(ce.A,{icon:"unmute",onClick:rt,children:Be("ChatsUnmute")}):(0,ee.FD)(ce.A,{icon:"mute",onClick:lt,children:[Be("ChatsMute"),"..."]})),(P||F)&&(0,ee.Y)(ce.A,{icon:"voice-chat",onClick:ut,children:Be(F?"StartVoipChat":"VoipGroupJoinCall")}),E&&(0,ee.Y)(ce.A,{icon:r?"comments":"channel",onClick:pt,children:Be(r?"ViewDiscussion":"lng_profile_view_channel")}),!d&&(0,ee.Y)(ce.A,{icon:"select",onClick:Nt,children:Be("ReportSelectMessages")}),k&&(0,ee.Y)(ce.A,{icon:"boost-outline",onClick:kt,children:Be("Boosts")}),S&&(0,ee.Y)(ce.A,{icon:"stats",onClick:St,children:Be("Statistics")}),r&&y&&(0,ee.Y)(ce.A,{icon:"cash-circle",onClick:yt,children:Be("lng_channel_earn_title")}),J&&(0,ee.Y)(ce.A,{icon:"language",onClick:wt,children:Be("lng_context_translate")}),A&&(0,ee.Y)(ce.A,{icon:"flag",onClick:et,children:Be("ReportPeer.Report")}),Dt,x&&(0,ee.Y)(ce.A,{icon:"gift",onClick:vt,children:Be("ProfileSendAGift")}),j&&(0,ee.Y)(ce.A,{icon:G?"bots":"hand-stop",onClick:G?at:Pt,children:Be(G?"BotRestart":"Bot.Stop")}),B&&!z&&!j&&(0,ee.Y)(ce.A,{icon:G?"user":"hand-stop",onClick:G?Yt:Pt,children:Be(G?"Unblock":"BlockUser")}),N&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Wm.A,{}),(0,ee.Y)(ce.A,{destructive:!0,icon:"delete",onClick:tt,children:Mt})]})]}),T&&(0,ee.Y)(qm.A,{isOpen:Ue,onClose:nt,chat:H||T,isSavedDialog:Boolean(H)}),C&&je&&T?.id&&(0,ee.Y)(Nc.A,{isOpen:Je,onClose:Xe,onCloseAnimationEnd:He,chatId:T.id})]})})})));var Xm=i(92915),eu=i(81642),tu=i(18653);const iu={root:"vv5ppXel",active:"FVgqrSSK",info:"DboxqiZd",topRow:"Ymu2m1PR",meta:"A2rsvUBm",subtitle:"qUzmwaIn"},su=(0,s.ph)((({isActive:e,message:t,senderPeer:i,messageChat:s,shouldShowChat:n,query:o,className:a,onClick:r})=>{const l=(0,M.A)(),c=t.forwardInfo?.hiddenUserName,d=n?s:i,h=n&&i?(0,Yt.Q5)(l,t.chatId,i):void 0,m=(0,D.A)((()=>{r(t)}));return(0,ee.FD)("div",{role:"button",tabIndex:0,className:(0,me.A)(iu.root,e&&iu.active,a),onClick:m,children:[(0,ee.Y)(Dt.A,{className:iu.avatar,peer:d,text:c,size:"medium"}),(0,ee.FD)("div",{className:iu.info,children:[(0,ee.FD)("div",{className:iu.topRow,children:[d&&(0,ee.Y)(Ls.A,{peer:d,withEmojiStatus:!0})||c,(0,ee.Y)(eu.A,{className:iu.meta,message:t})]}),(0,ee.FD)("div",{className:iu.subtitle,dir:"auto",children:[h&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("span",{className:"sender-name",children:(0,Ft.A)(h)}),(0,ee.Y)("span",{className:"colon",children:":"})]}),(0,ee.Y)(tu.A,{message:t,highlight:o,truncateLength:200})]})]})]})})),nu={root:"FTMljUuX",header:"OvmjSMwA",active:"DEIUzXQd",avatar:"mp1PmoMq",input:"z2K8Q7ib",mobile:"u0fb78AA",focused:"dqF8dYNx",withDropdown:"AqhBggrp",adaptSearchBorders:"Q9RZQaTu",dropdown:"MFGvbICO",dropdownHidden:"Alee0CKy",results:"RtfTOE72",placeholder:"O1HoZFge",separator:"_Yy43QLl",savedTags:"BcvAfv1E",wrap:"JkESCST6",searchTags:"rO3pH3LI",savedSearchTag:"qA4gov4D",hash:"q5NOmUAM",searchTypes:"rVYZG__K",searchType:"nE1Xwoo7",selectedType:"i29dP8iT",footer:"jyS1l9yn","keyboard-visible":"ao05jKHW",keyboardVisible:"ao05jKHW",counter:"NmmL_cO3",mobileNavigation:"dLO1hlHU",navigationButton:"Z4vLAlsu",navigationDisabled:"IqA7R2xO",jumpIn:"n9kXbTu6"},ou={isCustomPeer:!0,avatarIcon:"channel-filled",titleKey:"SearchPublicPosts"},au="MiddleSearchResult",ru=(0,ve.sg)((e=>e()),200,!1),lu=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.Xf0)(e);if(!t)return{};const{chatId:i,threadId:s}=t,n=(0,c.hds)(e,i);if(!n)return{};const{requestedQuery:o,savedTag:a,results:r,fetchingQuery:d,isHashtag:h,type:m}=(0,c.TCk)(e)||{},{totalCount:u,foundIds:p,query:v}=r||{},g=e.currentUserId,A=(0,c.nZ4)(e,i),b=(0,l.cG)(i,s,g),f=A&&!b?e.savedReactionTags?.byKey:void 0;return{chat:n,monoforumChat:(0,c.k2W)(e,i),requestedQuery:o,totalCount:u,threadId:s,foundIds:p,isHistoryCalendarOpen:Boolean((0,c.nTw)(e).historyCalendarSelectedAt),savedTags:f,savedTag:a,isCurrentUserPremium:(0,c.g29)(e),isSavedMessages:A,fetchingQuery:d,isHashtagQuery:h,currentUserId:g,searchType:m,lastSearchQuery:v}}))((({isActive:e,chat:t,monoforumChat:i,threadId:o,requestedQuery:d,savedTags:m,savedTag:u,totalCount:p,lastSearchQuery:v,foundIds:g,isHistoryCalendarOpen:A,isCurrentUserPremium:f,isSavedMessages:C,fetchingQuery:S,isHashtagQuery:y,searchType:k="chat",currentUserId:w})=>{const{updateMiddleSearch:N,resetMiddleSearch:P,performMiddleSearch:F,focusMessage:T,closeMiddleSearch:B,openHistoryCalendar:R,openPremiumModal:L,loadSavedReactionTags:x}=(0,n.ko)(),E=(0,s.li)(),V=(0,s.li)(),_=(0,s.li)(),U=(0,s.li)(!1),{isMobile:O}=(0,I.Ay)(),K=(0,M.A)(),J=(0,Vi.A)(),[G,j]=(0,s.J0)(d||""),[z,H]=(0,s.J0)(0),$=g&&z>0,Q=g&&z<g.length-1,[Z,X]=(0,s.J0)(!e),te=(0,s.li)(),ie=(0,s.li)(!0),[se,ne,oe]=(0,Y.A)(),[ae,re]=(0,s.J0)(!0),[le,ce]=(0,s.J0)(!1);!function(e,t){const i=(0,D.A)((i=>{e.every((e=>e.current&&!e.current.contains(i.target)))&&t(i)}));(0,s.vJ)((()=>(document.addEventListener("click",i),()=>{document.removeEventListener("click",i)})),[i])}([E],(0,D.A)((e=>{ie.current||e.target.closest(".Modal")||oe()})));const de=Boolean(G&&g||y),he=y&&!G,ue=Boolean(G&&g&&!g.length&&!le&&!he),pe=e&&(ae||!O)&&(se||"myChats"===k||"channels"===k)&&Boolean(de||ue||he||m),ge=Boolean(G&&!he||u),Ae="chat"===k&&Boolean(g?.length),be=(0,D.A)((()=>{B()})),Ce=(0,D.A)((()=>{(0,r.YS)((()=>{V.current?.focus()}))})),Se=(0,D.A)((()=>{V.current?.blur()}));(0,s.vJ)((()=>{const{visualViewport:e}=window;if(!e)return;const t=document.getElementById("Main"),i=()=>{const{activeElement:i}=document;if(i&&i===V.current){const{pageTop:i,height:s}=e;(0,r.RK)((()=>{t.style.transform=`translateY(${i}px)`,t.style.height=`${s}px`,document.documentElement.scrollTop=i}))}else(0,r.RK)((()=>{t.style.transform="",t.style.height=""}))};return e.addEventListener("resize",i),()=>{e.removeEventListener("resize",i)}}),[]),(0,s.vJ)((()=>{H(-1)}),[v]),(0,s.Nf)((()=>{b.pz&&Array.from(document.querySelectorAll("input")).forEach((t=>{t.disabled=Boolean(e&&t!==V.current)}))}),[e]),(0,s.vJ)((()=>{e?(X(!1),clearTimeout(te.current)):(V.current.blur(),re(!0),H(0),j(""),te.current=window.setTimeout((()=>X(!0)),200))}),[e]),(0,s.vJ)((()=>{d&&t?.id&&(j(d),N({chatId:t.id,threadId:o,update:{requestedQuery:void 0}}),ce(!0),(0,r.Uz)((()=>{const e=V.current;e&&((0,Di.A)(e,!0,!0),ne())})))}),[t?.id,d,o]),(0,yi.A)((([t])=>{e!==t&&!G&&v&&j(v)}),[e,v,G]),(0,yi.A)((([t])=>{e&&t!==A&&(A?(Se(),oe()):Ce())}),[A,e]);const ye=(0,D.A)((()=>{G?.length||u?(j(""),ce(!1),P(),Ce()):be()}));(0,s.vJ)((()=>e?(0,h.A)(ye):void 0),[e,be]);const ke=(0,s.Kr)((()=>{if(m)return Object.values(m)}),[m]),we=Boolean(ke?.length),Ne=we&&!f;(0,s.vJ)((()=>{C&&e&&x()}),[C,e]);const Ie=(0,D.A)((()=>{const e=t?.id;e&&ru((()=>{U.current||F({chatId:e,threadId:o,query:G})}))})),Pe=(0,D.A)((e=>{if(U.current=!1,e.startsWith("#")&&!y)return N({chatId:t.id,threadId:o,update:{isHashtag:!0}}),j(e.slice(1)),void Ie();j(e),e||(ce(!1),P(),U.current=!0)}));(0,s.vJ)((()=>{G&&Ie()}),[G]),(0,s.vJ)((()=>{ce(Boolean(S))}),[S]),(0,s.vJ)((()=>{g?.length&&g.length-z<5&&Ie()}),[z,g?.length]),(0,s.vJ)((()=>{if(e)return ie.current=!0,window.addEventListener("touchend",t),window.addEventListener("mouseup",t),window.addEventListener("touchstart",i),window.addEventListener("mousedown",i),()=>{i(),window.removeEventListener("touchstart",i),window.removeEventListener("mousedown",i)};function t(){V.current?.focus(),ne(),(0,ve.IJ)((()=>{ie.current=!1}))}function i(){window.removeEventListener("touchend",t),window.removeEventListener("mouseup",t),(0,ve.IJ)((()=>{ie.current=!1}))}}),[e]),(0,fe.A)({isActive:e,onBack:be});const[Ye,Fe,De=0]=(0,Ms.A)(Ie,g),Me=(0,s.Kr)((()=>{if(!G&&!u||!Ye?.length)return fi.p;const e=(0,n.mS)();return Ye.map((t=>{const[i,s]=(0,pc.a)(t),n=(0,c.O5q)(e,i,s);if(!n)return;const o=C||(0,l.DX)(i)||i===a.Ckz?(0,c.Szq)(e,n):void 0,r=(0,c.Y7C)(e,n);return{searchResultKey:t,message:n,messageChat:(0,c.hds)(e,n.chatId),senderPeer:o||r}})).filter(Boolean)}),[G,u,Ye,C]),Te=(0,D.A)((e=>{const t=(0,pc.D)(e),i=g?.indexOf(t)||0;H(i+De),"chat"===k&&re(!1),T({chatId:e.chatId,messageId:e.id,threadId:y?void 0:o}),oe()})),Be=(0,D.A)((()=>{re((e=>!e)),ne()})),Re=(0,Bs.A)(_,de,(e=>{const t=Me?.[-1===e?0:e];t&&(Te(t.message),H(e+De))}),`.${au}`,!0),Le=(0,D.A)((e=>{N({chatId:t.id,threadId:o,update:e}),Ie()})),xe=(0,D.A)((e=>{Ne?L({initialSection:"saved_tags"}):Le({savedTag:e})})),Ee=(0,D.A)((()=>{Le({savedTag:void 0})})),Ve=(0,D.A)((()=>{y?Le({isHashtag:!1}):u&&Ee()})),_e=(0,D.A)((e=>{Le({type:e}),re(!0)})),Ue=(0,D.A)((()=>{if("chat"===k&&(oe(),Se(),g)){const e=z+1,[t,i]=(0,pc.a)(g[e]);T({chatId:t,messageId:i,threadId:o}),H(e)}})),Oe=(0,D.A)((()=>{if("chat"===k&&(oe(),Se(),g)){const e=z-1,[t,i]=(0,pc.a)(g[e]);T({chatId:t,messageId:i,threadId:o}),H(e)}}));function Ke(e,i){const s=!i&&k===e;switch(e){case"chat":return(0,ee.Y)(Vr.A,{className:(0,me.A)(nu.searchType,s&&nu.selectedType),peerId:t?.id,title:K("SearchThisChat"),clickArg:"chat",onClick:i?Ve:_e});case"myChats":return(0,ee.Y)(Vr.A,{className:(0,me.A)(nu.searchType,s&&nu.selectedType),peerId:w,forceShowSelf:!0,title:K("SearchMyMessages"),clickArg:"myChats",onClick:i?Ve:_e});case"channels":return(0,ee.Y)(Vr.A,{className:(0,me.A)(nu.searchType,s&&nu.selectedType),customPeer:ou,title:K("SearchPublicPosts"),clickArg:"channels",onClick:i?Ve:_e})}}function Je(){return(0,ee.FD)("div",{className:(0,me.A)(nu.dropdown,!pe&&nu.dropdownHidden),children:[!O&&(0,ee.Y)("div",{className:nu.separator}),we&&!y&&(0,ee.Y)("div",{className:(0,me.A)(nu.savedTags,!O&&nu.wrap,"no-scrollbar"),children:ke.map((e=>{const t=(0,l.a0)(e.reaction,u);return(0,ee.Y)(Xm.A,{containerId:"local-search",reaction:e.reaction,tag:e,withCount:!0,isDisabled:Ne,isChosen:t,onClick:t?Ee:xe},(0,l.Jj)(e.reaction))}))}),y&&(0,ee.FD)("div",{className:(0,me.A)(nu.searchTypes,"no-scrollbar"),children:[Ke("chat"),Ke("myChats"),Ke("channels")]}),de&&(0,ee.FD)(bs.A,{ref:_,className:(0,me.A)(nu.results,"custom-scroll"),items:Me,itemSelector:`.${au}`,preloadBackwards:0,onLoadMore:Fe,onKeyDown:Re,children:[ue&&(0,ee.Y)("span",{className:nu.placeholder,children:K("NoResultFoundFor",G)},"nothing"),he&&(0,ee.Y)("span",{className:nu.placeholder,children:K("HashtagSearchPlaceholder")},"enterhash"),Me?.map((({message:e,senderPeer:t,messageChat:i,searchResultKey:s},n)=>(0,ee.Y)(su,{teactOrderKey:-e.date,className:au,query:G,message:e,senderPeer:t,messageChat:i,shouldShowChat:y,isActive:z-De===n,onClick:Te},s)))]})]})}return(0,ee.FD)("div",{id:"MiddleSearch",className:(0,me.A)(nu.root,e&&nu.active,!e&&Z&&"visually-hidden",se&&nu.focused,O&&nu.mobile),ref:E,children:[(0,ee.FD)("div",{className:nu.header,children:[!O&&(0,ee.Y)(Dt.A,{className:nu.avatar,peer:i||t,size:"medium",isSavedMessages:C}),(0,ee.FD)(Cs.A,{ref:V,value:G,className:(0,me.A)(nu.input,pe&&nu.withDropdown,pe&&!O&&nu.adaptSearchBorders),canClose:!O,isLoading:le,resultsItemSelector:`.${nu.results} .${au}`,hasUpButton:Ae&&!O,hasDownButton:Ae&&!O,placeholder:K(y?"SearchHashtagsHint":"Search"),teactExperimentControlled:!0,onChange:Pe,onStartBackspace:Ve,onReset:ye,withBackIcon:O,onFocus:ne,focused:se,onUpClick:Q?Ue:void 0,onDownClick:$?Oe:void 0,children:[(0,ee.FD)("div",{className:nu.searchTags,children:[u&&(0,ee.Y)(Xm.A,{containerId:"local-search-tags",className:nu.savedSearchTag,reaction:u,tag:m[(0,l.Jj)(u)],onClick:Ee}),y&&(0,ee.Y)("div",{className:nu.hash,children:"#"})]}),!O&&Je()]}),!O&&(0,ee.Y)("div",{className:nu.icons,children:(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>R({selectedAt:(0,ze.CS)(Date.now())}),ariaLabel:K("JumpToDate"),children:(0,ee.Y)(q.A,{name:"calendar"})})})]}),O&&Je(),O&&(0,ee.FD)("div",{className:nu.footer,children:[(0,ee.Y)(W.A,{round:!0,size:"smaller",color:"translucent",onClick:()=>R({selectedAt:(0,ze.CS)(Date.now())}),ariaLabel:K("JumpToDate"),children:(0,ee.Y)(q.A,{name:"calendar"})}),(0,ee.Y)("div",{className:nu.counter,children:ge&&(g?.length?K("Of",[Math.max(z+1,1),p]):g&&!g.length&&K("NoResult"))}),"chat"===k&&Boolean(g?.length)&&(0,ee.Y)(W.A,{className:nu.viewStyle,size:"smaller",isText:!0,fluid:!0,noForcedUpperCase:!0,onClick:Be,children:K(ae?"SearchAsChat":"SearchAsList")}),Ae&&!pe&&(0,ee.FD)("div",{className:nu.mobileNavigation,children:[(0,ee.Y)(W.A,{className:(0,me.A)(nu.navigationButton,!Q&&nu.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:Ue,nonInteractive:!Q,ariaLabel:J("AriaSearchOlderResult"),children:(0,ee.Y)(q.A,{name:"up"})}),(0,ee.Y)(W.A,{className:(0,me.A)(nu.navigationButton,!$&&nu.navigationDisabled),round:!0,size:"smaller",color:"secondary",onClick:Oe,nonInteractive:!$,ariaLabel:J("AriaSearchNewerResult"),children:(0,ee.Y)(q.A,{name:"down"})})]})]})]})})));var cu=i(80539),du=i(58734),hu=i(73172);const mu=2.5*p.$,uu=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{setsById:i,added:s,recent:n,favorite:o,effect:a}=e.stickers,r=(0,c.nZ4)(e,t),l=(0,c.hds)(e,t),d=(0,u.L8)(t)?void 0:(0,c.AWZ)(e,t)?.stickerSet?.id;return{chat:l,effectStickers:a?.stickers,effectEmojis:a?.emojis,recentStickers:n.stickers,favoriteStickers:o.stickers,stickerSetsById:i,addedSetIds:s.setIds,canAnimate:(0,c.ML4)(e),isSavedMessages:r,isCurrentUserPremium:(0,c.g29)(e),chatStickerSetId:d}}))((({chat:e,threadId:t,className:i,isHidden:o,isTranslucent:r,loadAndPlay:l,canSendStickers:c,recentStickers:d,favoriteStickers:h,effectStickers:m,effectEmojis:u,addedSetIds:p,stickerSetsById:v,chatStickerSetId:g,canAnimate:A,isSavedMessages:f,isCurrentUserPremium:C,noContextMenus:S,idPrefix:y,onStickerSelect:k,isForEffects:w})=>{const{loadRecentStickers:N,addRecentSticker:I,unfaveSticker:P,faveSticker:Y,removeRecentSticker:F}=(0,n.ko)(),T=(0,s.li)(),B=(0,s.li)(),R=(0,s.li)(),{handleScroll:L,isAtBeginning:x}=As(),E=(0,hu.A)(e?.id,t),V=`${y}-sticker-set`,{activeSetIndex:_,observeIntersectionForSet:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,observeIntersectionForCovers:J,selectStickerSet:G}=lr(T,B,V,o),j=(0,M.A)(),z=Boolean(p),H=(0,s.Kr)((()=>{if(w&&m){const e=[];return u?.length&&e.push({id:a.hfH,accessHash:"0",title:"",stickers:u,count:u.length,isEmoji:!0}),m?.length&&e.push({id:a.Kp3,accessHash:"0",title:j("StickerEffects"),stickers:m,count:m.length}),e}if(!p)return fi.p;const e=[];h.length&&e.push({id:a.tRH,accessHash:"0",title:j("FavoriteStickers"),stickers:h,count:h.length}),d.length&&e.push({id:a.sR2,accessHash:"0",title:j("RecentStickers"),stickers:d,count:d.length});const t=[...p||[]];g&&t.unshift(g);const i=Object.values((0,bi._E)(v,t));return[...e,...i]}),[p,v,h,d,g,j,m,w,u]),$=(0,s.Kr)((()=>z&&0===H.filter((e=>e.stickers?.length)).length),[H,z]);(0,s.vJ)((()=>{l&&(N(),c&&E({type:"chooseSticker"}))}),[c,l,N,E]);const Q=(0,sr.A)([],a.jhd),Z=z&&Q&&!$&&(c||w);(0,kn.A)(B,!Z||!B.current),(0,s.vJ)((()=>{if(!z)return;const e=B.current;if(!e)return;const t=_*mu-(e.offsetWidth/2-mu/2);(0,Ao.A)(e,t)}),[z,_]);const X=(0,D.A)(((e,t,i)=>{k(e,t,i,!0),I({sticker:e})})),te=(0,D.A)((e=>{P({sticker:e})})),ie=(0,D.A)((e=>{Y({sticker:e})})),se=(0,D.A)((()=>{c&&E({type:"chooseSticker"})})),ne=(0,D.A)((e=>{F({sticker:e})}));if(!e)return;const oe=(0,me.A)("lq8BD6Hc",i);if(!Z)return(0,ee.Y)("div",{className:oe,children:c||w?$?(0,ee.Y)("div",{className:Mr,children:j("NoStickers")}):(0,ee.Y)(Rs.A,{}):(0,ee.Y)("div",{className:Mr,children:j("ErrorSendRestrictedStickersAll")})});const ae=(0,me.A)(Yr,"no-scrollbar",!x&&Fr);return(0,ee.FD)("div",{className:oe,children:[!w&&(0,ee.Y)("div",{ref:B,className:ae,children:(0,ee.FD)("div",{className:"shared-canvas-container",children:[(0,ee.Y)("canvas",{ref:R,className:"shared-canvas"}),H.map((function(t,i){const s=t.stickers?.[0],n=(0,me.A)(Dr,i===_&&"y02WwQk6"),o=i<a.j41;return t.id===a.sR2||t.id===a.tRH||t.id===a.eKB||t.hasThumbnail||!s?(0,ee.Y)(W.A,{className:n,ariaLabel:t.title,round:!0,faded:t.id===a.sR2||t.id===a.tRH,color:"translucent",onClick:()=>G(i),children:t.id===a.sR2?(0,ee.Y)(q.A,{name:"recent"}):t.id===a.tRH?(0,ee.Y)(q.A,{name:"favorite"}):t.id===a.eKB?(0,ee.Y)(Dt.A,{peer:e,size:"small"}):(0,ee.Y)(ur,{stickerSet:t,noPlay:!A||!l,observeIntersection:J,sharedCanvasRef:o?R:void 0,forcePlayback:!0})},t.id):(0,ee.Y)(br,{sticker:s,size:a.TBj,title:t.title,className:n,noPlay:!A||!l,observeIntersection:J,noContextMenu:!0,isCurrentUserPremium:!0,sharedCanvasRef:o?R:void 0,withTranslucentThumb:r,onClick:G,clickArg:i,forcePlayback:!0},t.id)}))]})}),(0,ee.Y)("div",{ref:T,onMouseMove:se,onScroll:L,className:(0,me.A)(Ir,b.TF?"no-scrollbar":"custom-scroll",!w&&Pr),children:H.map(((e,t)=>(0,ee.Y)(wr,{stickerSet:e,loadAndPlay:Boolean(A&&l),noContextMenus:S,index:t,idPrefix:V,observeIntersection:U,observeIntersectionForPlayingItems:O,observeIntersectionForShowingItems:K,isNearActive:_>=t-1&&_<=t+1,favoriteStickers:h,isSavedMessages:f,isCurrentUserPremium:C,isTranslucent:r,isChatStickerSet:e.id===g,onStickerSelect:X,onStickerUnfave:te,onStickerFave:ie,onStickerRemoveRecent:ne,forcePlayback:!0,shouldHideHeader:e.id===a.hfH},e.id)))})]})}))),pu=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{availableReactions:i,topReactions:s}=e.reactions,{maxUniqueReactions:n}=e.appConfig||{},{enabledReactions:o,isPaidReactionAvailable:a}=(0,c.AWZ)(e,t)||{};return{enabledReactions:o,availableReactions:i,topReactions:s,reactionsLimit:n,isWithPaidReaction:a}}))((({loadAndPlay:e,enabledReactions:t,availableReactions:i,topReactions:n,selectedReactionIds:o,isWithPaidReaction:a,message:r,reactionsLimit:c,onReactionSelect:d,onReactionContext:h})=>{const m=(0,s.li)(),u=(0,s.li)(),{width:v}=(0,ke.A)(),{isTouchScreen:g}=(0,I.Ay)(),A=r?.reactions?.results,b=c&&A&&A.length>=c,f=(0,s.Kr)((()=>{if(b){const e=A.map((({reaction:e})=>e));return a&&e.unshift({type:"paid"}),e}if(!t)return[];if("all"===t.type){const e=(i||[]).map((({reaction:e})=>e));return a&&e.unshift({type:"paid"}),(0,l.fu)(e,n)}const e=t.allowed.slice();return a&&e.unshift({type:"paid"}),(0,l.fu)(e,n)}),[i,t,n,b,A,a]),C=(0,s.Kr)((()=>{const e=Math.min(26.25*p.$,v),t=(v>600?.625:.5)*p.$,i=e-.5*p.$,s=Math.floor((i+t)/(36+t)),n=Math.ceil(f.length/s),o=36*n+(n-1)*t+.5*p.$*2;return Math.min(18*p.$,o)}),[f.length,v]);return(0,ee.Y)("div",{className:"MhpiTAwi",style:`height: ${C}px`,children:(0,ee.Y)("div",{className:(0,me.A)("NIaqmosK",g?"no-scrollbar":"custom-scroll"),children:(0,ee.FD)("div",{className:"symbol-set-container shared-canvas-container",children:[(0,ee.Y)("canvas",{ref:m,className:"shared-canvas"}),(0,ee.Y)("canvas",{ref:u,className:"shared-canvas"}),f.map((t=>{const s=(0,l.Jj)(t),n=s?o?.includes(s):void 0;return(0,ee.Y)(yr,{reaction:t,isSelected:n,loadAndPlay:e,availableReactions:i,onClick:d,onContextMenu:h,sharedCanvasRef:m,sharedCanvasHqRef:u},s)}))]})})})}))),vu=16.375*p.$,gu=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.nTw)(e),i=e.availableEffectById,{chatId:s,messageId:n,storyPeerId:o,storyId:a,position:r,sendAsMessage:l,isForEffects:d}=t.reactionPicker||{},h=o&&a?(0,c.Msb)(e,o,a):void 0,m=s?(0,c.hds)(e,s):void 0,p=s?(0,c.AWZ)(e,s):void 0,v=s&&n?(0,c.O5q)(e,s,n):void 0,g=(0,u.L8)(s||o||""),A="some"===p?.enabledReactions?.type,{maxUniqueReactions:b}=e.appConfig||{},f="all"===p?.enabledReactions?.type&&p?.enabledReactions?.areCustomAllowed,C=v?.reactions?.results,S=Boolean(b&&C&&C.length>=b);return{message:v,story:h,position:r,shouldUseFullPicker:!(m?.isForbidden||A||S)&&(f||g),isTranslucent:(0,c.cwE)(e),isCurrentUserPremium:(0,c.g29)(e),sendAsMessage:l,isForEffects:d,chatId:s,availableEffectById:i}}))((({isOpen:e,message:t,story:i,position:o,isTranslucent:a,isCurrentUserPremium:r,shouldUseFullPicker:c,sendAsMessage:d,chatId:h,isForEffects:m,availableEffectById:u})=>{const{toggleReaction:p,closeReactionPicker:v,sendMessage:g,showNotification:A,sendStoryReaction:b,saveEffectInDraft:f,requestEffectInComposer:C,addLocalPaidReaction:S,openPaidReactionModal:y}=(0,n.ko)(),k=(0,M.A)(),w=(0,Ti.A)(t?.id,!0),N=(0,Ti.A)(t?.chatId,!0),P=(0,Ti.A)(i?.peerId,!0),Y=(0,Ti.A)(i?.id),F=(0,Ti.A)(o,!0),T=(0,s.li)(),B=(0,s.Kr)((()=>{if(F)return Y?F:{x:F.x+(c?-23:-21),y:F.y+(c?-64:-10)}}),[Y,F,c]),R=(0,D.A)((()=>T.current)),L=(0,D.A)((()=>({withPortal:!0,isDense:!P,deltaX:!(0,I.Ny)()&&T.current?-(T.current.offsetWidth-vu)/2- -11.5:0}))),x=(0,D.A)((e=>{if(!N||!w)return;const t=e.isCustomEmoji?{type:"custom",documentId:e.id}:{type:"emoji",emoticon:e.emoji};p({chatId:N,messageId:w,reaction:t,shouldAddToRecent:!0}),v()})),E=(0,D.A)((e=>{N&&w&&("paid"===e.type?S({chatId:N,messageId:w,count:1}):p({chatId:N,messageId:w,reaction:e,shouldAddToRecent:!0}),v())})),V=(0,D.A)((e=>{"paid"===e.type&&(y({chatId:N,messageId:w}),v())})),_=(0,D.A)((e=>{if("type"in e&&"paid"===e.type)return;const t="id"in e?{type:"custom",documentId:e.id}:e,i="type"in e&&"custom"===e.type?(0,n.mS)().customEmojis.byId[e.documentId]:"id"in e?e:void 0;if(i&&!i.isFree&&!r)return A({message:k("UnlockPremiumEmojiHint"),action:{action:"openPremiumModal",payload:{initialSection:"animated_emoji"}},actionText:k("PremiumMore")}),void v();if(!d)return b({peerId:P,storyId:Y,containerId:(0,l.$_)(P,Y),reaction:t,shouldAddToRecent:!0}),void v();let s,o;if("type"in e&&"emoji"===e.type)s=e.emoticon;else{const e=(0,cu.Ay)((0,du.hB)(i));s=e.text,o=e.entities}g({text:s,entities:o,isReaction:!0}),v()})),O=(0,D.A)((e=>{const t=Object.values(u),i=t.find((t=>t.effectStickerId===e.id))?.id;h&&f({chatId:h,threadId:U.l3,effectId:i}),i&&C({}),v()})),K=(0,s.Kr)((()=>(t?.reactions?.results||[]).reduce(((e,{chosenOrder:t,reaction:i})=>(void 0!==t&&e.push((0,l.Jj)(i)),e)),[])),[t?.reactions?.results]);return(0,ee.Y)($e.A,{isOpen:e,ref:T,className:(0,me.A)("gBh4WvBC","ReactionPicker"),bubbleClassName:(0,me.A)("qSfKwMzX",!c&&!Y&&"dRNSqkOC",Y&&"srpBMrqr"),withPortal:!0,noCompact:!0,anchor:B,positionY:i&&"bottom",getTriggerElement:Au,getRootElement:bu,getMenuElement:R,getLayout:L,backdropExcludedSelector:".Modal.confirm",onClose:v,children:m&&h?(0,ee.Y)(uu,{className:"",isHidden:!e,loadAndPlay:Boolean(e&&c),idPrefix:"message-effect",canSendStickers:!1,noContextMenus:!1,chatId:h,isTranslucent:a,onStickerSelect:O,isForEffects:m}):(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Lr,{chatId:N,idPrefix:"message-emoji-set-",isHidden:!e||!(c||Y),loadAndPlay:Boolean(e&&c),isReactionPicker:!0,className:c||Y?void 0:"KVwgF6DG",selectedReactionIds:K,isTranslucent:a,onCustomEmojiSelect:Y?_:x,onReactionSelect:Y?_:E,onReactionContext:V}),!c&&Boolean(N)&&(0,ee.Y)(pu,{chatId:N,loadAndPlay:e,onReactionSelect:Y?_:E,onReactionContext:V,selectedReactionIds:K,message:t})]})})})));function Au(){return document.querySelector("body")}function bu(){return document.querySelector("body")}var fu=i(39074),Cu=i(45761);const Su=document.createElement("div");var yu=i(41316),ku=i(3225),wu=i(25498),Nu=i(9442),Iu=i(91525),Pu=i(52988),Yu=i(27860);const Fu="SHoF85Vw",Du="Zo7u5epf",Mu=15*p.$,Tu=(0,s.ph)((({attachment:e,className:t,isSingle:i,shouldDisplayCompressed:n,shouldDisplayGrouped:o,index:r,onDelete:l,onToggleSpoiler:c})=>{const d=function(e,t){if(t&&e.quick){if(a.gex.has(e.mimeType))return"photo";if(a.fNs.has(e.mimeType))return"video"}return"file"}(e,n),h=(0,D.A)((()=>{c?.(r)})),m=(0,s.Kr)((()=>{switch(d){case"photo":return(0,ee.Y)("img",{className:Fu,src:e.blobUrl,alt:"",draggable:!1});case"video":return(0,ee.FD)(ee.FK,{children:[Boolean(e.quick?.duration)&&(0,ee.Y)("div",{className:"nI2M1SBH",children:(0,ze.QO)(e.quick.duration)}),(0,ee.Y)("video",{className:Fu,src:e.blobUrl,autoPlay:!0,muted:!0,loop:!0,disablePictureInPicture:!0})]});default:return(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(Pu.A,{className:"B6f6GcvN",name:e.filename,extension:(0,Iu.QC)(e.filename,e.mimeType),previewData:e.previewBlobUrl,size:e.size,smaller:!0}),l&&(0,ee.Y)(q.A,{name:"delete",className:(0,me.A)(Du,"CYJwy9T_"),onClick:()=>l(r)})]})}}),[e,d,r,l]),u="file"===d||!o,p=Boolean("file"!==d&&e.shouldSendAsSpoiler),v="file"!==d,g=(0,me.A)(t,"QucaiGVU",i&&"FjrnqGba",u&&"g0cTsM9d");return(0,ee.FD)("div",{className:g,children:[m,(0,ee.Y)(Yu.A,{isVisible:p,thumbDataUri:e.previewBlobUrl||e.blobUrl,width:Mu,height:Mu}),v&&(0,ee.FD)("div",{className:"bX7LdgxW",children:[(0,ee.Y)(q.A,{name:e.shouldSendAsSpoiler?"spoiler-disable":"spoiler",className:Du,onClick:h}),l&&(0,ee.Y)(q.A,{name:"delete",className:Du,onClick:()=>l(r)})]})]})}));var Bu=i(25897),Ru=i(83689),Lu=i(49068);function xu(e,t,i=!1){const s=e[i?"scrollLeft":"scrollTop"],n=s+e[i?"offsetWidth":"offsetHeight"],o=t[i?"offsetLeft":"offsetTop"],a=o+t[i?"offsetWidth":"offsetHeight"];return o>s&&a<n}function Eu(e,t,i=0,s=!1,n=!1,o=!1){const a=e[o?"scrollLeft":"scrollTop"],r=a+e[o?"offsetWidth":"offsetHeight"],l="string"==typeof t?e.querySelectorAll(t):t,{length:c}=l,d=[];let h=!1;for(let e=0;e<c;e++){const t=l[e],c=t[o?"offsetLeft":"offsetTop"],m=c+t[o?"offsetWidth":"offsetHeight"];if(n?m>=a-i&&m<=r+i:c<=r+i&&m>=a-i)d.push(e),h=!0;else if(h&&!s)break}return{allElements:l,visibleIndexes:d}}function Vu(e,t,i){const s=i.current;if(!s||t<0)return;const{visibleIndexes:n,allElements:o}=Eu(s,e,8,!0,!0);if(!o.length||!o[t])return;const a=n[0];if(!n.includes(t)||t===a&&!xu(s,o[a])){const e=t>n[n.length-1]?"start":"end";(0,nr.Ay)({container:s,element:o[t],position:e,margin:10})}}function _u({isActive:e,isHorizontal:t,shouldSaveSelectionOnUpdateItems:i,shouldRemoveSelectionOnReset:n,noArrowNavigation:o,items:a,shouldSelectOnTab:r,onSelect:l,onClose:c}){const[d,h]=(0,s.J0)(-1),m=(0,D.A)((e=>a?(0,Io.A)(a.length,e):-1)),u=(0,D.A)(((e,t)=>{t.preventDefault(),h((t=>m(t+e)))})),p=(0,D.A)((t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return!1;if(!e)return!1;if(a&&a.length&&d>-1){const e=a[d];if(e){if(!1===l(e))return!1;t.preventDefault()}}return!0}));(0,s.vJ)((()=>{e||h(n?-1:0)}),[e,n]);const v=!a||d>a.length-1;return(0,s.vJ)((()=>{i&&!v||h(n?-1:0)}),[v,n,i]),(0,s.vJ)((()=>e?(0,Bi.A)({onEsc:c,onUp:o||t?void 0:e=>u(-1,e),onDown:o||t?void 0:e=>u(1,e),onLeft:o||!t?void 0:e=>u(-1,e),onRight:o||!t?void 0:e=>u(1,e),onTab:r?p:void 0,onEnter:p}):void 0),[o,u,p,e,t,c,r]),d}const Uu=(0,s.ph)((({isOpen:e,onClose:t,onInsertUserName:i,filteredUsers:o})=>{const a=(0,s.li)(),{shouldRender:r,transitionClassNames:l}=(0,Oe.A)(e,void 0,void 0,!1),c=(0,D.A)(((e,t=!1)=>{const s=(0,n.mS)().users.byId[e];s&&i(s,t)})),d=(0,D.A)(((e,t)=>{e.preventDefault(),c(t)})),h=(0,D.A)((e=>{c(e.id,!0)})),m=_u({isActive:e,items:o,onSelect:h,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:t});(0,s.vJ)((()=>{Vu(".chat-item-clickable",m,a)}),[m]),(0,s.vJ)((()=>{o&&!o.length&&t()}),[o,t]);const u=(0,V.A)(o?.length?o:void 0,r),p=o&&!o.length?u:o;if(!r||p&&!p.length)return;const v=(0,me.A)("MentionTooltip composer-tooltip custom-scroll",l);return(0,ee.Y)("div",{className:v,ref:a,children:p?.map((({id:e},t)=>(0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item smaller-icon",onClick:d,clickArg:e,focus:m===t,children:(0,ee.Y)(ys.A,{userId:e,avatarSize:"small",withUsername:!0})},e)))})}));var Ou=i(78407),Ku=i(26440);const Ju="AT_d9l0W",Gu="AnO3BgVv",ju="caption-input-text",zu=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{currentUserId:i,recentEmojis:s,customEmojis:n,attachmentSettings:o}=e,r=(0,c.AWZ)(e,t),l=(0,c.nZ4)(e,t),{shouldSuggestCustomEmoji:d}=e.settings.byKey,{language:h}=(0,un.l)(e),m=e.emojiKeywords[a.cUY],u=h!==a.cUY?e.emojiKeywords[h]:void 0;return{isChatWithSelf:l,currentUserId:i,groupChatMembers:r?.members,recentEmojis:s,baseEmojiKeywords:m?.keywords,emojiKeywords:u?.keywords,shouldSuggestCustomEmoji:d,customEmojiForEmoji:n.forEmoji.stickers,captionLimit:(0,co.d)(e,"captionLength"),attachmentSettings:o}}))((({chatId:e,threadId:t,attachments:i,getHtml:o,editingMessage:c,canShowCustomSendMenu:d,captionLimit:m,isReady:u,isChatWithSelf:p,currentUserId:v,groupChatMembers:g,recentEmojis:A,baseEmojiKeywords:b,emojiKeywords:f,isForMessage:C,shouldSchedule:S,shouldSuggestCustomEmoji:y,customEmojiForEmoji:k,attachmentSettings:w,shouldForceCompression:N,shouldForceAsFile:P,isForCurrentMessageList:F,forceDarkTheme:T,onAttachmentsUpdate:B,onCaptionUpdate:R,onSend:L,onFileAppend:x,onClear:E,onSendSilent:_,onSendScheduled:U,onCustomEmojiSelect:O,onRemoveSymbol:J,onEmojiSelect:G,canScheduleUntilOnline:j,canSchedule:z,onSendWhenOnline:H,paidMessagesStars:$})=>{const Q=(0,s.li)(),X=(0,s.li)(),{addRecentCustomEmoji:te,addRecentEmoji:ie,updateAttachmentSettings:se}=(0,n.ko)(),ne=(0,M.A)(),oe=(0,Vi.A)(),ae=(0,s.li)(),re=(0,s.li)(),de=(0,s.li)(),he=(0,V.A)(i),ue=i.length?i:he,{isMobile:pe}=(0,I.Ay)(),ve=c&&Boolean(c),ge=c&&c?.groupedId,Ae="file"!==(ve&&i?.length&&(0,l.ES)(i[0])),[fe,Se,ye]=(0,Y.A)(),ke=w.shouldCompress,we=Boolean((ke||N||ge)&&!P),[Ne,Ie]=(0,s.J0)(w.shouldSendGrouped),Pe=w.isInvertedMedia,[Ye,Fe]=(0,s.J0)(w.shouldSendInHighQuality),[De,Me]=(0,s.J0)(Ye),{handleScroll:Te,isAtBeginning:Be,isAtEnd:Re}=As(),{handleScroll:Le,isAtBeginning:xe}=As(),Ee=Boolean(i.length),Ve=Boolean(ue?.length),[_e,Ue,Oe]=(0,Y.A)(),Ke=(0,s.li)();(0,s.vJ)((()=>{Ee||(ye(),se({isInvertedMedia:void 0}))}),[ye,Ee]);const[Je,Ge]=(0,s.Kr)((()=>Boolean(ue?.every((e=>e.quick||e.audio)))?[!0,!0]:[Boolean(ue?.some((e=>e.quick||e.audio))),!1]),[ue]),[je,ze]=(0,s.Kr)((()=>Boolean(ue?.every((e=>e.shouldSendAsSpoiler)))?[!0,!0]:[Boolean(ue?.some((e=>e.shouldSendAsSpoiler))),!1]),[ue]),He=(0,yu.A)(`#${a.e0F}`),{isEmojiTooltipOpen:$e,filteredEmojis:qe,filteredCustomEmojis:We,insertEmoji:Qe,closeEmojiTooltip:Ze}=(0,wu.A)(Boolean(u&&(F||!C)&&Ve),o,R,a.e0F,A,b,f),{isCustomEmojiTooltipOpen:Xe,insertCustomEmoji:et,closeCustomEmojiTooltip:tt}=(0,ku.A)(Boolean(u&&(F||!C)&&Ve&&y),o,R,He,re,k),{isMentionTooltipOpen:it,closeMentionTooltip:st,insertMention:nt,mentionFilteredUsers:ot}=(0,Nu.A)(Boolean(u&&F&&Ve),o,R,He,re,g,void 0,v);function at(e){se({isInvertedMedia:e})}(0,s.vJ)((()=>Ee?(0,h.A)(E):void 0),[Ee,E]),(0,s.vJ)((()=>{Ee&&(Ie(w.shouldSendGrouped),Fe(w.shouldSendInHighQuality))}),[w,Ee]),(0,s.vJ)((()=>{Ee||se({isInvertedMedia:void 0})}),[se,Ee]),(0,s.vJ)((()=>{Ee&&pe&&(0,fu.DY)()}),[pe,Ee]);const{isContextMenuOpen:rt,handleContextMenu:lt,handleContextMenuClose:ct,handleContextMenuHide:dt}=(0,An.A)(ae,!d||!Ee),ht=(0,D.A)(((e,t)=>{Ee&&(((S||t)&&C&&!c?U:e?_:L)(we,Ne,Pe),se({shouldCompress:we,shouldSendGrouped:Ne,isInvertedMedia:Pe,shouldSendInHighQuality:Ye}))})),mt=(0,D.A)((()=>{ht(!0)})),ut=(0,D.A)((()=>{ht()})),pt=(0,D.A)((()=>{ht(!1,!0)})),vt=(0,D.A)((async e=>{e.preventDefault(),Oe();const{dataTransfer:t}=e,i=await(0,Cu.A)(t.items);i?.length&&x(i,ze)})),gt=(0,D.A)((e=>{const{files:t}=e.target,i=(0,K.kc)(t);i?.length&&x(i,ze)})),At=(0,D.A)((()=>{(0,gh.p)("*",(e=>gt(e)))})),bt=(0,D.A)((e=>{B(i.filter(((t,i)=>i!==e)))})),ft=(0,D.A)((()=>{B(i.map((e=>({...e,shouldSendAsSpoiler:!0}))))})),Ct=(0,D.A)((()=>{se({shouldCompress:!ke})})),St=(0,D.A)((()=>{const e=!Ye;Fe(e),se({shouldSendInHighQuality:e})})),yt=(0,D.A)((()=>{B(i.map((e=>({...e,shouldSendAsSpoiler:void 0}))))})),kt=(0,D.A)((e=>{B(i.map(((t,i)=>i===e?{...t,shouldSendAsSpoiler:!t.shouldSendAsSpoiler||void 0}:t)))})),wt=(0,D.A)((()=>{const e=X.current;if(!e)return;const{width:t,height:i}=e.getBoundingClientRect();e.viewBox.baseVal.width=t,e.viewBox.baseVal.height=i}));(0,fr.A)(Q,wt),(0,Ce.A)(wt),(0,s.vJ)((()=>{const e=ae.current,t=document.getElementById(ju);if(!e||!t)return;const{width:i}=e.getBoundingClientRect();(0,r.RK)((()=>{t.style.setProperty("--margin-for-scrollbar",`${i}px`)}))}),[ne,Ee]);const Nt=(0,s.Kr)((()=>({onTrigger:e,isOpen:t})=>(0,ee.Y)(W.A,{round:!0,ripple:!pe,size:"smaller",color:"translucent",className:t?"active":"",onClick:e,ariaLabel:"More actions",children:(0,ee.Y)(q.A,{name:"more"})})),[pe]),It=(0,be.A)((()=>{if(!Ve)return;const e=m-(t=o(),Su.innerHTML=t,(0,cu.g4)(Su),Su.querySelectorAll("br").forEach((e=>{e.replaceWith("\n")})),Su.textContent?.trim().length||0);var t;return e<=100?e:void 0}),[m,o,Ve]),Pt=we&&Ge,[Yt,Ft,Dt,Mt]=(0,s.Kr)((()=>Pt&&ue?[ue.every((e=>a.gex.has(e.mimeType))),ue.every((e=>a.fNs.has(e.mimeType))),ue.every((e=>a.IH3.has(e.mimeType))),ue.some((e=>a.gex.has(e.mimeType)))]:[!1,!1,!1]),[ue,Pt]),Tt=(0,s.Kr)((()=>!!ue&&ue.some((e=>!a.IH3.has(e.mimeType)))),[ue]);if((0,s.vJ)((()=>{if(Ye!==De)return Ke.current&&clearTimeout(Ke.current),Ke.current=window.setTimeout((()=>{Me(Ye)}),200),()=>{Ke.current&&(clearTimeout(Ke.current),Ke.current=void 0)}}),[Ye,De]),!ue)return;const Bt=ue.length>1,Rt=!(ve||!Je||!(P||N||we)||Bt&&Ne);let Lt="";const xt=ue.length;Lt=ne(Yt?ve?"EditMessageReplacePhoto":"PreviewSender.SendPhoto":Ft?ve?"EditMessageReplaceVideo":"PreviewSender.SendVideo":Dt?ve?"EditMessageReplaceAudio":"PreviewSender.SendAudio":ve?"EditMessageReplaceFile":"PreviewSender.SendFile",xt,"i");const Et=!Re||!xe,Vt=$?(0,Li.U2)(oe,xt*$,{className:"C1OOt81o",asFont:!0}):ne("Send");return(0,ee.Y)(Z.A,{isOpen:Ee,onClose:E,header:function(){if(ue)return(0,ee.FD)("div",{className:"modal-header-condensed",dir:ne.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel attachments",onClick:E,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"modal-title",children:Lt}),Ae&&!ge&&(0,ee.FD)(le.A,{className:"attachmeneditingMessaget-modal-more-menu with-menu-transitions",trigger:Nt,positionX:"right",children:[Boolean(!c)&&(0,ee.Y)(ce.A,{icon:"add",onClick:At,children:ne("Add")}),Je&&(0,ee.FD)(ee.FK,{children:[Rt&&(Pe?(0,ee.Y)(ce.A,{icon:"move-caption-down",onClick:()=>at(void 0),children:ne("PreviewSender.MoveTextDown")}):(0,ee.Y)(ce.A,{icon:"move-caption-up",onClick:()=>at(!0),children:ne("PreviewSender.MoveTextUp")})),!P&&!N&&(we?(0,ee.Y)(ce.A,{icon:"document",onClick:Ct,children:ne(Bt?"Attachment.SendAsFiles":"Attachment.SendAsFile")}):(0,ee.Y)(ce.A,{icon:"photo",onClick:Ct,children:Bt?"Send All as Media":"Send as Media"})),we&&!c&&Mt&&(0,ee.Y)(ce.A,{icon:De?"sd-photo":"hd-photo",onClick:St,children:oe(De?"SendInStandardQuality":"SendInHighQuality")}),we&&Tt&&Boolean(!c)&&(je?(0,ee.Y)(ce.A,{icon:"spoiler-disable",onClick:yt,children:ne("Attachment.DisableSpoiler")}):(0,ee.Y)(ce.A,{icon:"spoiler",onClick:ft,children:ne("Attachment.EnableSpoiler")}))]}),Bt&&(Ne?(0,ee.Y)(ce.A,{icon:"grouped-disable",onClick:()=>Ie(!1),children:"Ungroup All Media"}):(0,ee.Y)(ce.A,{icon:"grouped",onClick:()=>Ie(!0),children:"Group All Media"}))]})]})}(),className:(0,me.A)("a27O2Qlr",_e&&Gu,!Be&&"Pc1k8G8s",pe&&"khvUZbGZ",fe&&"ir5kkMy1",T&&"component-theme-dark"),noBackdropClose:!0,isLowStackPriority:!0,children:(0,ee.FD)("div",{className:Ju,onDragEnter:Ue,onDrop:vt,onDragOver:function(e){e.preventDefault(),de.current&&(window.clearTimeout(de.current),de.current=void 0)},onDragLeave:e=>{const{relatedTarget:t,target:i}=e;i.matches(`.${Ju}`)&&!t&&(de.current=window.setTimeout(Oe,150)),i&&i.closest(`.${Gu}`)||(t&&e.stopPropagation(),Oe())},onClick:Oe,"data-attach-description":ne("Preview.Dragging.AddItems",10),"data-dropzone":!0,children:[(0,ee.Y)("svg",{className:"d9O65j_I",children:(0,ee.Y)("rect",{className:"jzCBDWMw",x:"0",y:"0",width:"100%",height:"100%",rx:"8"})}),(0,ee.Y)("div",{className:(0,me.A)("_bxSIFgj","custom-scroll",Et&&"RPVunBe2"),onScroll:Te,children:ue.map(((e,t)=>(0,ee.Y)(Tu,{attachment:e,shouldDisplayCompressed:we,shouldDisplayGrouped:Ne,isSingle:1===ue.length,index:t,onDelete:bt,onToggleSpoiler:kt},e.uniqueId||t)))}),(0,ee.FD)("div",{className:(0,me.A)("EtmiUn2k",Et&&"FjjSKMYe"),children:[(0,ee.Y)(Uu,{isOpen:it,filteredUsers:ot,onInsertUserName:nt,onClose:st}),(0,ee.Y)(Lu.A,{isOpen:$e,emojis:qe,customEmojis:We,addRecentEmoji:ie,addRecentCustomEmoji:te,onEmojiSelect:Qe,onCustomEmojiSelect:Qe,onClose:Ze}),(0,ee.Y)(Bu.A,{chatId:e,isOpen:Xe,addRecentCustomEmoji:te,onCustomEmojiSelect:et,onClose:tt}),(0,ee.FD)("div",{className:"Te7lIfpB",children:[(0,ee.Y)(Ku.A,{chatId:e,threadId:t,isMobile:pe,isReady:u,isSymbolMenuOpen:fe,openSymbolMenu:Se,closeSymbolMenu:ye,onCustomEmojiSelect:O,onRemoveSymbol:J,onEmojiSelect:G,isAttachmentModal:!0,canSendPlainText:!0,className:"attachment-modal-symbol-menu with-menu-transitions",idPrefix:"attachment",forceDarkTheme:T}),(0,ee.Y)(Ou.A,{ref:re,id:ju,chatId:e,threadId:t,isAttachmentModalInput:!0,customEmojiPrefix:"attachment",isReady:u,isActive:Ee,getHtml:o,editableInputId:a.e0F,placeholder:ne("AddCaption"),onUpdate:R,onSend:ut,onScroll:Le,canAutoFocus:Boolean(u&&F&&i.length),captionLimit:It,shouldSuppressFocus:pe&&fe,onSuppressedFocus:ye}),(0,ee.FD)("div",{className:"wDqWK9MD",children:[(0,ee.Y)(W.A,{ref:ae,className:"kNlWmBJI",onClick:ut,onContextMenu:d?lt:void 0,children:S&&!c?ne("Next"):c?ne("Save"):Vt}),d&&(0,ee.Y)(Ru.A,{isOpen:rt,canSchedule:z&&C,onSendSilent:p?void 0:mt,onSendSchedule:pt,onClose:ct,onCloseAnimationEnd:dt,isSavedMessages:p,onSendWhenOnline:H,canScheduleUntilOnline:j})]})]})]})]})})}))),Hu=(0,s.ph)((({isOpen:e,isQuiz:t,shouldBeAnonymous:i,maxOptionsCount:n=12,onSend:o,onClear:a})=>{const l=(0,s.li)(),c=(0,s.li)(),[d,m]=(0,s.J0)(""),[u,p]=(0,s.J0)([""]),[v,g]=(0,s.J0)(!0),[A,b]=(0,s.J0)(!1),[f,C]=(0,s.J0)(t||!1),[S,y]=(0,s.J0)(""),[k,w]=(0,s.J0)(),[N,I]=(0,s.J0)(!1),P=(0,M.A)(),Y=(0,D.A)((e=>{y(e.target.value)})),F=(0,D.A)((t=>{e&&t.current&&t.current.focus()}));(0,s.vJ)((()=>e?(0,h.A)(a):void 0),[e,a]),(0,s.vJ)((()=>{e||(m(""),p([""]),g(!0),b(!1),C(t||!1),y(""),w(void 0),I(!1))}),[t,e]),(0,s.vJ)((()=>F(l)),[F,e]);const T=(0,D.A)(((e=[])=>{p([...e,""]),(0,r.Uz)((()=>{const e=c.current;e&&(0,r.YS)((()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}))}))})),B=(0,D.A)((()=>{if(I(!1),!e)return;const t=f&&(void 0===k||!u[k].trim()),i=u.map(((e,t)=>{if(e=e.trim())return{text:{text:e},option:String(t),...t===k&&{correct:!0}}})).filter(Boolean),s=d.trim().substring(0,255);if(!s||i.length<2){if(m(s),i.length){const e=u.map((e=>e.trim().substring(0,100))).filter(Boolean);e.length<2?T(e):p(e)}else T();return void I(!0)}if(t)return void I(!0);const n={summary:{question:{text:s},answers:i,...!v&&{isPublic:!0},...A&&{multipleChoice:!0},...f&&{quiz:!0}}};if(f){const{text:e,entities:t}=S&&(0,cu.Ay)(S.substring(0,200))||{};n.quiz={correctAnswers:[String(k)],...e&&{solution:e},...t&&{solutionEntities:t}}}o(n)})),R=(0,D.A)(((e,t)=>{const i=[...u];i[e]=t,i[i.length-1].trim().length&&i.length<n?T(i):p(i)})),L=(0,D.A)((e=>{const t=[...u];t.splice(e,1),p(t),void 0!==k&&(k===e?w(void 0):e<k&&w(k-1)),(0,r.Uz)((()=>{c.current&&c.current.classList.toggle("overflown",c.current.scrollHeight>320)}))})),x=(0,D.A)((e=>{w(Number(e))})),E=(0,D.A)((e=>{g(e.target.checked)})),V=(0,D.A)((e=>{b(e.target.checked)})),_=(0,D.A)((e=>{C(e.target.checked)})),U=(0,D.A)((e=>{13===e.keyCode&&B()})),O=(0,D.A)((e=>{m(e.target.value)})),K=(0,D.A)((()=>{if(N&&!d.trim().length)return P("lng_polls_choose_question")})),J=(0,D.A)((e=>{const t=u.map((e=>e.trim())).filter((e=>e.length));if(N&&t.length<2&&!u[e].trim().length)return P("lng_polls_choose_answers")}));function G(){return u.map(((e,t)=>(0,ee.FD)("div",{className:"option-wrapper",children:[(0,ee.Y)(Q.A,{maxLength:100,label:t!==u.length-1||u.length===n?P("OptionHint"):P("CreatePoll.AddOption"),error:J(t),value:e,onChange:e=>R(t,e.currentTarget.value),onKeyPress:U}),t!==u.length-1&&(0,ee.Y)(W.A,{className:"option-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:P("Delete"),onClick:()=>L(t),children:(0,ee.Y)(q.A,{name:"close"})})]})))}return(0,ee.FD)(Z.A,{isOpen:e,onClose:a,header:(0,ee.FD)("div",{className:"modal-header-condensed",children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:"Cancel poll creation",onClick:a,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"modal-title",children:P("NewPoll")}),(0,ee.Y)(W.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:B,children:P("Create")})]}),className:"PollModal",children:[(0,ee.Y)(Q.A,{ref:l,label:P("AskAQuestion"),value:d,error:K(),onChange:O,onKeyPress:U}),(0,ee.Y)("div",{className:"options-divider"}),(0,ee.FD)("div",{className:"options-list custom-scroll",ref:c,children:[(0,ee.Y)("h3",{className:"options-header",children:P("PollOptions")}),N&&function(){const e=u.map((e=>e.trim())).filter((e=>e.length));return f&&(void 0===k||!e[k])&&(0,ee.Y)("p",{className:"poll-error",children:P("lng_polls_choose_correct")})}(),f?(0,ee.Y)(X.A,{name:"correctOption",options:G().map(((e,t)=>({value:String(t),label:e,hidden:!u[t].trim()}))),selected:String(k),onChange:x}):G()]}),(0,ee.Y)("div",{className:"options-divider"}),(0,ee.FD)("div",{className:"quiz-mode",children:[(0,ee.FD)("div",{className:"dialog-checkbox-group",children:[!i&&(0,ee.Y)(en.A,{label:P("PollAnonymous"),checked:v,onChange:E}),(0,ee.Y)(en.A,{label:P("PollMultiple"),checked:A,disabled:f,onChange:V}),(0,ee.Y)(en.A,{label:P("PollQuiz"),checked:f,disabled:A||void 0!==t,onChange:_})]}),f&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{className:"options-header",children:P("lng_polls_solution_title")}),(0,ee.Y)(Il.A,{value:S,onChange:Y,noReplaceNewlines:!0}),(0,ee.Y)("div",{className:"note",children:P("CreatePoll.ExplanationInfo")})]})]})]})}));var $u=i(14235);const qu=(0,s.ph)((0,n.EK)(((e,{modal:t})=>{const{appConfig:i}=e;return{editingMessage:t?.messageId?(0,c.O5q)(e,t.chatId,t.messageId):void 0,maxItemsCount:i?.todoItemsMax,maxTitleLength:i?.todoTitleLengthMax,maxItemLength:i?.todoItemLengthMax}}))((({modal:e,maxItemsCount:t=a.gyE,maxTitleLength:i=a.B_P,maxItemLength:o=a.QU5,editingMessage:l,onSend:c,onClear:d})=>{const{editTodo:m,closeTodoListModal:u,appendTodoList:p}=(0,n.ko)(),v=(0,s.li)(),g=(0,s.li)(),[A,b]=(0,s.J0)(""),[f,C]=(0,s.J0)([{id:(0,$u.t)(),text:""}]),[S,y]=(0,s.J0)(!0),[k,w]=(0,s.J0)(!0),[N,I]=(0,s.J0)(!1),P=(0,Vi.A)(),Y=Boolean(e),F=(0,Ti.A)(e),M=F?.forNewTask&&!l?.isOutgoing,T=l?.content.todo?.todo,B=(0,s.Kr)((()=>M&&T?T.items.map((e=>({id:e.id,text:e.title.text,isDisabled:!0}))):fi.p),[M,T]),R=(0,D.A)((e=>{Y&&e.current&&e.current.focus()}));(0,s.Nf)((()=>{if(T&&(b(T.title.text),y(T.othersCanAppend??!1),w(T.othersCanComplete??!1),!M)){const e=T.items.map((e=>({id:e.id,text:e.title.text})));e.length<t&&e.push({id:(0,$u.t)(),text:""}),C(e)}}),[T,M,t]),(0,s.vJ)((()=>Y?(0,h.A)(d):void 0),[Y,d]),(0,s.vJ)((()=>{Y||(b(""),C([{id:(0,$u.t)(),text:""}]),y(!0),w(!0),I(!1))}),[Y]),(0,s.vJ)((()=>{Y&&(0,r.YS)((()=>{if(F?.forNewTask){const e=g.current?.querySelectorAll("input"),t=e?.[e.length-1];t?.focus()}else R(v)}))}),[R,Y,F?.forNewTask]);const L=(0,D.A)((e=>{const t=(0,$u.t)();C([...e,{id:t,text:""}]),(0,r.Uz)((()=>{const e=g.current;e&&(0,r.YS)((()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}))}))})),x=(0,D.A)((()=>{if(I(!1),!Y)return;const e=f.map((e=>{const t=e.text.trim();if(t)return{id:e.id,title:{text:t.substring(0,o)}}})).filter(Boolean),t=A.trim().substring(0,i);if(!t||0===e.length){if(b(t),e.length){const e=f.map((e=>({...e,text:e.text.trim().substring(0,o)}))).filter((e=>e.text.length));0===e.length?L([]):C([...e,{id:(0,$u.t)(),text:""}])}else L([]);return void I(!0)}if(M&&l)return p({chatId:l.chatId,messageId:l.id,items:e}),void u();const s={todo:{title:{text:t},items:e,othersCanAppend:S,othersCanComplete:k}};l?m({chatId:l.chatId,todo:s,messageId:l.id}):c(s),u()})),E=(0,D.A)(((e,i)=>{const s=[...f];s[e]={...s[e],text:i},s[s.length-1].text.trim().length&&s.length<t?L(s):C(s)})),V=(0,D.A)((e=>{const t=[...f];t.splice(e,1),C(t),(0,r.Uz)((()=>{g.current&&g.current.classList.toggle("overflown",g.current.scrollHeight>320)}))})),_=(0,D.A)((e=>{y(e.target.checked)})),U=(0,D.A)((e=>{w(e.target.checked)})),O=(0,D.A)((e=>{"Enter"===e.key&&x()})),K=(0,D.A)((e=>{b(e.target.value)})),J=(0,D.A)((()=>{if(N&&!A.trim().length)return P("ToDoListErrorChooseTitle")})),G=(0,D.A)((e=>{const t=f.map((e=>e.text.trim())).filter((e=>e.length));if(N&&t.length<1&&!f[e].text.trim().length)return P("ToDoListErrorChooseTasks")}));return(0,ee.FD)(Z.A,{isOpen:Y,onClose:d,header:function(){const e=M?"TitleAppendToDoList":l?"TitleEditToDoList":"TitleNewToDoList";return(0,ee.FD)("div",{className:"modal-header-condensed",children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",ariaLabel:P("AriaToDoCancel"),onClick:d,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)("div",{className:"modal-title",children:P(e)}),(0,ee.Y)(W.A,{color:"primary",size:"smaller",className:"modal-action-button",onClick:x,children:P(M?"Add":l?"Save":"Create")})]})}(),className:"ToDoListModal",children:[!M&&(0,ee.Y)(Q.A,{ref:v,label:P("InputTitle"),value:A,error:J(),onChange:K,onKeyPress:O}),M&&(0,ee.Y)("div",{className:"readonly-title",children:A}),(0,ee.Y)("div",{className:"options-divider"}),(0,ee.FD)("div",{className:"options-list custom-scroll",ref:g,children:[(0,ee.Y)("h3",{className:"items-header",children:P("TitleToDoList")}),function(){const e=[...B,...f];return e.map(((i,s)=>{const n=s-B.length;return(0,ee.FD)("div",{className:"item-wrapper",children:[(0,ee.Y)(Q.A,{maxLength:100,label:s!==e.length-1||e.length===t?P("TitleTask"):P("TitleAddTask"),error:G(n),value:i.text,disabled:i.isDisabled,onChange:e=>E(n,e.currentTarget.value),onKeyPress:O}),s!==e.length-1&&!i.isDisabled&&(0,ee.Y)(W.A,{className:"item-remove-button",round:!0,color:"translucent",size:"smaller",ariaLabel:P("Delete"),onClick:()=>V(n),children:(0,ee.Y)(q.A,{name:"close"})})]})}))}()]}),(0,ee.Y)("div",{className:"items-count-hint",children:P("HintTodoListTasksCount",{count:t-f.length-(M&&T?T.items.length:0)})}),(0,ee.Y)("div",{className:"options-divider"}),!M&&(0,ee.Y)("div",{className:"options-footer",children:(0,ee.FD)("div",{className:"dialog-checkbox-group",children:[(0,ee.Y)(en.A,{label:P("AllowOthersAddTasks"),checked:S,onChange:_}),(0,ee.Y)(en.A,{label:P("AllowOthersMarkAsDone"),checked:k,onChange:U})]})})]})})));var Wu=i(36680),Qu=i(52491);const Zu=(0,s.ph)((({emoji:e,focus:t,onClick:i})=>{const s=(0,D.A)((t=>{t.preventDefault(),i(e.native,e.id)})),n=(0,me.A)("EmojiButton",t&&"focus"),o=`${a.jht?a.C1b:"."}/img-apple-64/${e.image}.png`,r=Qu.On.has(o);return(0,ee.Y)("div",{className:n,onMouseDown:s,title:`:${e.names[0]}:`,children:b.TL?e.native:(0,ee.Y)("img",{src:o,className:r?void 0:"opacity-transition shown",alt:e.native,loading:"lazy","data-path":o,onLoad:r?void 0:Qu.P_,draggable:!1})})})),Xu=.625*p.$,ep=.25*p.$,tp=.5*p.$,ip=.5*p.$,sp=(0,s.ph)((({category:e,index:t,allEmojis:i,observeIntersection:n,shouldRender:o,onEmojiSelect:r})=>{const l=(0,s.li)();(0,or.mv)(l,n);const c=(0,Ui.A)(o),d=(0,M.A)(),{isMobile:h}=(0,I.Ay)(),m=h?Math.floor((y.A.get().width-ip+Xu)/(a.g0Q+Xu)):8,u=Math.ceil(e.emojis.length/m)*(a.g0Q+(h?tp:ep));return(0,ee.FD)("div",{ref:l,id:`emoji-category-${t}`,className:"symbol-set",children:[(0,ee.Y)("div",{className:"symbol-set-header",children:(0,ee.Y)("p",{className:"symbol-set-name",dir:"auto",children:d(e.id===a.sR2?"RecentStickers":`Emoji${t}`)})}),(0,ee.Y)("div",{className:(0,me.A)("symbol-set-container",c),style:`height: ${u}px;`,dir:d.isRtl?"rtl":void 0,children:o&&e.emojis.map((e=>{const t=i[e];if(!t)return;const s="id"in t?t:t[1];return(0,ee.Y)(Zu,{emoji:s,onClick:r},s.id)}))})]},e.id)})),np={recent:"recent",people:"smile",nature:"animals",foods:"eats",activity:"sport",places:"car",objects:"lamp",symbols:"language",flags:"flag"},op=3.25*p.$,ap=2.625*p.$,rp=[];let lp,cp,dp;const hp=(0,s.ph)((0,n.EK)((e=>(0,bi.Up)(e,["recentEmojis"])))((({className:e,recentEmojis:t,onEmojiSelect:n})=>{const o=(0,s.li)(),r=(0,s.li)(),[l,c]=(0,s.J0)(),[d,h]=(0,s.J0)(),[m,u]=(0,s.J0)(0),{isMobile:p}=(0,I.Ay)(),{handleScroll:v,isAtBeginning:g}=As(),{observe:A}=(0,or.BL)({rootRef:o,throttleMs:200},(e=>{e.forEach((e=>{const{id:t}=e.target;if(!t||!t.startsWith("emoji-category-"))return;const i=Number(t.replace("emoji-category-",""));rp[i]=e.isIntersecting}));const t=rp.reduce(((e,t,i)=>t&&i<e?i:e),1/0);t!==1/0&&u(t)})),f=(0,sr.A)([],a.vVF),C=d&&f;(0,kn.A)(r,!(p&&C)),(0,s.vJ)((()=>{if(!l)return;const e=r.current;if(!e)return;const t=m*ap-e.offsetWidth/2+ap/2;(0,Ao.A)(e,t)}),[l,m]);const S=(0,M.A)(),y=(0,s.Kr)((()=>{if(!l)return fi.p;const e=[...l];return t?.length&&e.unshift({id:a.sR2,name:S("RecentStickers"),emojis:t}),e}),[l,S,t]);(0,s.vJ)((()=>{setTimeout((()=>{const e=()=>{c(dp.categories),h(dp.emojis)};dp?e():async function(){return lp||(lp=i.e(996).then(i.t.bind(i,20996,19)),cp=(await lp).default,dp=(0,Qu.cp)(cp)),lp}().then(e)}),200)}),[]);const k=(0,D.A)((e=>{u(e);const t=o.current.closest(".SymbolMenu-main").querySelector(`#emoji-category-${e}`);(0,nr.Ay)({container:o.current,element:t,position:"start",margin:op,maxDistance:100})})),w=(0,D.A)(((e,t)=>{n(e,t)})),N=(0,me.A)("EmojiPicker",e);if(!C)return(0,ee.Y)("div",{className:N,children:(0,ee.Y)(Rs.A,{})});const P=(0,me.A)("EmojiPicker-header",!g&&"with-top-border");return(0,ee.FD)("div",{className:N,children:[(0,ee.Y)("div",{ref:r,className:P,dir:S.isRtl?"rtl":void 0,children:y.map((function(e,t){const i=np[e.id];return i&&(0,ee.Y)(W.A,{className:"symbol-set-button "+(t===m?"activated":""),round:!0,faded:!0,color:"translucent",onClick:()=>k(t),ariaLabel:e.name,children:(0,ee.Y)(q.A,{name:i})})}))}),(0,ee.Y)("div",{ref:o,onScroll:v,className:(0,me.A)("EmojiPicker-main",b.TF?"no-scrollbar":"custom-scroll"),children:y.map(((e,t)=>(0,ee.Y)(sp,{category:e,index:t,allEmojis:d,observeIntersection:A,shouldRender:m>=t-1&&m<=t+1,onEmojiSelect:w})))})]})}))),mp=(0,s.ph)((({gif:e,isDisabled:t,className:i,observeIntersection:n,onClick:o,onUnsaveClick:a,isSavedMessages:r})=>{const c=(0,s.li)(),d=(0,M.A)(),h=(0,or.Vz)(c,n)&&!t,m=!e.hasVideoPreview&&e.thumbnail&&(0,l.sC)(e,"pictogram"),u=(0,j.A)(m,!h),[p]=(0,s.J0)(e.thumbnail?.dataUri&&!u),v=(0,Ei.A)(e.thumbnail?.dataUri,!p),g=(0,l.Ct)(e)||(0,l.sC)(e,"full"),A=(0,j.A)(g,!h),f=Boolean(h&&A),{isBuffered:C,bufferingHandlers:S}=(0,Ue.A)(!0),y=h&&!C,k=h&&C,{isContextMenuOpen:w,contextMenuAnchor:N,handleBeforeContextMenu:I,handleContextMenu:P,handleContextMenuClose:Y,handleContextMenuHide:F}=(0,An.A)(c),T=(0,D.A)((()=>c.current)),B=(0,D.A)((()=>c.current.closest(".custom-scroll, .no-scrollbar"))),R=(0,D.A)((()=>c.current.querySelector(".gif-context-menu .bubble"))),L=(0,D.A)((()=>{!w&&o&&o({...e,blobUrl:A})})),x=(0,D.A)((t=>{t.stopPropagation(),t.preventDefault(),a(e)})),E=(0,D.A)((()=>{a?.(e)})),V=(0,D.A)((()=>{o({...e,blobUrl:A},!0)})),_=(0,D.A)((()=>{o({...e,blobUrl:A},void 0,!0)})),U=(0,D.A)((e=>{(0,pr.u)(e),I(e)}));(0,s.vJ)((()=>{t&&Y()}),[Y,t]);const O=(0,me.A)("GifButton",e.width&&e.height&&e.width<e.height?"vertical":"horizontal",o&&"interactive",i);return(0,ee.FD)("div",{ref:c,className:O,onMouseDown:U,onClick:L,onContextMenu:P,children:[!b.TF&&a&&(0,ee.Y)(W.A,{className:"gif-unsave-button",color:"dark",pill:!0,noFastClick:!0,onClick:x,children:(0,ee.Y)(q.A,{name:"close",className:"gif-unsave-button-icon"})}),p&&(0,ee.Y)("canvas",{ref:v,className:"thumbnail"}),u&&!k&&(0,ee.Y)("img",{src:u,alt:"",className:"preview",draggable:!1}),f&&(0,ee.Y)(ji.A,{canPlay:!0,src:A,autoPlay:!0,loop:!0,muted:!0,disablePictureInPicture:!0,playsInline:!0,preload:"none",...S}),y&&(0,ee.Y)(xe.A,{color:u||p?"white":"black"}),o&&void 0!==N&&(0,ee.FD)($e.A,{isOpen:w,anchor:N,getTriggerElement:T,getRootElement:B,getMenuElement:R,className:"gif-context-menu",autoClose:!0,onClose:Y,onCloseAnimationEnd:F,children:[!r&&(0,ee.Y)(ce.A,{onClick:V,icon:"mute",children:d("SendWithoutSound")}),(0,ee.Y)(ce.A,{onClick:_,icon:"calendar",children:d(r?"SetReminder":"ScheduleMessage")}),a&&(0,ee.Y)(ce.A,{destructive:!0,icon:"delete",onClick:E,children:d("Delete")})]})]})})),up=(0,s.ph)((0,n.EK)((e=>{const{chatId:t}=(0,c.Xf0)(e)||{},i=Boolean(t)&&(0,c.nZ4)(e,t);return{savedGifs:e.gifs.saved.gifs,isSavedMessages:i}}))((({className:e,loadAndPlay:t,canSendGifs:i,savedGifs:o,isSavedMessages:r,onGifSelect:l})=>{const{loadSavedGifs:c,saveGif:d}=(0,n.ko)(),h=(0,s.li)(),{observe:m}=(0,or.BL)({rootRef:h,debounceMs:300});(0,s.vJ)((()=>{t&&c()}),[t,c]);const u=(0,D.A)((e=>{d({gif:e,shouldUnsave:!0})})),p=(0,sr.A)([],a.jhd);return(0,ee.Y)("div",{children:(0,ee.Y)("div",{ref:h,className:(0,me.A)("GifPicker",e,b.TF?"no-scrollbar":"custom-scroll"),children:i?p&&o&&o.length?o.map((e=>(0,ee.Y)(mp,{gif:e,observeIntersection:m,isDisabled:!t,onClick:i?l:void 0,onUnsaveClick:u,isSavedMessages:r},e.id))):p&&o?(0,ee.Y)("div",{className:"picker-disabled",children:"No saved GIFs."}):(0,ee.Y)(Rs.A,{}):(0,ee.Y)("div",{className:"picker-disabled",children:"Sending GIFs is not allowed in this chat."})})})})));let pp=function(e){return e[e.Emoji=0]="Emoji",e[e.CustomEmoji=1]="CustomEmoji",e[e.Stickers=2]="Stickers",e[e.GIFs=3]="GIFs",e}({});const vp={[pp.Emoji]:"Emoji",[pp.CustomEmoji]:"StickersList.EmojiItem",[pp.Stickers]:"AccDescrStickers",[pp.GIFs]:"GifsTab"},gp={[pp.Emoji]:"icon-smile",[pp.CustomEmoji]:"icon-favorite",[pp.Stickers]:"icon-stickers",[pp.GIFs]:"icon-gifs"},Ap=(0,s.ph)((({activeTab:e,onSwitchTab:t,onRemoveSymbol:i,onSearchOpen:s,isAttachmentModal:n,canSendPlainText:o,canSearch:a})=>{const r=(0,M.A)();function l(i){return(0,ee.Y)(W.A,{className:"symbol-tab-button "+(e===i?"activated":""),onClick:()=>t(i),ariaLabel:r(vp[i]),round:!0,faded:!0,color:"translucent",children:(0,ee.Y)("i",{className:(0,me.A)("icon",gp[i])})})}const c=(0,D.A)((()=>{s(e===pp.Stickers?"stickers":"gifs")}));return(0,ee.FD)("div",{className:"SymbolMenu-footer",onClick:function(e){e.stopPropagation()},dir:r.isRtl?"rtl":void 0,children:[e!==pp.Emoji&&e!==pp.CustomEmoji&&a&&(0,ee.Y)(W.A,{className:"symbol-search-button",ariaLabel:e===pp.Stickers?"Search Stickers":"Search GIFs",round:!0,faded:!0,color:"translucent",onClick:c,children:(0,ee.Y)(q.A,{name:"search"})}),o&&l(pp.Emoji),o&&l(pp.CustomEmoji),!n&&l(pp.Stickers),!n&&l(pp.GIFs),(e===pp.Emoji||e===pp.CustomEmoji)&&(0,ee.Y)(W.A,{className:"symbol-delete-button",onClick:i,ariaLabel:"Remove Symbol",round:!0,faded:!0,color:"translucent",children:(0,ee.Y)(q.A,{name:"delete-left"})})]})}));let bp=!1;const fp=(0,s.ph)((0,n.EK)((e=>({isLeftColumnShown:(0,c.nTw)(e).isLeftColumnShown,isBackgroundTranslucent:(0,c.cwE)(e)})))((({chatId:e,threadId:t,isOpen:i,canSendStickers:n,canSendGifs:o,isMessageComposer:a,isLeftColumnShown:l,idPrefix:c,isAttachmentModal:d,canSendPlainText:h,className:m,isBackgroundTranslucent:u,onLoad:p,onClose:v,onEmojiSelect:g,onCustomEmojiSelect:A,onStickerSelect:f,onGifSelect:C,onRemoveSymbol:S,onSearchOpen:y,addRecentEmoji:k,addRecentCustomEmoji:w,...N})=>{const[P,Y]=(0,s.J0)(pp.Emoji),[F,T]=(0,s.J0)([]),[B,R]=(0,s.J0)([]),{isMobile:L}=(0,I.Ay)(),[x,E]=(0,Wu.A)(i,v,void 0,L),{shouldRender:V,transitionClassNames:_}=(0,Oe.A)(i,v,!1,!1),U=(0,M.A)();!bp&&i&&(bp=!0),(0,s.vJ)((()=>{p()}),[p]),(0,s.vJ)((()=>{h||Y(2)}),[h]),(0,s.Nf)((()=>{if(L&&i&&!d)return document.body.classList.add("enable-symbol-menu-transforms"),document.body.classList.add("is-symbol-menu-open"),()=>{document.body.classList.remove("is-symbol-menu-open"),setTimeout((()=>{(0,r.RK)((()=>{document.body.classList.remove("enable-symbol-menu-transforms")}))}),350)}}),[d,L,i]);const O=(0,s.li)(F);O.current=F,(0,s.vJ)((()=>{O.current.length&&!i&&(O.current.forEach((e=>{k({emoji:e})})),T([]))}),[i,k]);const K=(0,D.A)(((e,t)=>{T((e=>[...e,t])),g(e)})),J=(0,s.li)(B);J.current=B,(0,s.vJ)((()=>{J.current.length&&!i&&(J.current.forEach((e=>{w({documentId:e})})),T([]))}),[i,w]);const G=(0,D.A)((e=>{R((t=>[...t,e.id])),A(e)})),j=(0,D.A)((e=>{v(),y(e)})),z=(0,D.A)(((e,t,i,s)=>{f?.(e,t,i,!0,s)})),H=(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{className:"SymbolMenu-main",onClick:function(e){e.stopPropagation()},children:bp&&(0,ee.Y)(se.Ay,{name:"slide",activeKey:P,renderCount:Object.values(vp).length,children:function(s,r){switch(P){case pp.Emoji:return(0,ee.Y)(hp,{className:"picker-tab",onEmojiSelect:K});case pp.CustomEmoji:return(0,ee.Y)(Lr,{className:"picker-tab",isHidden:!i||!s,idPrefix:c,loadAndPlay:i&&(s||r),chatId:e,isTranslucent:!L&&u,onCustomEmojiSelect:G});case pp.Stickers:return(0,ee.Y)(uu,{className:"picker-tab",isHidden:!i||!s,loadAndPlay:!!n&&i&&(s||r),idPrefix:c,canSendStickers:n,noContextMenus:!a,chatId:e,threadId:t,isTranslucent:!L&&u,onStickerSelect:z});case pp.GIFs:return(0,ee.Y)(up,{className:"picker-tab",loadAndPlay:!!o&&i&&(s||r),canSendGifs:o,onGifSelect:C})}}})}),L&&(0,ee.Y)(W.A,{round:!0,faded:!0,color:"translucent",ariaLabel:U("Close"),className:"symbol-close-button",size:"tiny",onClick:v,children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.Y)(Ap,{activeTab:P,onSwitchTab:Y,onRemoveSymbol:S,canSearch:a,onSearchOpen:j,isAttachmentModal:d,canSendPlainText:h})]});if(L){if(!V)return;const e=(0,me.A)("SymbolMenu mobile-menu",_,l&&"left-column-open",d&&"in-attachment-modal",a&&"in-middle-column");return d?(0,ee.Y)("div",{className:e,children:H}):(0,ee.Y)(xr.A,{children:(0,ee.Y)("div",{className:e,children:H})})}return(0,ee.Y)($e.A,{isOpen:i,onClose:v,withPortal:d,className:(0,me.A)("SymbolMenu",m),onCloseAnimationEnd:v,onMouseEnter:b.TF?void 0:x,onMouseLeave:b.TF?void 0:E,noCloseOnBackdrop:!b.TF,noCompact:!0,...d?N:{positionX:"left",positionY:"bottom"},children:H})})));var Cp=i(91034);const Sp=(0,s.ph)((({withAvatar:e,focus:t,command:i,description:s,peer:n,clickArg:o,onClick:a})=>{const r=(0,D.A)((()=>{a(o)}));return(0,ee.FD)(li.A,{className:(0,me.A)("BotCommand chat-item-clickable scroll-item",e&&"with-avatar"),multiline:!0,onClick:r,focus:t,children:[e&&(0,ee.Y)(Dt.A,{size:"small",peer:n}),(0,ee.FD)("div",{className:"content-inner",children:[(0,ee.FD)("span",{className:"title",children:["/",i]}),(0,ee.Y)("span",{className:"subtitle",children:(0,Ft.A)(s)})]})]},i)})),yp=(0,s.ph)((0,Cp.A)((({isOpen:e,chatId:t,withUsername:i,botCommands:o,quickReplies:a,quickReplyMessages:r,self:c,getHtml:d,onClick:h,onClose:m})=>{const{sendBotCommand:u,sendQuickReply:p}=(0,n.ko)(),v=(0,s.li)(),{shouldRender:g,transitionClassNames:A}=(0,Oe.A)(e,void 0,void 0,!1),b=(0,D.A)((({botId:e,command:t})=>{const s=(0,n.mS)().users.byId[e];u({command:`/${t}${i&&s?`@${(0,l.Kl)(s)}`:""}`}),h()})),f=(0,D.A)((e=>{p({chatId:t,quickReplyId:e}),h()})),C=(0,s.Kr)((()=>{if(a?.length&&r)return a.map((e=>{const t=r[e.topMessageId];return{id:e.id,command:e.shortcut,description:t?.content.text?.text||""}}))}),[a,r]),S=(0,D.A)((e=>!!e.command.startsWith(d().slice(1))&&("id"in e?f(e.id):b(e),!0))),y=_u({isActive:e,items:(0,s.Kr)((()=>{if(o||C)return[].concat(C||[],o||[])}),[o,C]),onSelect:S,onClose:m}),k=o&&!o.length||a&&!a.length;if((0,s.vJ)((()=>{k&&m()}),[k,m]),(0,s.vJ)((()=>{Vu(".chat-item-clickable",y,v)}),[y]),!g||k)return;const w=(0,me.A)("iaTB59vy","composer-tooltip custom-scroll",A);return(0,ee.FD)("div",{className:w,ref:v,children:[C?.map(((e,t)=>(0,ee.Y)(Sp,{command:e.command,description:e.description,peer:c,withAvatar:!0,clickArg:e.id,onClick:f,focus:y===t},`quickReply_${e.id}`))),o?.map(((e,t)=>(0,ee.Y)(Sp,{command:e.command,description:e.description,peer:(0,n.mS)().users.byId[e.botId],withAvatar:!0,clickArg:e,onClick:b,focus:y+(C?.length||0)===t},`${e.botId}_${e.command}`)))]})}))),kp=(0,s.ph)((({isOpen:e,botCommands:t,onClose:i})=>{const{sendBotCommand:s}=(0,n.ko)(),{isMobile:o}=(0,I.Ay)(),[a,r]=(0,Wu.A)(e,i,void 0,o),l=(0,D.A)((e=>{s({command:`/${e}`}),i()}));return(0,ee.Y)($e.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:i,className:"BotCommandMenu",onCloseAnimationEnd:i,onMouseEnter:b.TF?void 0:a,onMouseLeave:b.TF?void 0:r,noCloseOnBackdrop:!b.TF,noCompact:!0,children:t.map((e=>(0,ee.Y)(Sp,{command:e.command,description:e.description,clickArg:e.command,onClick:l},e.command)))})})),wp=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{stickers:i}=e.stickers.forEmoji;return{stickers:i,isSavedMessages:(0,c.nZ4)(e,t),isCurrentUserPremium:(0,c.g29)(e)}}))((({chatId:e,threadId:t,isOpen:i,onStickerSelect:n,onClose:o,stickers:r,isSavedMessages:l,isCurrentUserPremium:c})=>{const d=(0,s.li)(),{shouldRender:m,transitionClassNames:u}=(0,Oe.A)(i,void 0,void 0,!1),p=(0,V.A)(r,!0),v=r||p,g=(0,hu.A)(e,t),{observe:A}=(0,or.BL)({rootRef:d,throttleMs:200});(0,s.vJ)((()=>i?(0,h.A)(o):void 0),[i,o]);const b=(0,me.A)("StickerTooltip composer-tooltip custom-scroll",u,!v?.length&&"hidden");return(0,ee.Y)("div",{ref:d,className:b,onMouseMove:()=>{g({type:"chooseSticker"})},children:m&&v?v.map((e=>(0,ee.Y)(br,{sticker:e,size:a.bkT,observeIntersection:A,onClick:i?n:void 0,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c},e.id))):m?(0,ee.Y)(Rs.A,{}):void 0})}))),Np={root:"_8sFuAomM",emojiButton:"crWzZ2jr"},Ip=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{stickers:i}=e.customEmojis.forEmoji;return{customEmoji:i,isSavedMessages:(0,c.nZ4)(e,t),isCurrentUserPremium:(0,c.g29)(e)}}))((({isOpen:e,addRecentCustomEmoji:t,onCustomEmojiSelect:i,onClose:o,customEmoji:r,isSavedMessages:l,isCurrentUserPremium:c,noPlay:d})=>{const{clearCustomEmojiForEmoji:m}=(0,n.ko)(),u=(0,s.li)(),{shouldRender:p,transitionClassNames:v}=(0,Oe.A)(e,void 0,void 0,!1),g=(0,V.A)(r,!0),A=r||g;(0,kn.A)(u);const{observe:b}=(0,or.BL)({rootRef:u,throttleMs:200,isDisabled:!e});(0,s.vJ)((()=>e?(0,h.A)(o):void 0),[e,o]);const f=(0,D.A)((s=>{e&&(i(s),t({documentId:s.id}),m())})),C=(0,me.A)(Np.root,"composer-tooltip custom-scroll-x",v,!A?.length&&Np.hidden);return(0,ee.Y)("div",{ref:u,className:C,children:p&&A?A.map((e=>(0,ee.Y)(br,{sticker:e,className:Np.emojiButton,size:a.x6_,observeIntersection:b,onClick:f,clickArg:e,isSavedMessages:l,canViewSet:!0,isCurrentUserPremium:c,noPlay:d},e.id))):p?(0,ee.Y)(Rs.A,{}):void 0})})));var Pp=i(76283);const Yp=(0,s.ph)((({isOpen:e,isOpenToBottom:t=!1,isSavedMessages:i,canSchedule:o,canScheduleUntilOnline:a,onSendSilent:r,onSendSchedule:l,onSendWhenOnline:c,onRemoveEffect:d,onClose:h,onCloseAnimationEnd:m,chatId:u,withEffects:p,hasCurrentEffect:v,effectReactions:g,allAvailableReactions:A,onToggleReaction:f,canBuyPremium:C,isCurrentUserPremium:S,isInSavedMessages:y,isInStoryViewer:k,canPlayAnimatedEmojis:w})=>{const{openEffectPicker:N}=(0,n.ko)(),[I,P]=(0,Wu.A)(e,h),[F,T]=(0,s.J0)(!1),B=(0,M.A)(),R=(0,Vi.A)(),[L,x,E]=(0,Y.A)();(0,yi.A)((([t])=>{e&&!t&&(E(),T(Boolean(a)))}),[e,a]);const[V,_,U]=(0,Y.A)(),O=(0,D.A)((e=>{x(),u&&N({chatId:u,position:e})}));return(0,s.vJ)((()=>{e?setTimeout((()=>{_()}),200):U()}),[e,_,U]),(0,ee.FD)($e.A,{isOpen:e,autoClose:!0,positionX:"right",positionY:t?"top":"bottom",className:(0,me.A)("CustomSendMenu","fluid","with-menu-transitions",p&&"with-effects"),onClose:h,onCloseAnimationEnd:m,onMouseEnter:b.TF?void 0:I,onMouseLeave:b.TF?void 0:P,noCloseOnBackdrop:!b.TF,children:[p&&!k&&(0,ee.Y)(Pp.A,{allAvailableReactions:A,effectReactions:g,currentReactions:void 0,onToggleReaction:f,isPrivate:!0,isReady:V,canBuyPremium:C,isCurrentUserPremium:S,isInSavedMessages:y,isForEffects:!0,canPlayAnimatedEmojis:w,onShowMore:O,onClose:h,className:(0,me.A)(L&&"ReactionSelector-hidden")}),(0,ee.FD)("div",{className:(0,me.A)("CustomSendMenu_items",L&&"CustomSendMenu_items-hidden"),dir:B.isRtl?"rtl":void 0,children:[r&&(0,ee.Y)(ce.A,{icon:"mute",onClick:r,children:B("SendWithoutSound")}),o&&l&&(0,ee.Y)(ce.A,{icon:"schedule",onClick:l,children:B(i?"SetReminder":"ScheduleMessage")}),o&&l&&F&&(0,ee.Y)(ce.A,{icon:"user-online",onClick:c,children:B("SendWhenOnline")}),p&&v&&(0,ee.Y)(ce.A,{icon:"delete",onClick:d,children:R("RemoveEffect")})]})]})}));var Fp=i(41510),Dp=i(22802);const Mp={B:"bold",STRONG:"bold",I:"italic",EM:"italic",U:"underline",DEL:"strikethrough",CODE:"monospace",SPAN:"spoiler"},Tp=document.createElement("div"),Bp=(0,s.ph)((({isOpen:e,anchorPosition:t,selectedRange:i,setSelectedRange:n,onClose:o})=>{const r=(0,s.li)(),l=(0,s.li)(),{shouldRender:c,transitionClassNames:d}=(0,Oe.A)(e),[m,u,p]=(0,Y.A)(),[v,g]=(0,s.J0)(""),[A,b]=(0,s.J0)(!1),[C,S]=(0,s.J0)(),[y,k]=(0,s.J0)({});(0,s.vJ)((()=>e?(0,h.A)(o):void 0),[e,o]),(0,Dp.A)(e,r,o,!0),(0,s.vJ)((()=>{m?l.current.focus():(g(""),b(!1))}),[m]),(0,s.vJ)((()=>{c||(p(),k({}),S(void 0))}),[p,c]),(0,s.vJ)((()=>{if(!e||!i)return;const t={};let{parentElement:s}=i.commonAncestorContainer;for(;s&&s.id!==a.CfG;){const e=Mp[s.tagName];e&&(t[e]=!0),s=s.parentElement}k(t)}),[e,i,u]);const w=(0,D.A)((()=>{if(!i)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(i))})),N=(0,D.A)((()=>{const e=window.getSelection();e&&n(e.getRangeAt(0))})),I=(0,D.A)((e=>{if(i)return Tp.replaceChildren(i.cloneContents()),e&&Tp.querySelectorAll(du._p).forEach((e=>{e.replaceWith(e.getAttribute("alt"))})),Tp.innerHTML})),P=(0,D.A)((()=>{if(i)return i.commonAncestorContainer.parentElement}));function F(){const e=l.current;if(!e)return;const{offsetWidth:t,scrollWidth:i,scrollLeft:s}=e;if(i<=t)return void S(void 0);let n="";s<i-t&&(n="mask-right"),s>0&&(n+=" mask-left"),S(n)}function T(e){if(y[e])return"active";if("monospace"===e||"strikethrough"===e){if(Object.keys(y).some((t=>t!==e&&Boolean(y[t]))))return"disabled"}else if(y.monospace||y.strikethrough)return"disabled"}const B=(0,D.A)((()=>{if(y.spoiler){const e=P();if(!i||!e||e.dataset.entityType!==U.C7.Spoiler||!e.textContent)return;return e.replaceWith(e.textContent),void k((e=>({...e,spoiler:!1})))}const e=I();document.execCommand("insertHTML",!1,`<span class="spoiler" data-entity-type="${U.C7.Spoiler}">${e}</span>`),o()})),R=(0,D.A)((()=>{k((e=>(document.execCommand(e.bold?"removeFormat":"bold"),Object.keys(e).forEach((t=>{"italic"!==t&&"underline"!==t||!Boolean(e[t])||document.execCommand(t)})),N(),{...e,bold:!e.bold})))})),L=(0,D.A)((()=>{document.execCommand("italic"),N(),k((e=>({...e,italic:!e.italic})))})),x=(0,D.A)((()=>{document.execCommand("underline"),N(),k((e=>({...e,underline:!e.underline})))})),E=(0,D.A)((()=>{if(y.strikethrough){const e=P();if(!i||!e||"DEL"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void k((e=>({...e,strikethrough:!1})))}const e=I();document.execCommand("insertHTML",!1,`<del>${e}</del>`),o()})),V=(0,D.A)((()=>{if(y.monospace){const e=P();if(!i||!e||"CODE"!==e.tagName||!e.textContent)return;return e.replaceWith(e.textContent),void k((e=>({...e,monospace:!1})))}const e=I(!0);document.execCommand("insertHTML",!1,`<code class="text-entity-code" dir="auto">${e}</code>`),o()})),_=(0,D.A)((()=>{const e=((0,Ws.Tc)(v)||"").split("%").map(encodeURI).join("%");if(A){const t=P();if(!t||"A"!==t.tagName)return;return t.href=e,void o()}const t=I(!0);w(),document.execCommand("insertHTML",!1,`<a href=${e} class="text-entity-link" dir="auto">${t}</a>`),o()})),O=(0,D.A)((e=>{const t={k:u,b:R,u:x,i:L,m:V,s:E,p:B}[function(e){const t=e.key||e.code;return t.startsWith("Key")?t.slice(3).toLowerCase():t}(e)];!e.altKey&&(e.ctrlKey||e.metaKey)&&t&&(e.preventDefault(),e.stopPropagation(),t())}));(0,s.vJ)((()=>(e&&document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O))),[e,O]);const K=(0,M.A)();if(!c)return;const J=(0,me.A)("TextFormatter",d,m&&"link-control-shown"),G=(0,me.A)("TextFormatter-link-url-confirm",Boolean(v.length)&&"shown"),j=t?`left: ${t.x}px; top: ${t.y}px;--text-formatter-left: ${t.x}px;`:"";return(0,ee.FD)("div",{ref:r,className:J,style:j,onKeyDown:function(e){"Enter"===e.key&&m&&(_(),e.preventDefault())},onMouseDown:f.A,children:[(0,ee.FD)("div",{className:"TextFormatter-buttons",children:[(0,ee.Y)(W.A,{color:"translucent",ariaLabel:"Spoiler text",className:T("spoiler"),onClick:B,children:(0,ee.Y)(q.A,{name:"eye-crossed"})}),(0,ee.Y)("div",{className:"TextFormatter-divider"}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:"Bold text",className:T("bold"),onClick:R,children:(0,ee.Y)(q.A,{name:"bold"})}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:"Italic text",className:T("italic"),onClick:L,children:(0,ee.Y)(q.A,{name:"italic"})}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:"Underlined text",className:T("underline"),onClick:x,children:(0,ee.Y)(q.A,{name:"underlined"})}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:"Strikethrough text",className:T("strikethrough"),onClick:E,children:(0,ee.Y)(q.A,{name:"strikethrough"})}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:"Monospace text",className:T("monospace"),onClick:V,children:(0,ee.Y)(q.A,{name:"monospace"})}),(0,ee.Y)("div",{className:"TextFormatter-divider"}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:K("TextFormat.AddLinkTitle"),onClick:u,children:(0,ee.Y)(q.A,{name:"link"})})]}),(0,ee.Y)("div",{className:"TextFormatter-link-control",children:(0,ee.FD)("div",{className:"TextFormatter-buttons",children:[(0,ee.Y)(W.A,{color:"translucent",ariaLabel:K("Cancel"),onClick:p,children:(0,ee.Y)(q.A,{name:"arrow-left"})}),(0,ee.Y)("div",{className:"TextFormatter-divider"}),(0,ee.Y)("div",{className:(0,me.A)("TextFormatter-link-url-input-wrapper",C),children:(0,ee.Y)("input",{ref:l,className:"TextFormatter-link-url-input",type:"text",value:v,placeholder:"Enter URL...",autoComplete:"off",inputMode:"url",dir:"auto",onChange:function(e){g(e.target.value),F()},onScroll:F})}),(0,ee.FD)("div",{className:G,children:[(0,ee.Y)("div",{className:"TextFormatter-divider"}),(0,ee.Y)(W.A,{color:"translucent",ariaLabel:K("Save"),className:"color-primary",onClick:_,children:(0,ee.Y)(q.A,{name:"check"})})]})]})})]})})),Rp=(0,s.ph)((({emoji:e,focus:t,onClick:i,observeIntersection:s})=>{const n=(0,D.A)((t=>{t.preventDefault(),i?.(e)})),o=(0,me.A)("EmojiButton",t&&"focus");return(0,ee.Y)("div",{className:o,onMouseDown:n,title:e.emoji,children:(0,ee.Y)(mo.A,{documentId:e.id,size:32,withSharedAnimation:!0,shouldPreloadPreview:!0,observeIntersectionForPlaying:s})})})),Lp=(0,s.ph)((({isOpen:e,emojis:t,customEmojis:i,onClose:n,onEmojiSelect:o,onCustomEmojiSelect:a,addRecentEmoji:r,addRecentCustomEmoji:l})=>{const c=(0,s.li)(),{shouldRender:d,transitionClassNames:h}=(0,Oe.A)(e,void 0,void 0,!1),m=(0,Wi.A)(t.length?[...i,...t]:void 0,350)||[];(0,kn.A)(c);const{observe:u}=(0,or.BL)({rootRef:c,throttleMs:200,isDisabled:!e}),p=(0,D.A)((e=>{o(e.native),r({emoji:e.id})})),v=(0,D.A)((e=>{a(e),l({documentId:e.id})})),g=(0,D.A)((e=>{"native"in e?p(e):v(e)})),A=(0,D.A)(((e,t)=>{o(e),r({emoji:t})})),b=(0,D.A)((e=>{a(e),l({documentId:e.id})})),f=_u({isActive:e,isHorizontal:!0,items:m,shouldRemoveSelectionOnReset:!0,onSelect:g,onClose:n});(0,yi.A)((([e])=>{void 0!==e&&-1!==e&&function(e,t){const i=t.current;if(!i)return;const{visibleIndexes:s,allElements:n}=Eu(i,".EmojiButton",8,!0,!0,!0);if(!n.length||!n[e])return;const o=s[0];if(!s.includes(e)||e===o&&!xu(i,n[o],!0)){const t="start"==(e>s[s.length-1]?"start":"end")?44*e:0;(0,Ao.A)(i,t)}}(f,c)}),[f]);const C=(0,me.A)("EmojiTooltip composer-tooltip custom-scroll-x",h);return(0,ee.Y)("div",{ref:c,className:C,children:d&&m?m.map(((e,t)=>"native"in e?(0,ee.Y)(Zu,{emoji:e,focus:f===t,onClick:A},e.id):(0,ee.Y)(Rp,{emoji:e,focus:f===t,onClick:b,observeIntersection:u},e.id))):d?(0,ee.Y)(Rs.A,{}):void 0})})),xp=(0,s.ph)((({title:e,description:t,thumbnail:i,thumbUrl:s,focus:n,transitionClassNames:o="",onClick:a})=>{let r;const c=(0,j.A)(i?(0,l.cy)(i):void 0);return(s=s||c)?r=(0,ee.Y)("img",{src:s,className:o,alt:"",decoding:"async",draggable:!1}):e&&(r=(0,He.Qh)(e,1)),(0,ee.FD)(li.A,{focus:n,className:"BaseResult chat-item-clickable",onMouseDown:pr.u,onClick:a,children:[(0,ee.Y)("span",{className:"thumb",children:"string"==typeof r?(0,Ft.A)(r):r}),(0,ee.FD)("div",{className:"content-inner",children:[e&&(0,ee.Y)("div",{className:"title",children:e}),t&&(0,ee.Y)("div",{className:"description",children:t})]})]})})),Ep=(0,s.ph)((({focus:e,inlineResult:t,onClick:i})=>{const{title:s,description:n}=t,o="url"in t?t.url:void 0,a="webThumbnail"in t?t.webThumbnail:void 0,r=(0,D.A)((()=>{i(t)}));return(0,ee.Y)(xp,{focus:e,thumbnail:a,title:s||o,description:n,onClick:r})})),Vp=(0,s.ph)((({inlineResult:e,isSavedMessages:t,canSendGifs:i,observeIntersection:s,onClick:n})=>{const{gif:o}=e,a=(0,D.A)(((t,i,s)=>{n(e,i,s)}));if(o)return(0,ee.Y)(mp,{gif:o,observeIntersection:s,className:"chat-item-clickable",onClick:i?a:void 0,isSavedMessages:t})})),_p=(0,s.ph)((({focus:e,isForGallery:t,inlineResult:i,onClick:s})=>{let n,o,a;"photo"in i&&(n=i.photo),"thumbnail"in i&&(o=i.thumbnail),"webThumbnail"in i&&(a=i.webThumbnail);const r=(0,j.A)((0,l.cy)(a)),c=(0,j.A)(n&&(0,l.rI)(n,"pictogram")),d=(0,Ui.A)(c||r),h=(0,D.A)((()=>{s(i)}));if(t)return(0,ee.FD)("div",{className:"MediaResult chat-item-clickable",onClick:h,children:[(0,ee.Y)("img",{src:n?.thumbnail?.dataUri||r,alt:"",draggable:!1}),(0,ee.Y)("img",{src:c,className:(0,me.A)("full-media",d),alt:"",draggable:!1})]});const{title:m,description:u}=i;return(0,ee.Y)(xp,{focus:e,thumbnail:a,thumbUrl:c||o?.dataUri,transitionClassNames:d,title:m,description:u,onClick:h})})),Up=(0,s.ph)((({inlineResult:e,isSavedMessages:t,observeIntersection:i,onClick:s,isCurrentUserPremium:n})=>{const{sticker:o}=e;if(o)return(0,ee.Y)(br,{sticker:o,size:a.mD0,observeIntersection:i,title:o.emoji,className:"chat-item-clickable",onClick:s,clickArg:e,isSavedMessages:t,canViewSet:!0,noShowPremium:!0,isCurrentUserPremium:n})})),Op=(0,ve.nF)((e=>e()),500,!0),Kp=(0,s.ph)((({isOpen:e,botId:t,isGallery:i,inlineBotResults:a,switchPm:r,switchWebview:l,isSavedMessages:c,canSendGifs:d,loadMore:h,onClose:m,onSelectResult:u,isCurrentUserPremium:p})=>{const{openChat:v,startBot:g,requestSimpleWebView:A}=(0,n.ko)(),f=(0,s.li)(),{shouldRender:C,transitionClassNames:S}=(0,Oe.A)(e,void 0,void 0,!1),y=(0,Ti.A)(i,C),{observe:k}=(0,or.BL)({rootRef:f,debounceMs:200,isDisabled:!e}),w=(0,D.A)((({direction:e})=>{e===o.TN.Backwards&&Op(h)})),N=_u({isActive:e,shouldRemoveSelectionOnReset:y,noArrowNavigation:y,items:a,onSelect:u,onClose:m});(0,s.vJ)((()=>{Vu(".chat-item-clickable",N,f)}),[N]);const I=(0,D.A)((()=>{v({id:t}),g({botId:t,param:r.startParam})})),P=(0,D.A)((()=>{const e=(0,Nn.A)();A({botId:t,url:l.url,buttonText:l.text,theme:e,isFromSwitchWebView:!0})})),Y=(0,V.A)(a?.length?a:void 0,C),F=a?.length?a:Y;if(!C||!F?.length&&!r)return;const M=(0,me.A)("InlineBotTooltip composer-tooltip",b.TF?"no-scrollbar":"custom-scroll",y&&"gallery",S);return(0,ee.FD)(bs.A,{ref:f,className:M,items:F,itemSelector:".chat-item-clickable",noFastList:!0,onLoadMore:w,sensitiveArea:160,children:[r&&(0,ee.Y)(li.A,{ripple:!0,className:"switch-pm scroll-item",onClick:I,children:(0,ee.Y)("span",{className:"title",children:r.text})}),l&&(0,ee.Y)(li.A,{ripple:!0,className:"switch-pm scroll-item",onClick:P,children:(0,ee.Y)("span",{className:"title",children:l.text})}),Boolean(F?.length)&&F.map(((e,t)=>{switch(e.type){case"gif":return(0,ee.Y)(Vp,{inlineResult:e,observeIntersection:k,onClick:u,isSavedMessages:c,canSendGifs:d},e.id);case"photo":return(0,ee.Y)(_p,{isForGallery:y,inlineResult:e,onClick:u},e.id);case"sticker":return(0,ee.Y)(Up,{inlineResult:e,observeIntersection:k,onClick:u,isSavedMessages:c,isCurrentUserPremium:p},e.id);case"video":case"file":case"game":return(0,ee.Y)(_p,{focus:N===t,inlineResult:e,onClick:u},e.id);case"article":case"audio":case"voice":return(0,ee.Y)(Ep,{focus:N===t,inlineResult:e,onClick:u},e.id);default:return}}))]})})),Jp=(0,s.ph)((({isOpen:e,chatId:t,selectedSendAsId:i,sendAsPeerIds:o,isCurrentUserPremium:a,onClose:r})=>{const{saveDefaultSendAs:l,showNotification:c}=(0,n.ko)(),d=(0,n.mS)().users.byId,h=(0,n.mS)().chats.byId,m=(0,M.A)(),u=(0,s.li)(),[p,v,g]=(0,Wu.A)(e,r,void 0);(0,s.vJ)((()=>{e&&g()}),[e,g]);const A=(0,D.A)((e=>{r(),l({chatId:t,sendAsId:e})})),f=_u({isActive:e,items:o,onSelect:A,shouldSelectOnTab:!0,shouldSaveSelectionOnUpdateItems:!0,onClose:r});return(0,s.vJ)((()=>{Vu(".chat-item-clickable",f,u)}),[f]),(0,s.vJ)((()=>{o&&!o.length&&r()}),[o,r]),(0,ee.FD)($e.A,{isOpen:e,positionX:"left",positionY:"bottom",onClose:r,className:"SendAsMenu",onCloseAnimationEnd:r,onMouseEnter:b.TF?void 0:p,onMouseLeave:b.TF?void 0:v,noCloseOnBackdrop:!b.TF,noCompact:!0,children:[(0,ee.Y)("div",{className:"send-as-title",dir:"auto",children:m("SendMessageAsTitle")}),d&&h&&o?.map((({id:e,isPremium:t},s)=>{const n=d[e],o=h[e],r=n||o,l=(0,me.A)(i===e&&"selected");return(0,ee.FD)(li.A,{className:"SendAsItem chat-item-clickable scroll-item with-avatar",onClick:()=>{!t||a?A(e):c({message:m("SelectSendAsPeerPremiumHint"),actionText:m("Open"),action:{action:"openPremiumModal",payload:{}}})},focus:f===s,rightElement:!a&&t&&(0,ee.Y)(q.A,{name:"lock-badge",className:"send-as-icon-locked"}),children:[(0,ee.Y)(Dt.A,{size:"small",peer:r,className:l}),(0,ee.FD)("div",{className:"info",children:[r&&(0,ee.Y)(Ls.A,{peer:r,noFake:!0}),(0,ee.Y)("span",{className:"subtitle",children:n?m("VoipGroupPersonalAccount"):m("Subscribers",o?.membersCount,"i")})]})]},e)}))]})})),Gp=(0,s.ph)((0,n.EK)(((e,{stickerSetId:t})=>({set:(0,c.ycM)(e,t),shouldPlay:(0,c.ML4)(e),isCurrentUserPremium:(0,c.g29)(e)})))((({stickerSetId:e,observeIntersection:t,set:i,shouldPlay:o,isModalOpen:r,isCurrentUserPremium:l})=>{const{loadStickers:c,toggleStickerSet:d,openStickerSet:h}=(0,n.ko)(),m=(0,s.li)(),u=(0,M.A)(),p=i&&!i.isArchived&&Boolean(i.installedDate),v=Boolean(i?.stickers),g=(0,s.Kr)((()=>{if(!i)return[];const e=(i.stickers?.filter((({hasEffect:e})=>e))??[]).slice(0,3),t=(i.covers||[]).map((({id:e})=>e)),s=i.stickers?i.stickers.filter((({id:e})=>!t.includes(e))):[];return[...e,...i.covers||[],...s].slice(0,5)}),[i]);(0,s.vJ)((()=>{!v&&g.length<5&&i&&c({stickerSetInfo:{shortName:i.shortName}})}),[v,g.length,c,i,e]);const A=(0,s.hb)((()=>{d({stickerSetId:e})}),[d,e]),b=(0,s.hb)((e=>{h({stickerSetInfo:e.stickerSetInfo})}),[h]);if(!i)return;const f=g.length>0;return(0,ee.FD)("div",{className:"sticker-set",dir:u.isRtl?"rtl":void 0,children:[(0,ee.FD)("div",{className:"sticker-set-header",children:[(0,ee.FD)("div",{className:"title-wrapper",children:[(0,ee.Y)("h3",{className:"title",dir:"auto",children:i.title}),(0,ee.Y)("p",{className:"count",dir:"auto",children:u("Stickers",i.count,"i")})]}),(0,ee.Y)(W.A,{className:p?"is-added":void 0,color:"primary",size:"tiny",pill:!0,fluid:!0,onClick:A,children:u(p?"Stickers.Installed":"Stickers.Install")})]}),(0,ee.FD)("div",{className:"sticker-set-main shared-canvas-container",children:[(0,ee.Y)("canvas",{ref:m,className:"shared-canvas"}),!f&&(0,ee.Y)(xe.A,{}),f&&g.map((e=>(0,ee.Y)(br,{sticker:e,size:a.Rqe,observeIntersection:t,noPlay:!o||r,clickArg:e,onClick:b,noContextMenu:!0,isCurrentUserPremium:l,sharedCanvasRef:m})))]})]},i.id)}))),jp=(0,ve.nF)((e=>e()),6e4,!0),zp=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.BmE)(e),{query:i,resultIds:s}=t||{},{featured:n}=e.stickers;return{query:i,featuredIds:n.setIds,resultIds:s,isModalOpen:Boolean((0,c.nTw)(e).openedStickerSetShortName)}}))((({isActive:e,query:t,featuredIds:i,resultIds:o,isModalOpen:a,onClose:r})=>{const{loadFeaturedStickers:l}=(0,n.ko)(),c=(0,s.li)(),d=(0,M.A)(),{observe:h}=(0,or.BL)({rootRef:c,throttleMs:200});return(0,s.vJ)((()=>{jp((()=>{l()}))})),(0,fe.A)({isActive:e,onBack:r}),(0,ee.Y)("div",{ref:c,className:"StickerSearch custom-scroll",dir:d.isRtl?"rtl":void 0,children:function(){if(void 0!==t)return!t&&i?i.map((e=>(0,ee.Y)(Gp,{stickerSetId:e,observeIntersection:h,isModalOpen:a},e))):o?o.length?o.map((e=>(0,ee.Y)(Gp,{stickerSetId:e,observeIntersection:h,isModalOpen:a},e))):(0,ee.Y)("p",{className:"helper-text",dir:"auto",children:"Nothing found."}):(0,ee.Y)(Rs.A,{})}()})}))),Hp=(0,s.ph)((0,n.EK)((e=>{const t=(0,c.Wy7)(e),{query:i,results:s}=t||{},{chatId:n,threadId:o}=(0,c.Xf0)(e)||{},a=n?(0,c.hds)(e,n):void 0,r=n?(0,c.AWZ)(e,n):void 0,d=a?(0,c.ALW)(e,a):void 0,h=Boolean(n)&&(0,c.nZ4)(e,n),m=n&&o?(0,c.Vw0)(e,n,o):void 0,u=Boolean(!m?.isCommentsInfo&&m?.fromChannelId),p=n&&o?(0,c.S0q)(e,n,o):void 0;return{query:i,results:s,chat:a,isChatWithBot:d,isSavedMessages:h,canPostInChat:Boolean(a)&&Boolean(o)&&(0,l.__)(a,p,u,r),canScheduleUntilOnline:Boolean(n)&&(0,c.RBq)(e,n),currentMessageList:(0,c.Xf0)(e)}}))((({isActive:e,query:t,results:i,chat:o,chatFullInfo:a,isChatWithBot:r,canScheduleUntilOnline:c,isSavedMessages:d,canPostInChat:h,currentMessageList:m,onClose:u})=>{const{searchMoreGifs:p,sendMessage:v,setGifSearchQuery:g}=(0,n.ko)(),A=(0,s.li)(),[f,C]=(0,jm.A)(c),{observe:S}=(0,or.BL)({rootRef:A,debounceMs:300}),y=h&&(0,l.Q_)(o,a,r,d).canSendGifs,k=(0,s.hb)(((e,t,i)=>{if(y){if(!m)return;i?f((i=>{v({messageList:m,gif:e,scheduledAt:i,isSilent:t})})):v({messageList:m,gif:e,isSilent:t})}b.TF&&g({query:void 0})}),[y,m,f]),w=(0,s.hb)((()=>{p()}),[p]),N=(0,M.A)();(0,fe.A)({isActive:e,onBack:u});const I=Boolean(void 0!==t&&i&&i.length);return(0,ee.FD)("div",{className:"GifSearch",dir:N.isRtl?"rtl":void 0,children:[(0,ee.Y)(bs.A,{ref:A,className:(0,me.A)("gif-container custom-scroll",I&&"grid"),items:i,itemSelector:".GifButton",preloadBackwards:96,noFastList:!0,onLoadMore:w,children:function(){if(void 0!==t)return i?i.length?i.map((e=>(0,ee.Y)(mp,{gif:e,observeIntersection:S,onClick:y?k:void 0,isSavedMessages:d},e.id))):(0,ee.Y)("p",{className:"helper-text",dir:"auto",children:N("NoGIFsFound")}):(0,ee.Y)(Rs.A,{})}()}),C]})})));var $p=i(71950);const qp="OAKzmAva",Wp="BQ6HUOqN",Qp="U96CW2I7",Zp="vXi2JQlj",Xp="bi3fL59p",ev="GUK4ajPK",tv="YH6jeZIh",iv="q1LnuIUn",sv="PJZzyVLK",nv="C7NpG5Y9",ov=(0,s.ph)((function({postStatistic:e}){const t=(0,M.A)(),i=(0,Vi.A)();return(0,ee.FD)("div",{className:tv,children:[e.reactionsCount>0&&(0,ee.FD)("span",{className:iv,children:[(0,ee.Y)(q.A,{name:"heart-outline",className:sv}),(0,He.Vw)(i,e.reactionsCount)]}),e.forwardsCount>0&&(0,ee.FD)("span",{className:iv,children:[(0,ee.Y)(q.A,{name:"forward",className:sv}),(0,He.Vw)(i,e.forwardsCount)]}),!e.forwardsCount&&!e.reactionsCount&&t("ChannelStats.SharesCount_ZeroValueHolder")]})}));function av(e,t,i,s){return i?(0,ee.FD)("span",{children:[(0,ee.Y)("img",{src:i,alt:"",draggable:!1,className:(0,me.A)(Qp,s&&"yxjDeIct")}),(0,l.zX)(t)&&(0,ee.Y)(q.A,{name:"play"}),(0,v.C)(e,t,!0)]}):(0,v.C)(e,t)}const rv=(0,s.ph)((({postStatistic:e,message:t})=>{const i=(0,M.A)(),{toggleMessageStatistics:o}=(0,n.ko)(),a=(0,l.CI)(t),r=(0,j.A)((0,l.EO)(t,"micro")),c=Boolean((0,l.lk)(t)),d=(0,s.hb)((()=>{o({messageId:t.id})}),[o,t.id]);return(0,ee.FD)("div",{className:(0,me.A)(qp,Boolean(r||a)&&Wp),onClick:d,children:[(0,ee.FD)("div",{className:Xp,children:[(0,ee.Y)("div",{className:Zp,children:av(i,t,r||a,c)}),(0,ee.Y)("div",{className:tv,children:i("ChannelStats.ViewsCount",e.viewsCount,"i")})]}),(0,ee.FD)("div",{className:ev,children:[(0,ee.Y)("div",{className:nv,children:(0,ze.L2)(1e3*t.date,i.code)}),(0,ee.Y)(ov,{postStatistic:e})]})]})}));function lv(e,t,i){return(0,ee.FD)("span",{children:[i?(0,ee.Y)("span",{className:"TmJvv2A6",children:(0,ee.Y)("img",{src:i,alt:"",draggable:!1,className:(0,me.A)(Qp,"cdfiLmXo","BOfHPv20")})}):(0,ee.Y)(Dt.A,{peer:t,size:"small",className:Qp,withStorySolid:!0,forceUnreadStorySolid:!0}),e("Story")]})}const cv=(0,s.ph)((function({chat:e,story:t,postStatistic:i}){const s=(0,M.A)(),{toggleStoryStatistics:o}=(0,n.ko)(),a=t&&"content"in t,r=a?t.content.video:void 0,c=a?(0,l.EN)(t):void 0,d=(0,j.A)(c),h=d||r?.thumbnail?.dataUri,m=(0,D.A)((()=>{o({storyId:i.storyId})}));return(0,ee.FD)("div",{className:(0,me.A)(qp,Wp),onClick:m,children:[(0,ee.FD)("div",{className:Xp,children:[(0,ee.Y)("div",{className:Zp,children:lv(s,e,d||h)}),(0,ee.Y)("div",{className:tv,children:s("ChannelStats.ViewsCount",i.viewsCount,"i")})]}),(0,ee.FD)("div",{className:ev,children:[(0,ee.Y)("div",{className:nv,children:a&&Boolean(t.date)&&(0,ze.L2)(1e3*t.date,s.code)}),(0,ee.Y)(ov,{postStatistic:i})]})]})})),dv="T1l_4J8z",hv="S1x1ovkC",mv="WxL3i5PM",uv="aUrozL5_",pv="QQHwjG88",vv="QGctP1Nk";let gv,Av;const bv={growthGraph:"ChannelStats.Graph.Growth",followersGraph:"ChannelStats.Graph.Followers",muteGraph:"ChannelStats.Graph.Notifications",topHoursGraph:"ChannelStats.Graph.ViewsByHours",viewsBySourceGraph:"ChannelStats.Graph.ViewsBySource",newFollowersBySourceGraph:"ChannelStats.Graph.NewFollowersBySource",languagesGraph:"ChannelStats.Graph.Language",interactionsGraph:"ChannelStats.Graph.Interactions",reactionsByEmotionGraph:"ChannelStats.Graph.Reactions",storyInteractionsGraph:"ChannelStats.Graph.Stories",storyReactionsByEmotionGraph:"ChannelStats.Graph.StoriesReactions"},fv=Object.keys(bv),Cv={growthGraph:"Stats.GroupGrowthTitle",membersGraph:"Stats.GroupMembersTitle",languagesGraph:"Stats.GroupLanguagesTitle",messagesGraph:"Stats.GroupMessagesTitle",actionsGraph:"Stats.GroupActionsTitle",topHoursGraph:"Stats.GroupTopHoursTitle"},Sv=Object.keys(Cv),yv=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.gqw)(e,t),s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t)?.statisticsDcId,o="chatTypeSuperGroup"===s?.type,a=(0,c.zeq)(e,t),r=(0,c._bp)(e,t)?.byId;return{statistics:i,dcId:n,isGroup:o,chat:s,messagesById:a,storiesById:r}}))((({chatId:e,chat:t,statistics:o,dcId:a,isGroup:r,messagesById:l,storiesById:c})=>{const d=(0,M.A)(),h=(0,s.li)(),[m,u]=(0,s.J0)(!1),p=(0,s.li)([]),{loadStatistics:v,loadStatisticsAsyncGraph:g}=(0,n.ko)(),A=(0,F.A)();(0,s.vJ)((()=>{v({chatId:e,isGroup:r})}),[e,v,r]);const b=(0,s.Kr)((()=>r?Sv:fv),[r]),f=(0,s.Kr)((()=>r?Cv:bv),[r]);return(0,s.vJ)((()=>{o&&b.forEach((t=>{const i=o[t];"string"==typeof i&&g({name:t,chatId:e,token:i,isPercentage:"languagesGraph"===t})}))}),[b,e,o,g]),(0,s.vJ)((()=>{(async()=>{await async function(){return gv||(gv=i.e(4810).then(i.bind(i,24810)),Av=await gv),gv}(),m?o&&h.current&&(b.forEach(((e,t)=>{const i=o[e];if("string"==typeof i||p.current.includes(e))return;if(!i)return void p.current.push(e);const{zoomToken:s}=i;Av.create(h.current.children[t],{title:d(f[e]),...s?{onZoom:e=>(0,Qe.px)("fetchStatisticsAsyncGraph",{token:s,x:e,dcId:a}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.push(e),h.current.children[t].classList.remove(vv)})),A()):u(!0)})()}),[b,f,m,o,d,e,g,a,A]),(0,ee.FD)("div",{className:(0,me.A)(dv,"panel-content custom-scroll",m&&uv),children:[o&&(0,ee.Y)($p.A,{statistics:o,type:r?"group":"channel",title:d("StatisticOverview")}),!p.current.length&&(0,ee.Y)(Rs.A,{}),(0,ee.Y)("div",{ref:h,children:b.map((e=>(0,ee.Y)("div",{className:(0,me.A)(pv,vv)},e)))}),Boolean(o?.recentPosts?.length)&&(0,ee.FD)("div",{className:"suY9dEIz",children:[(0,ee.Y)("h2",{className:"evQIkAqx",children:d("ChannelStats.Recent.Header")}),o.recentPosts.map((e=>{if("msgId"in e){const t=l[e.msgId];if(!t||!("content"in t))return;return(0,ee.Y)(rv,{message:t,postStatistic:e},`statistic_message_${e.msgId}`)}if("storyId"in e&&t){const i=c?.[e.storyId];return(0,ee.Y)(cv,{chat:t,story:i,postStatistic:e},`statistic_story_${e.storyId}`)}}))]})]})}))),kv="oXLpD4Y4",wv="paQ2VBe_",Nv="WvFuOAIf",Iv=(0,s.ph)((({data:e})=>{const t=(0,M.A)(),{openChatByUsername:i}=(0,n.ko)(),o=(0,s.Kr)((()=>e.chat?(0,l.Kl)(e.chat):void 0),[e.chat]),a=(0,s.hb)((()=>{i({username:o,messageId:e.messageId})}),[e.messageId,i,o]);return(0,ee.FD)("div",{className:(0,me.A)(kv,"statistic-public-forward"),onClick:a,children:[(0,ee.Y)(Dt.A,{size:"medium",peer:e.chat}),(0,ee.FD)("div",{children:[(0,ee.Y)("div",{className:wv,children:e.title}),(0,ee.Y)("div",{className:Nv,children:t("ChannelStats.ViewsCount",e.views,"i")})]})]})}));let Pv,Yv;const Fv={viewsGraph:"Stats.MessageInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},Dv=Object.keys(Fv),Mv=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,s=(0,c.nTw)(e);return{statistics:s.statistics.currentMessage,dcId:i,messageId:s.statistics.currentMessageId}}))((function({chatId:e,isActive:t,statistics:r,dcId:l,messageId:c}){const d=(0,M.A)(),h=(0,s.li)(),[m,u]=(0,s.J0)(!1),p=(0,s.li)([]),{loadMessageStatistics:v,loadMessagePublicForwards:g,loadStatisticsAsyncGraph:A}=(0,n.ko)(),b=(0,F.A)();(0,s.vJ)((()=>{c&&v({chatId:e,messageId:c})}),[e,v,c]),(0,s.vJ)((()=>{t&&!c||(p.current=[],u(!1))}),[t,c]),(0,s.vJ)((()=>{r&&Dv.forEach((t=>{const i=r[t];"string"==typeof i&&A({name:t,chatId:e,token:i})}))}),[e,r,A]),(0,s.vJ)((()=>{(async()=>{await async function(){return Pv||(Pv=i.e(4810).then(i.bind(i,24810)),Yv=await Pv),Pv}(),m?r&&h.current&&(Dv.forEach(((e,t)=>{const i=r[e];if("string"==typeof i||p.current.includes(e))return;if(!i)return void p.current.push(e);const{zoomToken:s}=i;Yv.create(h.current.children[t],{title:d(Fv[e]),...s?{onZoom:e=>(0,Qe.px)("fetchStatisticsAsyncGraph",{token:s,x:e,dcId:l}),zoomOutLabel:d("Graph.ZoomOut")}:{},...i}),p.current.push(e)})),b()):u(!0)})()}),[m,r,d,e,c,A,l,b]);const f=(0,D.A)((({direction:t})=>{t===o.TN.Backwards&&c&&g({chatId:e,messageId:c})}));return m&&r&&c?(0,ee.FD)("div",{className:(0,me.A)(dv,"custom-scroll",m&&uv),children:[(0,ee.Y)($p.A,{statistics:r,type:"message",title:d("StatisticOverview")}),!p.current.length&&(0,ee.Y)(Rs.A,{}),(0,ee.Y)("div",{ref:h,children:Dv.map((e=>(0,ee.Y)("div",{className:(0,me.A)(pv,!p.current.includes(e)&&vv)})))}),Boolean(r.publicForwards)&&(0,ee.FD)("div",{className:hv,children:[(0,ee.Y)("h2",{className:mv,children:d("Stats.Message.PublicShares")}),(0,ee.Y)(bs.A,{items:r.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:f,preloadBackwards:a.DRJ,noFastList:!0,children:r.publicForwardsData.map((e=>(0,ee.Y)(Iv,{data:e},e.messageId)))})]})]}):(0,ee.Y)(Rs.A,{})}))),Tv=(0,s.ph)((function({data:e,chatsById:t,usersById:i}){const s=(0,M.A)(),{openChat:o}=(0,n.ko)(),a=i[e.peerId],r=t[e.peerId],c=(0,D.A)((()=>{o({id:a.id})}));return(0,ee.FD)("div",{className:(0,me.A)(kv,"statistic-public-forward"),onClick:c,children:[(0,ee.Y)(Dt.A,{size:"medium",peer:a||r,withStorySolid:!0,forceUnreadStorySolid:!0}),(0,ee.FD)("div",{children:[(0,ee.Y)("div",{className:wv,children:a?(0,l.Yg)(a):(0,l.Js)(s,r)}),(0,ee.Y)("div",{className:Nv,children:e.viewsCount?s("ChannelStats.ViewsCount",e.viewsCount,"i"):s("NoViews")})]})]})}));let Bv,Rv;const Lv={viewsGraph:"Stats.StoryInteractionsTitle",reactionsGraph:"ReactionsByEmotionChartTitle"},xv=Object.keys(Lv),Ev=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.AWZ)(e,t)?.statisticsDcId,s=(0,c.nTw)(e),n=s.statistics.currentStory,o=s.statistics.currentStoryId,{byId:a}=e.users,{byId:r}=e.chats;return{statistics:n,dcId:i,storyId:o,usersById:a,chatsById:r}}))((function({chatId:e,isActive:t,statistics:o,dcId:r,storyId:l,chatsById:c,usersById:d}){const h=(0,M.A)(),m=(0,s.li)(),[u,p]=(0,s.J0)(!1),v=(0,s.li)([]),{loadStoryStatistics:g,loadStoryPublicForwards:A,loadStatisticsAsyncGraph:b}=(0,n.ko)(),f=(0,F.A)();(0,s.vJ)((()=>{l&&g({chatId:e,storyId:l})}),[e,l]),(0,s.vJ)((()=>{t&&!l||(v.current=[],p(!1))}),[t,l]),(0,s.vJ)((()=>{o&&xv.forEach((t=>{const i=o[t];"string"==typeof i&&b({name:t,chatId:e,token:i})}))}),[e,o,b]),(0,s.vJ)((()=>{(async()=>{await async function(){return Bv||(Bv=i.e(4810).then(i.bind(i,24810)),Rv=await Bv),Bv}(),u?o&&m.current&&(xv.forEach(((e,t)=>{const i=o[e];if("string"==typeof i||v.current.includes(e))return;if(!i)return void v.current.push(e);const{zoomToken:s}=i;Rv.create(m.current.children[t],{title:h(Lv[e]),...s?{onZoom:e=>(0,Qe.px)("fetchStatisticsAsyncGraph",{token:s,x:e,dcId:r}),zoomOutLabel:h("Graph.ZoomOut")}:{},...i}),v.current.push(e)})),f()):p(!0)})()}),[u,o,h,e,l,b,r,f]);const C=(0,D.A)((()=>{l&&A({chatId:e,storyId:l})}));return u&&o&&l?(0,ee.FD)("div",{className:(0,me.A)(dv,"custom-scroll",u&&uv),children:[(0,ee.Y)($p.A,{statistics:o,type:"story",title:h("StatisticOverview")}),!v.current.length&&(0,ee.Y)(Rs.A,{}),(0,ee.Y)("div",{ref:m,children:xv.map((e=>(0,ee.Y)("div",{className:(0,me.A)(pv,!v.current.includes(e)&&vv)})))}),Boolean(o.publicForwards)&&(0,ee.FD)("div",{className:hv,children:[(0,ee.Y)("h2",{className:mv,children:h("Stats.Message.PublicShares")}),(0,ee.Y)(bs.A,{items:o.publicForwardsData,itemSelector:".statistic-public-forward",onLoadMore:C,preloadBackwards:a.DRJ,noFastList:!0,children:o.publicForwardsData.map((e=>"messageId"in e?(0,ee.Y)(Iv,{data:e},`message_${e.messageId}`):(0,ee.Y)(Tv,{data:e,chatsById:c,usersById:d},`story_${e.storyId}`)))})]})]}):(0,ee.Y)(Rs.A,{})})));var Vv=i(55573);const _v=(0,s.ph)((0,n.EK)(((e,{answer:t})=>{const{voters:i,offsets:s}=(0,c.nTw)(e).pollResults;return{voters:i?.[t.option],offset:s?.[t.option]||""}}))((({chat:e,message:t,answer:i,answerVote:o,totalVoters:a,voters:r,offset:l})=>{const{loadPollOptionResults:c,openChat:d,closePollResults:h}=(0,n.ko)(),m=(0,V.A)(o.votersCount),[p,v]=(0,s.J0)(!0),g=Boolean(r),{option:A,text:b}=i,f=(0,M.A)();(0,s.vJ)((()=>{g&&m===o.votersCount||c({chat:e,messageId:t.id,option:A,offset:l,limit:4,shouldResetVoters:!0})}),[o.votersCount,g]);const C=(0,s.hb)((()=>{v(!0),c({chat:e,messageId:t.id,option:A,offset:l,limit:50})}),[e,c,t.id,l,A]);(0,s.vJ)((()=>{v(!1)}),[r]);const S=(0,s.hb)((e=>{d({id:e}),h()}),[h,d]);return(0,ee.FD)("div",{className:"PollAnswerResults",children:[(0,ee.FD)("div",{className:"poll-voters",children:[r?r.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable",onClick:()=>S(e),children:(0,u.L8)(e)?(0,ee.Y)(ys.A,{avatarSize:"tiny",userId:e,forceShowSelf:!0,noStatusOrTyping:!0}):(0,ee.Y)(Ss.A,{avatarSize:"tiny",chatId:e,noStatusOrTyping:!0})},e))):(0,ee.Y)(Rs.A,{}),r&&function(){const e=o.votersCount-r.length;return o.votersCount>4&&e>0&&(0,ee.Y)(Vv.A,{count:e,itemName:"voter",isLoading:p,onClick:C})}()]}),(0,ee.FD)("div",{className:"answer-head",dir:f.isRtl?"rtl":void 0,children:[(0,ee.Y)("span",{className:"answer-title",dir:"auto",children:(0,Zi.fd)({text:b.text,entities:b.entities})}),(0,ee.FD)("span",{className:"answer-percent",dir:f.isRtl?"auto":void 0,children:[(y=o.votersCount,k=a,k>0?(y/k*100).toFixed():0),"%"]})]})]});var y,k}))),Uv=(0,s.ph)((0,n.EK)((e=>{const{pollResults:{chatId:t,messageId:i}}=(0,c.nTw)(e);if(!t||!i)return{};const s=(0,c.hds)(e,t),n=(0,c.O5q)(e,t,i);return{chat:s,message:n,poll:n&&(0,c.zcZ)(e,n)}}))((({isActive:e,chat:t,message:i,poll:s,onClose:n})=>{const o=(0,M.A)();if((0,fe.A)({isActive:e,onBack:n}),!i||!s||!t)return(0,ee.Y)(Rs.A,{});const{summary:a,results:r}=s;if(!r.results)return;const l=(0,bi.dU)(r.results,"option");return(0,ee.FD)("div",{className:"PollResults",dir:o.isRtl?"rtl":void 0,children:[(0,ee.Y)("h3",{className:"poll-question",dir:"auto",children:(0,Zi.fd)({text:a.question.text,entities:a.question.entities})}),(0,ee.Y)("div",{className:"poll-results-list custom-scroll",children:a.answers.map((e=>(0,ee.Y)(_v,{chat:t,message:i,answer:e,answerVote:l[e.option],totalVoters:r.totalVoters},`${s.id}-${e.option}`)))})]})})));var Ov=i(90603);const Kv="xrnUE4e6",Jv="z7kF7tij",Gv="T6wFpdQO",jv="CWsWIKQ1",zv="KBl0ycLl",Hv="iJ1U9kDD",$v="Rk6PT_yc",qv="qlo3vSEw",Wv="r06zwL42",Qv=5*p.$,Zv=(0,s.ph)((0,n.EK)((e=>{const{createTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,createTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}}))((({isActive:e,chat:t,createTopicPanel:i,isCurrentUserPremium:o,onClose:r})=>{const{createTopic:l,openPremiumModal:c}=(0,n.ko)(),[d,h]=(0,s.J0)(""),[m,u]=(0,s.J0)(0),[p,v]=(0,s.J0)(void 0),g=(0,M.A)(),A=Boolean(d),b=Boolean(i?.isLoading);(0,fe.A)({isActive:e,onBack:r}),(0,s.vJ)((()=>{e||(h(""),v(void 0))}),[e]);const f=(0,s.hb)((e=>{h(e.target.value)}),[]),C=(0,s.hb)((()=>{u((e=>(0,Io.A)((0,Ov.e$)().length,e+1)))}),[]),S=(0,s.hb)((()=>{l({chatId:t.id,title:d,iconColor:(0,Ov.e$)()[m],iconEmojiId:p})}),[t,l,m,p,d]),y=(0,s.hb)((e=>{e.isFree||o||e.id===a.MyF?e.id!==a.MyF?v(e.id):v(void 0):c({initialSection:"animated_emoji"})}),[o,c]),k=(0,s.Kr)((()=>({id:0,title:d,iconColor:(0,Ov.e$)()[m],iconEmojiId:p})),[m,p,d]);if(t?.isForum)return(0,ee.FD)("div",{className:Kv,children:[(0,ee.FD)("div",{className:(0,me.A)(Jv,"custom-scroll"),children:[(0,ee.FD)("div",{className:(0,me.A)(Gv,jv),children:[(0,ee.Y)("span",{className:qv,children:g("CreateTopicTitle")}),(0,ee.Y)(se.Ay,{name:"zoomFade",activeKey:Number(k.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:Hv,children:(0,ee.Y)(xs.A,{topic:k,className:(0,me.A)($v,"K1CTKtBS"),onClick:C,size:Qv,noLoopLimit:!0})}),(0,ee.Y)(Q.A,{value:d,onChange:f,label:g("lng_forum_topic_title"),disabled:b,teactExperimentControlled:!0})]}),(0,ee.Y)("div",{className:(0,me.A)(Gv,zv),children:(0,ee.Y)(Lr,{idPrefix:"create-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:y,className:Wv,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]}),(0,ee.Y)(ki.A,{isShown:A,disabled:b,onClick:S,ariaLabel:g("Save"),children:b?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})}))),Xv=5*p.$,eg=(0,s.ph)((0,n.EK)((e=>{const{editTopicPanel:t}=(0,c.nTw)(e);return{chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0,topic:t?.chatId&&t?.topicId?(0,c.S0q)(e,t.chatId,t.topicId):void 0,editTopicPanel:t,isCurrentUserPremium:(0,c.g29)(e)}}))((({isActive:e,chat:t,topic:i,editTopicPanel:o,isCurrentUserPremium:r,onClose:l})=>{const{editTopic:c,openPremiumModal:d}=(0,n.ko)(),[h,m]=(0,s.J0)(""),[u,p]=(0,s.J0)(void 0),v=(0,M.A)(),g=Boolean(o?.isLoading),A=i?.id===a.HxB;(0,fe.A)({isActive:e,onBack:l}),(0,s.vJ)((()=>{e||(m(""),p(void 0))}),[e]),(0,s.vJ)((()=>{(i?.title||i?.iconEmojiId)&&(m(i.title),p(i.iconEmojiId))}),[i]);const b=(0,s.Kr)((()=>h!==i?.title||u!==i?.iconEmojiId),[u,h,i?.iconEmojiId,i?.title]),f=(0,s.hb)((e=>{const t=e.target.value;m(t)}),[]),C=(0,s.hb)((()=>{c({chatId:t.id,title:h,topicId:i.id,iconEmojiId:u})}),[t,c,u,h,i]),S=(0,s.hb)((e=>{e.isFree||r||e.id===a.MyF?e.id!==a.MyF?p(e.id):p("0"):d({initialSection:"animated_emoji"})}),[r,d]),y=(0,s.Kr)((()=>({...i,title:h,iconEmojiId:u})),[u,h,i]);if(t?.isForum)return(0,ee.FD)("div",{className:Kv,children:[(0,ee.FD)("div",{className:(0,me.A)(Jv,"custom-scroll"),children:[!i&&(0,ee.Y)(Rs.A,{}),i&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:(0,me.A)(Gv,jv,A&&"YftUWqqw"),children:[(0,ee.Y)("span",{className:qv,children:v(A?"CreateGeneralTopicTitle":"CreateTopicTitle")}),(0,ee.Y)(se.Ay,{name:"zoomFade",activeKey:Number(y.iconEmojiId)||0,shouldCleanup:!0,direction:1,className:Hv,children:(0,ee.Y)(xs.A,{topic:y,className:$v,size:Xv,noLoopLimit:!0})}),(0,ee.Y)(Q.A,{value:h,onChange:f,label:v("lng_forum_topic_title"),disabled:g,teactExperimentControlled:!0})]}),!A&&(0,ee.Y)("div",{className:(0,me.A)(Gv,zv),children:(0,ee.Y)(Lr,{idPrefix:"edit-topic-icons-set-",isHidden:!e,loadAndPlay:e,onCustomEmojiSelect:S,className:Wv,pickerListClassName:"fab-padding-bottom",withDefaultTopicIcons:!0})})]})]}),(0,ee.Y)(ki.A,{isShown:b,disabled:g,onClick:C,ariaLabel:v("Save"),children:g?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})}))),tg="Please provide name",ig=(0,s.ph)((0,n.EK)(((e,{userId:t})=>{const i=(0,c.yps)(e,t),s=(0,c.vGo)(e,t),{progress:n}=(0,c.nTw)(e).management,o=(0,co.d)(e,"aboutLength");return{userId:t,user:i,progress:n,currentBio:s?.bio,maxBioLength:o}}))((({userId:e,user:t,progress:i,onClose:a,currentBio:r,isActive:c,maxBioLength:d})=>{const{setBotInfo:h,uploadProfilePhoto:m,uploadContactProfilePhoto:u,startBotFatherConversation:p}=(0,n.ko)(),[v,g,A]=(0,Y.A)(!1),[b,f,C]=(0,Y.A)(!1),[S,y]=(0,s.J0)(),k=(0,M.A)(),w=(0,s.Kr)((()=>t?(0,l.Kl)(t):void 0),[t]);(0,fe.A)({isActive:c,onBack:a});const N=t?(0,l.u0)(t):"",[I,P]=(0,s.J0)(),[F,T]=(0,s.J0)(N||""),[B,R]=(0,s.J0)(r||""),L=t&&(0,l.cP)(t),x=(0,j.A)(L,!1,U.qZ.BlobUrl);(0,s.vJ)((()=>{A(),C()}),[e]),(0,s.vJ)((()=>{T(N||""),R(r||"")}),[N,r,t]),(0,s.vJ)((()=>{P(void 0)}),[x]),(0,s.vJ)((()=>{i===o.TD.Complete&&(A(),C(),y(void 0))}),[i]);const E=(0,D.A)((e=>{T(e.target.value),g(),S===tg&&y(void 0)})),V=(0,D.A)((e=>{R(e.target.value),g()})),_=(0,D.A)((e=>{P(e),f()})),O=(0,D.A)((()=>{const e=F.trim(),i=B.trim();e.length?(h({...v&&{bot:t,name:e,description:i}}),I&&m({file:I,...b&&{bot:t}})):y(tg)})),K=(0,D.A)((()=>{p({param:`${w}-intro`})})),J=(0,D.A)((()=>{p({param:`${w}-commands`})})),G=(0,D.A)((()=>{p({param:w})})),z=(0,s.li)(),H=(0,s.li)(!1),$=(0,D.A)((t=>{f(),u({userId:e,file:t,isSuggest:H.current})}));if(!t)return;const W=i===o.TD.InProgress;return(0,ee.FD)("div",{className:"Management",children:[(0,ee.FD)("div",{className:"custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(ah.A,{currentAvatarBlobUrl:x,onChange:_,title:k("ChatSetPhotoOrVideo"),disabled:W}),(0,ee.Y)(Q.A,{id:"user-name",label:k("PaymentCheckoutName"),onChange:E,value:F,error:S===tg?S:void 0,teactExperimentControlled:!0}),(0,ee.Y)(Il.A,{value:B,onChange:V,label:k("DescriptionPlaceholder"),disabled:W,maxLength:d,maxLengthIndicator:d?(d-B.length).toString():void 0})]}),(0,ee.Y)("div",{className:"section",children:(0,ee.FD)("div",{className:"dialog-buttons",children:[(0,ee.Y)(li.A,{icon:"bot-commands-filled",ripple:!0,onClick:K,children:(0,ee.Y)("span",{children:k("BotEditIntro")})}),(0,ee.Y)(li.A,{icon:"bot-command",ripple:!0,onClick:J,children:(0,ee.Y)("span",{children:k("BotEditCommands")})}),(0,ee.Y)(li.A,{icon:"bots",ripple:!0,onClick:G,children:(0,ee.Y)("span",{children:k("BotChangeSettings")})}),(0,ee.Y)("div",{className:"section-info section-info_push",children:(0,Ft.A)(k("BotManageInfo"),["links"])})]})})]}),(0,ee.Y)(ki.A,{isShown:v||b,onClick:O,disabled:W,ariaLabel:k("Save"),children:W?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),(0,ee.Y)(Hh.A,{onChange:$,inputRef:z})]})}))),sg="Channel title can't be empty",ng=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{management:s}=(0,c.nTw)(e),{progress:n}=s,{invites:o}=s.byChatId[t]||{},a=e.appConfig?.channelAutoTranslationLevelMin,r=i?.hasAutoTranslation,d=i?.level,h=!(!d||!a)&&d>=a;return{chat:i,chatFullInfo:(0,c.AWZ)(e,t),progress:n,canChangeInfo:(0,l.ub)(i,"changeInfo"),canInvite:(0,l.ub)(i,"inviteUsers"),exportedInvites:o,availableReactions:e.reactions.availableReactions,hasAutoTranslation:r,canToggleAutoTranslation:h}}),((e,{chatId:t})=>Boolean((0,c.hds)(e,t))))((({chatId:e,chat:t,chatFullInfo:i,progress:a,canChangeInfo:r,canInvite:d,exportedInvites:h,isActive:m,availableReactions:u,onScreenSelect:p,onClose:v,hasAutoTranslation:g,canToggleAutoTranslation:A})=>{const{updateChat:b,closeManagement:f,leaveChannel:C,deleteChannel:S,openChat:y,loadExportedChatInvites:k,loadChatJoinRequests:w,toggleAutoTranslation:N}=(0,n.ko)(),I=t?.title||"",P=i?.about||"",F=Boolean(i?.linkedChatId),[T,B,R]=(0,Y.A)(),[L,x]=(0,s.J0)(!1),[E,V]=(0,s.J0)(I),[_,O]=(0,s.J0)(P),[K,J]=(0,s.J0)(),[G,z]=(0,s.J0)(),H=t&&(0,l.cP)(t),$=(0,j.A)(H,!1,U.qZ.BlobUrl),W=(0,M.A)(),Z=t&&(0,l.WX)(t),X=(0,D.A)((()=>{N({chatId:e,isEnabled:!g})}));(0,fe.A)({isActive:m,onBack:v}),(0,s.vJ)((()=>{d&&(k({chatId:e}),k({chatId:e,isRevoked:!0}),w({chatId:e}))}),[e,d]),(0,s.vJ)((()=>{a===o.TD.Complete&&(x(!1),z(void 0))}),[a]);const te=(0,s.Kr)((()=>Object.keys(i?.adminMembersById||{}).length),[i?.adminMembersById]),ie=i?.kickedMembers?.length||0,se=(0,D.A)((()=>{p(o.je.ChatPrivacyType)})),ne=(0,D.A)((()=>{p(o.je.Discussion)})),oe=(0,D.A)((()=>{p(o.je.Reactions)})),ae=(0,D.A)((()=>{p(o.je.ChatAdministrators)})),re=(0,D.A)((()=>{p(o.je.Invites)})),le=(0,D.A)((()=>{p(o.je.JoinRequests)})),ce=(0,D.A)((e=>{J(e),x(!0)})),de=(0,D.A)((e=>{V(e.target.value),x(!0)})),he=(0,D.A)((e=>{O(e.target.value),x(!0)})),me=(0,D.A)((()=>{const t=E.trim(),i=_.trim();t.length?b({chatId:e,title:t,about:i,photo:K}):z(sg)})),ue=(0,D.A)((()=>{p(o.je.ChannelSubscribers)})),pe=(0,D.A)((()=>{p(o.je.ChannelRemovedUsers)})),ve=(0,D.A)((()=>{t.isCreator?S({chatId:t.id}):C({chatId:t.id}),R(),f(),y({id:void 0})})),ge=(0,s.Kr)((()=>{if(!i?.enabledReactions)return W("ReactionsOff");if("all"===i.enabledReactions.type)return W("ReactionsAll");const e=i.enabledReactions.allowed.length,t=u?.filter((e=>!e.isInactive)).length||0;return t?`${e} / ${t}`:e.toString()}),[u,i?.enabledReactions,W]),Ae=(0,s.Kr)((()=>(0,l.gA)(t)),[t]);if((0,c._ls)((0,n.mS)(),e)||t.isForbidden)return;const be=a===o.TD.InProgress;return(0,ee.FD)("div",{className:"Management",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(ah.A,{currentAvatarBlobUrl:$,onChange:ce,disabled:!r}),(0,ee.FD)("div",{className:"settings-edit",children:[(0,ee.Y)(Q.A,{id:"channel-title",label:W("EnterChannelName"),onChange:de,value:E,error:G===sg?G:void 0,disabled:!r}),(0,ee.Y)(Il.A,{id:"channel-about",label:W("DescriptionPlaceholder"),onChange:he,value:_,maxLength:255,maxLengthIndicator:(255-_.length).toString(),disabled:!r,noReplaceNewlines:!0})]}),t.isCreator&&(0,ee.FD)(li.A,{icon:"lock",multiline:!0,onClick:se,children:[(0,ee.Y)("span",{className:"title",children:W("ChannelType")}),(0,ee.Y)("span",{className:"subtitle",children:W(Ae?"TypePublic":"TypePrivate")})]}),(0,ee.FD)(li.A,{icon:"message",multiline:!0,onClick:ne,disabled:!r,children:[(0,ee.Y)("span",{className:"title",children:W("Discussion")}),(0,ee.Y)("span",{className:"subtitle",children:W(F?"DiscussionUnlink":"Add")})]}),d&&(0,ee.FD)(li.A,{icon:"link",onClick:re,multiline:!0,disabled:!h,children:[(0,ee.Y)("span",{className:"title",children:W("GroupInfo.InviteLinks")}),(0,ee.Y)("span",{className:"subtitle",children:h?(0,He.Sm)(h.length):W("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,ee.FD)(li.A,{icon:"add-user-filled",onClick:le,multiline:!0,children:[(0,ee.Y)("span",{className:"title",children:W("SubscribeRequests")}),(0,ee.Y)("span",{className:"subtitle",children:(0,He.Sm)(t.joinRequests.length)})]}),(0,ee.FD)(li.A,{icon:"heart-outline",multiline:!0,onClick:oe,disabled:!r,children:[(0,ee.Y)("span",{className:"title",children:W("Reactions")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:ge})]}),Z&&(0,ee.FD)(li.A,{icon:"language",narrow:!0,ripple:!0,disabled:!A,onClick:X,children:[(0,ee.Y)("span",{children:W("AutomaticTranslation")}),(0,ee.Y)(Ai.A,{id:"auto-translation",label:W("AutomaticTranslation"),checked:g})]})]}),(0,ee.FD)("div",{className:"section",children:[(0,ee.FD)(li.A,{icon:"admin",multiline:!0,onClick:ae,children:[(0,ee.Y)("span",{className:"title",children:W("ChannelAdministrators")}),(0,ee.Y)("span",{className:"subtitle",children:te})]}),(0,ee.FD)(li.A,{icon:"group",multiline:!0,onClick:ue,children:[(0,ee.Y)("span",{className:"title",dir:"auto",children:W("ChannelSubscribers")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:(0,He.Sm)(t.membersCount)})]}),(0,ee.FD)(li.A,{icon:"delete-user",multiline:!0,onClick:pe,children:[(0,ee.Y)("span",{className:"title",children:W("ChannelBlockedUsers")}),(0,ee.Y)("span",{className:"subtitle",children:ie})]})]}),(0,ee.Y)("div",{className:"section",children:(0,ee.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:B,children:t.isCreator?W("ChannelDelete"):W("LeaveChannel")})})]}),(0,ee.Y)(ki.A,{isShown:L,onClick:me,disabled:be,ariaLabel:W("Save"),children:be?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),(0,ee.Y)(pi.A,{isOpen:T,onClose:R,text:t.isCreator?W("ChannelDeleteAlert"):W("ChannelLeaveAlert"),confirmLabel:t.isCreator?W("ChannelDelete"):W("LeaveChannel"),confirmHandler:ve,confirmIsDestructive:!0})]})}))),og=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,currentUserId:e.currentUserId,isChannel:i&&(0,l.WX)(i),adminMembersById:(0,c.AWZ)(e,t)?.adminMembersById}}))((({isActive:e,chat:t,isChannel:i,currentUserId:a,adminMembersById:r,onScreenSelect:c,onChatMemberSelect:d,onClose:h})=>{const{toggleSignatures:m}=(0,n.ko)(),u=(0,M.A)();(0,fe.A)({isActive:e,onBack:h});const p=Boolean(t?.areSignaturesShown),v=Boolean(t?.areProfilesShown),g=Boolean(t?.isCreator||t&&(0,l.ub)(t,"addAdmins")),A=i&&(0,l.ub)(t,"postMessages"),b=(0,s.Kr)((()=>{if(!r)return[];const[e,t]=(0,bi.jB)(Object.values(r),(e=>e.isOwner));return[...e,...t]}),[r]),f=(0,D.A)((e=>{d(e.userId,e.promotedByUserId===a),c(o.je.ChatAdminRights)})),C=(0,D.A)((()=>{m({chatId:t.id,areProfilesEnabled:v,areSignaturesEnabled:!p})})),S=(0,D.A)((()=>{m({chatId:t.id,areProfilesEnabled:!v,areSignaturesEnabled:p})})),y=(0,D.A)((()=>{c(o.je.GroupAddAdmins)})),k=(0,D.A)((e=>{if(e.isOwner)return u("ChannelCreator");const t=(0,n.mS)().users.byId,i=e.promotedByUserId?t[e.promotedByUserId]:void 0;return i?u("EditAdminPromotedBy",(0,l.Yg)(i)):u("ChannelAdmin")}));return(0,ee.Y)("div",{className:"Management",children:(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.Y)("div",{className:"section",children:(0,ee.FD)(li.A,{icon:"recent",multiline:!0,disabled:!0,children:[(0,ee.Y)("span",{className:"title",children:u("EventLog")}),(0,ee.Y)("span",{className:"subtitle",children:u(i?"EventLogInfoDetailChannel":"EventLogInfoDetail")})]})}),(0,ee.FD)("div",{className:"section",dir:u.isRtl?"rtl":void 0,children:[(0,ee.Y)("p",{className:"section-help",dir:"auto",children:u(i?"Channel.Management.AddModeratorHelp":"Group.Management.AddModeratorHelp")}),b.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable",onClick:()=>f(e),children:(0,ee.Y)(ys.A,{userId:e.userId,status:k(e),forceShowSelf:!0})},e.userId))),(0,ee.Y)(ki.A,{isShown:g,onClick:y,ariaLabel:u("Channel.Management.AddModerator"),children:(0,ee.Y)(q.A,{name:"add-user-filled"})})]}),A&&(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("div",{className:"ListItem narrow",children:(0,ee.Y)(en.A,{checked:p,label:u("ChannelSignMessages"),onChange:C})}),p&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("div",{className:"ListItem narrow",children:(0,ee.Y)(en.A,{checked:v,label:u("ChannelSignMessagesWithProfile"),onChange:S})}),(0,ee.Y)("p",{className:"section-info section-info_push",children:u("ChannelSignProfilesInfo")})]})]})]})})}))),ag=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{isUsernameAvailable:s,checkedUsername:n,error:o}=(0,c.YK)(e,t);return{chat:i,isChannel:(0,l.WX)(i),progress:(0,c.nTw)(e).management.progress,error:o,isUsernameAvailable:s,checkedUsername:n,isProtected:i?.isProtected,maxPublicLinks:(0,co.d)(e,"channelsPublic"),privateInviteLink:(0,c.AWZ)(e,t)?.inviteLink}}),((e,{chatId:t})=>Boolean((0,c.hds)(e,t)&&(0,c.YK)(e,t))))((({chat:e,isActive:t,isChannel:i,progress:r,isUsernameAvailable:c,checkedUsername:d,error:h,isProtected:m,maxPublicLinks:u,privateInviteLink:p,onClose:v})=>{const{updatePublicLink:g,updatePrivateLink:A,toggleIsProtected:b,openLimitReachedModal:f,resetManagementError:C}=(0,n.ko)(),S=(0,s.Kr)((()=>e.usernames?.find((({isEditable:e})=>e))),[e.usernames]),y=S?.username||"",k=(0,s.Kr)((()=>(0,l.gA)(e)),[e]),[w,N]=(0,s.J0)(!1),[I,P]=(0,s.J0)(k?"public":"private"),[F,D]=(0,s.J0)(),[T,B,R]=(0,Y.A)(),[L,x,E]=(0,Y.A)(),_=(0,V.A)(c),U=w&&Boolean("public"===I&&(F||y&&""===F)&&(c??_)||"private"===I&&k);(0,fe.A)({isActive:t,onBack:v}),(0,s.vJ)((()=>{N(!1)}),[y]),(0,s.vJ)((()=>{I&&!p&&A()}),[I,p,A]);const O=(0,s.hb)((t=>{D(t),N(!0),h&&C({chatId:e.id})}),[e.id,h]),K=(0,s.hb)(((e,t)=>{if(Object.values((0,n.mS)().chats.byId).filter((({isCreator:e,usernames:t})=>e&&t?.some((e=>e.isActive)))).length>=u&&"public"===e){f({limit:"channelsPublic"});const e=t.currentTarget.closest(".radio-group");return e.querySelector("[value=public]").checked=!1,void(e.querySelector("[value=private]").checked=!0)}P(e),N(!0)}),[u,f]),J=(0,s.hb)((t=>{b({chatId:e.id,isProtected:"protected"===t})}),[e.id,b]),G=(0,s.hb)((()=>{k&&"private"===I?x():g({username:"public"===I&&F||""})}),[k,x,I,g,F]),j=(0,s.hb)((()=>{g({username:"",shouldDisableUsernames:!0}),E()}),[E,g]),z=(0,s.hb)((()=>{R(),A()}),[R,A]),H=(0,M.A)(),$=i?"Channel":"Mega",W=i?"Channel":"Group",Q=[{value:"private",label:H(`${$}Private`),subLabel:H(`${$}PrivateInfo`)},{value:"public",label:H(`${$}Public`),subLabel:H(`${$}PublicInfo`)}],Z=[{value:"allowed",label:H("ChannelVisibility.Forwarding.Enabled")},{value:"protected",label:H("ChannelVisibility.Forwarding.Disabled")}],te=r===o.TD.InProgress,ie="public"===I&&e.usernames&&e.usernames.length>0;return(0,ee.FD)("div",{className:"Management",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.FD)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:[(0,ee.Y)("h3",{className:"section-heading",children:H(`${W}Type`)}),(0,ee.Y)(X.A,{selected:I,name:"channel-type",options:Q,onChange:K})]}),"private"===I?(0,ee.Y)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:p?(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(zr.A,{link:p,className:"invite-link"}),(0,ee.Y)("p",{className:"section-info",dir:H.isRtl?"rtl":void 0,children:H(`${$}PrivateLinkHelp`)}),(0,ee.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:B,children:H("RevokeLink")}),(0,ee.Y)(pi.A,{isOpen:T,onClose:R,text:H("RevokeAlert"),confirmLabel:H("RevokeButton"),confirmHandler:z,confirmIsDestructive:!0})]}):(0,ee.Y)(Rs.A,{})}):(0,ee.FD)("div",{className:"section no-border",children:[(0,ee.Y)("div",{className:"settings-input",children:(0,ee.Y)(oh,{asLink:!0,currentUsername:y,isLoading:te,isUsernameAvailable:c,checkedUsername:d,onChange:O})}),h===a.Y3M&&function(){const e=`${a.jsp}${a.NjX}`;return(0,ee.Y)("p",{className:"section-info",dir:"auto",children:H("lng_username_purchase_available").replace("{link}","%PURCHASE_LINK%").split("%").map((t=>"PURCHASE_LINK"===t?(0,ee.Y)(dl.A,{url:e,text:`@${a.NjX}`}):t))})}(),(0,ee.Y)("p",{className:"section-info",dir:"auto",children:H(`${W}.Username.CreatePublicLinkHelp`)})]}),ie&&(0,ee.Y)(th,{chatId:e.id,usernames:e.usernames,onEditUsername:O}),(0,ee.FD)("div",{className:"section",dir:H.isRtl?"rtl":void 0,children:[(0,ee.Y)("h3",{className:"section-heading",children:H(i?"ChannelVisibility.Forwarding.ChannelTitle":"ChannelVisibility.Forwarding.GroupTitle")}),(0,ee.Y)(X.A,{selected:m?"protected":"allowed",name:"forwarding-type",options:Z,onChange:J}),(0,ee.Y)("p",{className:"section-info section-info_push",children:H(i?"ChannelVisibility.Forwarding.ChannelInfo":"ChannelVisibility.Forwarding.GroupInfo")})]})]}),(0,ee.Y)(ki.A,{isShown:U,disabled:te,ariaLabel:H("Save"),onClick:G,children:te?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),(0,ee.Y)(pi.A,{isOpen:L,onClose:E,text:H("ChannelVisibility.Confirm.MakePrivate.Channel",y),confirmHandler:j,confirmIsDestructive:!0})]})}))),rg=(0,s.ph)((0,n.EK)(((e,{chat:t})=>{const{currentUserId:i}=e;return{currentUserId:i,chatMembers:(0,c.AWZ)(e,t.id)?.members}}))((({chat:e,currentUserId:t,chatMembers:i,isOpen:o,onClose:a})=>{const{loadMoreMembers:r,deleteChatMember:l}=(0,n.ko)(),c=(0,M.A)(),[d,h]=(0,s.J0)(""),m=(0,s.Kr)((()=>{const e=(i||[]).reduce(((e,i)=>(i.isAdmin||i.isOwner||i.userId===t||e.push(i.userId),e)),[]);return(0,Yt.PU)({ids:e,query:d,type:"user"})}),[i,t,d]),u=(0,D.A)((()=>{r({chatId:e.id})})),p=(0,D.A)((t=>{l({chatId:e.id,userId:t}),a()}));return(0,ee.Y)(Us,{isOpen:o,chatOrUserIds:m,searchPlaceholder:c("ChannelBlockUser"),search:d,onSearchChange:h,loadMore:u,onSelectChatOrUser:p,onClose:a})}))),lg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:s}=e.users;return{chat:i,usersById:s,canDeleteMembers:i&&((0,l.ub)(i,"banUsers")||i.isCreator),removedMembers:(0,c.AWZ)(e,t)?.kickedMembers||fi.p,isChannel:i&&(0,l.WX)(i)}}))((({chat:e,usersById:t,canDeleteMembers:i,removedMembers:o,isChannel:a,onClose:r,isActive:c})=>{const{updateChatMemberBannedRights:d}=(0,n.ko)(),h=(0,M.A)(),[m,u,p]=(0,Y.A)();(0,fe.A)({isActive:c,onBack:r});const v=(0,s.hb)((e=>{if(!e.kickedByUserId)return;const i=t[e.kickedByUserId];return i?h("UserRemovedBy",(0,l.Yg)(i)):void 0}),[h,t]),g=(0,s.hb)((t=>{if(e)return[{title:h("Unblock"),icon:"delete",destructive:!0,handler:()=>d({chatId:e.id,userId:t.userId,bannedRights:{}})}]}),[h,e,d]);return(0,ee.Y)("div",{className:"Management",children:(0,ee.Y)("div",{className:"panel-content custom-scroll",children:(0,ee.FD)("div",{className:"section",dir:h.isRtl?"rtl":void 0,children:[(0,ee.Y)("p",{className:"section-help",children:h(a?"NoBlockedChannel2":"NoBlockedGroup2")}),o.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable",ripple:!0,contextActions:g(e),children:(0,ee.Y)(ys.A,{userId:e.userId,status:v(e),forceShowSelf:!0})},e.userId))),i&&(0,ee.Y)(ki.A,{isShown:!0,onClick:u,ariaLabel:h("Channel.EditAdmin.Permission.BanUsers"),children:(0,ee.Y)(q.A,{name:"add-user-filled"})}),e&&i&&(0,ee.Y)(rg,{chat:e,isOpen:m,onClose:p})]})})})}))),cg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{linkedChatId:s}=(0,c.AWZ)(e,t)||{},{forDiscussionIds:n,byId:o}=e.chats;return{chat:i,chatsByIds:o,forDiscussionIds:n,linkedChat:s?(0,c.hds)(e,s):void 0,isChannel:i&&(0,l.WX)(i)}}))((({chat:e,onClose:t,isActive:i,chatId:r,chatsByIds:c,linkedChat:d,forDiscussionIds:h,isChannel:m,onScreenSelect:u})=>{const{loadGroupsForDiscussion:p,linkDiscussionGroup:v,unlinkDiscussionGroup:g,toggleJoinRequest:A,toggleJoinToSend:b}=(0,n.ko)(),[f,C]=(0,s.J0)(),[S,y,k]=(0,Y.A)(),[w,N,I]=(0,Y.A)(),[P,F]=(0,s.J0)(Boolean(d?.isJoinToSend)),[T,B]=(0,s.J0)(Boolean(d?.isJoinRequest)),R=(0,M.A)(),L=d?.id;(0,fe.A)({isActive:i,onBack:t}),(0,s.vJ)((()=>{p()}),[p]),(0,s.vJ)((()=>{i&&(F(d?.isJoinToSend||!1),B(d?.isJoinRequest||!1))}),[d,i]);const x=(0,s.hb)((()=>{k(),g({channelId:m?r:L}),m||u(o.je.Initial)}),[k,g,m,r,L,u]),E=(0,s.hb)((()=>{I(),v({channelId:r,chatId:f})}),[I,v,r,f]),V=(0,s.hb)((e=>{F(e),b({chatId:L,isEnabled:e}),e||B(!1)}),[L,b]),_=(0,s.hb)((e=>{B(e),A({chatId:L,isEnabled:e})}),[L,A]);const U=(0,D.A)((()=>{u(o.je.NewDiscussionGroup)}));return(0,ee.Y)("div",{className:"Management",children:(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.DiscussionGroups,size:a.Uyp,className:"section-icon"}),d&&(0,ee.FD)("div",{children:[d&&(0,ee.Y)(li.A,{className:"chat-item-clickable",inactive:!0,children:(0,ee.Y)(Ss.A,{chatId:d.id})}),(0,ee.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:y,children:R(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")}),(0,ee.Y)(pi.A,{isOpen:S,onClose:k,header:(0,ee.FD)("div",{className:"modal-header",children:[(0,ee.Y)(Dt.A,{size:"tiny",peer:d}),(0,ee.Y)("div",{className:"modal-title",children:R(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel")})]}),textParts:(0,Ft.A)(R(m?"DiscussionUnlinkChannelAlert":"DiscussionUnlinkGroupAlert",d?.title),["br","simple_markdown"]),confirmLabel:R(m?"DiscussionUnlinkGroup":"DiscussionUnlinkChannel"),confirmHandler:x,confirmIsDestructive:!0})]}),!d&&(0,ee.FD)("div",{children:[(0,ee.Y)("p",{className:"section-help",dir:"auto",children:R("DiscussionChannelHelp")}),(0,ee.FD)("div",{teactFastList:!0,children:[(0,ee.Y)(li.A,{icon:"group",ripple:!0,className:"create-item",withPrimaryColor:!0,teactOrderKey:0,onClick:U,children:R("DiscussionCreateGroup")},"create-group"),h?h.map(((e,t)=>(0,ee.Y)(li.A,{teactOrderKey:t+1,className:"chat-item-clickable scroll-item",onClick:()=>{C(e),N()},children:(0,ee.Y)(Ss.A,{chatId:e})},e))):(0,ee.Y)(bc.A,{teactOrderKey:0,text:"No discussion groups found"},"nothing-found")]}),(0,ee.Y)("p",{className:"mt-4 mb-0 section-help",dir:"auto",children:R("DiscussionChannelHelp2")}),(0,ee.Y)(pi.A,{isOpen:w,onClose:I,header:function(){if(!f)return;const e=c[f];return e?(0,ee.FD)("div",{className:"modal-header",children:[(0,ee.Y)(Dt.A,{size:"tiny",peer:e}),(0,ee.Y)("div",{className:"modal-title",children:R("Channel.DiscussionGroup.LinkGroup")})]}):void 0}(),textParts:function(){if(!f)return;const t=c[f];return t?(0,l.gA)(t)?(0,Ft.A)(`Do you want to make **${t.title}** the discussion board for **${e?.title}**?`,["br","simple_markdown"]):(0,Ft.A)(`Do you want to make **${t.title}** the discussion board for **${e?.title}**?\n\nAnyone from the channel will be able to see messages in this group.`,["br","simple_markdown"]):void 0}(),confirmLabel:R("DiscussionLinkGroup"),confirmHandler:E})]})]}),d&&(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("h3",{className:"section-heading",children:R("ChannelSettingsJoinTitle")}),(0,ee.Y)("div",{className:"ListItem narrow",children:(0,ee.Y)(en.A,{checked:P,onCheck:V,label:R("ChannelSettingsJoinToSend")})}),P&&(0,ee.Y)("div",{className:"ListItem narrow",children:(0,ee.Y)(en.A,{checked:T,onCheck:_,label:R("ChannelSettingsJoinRequest")})}),(0,ee.Y)("p",{className:"section-info section-info_push",children:R(P?"ChannelSettingsJoinRequestInfo":"ChannelSettingsJoinToSendInfo")})]})]})})}))),dg="Group title can't be empty",hg=["sendMessages","embedLinks","sendPolls","changeInfo","inviteUsers","pinMessages","manageTopics","sendPhotos","sendVideos","sendRoundvideos","sendVoices","sendAudios","sendDocs"],mg=hg.length+1,ug=(0,ve.sg)((e=>e()),500,!1),pg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t),{management:n,limitReachedModal:o}=(0,c.nTw)(e),{progress:a}=n,r=Boolean(s?.linkedChatId),d=(0,l.yn)(i),{invites:h}=n.byChatId[t]||{},m=!r&&((0,l.ub)(i,"changeInfo")||i.isCreator);return{chat:i,chatFullInfo:s,progress:a,isBasicGroup:d,hasLinkedChannel:r,canChangeInfo:i.isCreator||(0,l.ub)(i,"changeInfo"),canBanUsers:i.isCreator||(0,l.ub)(i,"banUsers"),canInvite:i.isCreator||(0,l.ub)(i,"inviteUsers"),exportedInvites:h,isChannelsPremiumLimitReached:"channels"===o?.limit,availableReactions:e.reactions.availableReactions,canEditForum:m}}),((e,{chatId:t})=>Boolean((0,c.hds)(e,t))))((({chatId:e,chat:t,chatFullInfo:i,progress:a,isBasicGroup:r,hasLinkedChannel:d,canChangeInfo:h,canBanUsers:m,canInvite:u,canEditForum:p,isActive:v,exportedInvites:g,isChannelsPremiumLimitReached:A,availableReactions:b,onScreenSelect:f,onClose:C})=>{const{togglePreHistoryHidden:S,updateChat:y,deleteChat:k,leaveChannel:w,deleteChannel:N,closeManagement:I,openChat:P,loadExportedChatInvites:F,loadChatJoinRequests:T,toggleForum:B}=(0,n.ko)(),[R,L,x]=(0,Y.A)(),E=t.title,V=i?.about||"",[_,O]=(0,s.J0)(!1),[K,J]=(0,s.J0)(E),[G,z]=(0,s.J0)(V),[H,$]=(0,s.J0)(),[W,Z]=(0,s.J0)(),[X,te]=(0,s.J0)(t.isForum),ie=(0,l.cP)(t),se=(0,j.A)(ie,!1,U.qZ.BlobUrl),ne=(0,s.Kr)((()=>(0,l.gA)(t)),[t]),oe=(0,M.A)(),ae=(0,s.li)();(0,fe.A)({isActive:v,onBack:C}),(0,s.vJ)((()=>{u&&(F({chatId:e}),F({chatId:e,isRevoked:!0}),T({chatId:e}))}),[e,u]),(0,s.vJ)((()=>{te(Boolean(t.isForum))}),[t.isForum]),(0,s.vJ)((()=>{a===o.TD.Complete&&(O(!1),Z(void 0))}),[a]);const re=(0,D.A)((()=>{f(o.je.ChatPrivacyType)})),le=(0,D.A)((()=>{f(o.je.Discussion)})),ce=(0,D.A)((()=>{f(o.je.Reactions)})),de=(0,D.A)((()=>{f(o.je.GroupPermissions)})),he=(0,D.A)((()=>{f(o.je.ChatAdministrators)})),me=(0,D.A)((()=>{f(o.je.Invites)})),ue=(0,D.A)((()=>{f(o.je.JoinRequests)})),pe=(0,D.A)((e=>{$(e),O(!0)})),ve=(0,D.A)((e=>{J(e.target.value),O(!0)})),ge=(0,D.A)((e=>{z(e.target.value),O(!0)})),Ae=(0,D.A)((()=>{const t=K.trim(),i=G.trim();t.length?y({chatId:e,title:t,about:i,photo:H}):Z(dg)})),be=(0,D.A)((()=>{f(o.je.GroupMembers)})),Ce=(0,D.A)((()=>{if(!i)return;const{isPreHistoryHidden:e}=i;S({chatId:t.id,isEnabled:!e})})),Se=(0,D.A)((()=>{te((t=>{const i=!t;return ug((()=>{B({chatId:e,isEnabled:i})})),i}))}));(0,s.vJ)((()=>{if(!A)return;const e=ae.current?.querySelector("input");e.checked=!i?.isPreHistoryHidden}),[A,i?.isPreHistoryHidden]);const ye=(0,s.Kr)((()=>{if(!i?.enabledReactions)return oe("ReactionsOff");if("all"===i.enabledReactions.type)return oe("ReactionsAll");const e=i.enabledReactions.allowed.length,t=b?.filter((e=>!e.isInactive)).length||0;return t?`${e} / ${t}`:e.toString()}),[b,i?.enabledReactions,oe]),ke=(0,s.Kr)((()=>{if(!t.defaultBannedRights)return 0;let e=hg.filter((e=>!("manageTopics"===e&&!X||t.defaultBannedRights[e]))).length;const{sendStickers:i,sendGifs:s}=t.defaultBannedRights;return i||s||(e+=1),e}),[t.defaultBannedRights,X]),we=(0,s.Kr)((()=>Object.keys(i?.adminMembersById||{}).length),[i?.adminMembersById]),Ne=(0,D.A)((()=>{r?k({chatId:t.id}):t.isCreator?N({chatId:t.id}):w({chatId:t.id}),x(),I(),P({id:void 0})}));if((0,c._ls)((0,n.mS)(),e)||t.isForbidden)return;const Ie=a===o.TD.InProgress;return(0,ee.FD)("div",{className:"Management",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(ah.A,{isForForum:X,currentAvatarBlobUrl:se,onChange:pe,disabled:!h}),(0,ee.FD)("div",{className:"settings-edit",children:[(0,ee.Y)(Q.A,{id:"group-title",label:oe("GroupName"),onChange:ve,value:K,error:W===dg?W:void 0,disabled:!h}),(0,ee.Y)(Il.A,{id:"group-about",label:oe("DescriptionPlaceholder"),maxLength:255,maxLengthIndicator:(255-G.length).toString(),onChange:ge,value:G,disabled:!h,noReplaceNewlines:!0})]}),t.isCreator&&(0,ee.FD)(li.A,{icon:"lock",multiline:!0,onClick:re,children:[(0,ee.Y)("span",{className:"title",children:oe("GroupType")}),(0,ee.Y)("span",{className:"subtitle",children:oe(ne?"TypePublic":"TypePrivate")})]}),d&&(0,ee.FD)(li.A,{icon:"message",multiline:!0,onClick:le,children:[(0,ee.Y)("span",{className:"title",children:oe("LinkedChannel")}),(0,ee.Y)("span",{className:"subtitle",children:oe("DiscussionUnlink")})]}),(0,ee.FD)(li.A,{icon:"permissions",multiline:!0,onClick:de,disabled:!m,children:[(0,ee.Y)("span",{className:"title",children:oe("ChannelPermissions")}),(0,ee.FD)("span",{className:"subtitle",dir:"auto",children:[ke,"/",mg-(X?0:1)]})]}),(0,ee.FD)(li.A,{icon:"heart-outline",multiline:!0,onClick:ce,disabled:!h,children:[(0,ee.Y)("span",{className:"title",children:oe("Reactions")}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:ye})]}),(0,ee.FD)(li.A,{icon:"admin",multiline:!0,onClick:he,children:[(0,ee.Y)("span",{className:"title",children:oe("ChannelAdministrators")}),(0,ee.Y)("span",{className:"subtitle",children:(0,He.Sm)(we)})]}),u&&(0,ee.FD)(li.A,{icon:"link",onClick:me,multiline:!0,disabled:!g,children:[(0,ee.Y)("span",{className:"title",children:oe("GroupInfo.InviteLinks")}),(0,ee.Y)("span",{className:"subtitle",children:g?(0,He.Sm)(g.length):oe("Loading")})]}),Boolean(t.joinRequests?.length)&&(0,ee.FD)(li.A,{icon:"add-user-filled",onClick:ue,multiline:!0,children:[(0,ee.Y)("span",{className:"title",children:oe("MemberRequests")}),(0,ee.Y)("span",{className:"subtitle",children:(0,He.Sm)(t.joinRequests.length)})]}),p&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)(li.A,{icon:"forums",ripple:!0,onClick:Se,children:[(0,ee.Y)("span",{children:oe("ChannelTopics")}),(0,ee.Y)(Ai.A,{id:"group-notifications",label:oe("ChannelTopics"),checked:X,inactive:!0})]}),(0,ee.Y)("div",{className:"section-info section-info_push",children:oe("ForumToggleDescription")})]})]}),(0,ee.FD)("div",{className:"section",children:[(0,ee.FD)(li.A,{icon:"group",multiline:!0,onClick:be,children:[(0,ee.Y)("span",{className:"title",children:oe("GroupMembers")}),(0,ee.Y)("span",{className:"subtitle",children:(0,He.Sm)(t.membersCount??0)})]}),!ne&&!d&&Boolean(i)&&(0,ee.Y)("div",{className:"ListItem narrow",ref:ae,children:(0,ee.Y)(en.A,{checked:!i.isPreHistoryHidden,label:oe("ChatHistory"),onChange:Ce,subLabel:i.isPreHistoryHidden?oe("ChatHistoryHiddenInfo2"):oe("ChatHistoryVisibleInfo"),disabled:!m})})]}),(0,ee.Y)("div",{className:"section",children:(0,ee.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:L,children:oe("DeleteMega")})})]}),(0,ee.Y)(ki.A,{isShown:_,onClick:Ae,disabled:Ie,ariaLabel:oe("Save"),children:Ie?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),(0,ee.Y)(pi.A,{isOpen:R,onClose:x,textParts:(0,Ft.A)(r||!t.isCreator?oe("AreYouSureDeleteAndExit"):oe("AreYouSureDeleteThisChatWithGroup",t.title),["br","simple_markdown"]),confirmLabel:r||!t.isCreator?oe("DeleteMega"):oe("DeleteGroupForAll"),confirmHandler:Ne,confirmIsDestructive:!0})]})}))),vg=(0,s.ph)((0,n.EK)(((e,{chatId:t,isPromotedByCurrentUser:i})=>{const s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t),{byId:o}=e.users,{currentUserId:a}=e,r=(0,l.WX)(s),d=!(s.isCreator||i);return{chat:s,usersById:o,currentUserId:a,isChannel:r,isForum:s.isForum,isFormFullyDisabled:d,defaultRights:s.adminRights,hasFullInfo:Boolean(n),adminMembersById:n?.adminMembersById}}),((e,{chatId:t})=>Boolean((0,c.hds)(e,t))))((({isActive:e,isNewAdmin:t,selectedUserId:i,defaultRights:a,chat:r,usersById:c,currentUserId:d,adminMembersById:h,hasFullInfo:m,isChannel:u,isForum:p,isFormFullyDisabled:v,onClose:g,onScreenSelect:A})=>{const{updateChatAdmin:b}=(0,n.ko)(),[f,C]=(0,s.J0)({}),[S,y]=(0,s.J0)(Boolean(t)),[k,w]=(0,s.J0)(!1),[N,I,P]=(0,Y.A)(),[F,D]=(0,s.J0)(""),T=(0,M.A)();(0,fe.A)({isActive:e,onBack:g});const B=(0,s.Kr)((()=>{const e=i?h?.[i]:void 0;if(!t||!e&&i){if(t){const e=(0,n.mS)().users.byId[i];return e?{userId:e.id,adminRights:a,customTitle:T("ChannelAdmin"),isOwner:!1,promotedByUserId:void 0}:void 0}return e}}),[h,a,t,T,i]);(0,s.vJ)((()=>{m&&i&&!B&&A(o.je.ChatAdministrators)}),[r,m,A,B,i]),(0,s.vJ)((()=>{C(B?.adminRights||{}),D((B?.customTitle||"").substr(0,16)),y(Boolean(t)),w(!1)}),[a,t,B]);const R=(0,s.hb)((e=>{const{name:t}=e.target;C((e=>{return{...e,[t]:(i=e[t],!i||void 0)};var i})),y(!0)}),[]),L=(0,s.hb)((()=>{i&&(w(!0),b({chatId:r.id,userId:i,adminRights:f,customTitle:F}))}),[i,b,r.id,f,F]),x=(0,s.hb)((()=>{i&&(b({chatId:r.id,userId:i,adminRights:{}}),P())}),[r.id,P,i,b]),E=(0,s.hb)((e=>!((0,l.yn)(r)||!v&&r.adminRights&&(r.isCreator||r.adminRights[e]))),[r,v]),V=(0,s.Kr)((()=>{if(t||!B)return;if(B.isOwner)return T("ChannelCreator");const e=B.promotedByUserId?c[B.promotedByUserId]:void 0;return e?T("EditAdminPromotedBy",(0,l.Yg)(e)):T("ChannelAdmin")}),[t,B,c,T]),_=(0,s.hb)((e=>{const{value:t}=e.target;D(t),y(!0)}),[]);if(B)return(0,ee.FD)("div",{className:"Management",children:[(0,ee.Y)("div",{className:"panel-content custom-scroll",children:(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(li.A,{inactive:!0,className:"chat-item-clickable",children:(0,ee.Y)(ys.A,{userId:B.userId,status:V,forceShowSelf:!0})}),(0,ee.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:T("EditAdminWhatCanDo")}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"changeInfo",checked:Boolean(f.changeInfo),label:T(u?"EditAdminChangeChannelInfo":"EditAdminChangeGroupInfo"),blocking:!0,disabled:E("changeInfo"),onChange:R})}),u&&(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"postMessages",checked:Boolean(f.postMessages),label:T("EditAdminPostMessages"),blocking:!0,disabled:E("postMessages"),onChange:R})}),u&&(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"editMessages",checked:Boolean(f.editMessages),label:T("EditAdminEditMessages"),blocking:!0,disabled:E("editMessages"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"deleteMessages",checked:Boolean(f.deleteMessages),label:T(u?"EditAdminDeleteMessages":"EditAdminGroupDeleteMessages"),blocking:!0,disabled:E("deleteMessages"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"postStories",checked:Boolean(f.postStories),label:T("EditAdminPostStories"),blocking:!0,disabled:E("postStories"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"editStories",checked:Boolean(f.editStories),label:T("EditAdminEditStories"),blocking:!0,disabled:E("editStories"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"deleteStories",checked:Boolean(f.deleteStories),label:T("EditAdminDeleteStories"),blocking:!0,disabled:E("deleteStories"),onChange:R})}),!u&&(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"banUsers",checked:Boolean(f.banUsers),label:T("EditAdminBanUsers"),blocking:!0,disabled:E("banUsers"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"inviteUsers",checked:Boolean(f.inviteUsers),label:T("EditAdminAddUsers"),blocking:!0,disabled:E("inviteUsers"),onChange:R})}),!u&&(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"pinMessages",checked:Boolean(f.pinMessages),label:T("EditAdminPinMessages"),blocking:!0,disabled:E("pinMessages"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"addAdmins",checked:Boolean(f.addAdmins),label:T("EditAdminAddAdmins"),blocking:!0,disabled:E("addAdmins"),onChange:R})}),(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"manageCall",checked:Boolean(f.manageCall),label:T("StartVoipChatPermission"),blocking:!0,disabled:E("manageCall"),onChange:R})}),p&&(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"manageTopics",checked:Boolean(f.manageTopics),label:T("ManageTopicsPermission"),blocking:!0,disabled:E("manageTopics"),onChange:R})}),!u&&(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:"anonymous",checked:Boolean(f.anonymous),label:T("EditAdminSendAnonymously"),blocking:!0,disabled:E("anonymous"),onChange:R})}),v&&(0,ee.Y)("p",{className:"section-info mb-4",dir:"auto",children:T("Channel.EditAdmin.CannotEdit")}),!u&&(0,ee.Y)(Q.A,{id:"admin-title",label:T("EditAdminRank"),onChange:_,value:F,disabled:v,maxLength:16}),d!==i&&!v&&!t&&(0,ee.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:I,children:T("EditAdminRemoveAdmin")})]})}),(0,ee.Y)(ki.A,{isShown:S,onClick:L,ariaLabel:T("Save"),disabled:k,children:k?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),!t&&(0,ee.Y)(pi.A,{isOpen:N,onClose:P,text:"Are you sure you want to dismiss this admin?",confirmLabel:T("Channel.Admin.Dismiss"),confirmHandler:x,confirmIsDestructive:!0})]})})));var gg=i(23459),Ag=i(285);const bg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{statusesById:s}=e.users,{members:n,adminMembersById:o,areParticipantsHidden:a}=(0,c.AWZ)(e,t)||{},r=i&&(0,l.WX)(i),{userIds:d}=e.contactList||{},h=e.appConfig?.hiddenMembersMinCount,m=i&&(i.isCreator||(0,l.ub)(i,"banUsers")),u=m&&!(0,l.yn)(i)&&void 0!==i.membersCount&&void 0!==h&&i.membersCount>=h,p=i&&((0,l.ub)(i,"inviteUsers")||!r&&!(0,l.Sq)(i,"inviteUsers")||i.isCreator),{query:v,fetchingStatus:g,globalUserIds:A,localUserIds:b}=(0,c.nTw)(e).userSearch;return{areParticipantsHidden:Boolean(i&&a),members:n,canAddMembers:p,adminMembersById:o,userStatusesById:s,isChannel:r,localContactIds:d,searchQuery:v,isSearching:g,globalUserIds:A,localUserIds:b,canDeleteMembers:m,currentUserId:e.currentUserId,canHideParticipants:u}}))((({chatId:e,noAdmins:t,members:i,canAddMembers:a,adminMembersById:r,userStatusesById:c,isChannel:d,isActive:h,globalUserIds:m,localContactIds:u,localUserIds:p,isSearching:v,searchQuery:g,currentUserId:A,canDeleteMembers:b,areParticipantsHidden:f,canHideParticipants:C,onClose:S,onScreenSelect:y,onChatMemberSelect:k})=>{const{openChat:w,setUserSearchQuery:N,closeManagement:I,toggleParticipantsHidden:P,setNewChatMembersDialogState:Y,toggleManagement:F}=(0,n.ko)(),T=(0,M.A)(),B=(0,s.li)(),R=(0,s.li)(),[L,x]=(0,s.J0)(),E=(0,s.Kr)((()=>t&&r?Object.keys(r):[]),[r,t]),V=(0,s.Kr)((()=>{const e=(0,n.mS)().users.byId;if(!i||!e)return[];const s=(0,l.UB)(i.map((({userId:e})=>e)),e,c);return t?s.filter((e=>!E.includes(e))):s}),[i,c,t,E]);(0,gg.A)(V);const _=(0,s.Kr)((()=>{const e=(0,n.mS)().users.byId,i=Boolean(g),s=i?u?(0,Yt.PU)({ids:u,query:g,type:"user"}):[]:V;return(0,Fs.A)((0,bi.Am)([...s,...i&&p||[],...i&&m||[]]).filter((i=>{const s=e[i];return!s||(d||s.canBeInvitedToGroup||!(0,l.tv)(s))&&(!t||!E.includes(i))})),!0)}),[V,u,g,p,m,d,t,E]),[U,O]=(0,Ms.A)(void 0,_,Boolean(g)),K=(0,D.A)((e=>{t?(k(e,!0),y(o.je.ChatNewAdminRights)):(I(),w({id:e}))})),J=(0,D.A)((e=>{N({query:e.target.value})})),G=(0,Bs.A)(R,h,(e=>{U&&U.length>0&&K(U[-1===e?0:e])}),".ListItem-button",!0),j=(0,D.A)((()=>{x(void 0)})),z=(0,D.A)((()=>{P({chatId:e,isEnabled:!f})})),H=(0,D.A)((()=>{F(),Y({newChatMembersProgress:o.D7.InProgress})}));return(0,fe.A)({isActive:h,onBack:S}),(0,ee.FD)("div",{className:"Management",children:[t&&(0,ee.Y)("div",{className:"Management__filter",dir:T.isRtl?"rtl":void 0,children:(0,ee.Y)(Q.A,{ref:B,value:g,onChange:J,placeholder:T("Search")})}),(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[C&&!d&&(0,ee.FD)("div",{className:"section",children:[(0,ee.FD)(li.A,{icon:"group",ripple:!0,onClick:z,children:[(0,ee.Y)("span",{children:T("ChannelHideMembers")}),(0,ee.Y)(Ai.A,{label:T("ChannelHideMembers"),checked:f})]}),(0,ee.Y)("p",{className:"section-info",children:T(f?"GroupMembers.MembersHiddenOn":"GroupMembers.MembersHiddenOff")})]}),(0,ee.Y)("div",{className:"section",children:U?.length?(0,ee.Y)(bs.A,{className:"picker-list custom-scroll",items:_,onLoadMore:O,noScrollRestore:Boolean(g),ref:R,onKeyDown:G,children:U.map((e=>{return(0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item",onClick:()=>K(e),contextActions:(t=e,t!==A&&b?[{title:T("lng_context_remove_from_group"),icon:"stop",handler:()=>{x(t)}}]:void 0),withPortalForMenu:!0,children:(0,ee.Y)(ys.A,{userId:e,forceShowSelf:!0,withStory:!0})},e);var t}))}):v||!U||U.length?(0,ee.Y)(Rs.A,{}):(0,ee.Y)(bc.A,{teactOrderKey:0,text:d?"No subscribers found":"No members found"},"nothing-found")})]}),a&&(0,ee.Y)(ki.A,{isShown:!0,onClick:H,ariaLabel:T("lng_channel_add_users"),children:(0,ee.Y)(q.A,{name:"add-user-filled"})}),b&&(0,ee.Y)(Ag.A,{isOpen:Boolean(L),userId:L,onClose:j})]})}))),fg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),s=(0,c.AWZ)(e,t),{progress:n}=(0,c.nTw)(e).management,o=i?.paidMessagesStars,r=e.appConfig?.starsPaidMessageCommissionPermille;return{chat:i,progress:n,currentUserId:e.currentUserId,removedUsersCount:s?.kickedMembers?.length||0,members:s?.members,arePaidMessagesAvailable:Boolean(s?.arePaidMessagesAvailable&&r),canChargeForMessages:Boolean(o&&r),groupPeersPaidStars:o||a.wZe}}))((({onScreenSelect:e,onChatMemberSelect:t,chat:i,progress:a,currentUserId:r,removedUsersCount:l,members:c,onClose:d,isActive:h,arePaidMessagesAvailable:m,canChargeForMessages:u,groupPeersPaidStars:p})=>{const{updateChatDefaultBannedRights:v,updatePaidMessagesPrice:g}=(0,n.ko)(),{permissions:A,havePermissionChanged:b,isLoading:f,handlePermissionChange:C,setIsLoading:S}=Kl(i?.defaultBannedRights),y=(0,M.A)(),k=(0,Vi.A)();(0,fe.A)({isActive:h,onBack:d});const w=(0,s.hb)((()=>{e(o.je.GroupRemovedUsers)}),[e]),N=(0,s.hb)((()=>{e(o.je.GroupUserPermissionsCreate)}),[e]),I=(0,s.hb)((i=>{t(i.userId,i.promotedByUserId===r),e(o.je.GroupUserPermissions)}),[r,t,e]),[P,F]=(0,s.J0)(!1),[T,B,R]=(0,Y.A)(),[L,x]=(0,s.J0)(u),[E,V]=(0,s.J0)(p);(0,s.vJ)((()=>{a===o.TD.Complete&&R()}),[a]);const _=(0,D.A)((()=>{i&&(S(!0),v({chatId:i.id,bannedRights:A}))})),U=(0,D.A)((()=>{i&&g({chatId:i?.id,paidMessagesStars:L?E:0})})),O=(0,D.A)((()=>{T&&U(),b&&_()})),K=(0,s.Kr)((()=>c?c.filter((({bannedRights:e})=>Boolean(e))):[]),[c]),J=(0,s.hb)((e=>{const{bannedRights:t}=e;if(!t||!i)return;const{defaultBannedRights:s}=i;return Object.keys(t).reduce(((e,i)=>{const n=i;if(!t[n]||s?.[n]||"sendInline"===n||"viewMessages"===n||"sendGames"===n)return e;const o=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";case"manageTopics":return"GroupPermission.NoManageTopics";case"sendPlain":return"UserRestrictionsNoSendText";case"sendDocs":return"UserRestrictionsNoSendDocs";case"sendRoundvideos":return"UserRestrictionsNoSendRound";case"sendVoices":return"UserRestrictionsNoSendVoice";case"sendAudios":return"UserRestrictionsNoSendMusic";case"sendVideos":return"UserRestrictionsNoSendVideos";case"sendPhotos":return"UserRestrictionsNoSendPhotos";default:return}}(n);if(!o)return e;const a=y(o);return`${e}${e.length?`, ${a}`:a}`}),"")}),[i,y]),G=(0,D.A)((()=>{x(!L),B()})),j=(0,D.A)((e=>{V(e),B()})),z=T||b,H=a===o.TD.InProgress||f;return(0,ee.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 432px;--before-shift-height: 96px;",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.FD)("div",{className:"section without-bottom-shadow",children:[(0,ee.Y)("h3",{className:"section-heading",dir:"auto",children:k("ChannelPermissionsHeader")}),(0,ee.Y)(Gl,{chatId:i?.id,isMediaDropdownOpen:P,setIsMediaDropdownOpen:F,handlePermissionChange:C,permissions:A,dropdownClassName:"DropdownListTrap",className:(0,me.A)("DropdownList",P&&"DropdownList--open"),shiftedClassName:(0,me.A)("part",P&&"shifted")})]}),m&&(0,ee.FD)("div",{className:(0,me.A)("section",P&&"shifted"),children:[(0,ee.FD)(li.A,{onClick:G,children:[(0,ee.Y)("span",{children:k("GroupMessagesChargePrice")}),(0,ee.Y)(Ai.A,{id:"charge_for_messages",label:k("GroupMessagesChargePrice"),checked:L})]}),(0,ee.Y)("p",{className:"settings-item-description-larger",dir:k.isRtl?"rtl":void 0,children:k("RightsChargeStarsAbout")})]}),L&&(0,ee.Y)("div",{className:(0,me.A)("section",P&&"shifted"),children:(0,ee.Y)(Bd,{canChangeChargeForMessages:!0,isGroupChat:!0,chargeForMessages:E,onChange:j})}),(0,ee.Y)("div",{className:(0,me.A)("section",P&&"shifted"),children:(0,ee.FD)(li.A,{icon:"delete-user",multiline:!0,narrow:!0,onClick:w,children:[(0,ee.Y)("span",{className:"title",children:k("ChannelBlockedUsers")}),(0,ee.Y)("span",{className:"subtitle",children:l})]})}),(0,ee.FD)("div",{className:(0,me.A)("section",P&&"shifted"),children:[(0,ee.Y)("h3",{className:"section-heading",dir:"auto",children:k("PrivacyExceptions")}),(0,ee.Y)(li.A,{icon:"add-user",onClick:N,children:k("ChannelAddException")}),K.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable exceptions-member",onClick:()=>I(e),children:(0,ee.Y)(ys.A,{userId:e.userId,status:J(e),forceShowSelf:!0})},e.userId)))]})]}),(0,ee.Y)(ki.A,{isShown:z,onClick:O,ariaLabel:k("Save"),disabled:H,children:H?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})}))),Cg=(0,s.ph)((0,n.EK)(((e,{chatId:t,isPromotedByCurrentUser:i})=>{const s=(0,c.hds)(e,t),n=(0,c.AWZ)(e,t);return{chat:s,isFormFullyDisabled:!(s.isCreator||i),hasFullInfo:Boolean(n),members:n?.members}}),((e,{chatId:t})=>Boolean((0,c.hds)(e,t))))((({chat:e,selectedChatMemberId:t,hasFullInfo:i,members:a,onScreenSelect:r,isFormFullyDisabled:l,onClose:c,isActive:d})=>{const{updateChatMemberBannedRights:h}=(0,n.ko)(),m=(0,s.Kr)((()=>{if(a)return a.find((({userId:e})=>e===t))}),[a,t]),{permissions:u,havePermissionChanged:p,isLoading:v,handlePermissionChange:g,setIsLoading:A}=Kl(m?.bannedRights||e?.defaultBannedRights),[b,f,C]=(0,Y.A)(),S=(0,Vi.A)(),y=(0,M.A)();(0,fe.A)({isActive:d,onBack:c}),(0,s.vJ)((()=>{i&&t&&!m&&r(o.je.GroupPermissions)}),[e,i,r,m,t]);const k=(0,s.hb)((()=>{e&&t&&(A(!0),h({chatId:e.id,userId:t,bannedRights:u}))}),[e,t,A,h,u]),w=(0,s.hb)((()=>{e&&t&&h({chatId:e.id,userId:t,bannedRights:{viewMessages:!0}})}),[e,t,h]),N=(0,s.hb)((t=>!!l||!(!e||!e.defaultBannedRights)&&e.defaultBannedRights[t]),[e,l]),[I,P]=(0,s.J0)(!1);if(m)return(0,ee.FD)("div",{className:"Management with-shifted-dropdown",style:"--shift-height: 431px;--before-shift-height: 192px;",children:[(0,ee.FD)("div",{className:"custom-scroll",children:[(0,ee.FD)("div",{className:"section without-bottom-shadow",children:[(0,ee.Y)(li.A,{inactive:!0,className:"chat-item-clickable",children:(0,ee.Y)(ys.A,{userId:m.userId,forceShowSelf:!0})}),(0,ee.Y)("h3",{className:"section-heading mt-4",dir:"auto",children:y("UserRestrictionsCanDo")}),(0,ee.Y)(Gl,{chatId:e?.id,isMediaDropdownOpen:I,setIsMediaDropdownOpen:P,handlePermissionChange:g,permissions:u,className:(0,me.A)("DropdownList",I&&"DropdownList--open"),dropdownClassName:"DropdownListTrap",shiftedClassName:(0,me.A)("part",I&&"shifted"),getControlIsDisabled:N})]}),!l&&(0,ee.Y)("div",{className:(0,me.A)("section",I&&"shifted"),children:(0,ee.Y)(li.A,{icon:"delete-user",ripple:!0,destructive:!0,onClick:f,children:y("UserRestrictionsBlock")})})]}),(0,ee.Y)(ki.A,{isShown:p,onClick:k,ariaLabel:y("Save"),disabled:v,children:v?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),(0,ee.Y)(pi.A,{isOpen:b,onClose:C,text:S("GroupManagementBanUserConfirm"),confirmLabel:"Remove",confirmHandler:w,confirmIsDestructive:!0})]})}))),Sg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{byId:s,statusesById:n}=e.users,o=(0,c.AWZ)(e,t)?.members;return{members:o,usersById:s,userStatusesById:n,isChannel:i&&(0,l.WX)(i)}}))((({usersById:e,userStatusesById:t,members:i,isChannel:n,onScreenSelect:a,onChatMemberSelect:r,onClose:c,isActive:d})=>{(0,fe.A)({isActive:d,onBack:c});const h=(0,s.Kr)((()=>{if(i&&e)return(0,l.UB)(i.filter((e=>!e.isOwner)).map((({userId:e})=>e)),e,t)}),[i,e,t]),m=(0,s.hb)((e=>{r(e),a(o.je.GroupUserPermissions)}),[r,a]);return(0,ee.Y)("div",{className:"Management",children:(0,ee.Y)("div",{className:"custom-scroll",children:(0,ee.Y)("div",{className:"section",teactFastList:!0,children:h?h.map(((e,t)=>(0,ee.Y)(li.A,{teactOrderKey:t,className:"chat-item-clickable scroll-item",onClick:()=>m(e),children:(0,ee.Y)(ys.A,{userId:e,forceShowSelf:!0})},e))):(0,ee.Y)(bc.A,{teactOrderKey:0,text:n?"No subscribers found":"No members found"},"nothing-found")})})})}))),yg=[1,10,100],kg={hour:36e5,day:864e5,week:6048e5},wg=kg.hour,Ng=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{editingInvite:i}=(0,c.nTw)(e).management.byChatId[t]||{};return{editingInvite:i}}))((({chatId:e,editingInvite:t,isActive:i,onClose:a,onScreenSelect:r})=>{const{editExportedChatInvite:l,exportChatInvite:c}=(0,n.ko)(),d=(0,M.A)(),[h,m,u]=(0,Y.A)(),[p,v]=(0,s.J0)(!1),[g,A]=(0,s.J0)(""),[b,f]=(0,s.J0)(Date.now()+wg),[C,S]=(0,s.J0)("unlimited"),[y,k]=(0,s.J0)(10),[w,N]=(0,s.J0)("0"),[I,P]=(0,s.J0)(!1);(0,fe.A)({isActive:i,onBack:a}),(0,G.A)((([e])=>{if(e!==t)if(t){const{title:e,usageLimit:i,expireDate:s,isRequestNeeded:n}=t;if(e&&A(e),i&&(N(yg.includes(i)?i.toString():"custom"),k(i)),s){const e=(0,ri.Fm)()+wg;S("custom"),f(1e3*Math.max(s,e))}n&&v(!0)}else A(""),S("unlimited"),N("0"),f(1e3*(0,ri.Fm)()+wg),k(10),v(!1)}),[t]);const F=(0,s.hb)((e=>{v(e.target.checked)}),[]),D=(0,s.hb)((e=>{A(e.target.value)}),[]),T=(0,s.hb)((e=>{k(Number.parseInt(e.target.value,10))}),[]),B=(0,s.hb)((e=>{f(e.getTime()),u()}),[u]),R=(0,s.hb)((()=>{P(!0);const i="custom"===w?y:Number(w);let s;switch(C){case"custom":s=(0,ri.Fm)()+(b-Date.now())/1e3;break;case"hour":case"day":case"week":s=(0,ri.Fm)()+kg[C]/1e3;break;case"unlimited":s=0;break;default:s=void 0}t?l({link:t.link,chatId:e,title:g,isRequestNeeded:p,expireDate:s,usageLimit:i}):c({chatId:e,title:g,isRequestNeeded:p,expireDate:s,usageLimit:i}),r(o.je.Invites)}),[e,b,y,l,t,c,p,C,w,g,r]);return(0,ee.FD)("div",{className:"Management ManageInvite",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.Y)("div",{className:"section",children:(0,ee.Y)(en.A,{label:d("ApproveNewMembers"),subLabel:d("ApproveNewMembersDescription"),checked:p,onChange:F})}),(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(Q.A,{className:"link-name",placeholder:d("LinkNameHint"),value:g,onChange:D}),(0,ee.Y)("p",{className:"section-help hint",children:d("LinkNameHelp")})]}),(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("div",{className:"section-heading",children:d("LimitByPeriod")}),(0,ee.Y)(X.A,{name:"expireOptions",options:[{value:"hour",label:d("Hours",1)},{value:"day",label:d("Days",1)},{value:"week",label:d("Weeks",1)},{value:"unlimited",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_expire_custom")}],onChange:S,selected:C}),"custom"===C&&(0,ee.FD)(W.A,{className:"expire-limit",isText:!0,onClick:m,children:[(0,ze.Lu)(d,b)," ",(0,ze.fU)(d,b)]}),(0,ee.Y)("p",{className:"section-help hint",children:d("TimeLimitHelp")})]}),!p&&(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("div",{className:"section-heading",children:d("LimitNumberOfUses")}),(0,ee.Y)(X.A,{name:"usageOptions",options:[...yg.map((e=>({value:e.toString(),label:e}))),{value:"0",label:d("NoLimit")},{value:"custom",label:d("lng_group_invite_usage_custom")}],onChange:N,selected:w}),"custom"===w&&(0,ee.Y)("input",{className:"form-control usage-limit",type:"number",min:"1",max:"99999",value:y,onChange:T}),(0,ee.Y)("p",{className:"section-help hint",children:d("UsesLimitHelp")})]}),(0,ee.Y)(ki.A,{isShown:!0,onClick:R,disabled:I,ariaLabel:d(t?"SaveLink":"CreateLink"),children:(0,ee.Y)(q.A,{name:"check"})})]}),(0,ee.Y)(ln,{isOpen:h,isFutureMode:!0,withTimePicker:!0,onClose:u,onSubmit:B,selectedAt:b,submitButtonLabel:d("Save")})]})}))),Ig=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{inviteInfo:i}=(0,c.nTw)(e).management.byChatId[t]||{},{invite:s,importers:n,requesters:o}=i||{},a=(0,c.hds)(e,t);return{invite:s,importers:n,requesters:o,isChannel:a&&(0,l.WX)(a)}}))((({chatId:e,invite:t,importers:i,requesters:o,isChannel:a,isActive:r,onClose:l})=>{const{loadChatInviteImporters:c,loadChatInviteRequesters:d,openChat:h}=(0,n.ko)(),m=(0,M.A)(),{usage:u=0,usageLimit:p,link:v,adminId:g}=t||{},A=t?.expireDate&&1e3*(t.expireDate-(0,ri.Fm)())+Date.now(),b=(t?.expireDate||0)-(0,ri.Fm)()<0;return(0,s.vJ)((()=>{v&&(c({chatId:e,link:v}),d({chatId:e,link:v}))}),[e,v,c,d]),(0,fe.A)({isActive:r,onBack:l}),(0,ee.Y)("div",{className:"Management ManageInviteInfo",children:(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[!t&&(0,ee.Y)("p",{className:"section-help",children:m("Loading")}),t&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(zr.A,{title:t.title,link:t.link,className:"invite-link"}),Boolean(A)&&(0,ee.Y)("p",{className:"section-help",children:b?m("ExpiredLink"):m("LinkExpiresIn",`${(0,ze.Lu)(m,A)} ${(0,ze.fU)(m,A)}`)})]}),g&&(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("p",{className:"section-heading",children:m("LinkCreatedeBy")}),(0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:g}),children:(0,ee.Y)(ys.A,{userId:g,status:(0,ze.fS)(m,1e3*t.date,!0),forceShowSelf:!0})})]}),(()=>{if(i?.length||!o?.length)return i?(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("p",{className:"section-heading",children:i.length?m("PeopleJoined",u):m("NoOneJoined")}),(0,ee.FD)("p",{className:"section-help",children:[!i.length&&(p?m("PeopleCanJoinViaLinkCount",p-u):m("NoOneJoinedYet")),i.map((e=>{const t=(0,ze.fS)(m,1e3*e.date,!0),i=e.isFromChatList?`${t}${m("JoinedViaFolder")}`:t;return(0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,ee.Y)(ys.A,{userId:e.userId,status:i,forceShowSelf:!0})})}))]})]}):(0,ee.Y)(xe.A,{})})(),(()=>{if(!t?.isRevoked){if(!o&&i)return(0,ee.Y)(xe.A,{});if(o?.length)return(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("p",{className:"section-heading",children:m(a?"SubscribeRequests":"MemberRequests")}),(0,ee.Y)("p",{className:"section-help",children:o.map((e=>(0,ee.Y)(li.A,{className:"chat-item-clickable scroll-item small-icon",onClick:()=>h({id:e.userId}),children:(0,ee.Y)(ys.A,{userId:e.userId,status:(0,ze.fS)(m,1e3*e.date,!0),forceShowSelf:!0})})))})]})}})()]})]})})}))),Pg="•";function Yg(e,t){const{isPermanent:i,usage:s=0,date:n}=e,{isPermanent:o,usage:a=0,date:r}=t;return i||o?Number(i)-Number(o):s||a?a-s:r-n}const Fg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{invites:i,revokedInvites:s}=(0,c.nTw)(e).management.byChatId[t]||{},n=(0,c.hds)(e,t);return{exportedInvites:i,revokedExportedInvites:s,chat:n,isChannel:n&&(0,l.WX)(n)}}))((({chatId:e,chat:t,exportedInvites:i,revokedExportedInvites:r,isActive:c,isChannel:d,onClose:h,onScreenSelect:m})=>{const{setEditingExportedInvite:u,showNotification:p,editExportedChatInvite:v,deleteExportedChatInvite:g,deleteRevokedExportedChatInvites:A,setOpenedInviteInfo:b}=(0,n.ko)(),f=(0,Vi.A)(),C=(0,M.A)(),[S,y,k]=(0,Y.A)(),[w,N,I]=(0,Y.A)(),[P,D]=(0,s.J0)(),[T,B,R]=(0,Y.A)(),[L,x]=(0,s.J0)();(0,fe.A)({isActive:c,onBack:h});const E=(0,s.Kr)((()=>{if(i)return i.some((({expireDate:e})=>e&&e-(0,ri.Fm)()<ze.il/1e3))}),[i]),V=(0,F.A)();(0,gn.A)(V,E?1e3:void 0);const _=(0,s.Kr)((()=>t&&(0,l.Kl)(t)),[t]),U=i?.find((({isPermanent:e})=>e)),O=_?`${a.jsp}${_}`:U?.link,K=(0,s.Kr)((()=>{const e=t?.hasUsername?i:i?.filter((({isPermanent:e})=>!e));return e?.sort(Yg)}),[t?.hasUsername,i]),J=(0,s.hb)((t=>{const{link:i,title:s,isRequestNeeded:n,expireDate:o,usageLimit:a}=t;v({chatId:e,link:i,title:s,isRequestNeeded:n,expireDate:o,usageLimit:a,isRevoked:!0})}),[e,v]),G=(0,s.hb)((e=>{D(e),N()}),[N]),j=(0,s.hb)((()=>{P&&(J(P),D(void 0),I())}),[I,J,P]),z=(0,s.hb)((()=>{m(o.je.EditInvite)}),[m]),H=(0,s.hb)((()=>{U&&G(U)}),[G,U]),$=(0,s.hb)((()=>{A({chatId:e}),k()}),[e,k,A]),W=(0,s.hb)((t=>{b({chatId:e,invite:t}),m(o.je.InviteInfo)}),[e,m,b]),Q=(0,s.hb)((t=>{g({chatId:e,link:t.link})}),[e,g]),Z=(0,s.hb)((e=>{x(e),B()}),[B]),X=(0,s.hb)((()=>{L&&(Q(L),x(void 0),R())}),[R,Q,L]),te=(0,s.hb)((e=>{(0,cc.eM)(e),p({message:C("LinkCopied")})}),[C,p]),ie=e=>{const{usage:t=0,usageLimit:i,expireDate:s,isPermanent:n,requested:o,isRevoked:a}=e;let r="";if(r=!a&&i&&t<i?C("CanJoin",i-t):t?C("PeopleJoined",t):C("NoOneJoined"),a)return r+=` ${Pg} ${C("Revoked")}`,r;if(o&&(r+=` ${Pg} ${C("JoinRequests",o)}`),void 0!==i&&t===i)r+=` ${Pg} ${C("LinkLimitReached")}`;else if(s){const e=s-(0,ri.Fm)();r+=` ${Pg} `,r+=e>0?C("InviteLink.ExpiresIn",(0,ze.zt)(f,e)):C("InviteLink.Expired")}else n&&(r+=` ${Pg} ${C("Permanent")}`);return r},se=e=>{const{usage:t=0,usageLimit:i,isRevoked:s,expireDate:n}=e;return s?"link-status-icon-gray":i&&t<i?"link-status-icon-green":n&&1e3*(n-(0,ri.Fm)())<=0?"link-status-icon-red":"link-status-icon-blue"},ne=t=>{const i=[];return i.push({title:C("Copy"),icon:"copy",handler:()=>te(t.link)}),t.isPermanent||t.isRevoked||i.push({title:C("Edit"),icon:"edit",handler:()=>(t=>{u({chatId:e,invite:t}),m(o.je.EditInvite)})(t)}),t.isRevoked?i.push({title:C("DeleteLink"),icon:"delete",handler:()=>Z(t),destructive:!0}):i.push({title:C("RevokeButton"),icon:"delete",handler:()=>G(t),destructive:!0}),i};return(0,ee.FD)("div",{className:"Management ManageInvites",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.Invite,size:a.xMZ,className:"section-icon"}),(0,ee.Y)("p",{className:"section-help",children:C(d?"PrimaryLinkHelpChannel":"PrimaryLinkHelp")})]}),O&&(0,ee.Y)("div",{className:"section",children:(0,ee.Y)(zr.A,{className:"settings-input",link:O,withShare:!0,onRevoke:t?.usernames?void 0:H,title:C(t?.usernames?"PublicLink":"lng_create_permanent_link_title")})}),(0,ee.FD)("div",{className:"section",teactFastList:!0,children:[(0,ee.Y)(li.A,{icon:"add",withPrimaryColor:!0,className:"create-item",onClick:z,children:C("CreateNewLink")},"create"),(!K||!K.length)&&(0,ee.Y)(bc.A,{text:"No links found"},"nothing"),K?.map((e=>(0,ee.FD)(li.A,{leftElement:(0,ee.Y)(q.A,{name:"link",className:`link-status-icon ${se(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>W(e),contextActions:ne(e),children:[(0,ee.Y)("span",{className:"title invite-title",children:e.title||e.link}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:ie(e)})]},e.link))),(0,ee.Y)("p",{className:"section-help hint",children:C("ManageLinksInfoHelp")},"links-hint")]}),r&&Boolean(r.length)&&(0,ee.FD)("div",{className:"section",teactFastList:!0,children:[(0,ee.Y)("p",{className:"section-help",children:C("RevokedLinks")},"title"),(0,ee.Y)(li.A,{icon:"delete",destructive:!0,onClick:y,children:(0,ee.Y)("span",{className:"title",children:C("DeleteAllRevokedLinks")})},"delete"),r?.map((e=>(0,ee.FD)(li.A,{leftElement:(0,ee.Y)(q.A,{name:"link",className:`link-status-icon ${se(e)}`}),secondaryIcon:"more",multiline:!0,onClick:()=>W(e),contextActions:ne(e),children:[(0,ee.Y)("span",{className:"title",children:e.title||e.link}),(0,ee.Y)("span",{className:"subtitle",dir:"auto",children:ie(e)})]},e.link)))]})]}),(0,ee.Y)(pi.A,{isOpen:S,onClose:k,title:C("DeleteAllRevokedLinks"),text:C("DeleteAllRevokedLinkHelp"),confirmIsDestructive:!0,confirmLabel:C("DeleteAll"),confirmHandler:$}),(0,ee.Y)(pi.A,{isOpen:w,onClose:I,title:C("RevokeLink"),text:C("RevokeAlert"),confirmIsDestructive:!0,confirmLabel:C("RevokeButton"),confirmHandler:j}),(0,ee.Y)(pi.A,{isOpen:T,onClose:R,title:C("DeleteLink"),text:C("DeleteLinkHelp"),confirmIsDestructive:!0,confirmLabel:C("Delete"),confirmHandler:X})]})}))),Dg=(0,s.ph)((0,n.EK)(((e,{userId:t})=>({user:(0,c.mBe)(e,t)})))((({userId:e,chatId:t,about:i,date:o,isChannel:a,user:r})=>{const{openChat:c,hideChatJoinRequest:d}=(0,n.ko)(),h=(0,me.x)("JoinRequest"),m=(0,M.A)(),u=(0,l.Yg)(r),p=1e3*(o-(0,ri.Fm)())+Date.now(),v=(0,ze.cK)(new Date(p))?(0,ze.fU)(m,p):(0,ze.F5)(m,p,!0,!1,!0),g=(0,s.hb)((()=>{d({chatId:t,userId:e,isApproved:!0})}),[t,d,e]),A=(0,s.hb)((()=>{d({chatId:t,userId:e,isApproved:!1})}),[t,d,e]);return(0,ee.FD)("div",{className:h("&"),children:[(0,ee.FD)("div",{className:h("top"),children:[(0,ee.FD)("div",{className:h("user"),onClick:()=>{c({id:e})},children:[(0,ee.Y)(Dt.A,{size:"medium",peer:r},e),(0,ee.FD)("div",{className:h("user-info"),children:[(0,ee.Y)("div",{className:h("user-name"),children:u}),(0,ee.Y)("div",{className:h("user-subtitle"),children:i})]})]}),(0,ee.Y)("div",{className:h("date"),children:v})]}),(0,ee.FD)("div",{className:h("buttons"),children:[(0,ee.Y)(W.A,{className:h("button"),onClick:g,children:m(a?"ChannelAddToChannel":"ChannelAddToGroup")}),(0,ee.Y)(W.A,{className:h("button"),isText:!0,onClick:A,children:m("DismissRequest")})]})]})}))),Mg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t);return{chat:i,isChannel:i&&(0,l.WX)(i)}}))((({chat:e,chatId:t,isActive:i,isChannel:o,onClose:r})=>{const{hideAllChatJoinRequests:l,loadChatJoinRequests:c}=(0,n.ko)(),[d,h,m]=(0,Y.A)(),[p,v,g]=(0,Y.A)(),A=(0,M.A)();(0,fe.A)({isActive:i,onBack:r}),(0,s.vJ)((()=>{e?.joinRequests||(0,u.L8)(t)||c({chatId:t})}),[e,t,c]);const b=(0,s.hb)((()=>{l({chatId:t,isApproved:!0}),m()}),[l,t,m]),f=(0,s.hb)((()=>{l({chatId:t,isApproved:!1}),g()}),[l,t,g]);return(0,ee.FD)("div",{className:"Management ManageJoinRequests",children:[(0,ee.FD)("div",{className:"custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(Sr.A,{tgsUrl:Cr.w.JoinRequest,size:a.OMf,className:"section-icon"}),Boolean(e?.joinRequests?.length)&&(0,ee.FD)("div",{className:"bulk-actions",children:[(0,ee.Y)(W.A,{className:"bulk-action-button",onClick:h,children:"Accept all"}),(0,ee.Y)(W.A,{className:"bulk-action-button",onClick:v,isText:!0,children:"Dismiss all"})]})]}),(0,ee.FD)("div",{className:"section",teactFastList:!0,children:[(0,ee.Y)("p",{children:e?.joinRequests?e.joinRequests.length?A("JoinRequests",e.joinRequests.length):A("NoMemberRequests"):A("Loading")},"title"),!e?.joinRequests&&(0,ee.Y)(xe.A,{},"loading"),0===e?.joinRequests?.length&&(0,ee.Y)("p",{className:"section-help",children:A(o?"NoSubscribeRequestsDescription":"NoMemberRequestsDescription")},"empty"),e?.joinRequests?.map((({userId:e,about:i,date:s})=>(0,ee.Y)(Dg,{userId:e,about:i,date:s,isChannel:o,chatId:t},e)))]})]}),(0,ee.Y)(pi.A,{isOpen:d,onClose:m,title:"Accept all requests?",text:"Are you sure you want to accept all requests?",confirmHandler:b}),(0,ee.Y)(pi.A,{isOpen:p,onClose:g,title:"Reject all requests?",text:"Are you sure you want to reject all requests?",confirmHandler:f})]})}))),Tg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const i=(0,c.hds)(e,t),{maxUniqueReactions:s=a.UAx}=e.appConfig||{},n=(0,c.AWZ)(e,t),o=n?.reactionsLimit||s,r=(0,l.WX)(i);return{enabledReactions:n?.enabledReactions,availableReactions:e.reactions.availableReactions,chat:i,maxUniqueReactions:s,reactionsLimit:o,isChannel:r}}),((e,{chatId:t})=>Boolean((0,c.hds)(e,t))))((({availableReactions:e,enabledReactions:t,chat:i,isActive:o,onClose:a,maxUniqueReactions:r,reactionsLimit:c,isChannel:d})=>{const{setChatEnabledReactions:h}=(0,n.ko)(),m=(0,M.A)(),[u,p]=(0,s.J0)(!1),[v,g]=(0,s.J0)(!1),[A,b]=(0,s.J0)(t),[f,C]=(0,s.J0)(c);(0,fe.A)({isActive:o,onBack:a});const S=(0,s.Kr)((()=>[{value:"all",label:m("AllReactions")},{value:"some",label:m("SomeReactions")},{value:"none",label:m("NoReactions")}]),[m]),y=(0,s.hb)((()=>{i&&(g(!0),h({chatId:i.id,enabledReactions:A,reactionsLimit:f}))}),[i,A,h,f]);(0,s.vJ)((()=>{g(!1),p(!1),b(t),C(c)}),[t,c]);const k=(0,s.Kr)((()=>e?.filter((({isInactive:e})=>!e))),[e]);(0,s.vJ)((()=>{if(void 0===f||f===c){if("some"===A?.type&&"all"!==t?.type&&"some"!==t?.type&&0===A.allowed.length)return void p(!1);if(A?.type===t?.type){if("some"===A?.type&&"some"===t?.type){const e=A.allowed,i=t?.allowed;if(e.length!==i.length||e.reverse().some((e=>!i.find((t=>(0,l.a0)(e,t))))))return void p(!0)}p(!1)}else p(!0)}else p(!0)}),[f,c,A,t]);const w=(0,s.hb)((e=>{"all"===e?(b({type:"all"}),C(c)):"some"===e?(b({type:"some",allowed:"some"===t?.type?t.allowed:[]}),C(c)):(b(void 0),C(void 0))}),[t,c]),N=(0,s.hb)((e=>{if(!i||!k)return;const{name:t,checked:s}=e.currentTarget;if("some"===A?.type){const e={emoticon:t};b(s?{type:"some",allowed:[...A.allowed,e]}:{type:"some",allowed:A.allowed.filter((t=>!(0,l.a0)(t,e)))})}}),[k,i,A]),I=(0,s.hb)((e=>{C(e)}),[]),P=(0,s.hb)((e=>m("PeerInfo.AllowedReactions.MaxCountValue",e)),[m]),Y=d&&("all"===A?.type||"some"===A?.type);return(0,ee.FD)("div",{className:"Management",children:[(0,ee.FD)("div",{className:"panel-content custom-scroll",children:[Boolean(f&&Y)&&(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("h3",{className:"section-heading",children:m("MaximumReactionsHeader")}),(0,ee.Y)(qe.A,{min:1,max:r,value:f,onChange:I,renderValue:P,isCenteredLayout:!0}),(0,ee.Y)("p",{className:"section-info section-info_push",children:m("ChannelReactions.MaxCount.Info")})]}),(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)("h3",{className:"section-heading",children:m("AvailableReactions")}),(0,ee.Y)(X.A,{selected:A?.type||"none",name:"reactions",options:S,onChange:w}),(0,ee.FD)("p",{className:"section-info section-info_push",children:["all"===A?.type&&m("EnableAllReactionsInfo"),"some"===A?.type&&m("EnableSomeReactionsInfo"),!A&&m("DisableReactionsInfo")]})]}),"some"===A?.type&&(0,ee.FD)("div",{className:"section section-with-fab",children:[(0,ee.Y)("h3",{className:"section-heading",children:m("OnlyAllowThisReactions")}),k?.map((({reaction:t,title:i})=>(0,ee.Y)("div",{className:"ListItem",children:(0,ee.Y)(en.A,{name:t.emoticon,checked:A?.allowed.some((e=>(0,l.a0)(t,e))),label:(0,ee.FD)("div",{className:"Reaction",children:[(0,ee.Y)(ks.A,{reaction:t,availableReactions:e}),i]}),withIcon:!0,onChange:N})})))]})]}),(0,ee.Y)(ki.A,{isShown:u,onClick:y,ariaLabel:m("Save"),disabled:v,children:v?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})})]})}))),Bg="Please provide first name",Rg=(0,s.ph)((0,n.EK)(((e,{userId:t})=>{const i=(0,c.mBe)(e,t),s=(0,c.hds)(e,t),n=(0,c.vGo)(e,t),{progress:o}=(0,c.nTw)(e).management,a=s&&(0,Sc.If)(s,(0,c.K52)(e),(0,c.P5N)(e,s.id)),r=n?.personalPhoto;return{user:i,progress:o,isMuted:a,personalPhoto:r,notPersonalPhoto:n?.profilePhoto||n?.fallbackPhoto}}))((({userId:e,user:t,progress:i,isMuted:r,onClose:c,isActive:d,personalPhoto:h,notPersonalPhoto:m})=>{const{updateContact:u,deleteContact:p,closeManagement:v,uploadContactProfilePhoto:g}=(0,n.ko)(),[A,b,f]=(0,Y.A)(),[C,S,y]=(0,Y.A)(),[k,w]=(0,s.J0)(!1),[N,I]=(0,s.J0)(),P=(0,M.A)();(0,fe.A)({isActive:d,onBack:c});const F=t&&t.firstName||"",D=t&&t.lastName||"",[T,B]=(0,s.J0)(F),[R,L]=(0,s.J0)(D),[x,E]=(0,s.J0)(!r);(0,s.vJ)((()=>{E(!r)}),[r]),(0,s.vJ)((()=>{w(!1),f()}),[f,e]),(0,s.vJ)((()=>{B(F),L(D)}),[F,D,t]),(0,s.vJ)((()=>{i===o.TD.Complete&&(w(!1),I(void 0),f())}),[f,i]);const V=(0,s.hb)((e=>{B(e.target.value),w(!0),N===Bg&&I(void 0)}),[N]),_=(0,s.hb)((e=>{L(e.target.value),w(!0)}),[]),U=(0,s.hb)((e=>{E(e.target.checked),w(!0)}),[]),O=(0,s.hb)((()=>{const t=T.trim(),i=R.trim();t.length?u({userId:e,isMuted:!x,firstName:t,lastName:i}):I(Bg)}),[T,R,u,e,x]),K=(0,s.hb)((()=>{p({userId:e}),f(),v()}),[f,v,p,e]),J=(0,s.li)(),G=(0,s.li)(!1),j=(0,s.hb)((()=>{J.current?.click(),G.current=!0}),[]),z=(0,s.hb)((()=>{J.current?.click(),G.current=!1}),[]),H=(0,s.hb)((()=>{y(),w(!0),g({userId:e})}),[y,g,e]),$=(0,s.hb)((t=>{w(!0),g({userId:e,file:t,isSuggest:G.current})}),[g,e]);if(!t)return;const W=!(0,l.tv)(t)&&t.id!==a.zv8,Z=i===o.TD.InProgress;return(0,ee.FD)("div",{className:"Management",children:[(0,ee.FD)("div",{className:"custom-scroll",children:[(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(ys.A,{userId:t.id,avatarSize:"jumbo",noStatusOrTyping:!0,noEmojiStatus:!0,withFullInfo:!0}),(0,ee.FD)("div",{className:"settings-edit",children:[(0,ee.Y)(Q.A,{id:"user-first-name",label:P("UserInfo.FirstNamePlaceholder"),onChange:V,value:T,error:N===Bg?N:void 0}),(0,ee.Y)(Q.A,{id:"user-last-name",label:P("UserInfo.LastNamePlaceholder"),onChange:_,value:R})]}),(0,ee.Y)("div",{className:"ListItem narrow",children:(0,ee.Y)(en.A,{checked:x,label:P("Notifications"),subLabel:P(x?"UserInfo.NotificationsEnabled":"UserInfo.NotificationsDisabled"),onChange:U})})]}),W&&(0,ee.FD)("div",{className:"section",children:[(0,ee.Y)(li.A,{icon:"camera-add",ripple:!0,onClick:j,children:(0,ee.Y)("span",{className:"list-item-ellipsis",children:P("UserInfo.SuggestPhoto",t.firstName)})}),(0,ee.Y)(li.A,{icon:"camera-add",ripple:!0,onClick:z,children:(0,ee.Y)("span",{className:"list-item-ellipsis",children:P("UserInfo.SetCustomPhoto",t.firstName)})}),h&&(0,ee.Y)(li.A,{leftElement:(0,ee.Y)(Dt.A,{photo:m,noPersonalPhoto:!0,peer:t,size:"mini",className:"personal-photo"}),ripple:!0,onClick:S,children:P("UserInfo.ResetCustomPhoto")}),(0,ee.Y)("p",{className:"section-help",dir:"auto",children:P("UserInfo.CustomPhotoInfo",t.firstName)})]}),(0,ee.Y)("div",{className:"section",children:(0,ee.Y)(li.A,{icon:"delete",ripple:!0,destructive:!0,onClick:b,children:P("DeleteContact")})})]}),(0,ee.Y)(ki.A,{isShown:k,onClick:O,disabled:Z,ariaLabel:P("Save"),children:Z?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"check"})}),(0,ee.Y)(pi.A,{isOpen:A,onClose:f,text:P("AreYouSureDeleteContact"),confirmLabel:P("DeleteContact"),confirmHandler:K,confirmIsDestructive:!0}),(0,ee.Y)(pi.A,{isOpen:C,onClose:y,text:P("UserInfo.ResetToOriginalAlertText",t.firstName),confirmLabel:P("Reset"),confirmHandler:H,confirmIsDestructive:!0}),(0,ee.Y)(Hh.A,{onChange:$,inputRef:J})]})}))),Lg=(0,s.ph)((0,n.EK)(((e,{chatId:t})=>{const{progress:i,error:s}=(0,c.nTw)(e).chatCreation||{};return{chat:(0,c.hds)(e,t),creationProgress:i,creationError:s}}))((({chat:e,onClose:t,isActive:i,creationProgress:a,creationError:r})=>{const{createChannel:l}=(0,n.ko)(),c=(0,Vi.A)();(0,fe.A)({isActive:i,onBack:t});const[d,h]=(0,s.J0)(c("NewDiscussionChatTitle",{name:e?.title})),[m,u]=(0,s.J0)(),[p,v]=(0,s.J0)(),g=a===o.n7.InProgress,A=(0,D.A)((e=>{const{value:t}=e.currentTarget,i=t.trimStart();h(i),i!==t&&(e.currentTarget.value=i)})),b=r&&c("NewChatTitleEmptyError")||(p!==c("NewChatTitleEmptyError")&&p!==c("NewChannelTitleEmptyError")?p:void 0),f=(0,D.A)((()=>{d.length?e&&l({discussionChannelId:e.id,title:d,photo:m,isSuperGroup:!0}):v(c("NewChatTitleEmptyError"))}));return(0,ee.Y)("div",{className:"Management",children:(0,ee.Y)("div",{className:"panel-content custom-scroll",children:(0,ee.FD)("div",{className:"NewChat",children:[(0,ee.FD)("div",{className:"NewChat-inner step-2",children:[(0,ee.Y)(ah.A,{onChange:u,title:c("AddPhoto")}),(0,ee.Y)(Q.A,{value:d,onChange:A,label:c("GroupName"),error:p===c("NewChatTitleEmptyError")||p===c("NewChannelTitleEmptyError")?p:void 0}),b&&(0,ee.Y)("p",{className:"error",children:b})]}),(0,ee.Y)(ki.A,{isShown:0!==d.length,onClick:f,disabled:g,ariaLabel:c("DiscussionCreateGroup"),children:g?(0,ee.Y)(xe.A,{color:"white"}):(0,ee.Y)(q.A,{name:"arrow-right"})})]})})})}))),xg=(0,s.ph)((0,n.EK)((e=>({managementType:(0,c.vn8)(e)})))((({chatId:e,currentScreen:t,selectedChatMemberId:i,isPromotedByCurrentUser:s,onScreenSelect:n,onChatMemberSelect:a,onClose:r,isActive:l,managementType:c})=>{switch(t){case o.je.Initial:switch(c){case"bot":return(0,ee.Y)(ig,{userId:e,onClose:r,isActive:l},e);case"user":return(0,ee.Y)(Rg,{userId:e,onClose:r,isActive:l},e);case"group":return(0,ee.Y)(pg,{chatId:e,onScreenSelect:n,onClose:r,isActive:l||[o.je.ChatPrivacyType,o.je.Discussion,o.je.GroupPermissions,o.je.ChatAdministrators,o.je.GroupRemovedUsers,o.je.GroupUserPermissionsCreate,o.je.GroupUserPermissions,o.je.ChatAdminRights,o.je.ChatNewAdminRights,o.je.GroupRecentActions].includes(t)},e);case"channel":return(0,ee.Y)(ng,{chatId:e,onScreenSelect:n,onClose:r,isActive:l||[o.je.ChannelSubscribers,o.je.ChatAdministrators,o.je.ChannelRemovedUsers,o.je.Discussion,o.je.ChatPrivacyType,o.je.ChatAdminRights,o.je.ChatNewAdminRights,o.je.GroupRecentActions].includes(t)},e)}break;case o.je.ChatPrivacyType:return(0,ee.Y)(ag,{chatId:e,isActive:l,onClose:r});case o.je.Discussion:return(0,ee.Y)(cg,{chatId:e,onScreenSelect:n,isActive:l,onClose:r});case o.je.GroupPermissions:return(0,ee.Y)(fg,{chatId:e,onScreenSelect:n,onChatMemberSelect:a,isActive:l||[o.je.GroupRemovedUsers,o.je.GroupUserPermissionsCreate,o.je.GroupUserPermissions].includes(t),onClose:r});case o.je.ChannelRemovedUsers:case o.je.GroupRemovedUsers:return(0,ee.Y)(lg,{chatId:e,isActive:l,onClose:r});case o.je.GroupUserPermissionsCreate:return(0,ee.Y)(Sg,{chatId:e,onChatMemberSelect:a,onScreenSelect:n,isActive:l||[o.je.GroupUserPermissions].includes(t),onClose:r});case o.je.GroupUserPermissions:return(0,ee.Y)(Cg,{chatId:e,selectedChatMemberId:i,isPromotedByCurrentUser:s,onScreenSelect:n,isActive:l,onClose:r});case o.je.ChatAdministrators:return(0,ee.Y)(og,{chatId:e,onScreenSelect:n,onChatMemberSelect:a,isActive:l||[o.je.ChatAdminRights,o.je.ChatNewAdminRights,o.je.GroupRecentActions].includes(t),onClose:r});case o.je.NewDiscussionGroup:return(0,ee.Y)(Lg,{chatId:e,onScreenSelect:n,isActive:l,onClose:r});case o.je.ChatNewAdminRights:case o.je.ChatAdminRights:return(0,ee.Y)(vg,{chatId:e,isNewAdmin:t===o.je.ChatNewAdminRights,selectedUserId:i,isPromotedByCurrentUser:s,onScreenSelect:n,isActive:l,onClose:r});case o.je.ChannelSubscribers:case o.je.GroupMembers:return(0,ee.Y)(bg,{chatId:e,isActive:l,onClose:r});case o.je.Invites:return(0,ee.Y)(Fg,{chatId:e,isActive:l,onClose:r,onScreenSelect:n});case o.je.EditInvite:return(0,ee.Y)(Ng,{chatId:e,isActive:l,onClose:r,onScreenSelect:n});case o.je.GroupAddAdmins:return(0,ee.Y)(bg,{chatId:e,noAdmins:!0,isActive:l,onClose:r,onScreenSelect:n,onChatMemberSelect:a});case o.je.Reactions:return(0,ee.Y)(Tg,{chatId:e,isActive:l,onClose:r});case o.je.InviteInfo:return(0,ee.Y)(Ig,{chatId:e,isActive:l,onClose:r});case o.je.JoinRequests:return(0,ee.Y)(Mg,{chatId:e,isActive:l,onClose:r})}}))),Eg=/^4\d/,Vg=/^5[1-5]/,_g=/^2[2-7]\d{2}/,Ug=/^220[0-4]/;let Og=function(e){return e[e.Default=0]="Default",e[e.Visa=1]="Visa",e[e.Mastercard=2]="Mastercard",e[e.Mir=3]="Mir",e}({});const Kg={[Og.Default]:"",[Og.Visa]:"visa",[Og.Mastercard]:"mastercard",[Og.Mir]:"mir"};function Jg(e){return e=e.replace(/\s/g,""),Eg.test(e)?Og.Visa:Ug.test(e)?Og.Mir:Vg.test(e)||_g.test(e)?Og.Mastercard:Og.Default}const Gg={streetLine1:"",streetLine2:"",city:"",state:"",countryIso2:"",postCode:"",fullName:"",email:"",phone:"",shipping:"",cardNumber:"",cardholder:"",expiry:"",cvv:"",billingCountry:"",billingZip:"",saveInfo:!0,saveCredentials:!1,formErrors:{},tipAmount:0,savedCredentialId:""},jg=(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.iso2,billingCountry:t.payload.defaultName,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.country?{...e,...t.payload,billingCountry:t.payload.country}:{...e,...t.payload};case"setFormErrors":return{...e,formErrors:{...e.formErrors,...t.payload}};case"setTipAmount":return{...e,tipAmount:t.payload};case"changeSavedCredentialId":return{...e,savedCredentialId:t.payload};case"resetState":return{...Gg};default:return e}};var zg=i(37960);const Hg={root:"maC_9u6e",description:"zQ6lEVJ2","checkout-picture":"JgWvLdK2",checkoutPicture:"JgWvLdK2",text:"T2pYH395","checkout-title":"HadolzeF",checkoutTitle:"HadolzeF","checkout-description":"oZW7mUNP",checkoutDescription:"oZW7mUNP","price-info":"P618Q3yr",priceInfo:"P618Q3yr","price-info-item":"XNNG_ajy",priceInfoItem:"XNNG_ajy","price-info-item-main":"D9gYNLVk",priceInfoItemMain:"D9gYNLVk","price-info-item-title":"NtY5Aah7",priceInfoItemTitle:"NtY5Aah7",tipsList:"WHO341eB",tipsItem:"ksLlzBxw",tipsItem_active:"J4yem62L",tipsItemActive:"J4yem62L","invoice-info":"U2IBOLP1",invoiceInfo:"U2IBOLP1",provider:"kqWcdro1",stripe:"xKztZrna",smartglocal:"X_Ge1o4u","checkout-info-item-info-title":"ysWuPklS",checkoutInfoItemInfoTitle:"ysWuPklS","checkout-info-item-info-data":"MpC_P8_c",checkoutInfoItemInfoData:"MpC_P8_c","tos-checkbox":"OrRb0xG7",tosCheckbox:"OrRb0xG7",list:"l_wfiFG0"},$g=(0,s.ph)((({title:e,description:t,photo:i,invoice:a,shippingPrices:r,checkoutInfo:c,totalPrice:d,isTosAccepted:h,dispatch:m,onAcceptTos:u,tipAmount:p,needAddress:v,hasShippingOptions:g,savedCredentials:A,isPaymentFormUrl:b,botName:f})=>{const{setPaymentStep:C}=(0,n.ko)(),S=(0,M.A)(),y=(0,Vi.A)(),k=Boolean(m),{termsUrl:w,suggestedTipAmounts:N,maxTipAmount:I}=a||{},{paymentMethod:P,paymentProvider:Y,shippingAddress:F,name:D,phone:T,shippingMethod:B}=c||{},R=(0,j.A)((0,l.cy)(i)),L=(0,zg.A)(R),x=(0,s.hb)((e=>{m({type:"setTipAmount",payload:I?Math.min(e,I):e})}),[m,I]),E=(0,s.hb)((()=>{C({step:A?.length?o.tn.SavedPayments:o.tn.PaymentInfo})}),[A?.length,C]),V=(0,s.hb)((()=>{C({step:o.tn.ShippingInfo})}),[C]),_=(0,s.hb)((()=>{C({step:o.tn.Shipping})}),[C]);return(0,ee.FD)("div",{className:Hg.root,children:[(0,ee.FD)("div",{className:Hg.description,children:[R&&(0,ee.Y)("img",{ref:L,className:Hg.checkoutPicture,src:R,draggable:!1,width:i.dimensions?.width,height:i.dimensions?.height,alt:""}),!R&&i&&(0,ee.Y)(zi.A,{width:i.dimensions?.width,height:i.dimensions?.height,className:Hg.checkoutPicture,forceAspectRatio:!0}),(0,ee.FD)("div",{className:Hg.text,children:[(0,ee.Y)("h5",{className:Hg.checkoutTitle,children:e}),t&&(0,ee.Y)("div",{className:Hg.checkoutDescription,children:(0,Ft.A)(t,["br","links","emoji"])})]})]}),(0,ee.FD)("div",{className:Hg.priceInfo,children:[a.prices.map((e=>qg(y,e.label,e.amount,a.currency))),r&&r.map((e=>qg(y,e.label,e.amount,a.currency))),N&&N.length>0&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:Hg.priceInfoItem,children:[(0,ee.Y)("div",{className:Hg.priceInfoItemTitle,children:e}),(0,ee.Y)("div",{children:(0,ho.vv)(y,p,a.currency)})]}),(0,ee.Y)("div",{className:Hg.tipsList,children:N.map((e=>(0,ee.Y)("div",{className:(0,me.A)(Hg.tipsItem,e===p&&Hg.tipsItem_active),onClick:m?()=>x(e===p?0:e):void 0,children:(0,ho.vv)(y,e,a.currency,{shouldOmitFractions:!0})},e)))})]}),void 0!==d&&qg(y,S("Checkout.TotalAmount"),d,a.currency,!0)]}),(0,ee.FD)("div",{className:Hg.invoiceInfo,children:[!b&&Wg({title:P||A?.[0].title,label:S("PaymentCheckoutMethod"),icon:"card",onClick:k?E:void 0}),Y&&Wg({title:Y,label:S("PaymentCheckoutProvider"),customIcon:(0,me.A)(Hg.provider,Hg[Y.toLowerCase()])}),(v||!k&&F)&&Wg({title:F,label:S("PaymentShippingAddress"),icon:"location",onClick:k?V:void 0}),D&&Wg({title:D,label:S("PaymentCheckoutName"),icon:"user"}),T&&Wg({title:T,label:S("PaymentCheckoutPhoneNumber"),icon:"phone"}),(g||!k&&B)&&Wg({title:B,label:S("PaymentCheckoutShippingMethod"),icon:"truck",onClick:k?_:void 0}),w&&(U=w,(0,ee.Y)(en.A,{label:function(e,t){const i=S("PaymentCheckoutAcceptRecurrent",f).split("*");return(0,ee.FD)(ee.FK,{children:[i[0],(0,ee.Y)(dl.A,{url:e,text:i[1],isRtl:t}),i.slice(2)]})}(U,S.isRtl),name:"checkout_tos",checked:Boolean(h),className:Hg.tosCheckbox,tabIndex:0,onCheck:u}))]})]});var U}));function qg(e,t,i,s,n=!1){return(0,ee.FD)("div",{className:(0,me.A)(Hg.priceInfoItem,n&&Hg.priceInfoItemMain),children:[(0,ee.Y)("div",{className:Hg.priceInfoItemTitle,children:t}),(0,ee.Y)("div",{children:(0,ho.vv)(e,i,s)})]})}function Wg({title:e,label:t,icon:i,customIcon:s,onClick:n}){const o=Boolean(e&&t!==e);return(0,ee.FD)(li.A,{className:Hg.list,narrow:!0,multiline:o,icon:i,inactive:!n,onClick:n,leftElement:s&&(0,ee.Y)("i",{className:(0,me.A)("icon",s)}),children:[(0,ee.Y)("div",{className:Hg.checkoutInfoItemInfoTitle,children:e||t}),e&&t!==e&&(0,ee.Y)("p",{className:Hg.checkoutInfoItemInfoData,children:t})]})}const Qg=(0,s.ph)((({url:e,noRedirect:t,onClose:i,onPaymentFormSubmit:o})=>{const{openTelegramLink:r}=(0,n.ko)(),l=(0,M.A)(),c=(0,s.hb)((e=>{try{const s=JSON.parse(e.data),{eventType:n,eventData:l}=s;switch(n){case"web_app_open_tg_link":if(!t){const e=a.jsp+l.path_full;r({url:e})}i();break;case"payment_form_submit":o&&o(l);break;default:i()}}catch(e){}}),[i,t,r,o]);return(0,s.vJ)((()=>(window.addEventListener("message",c),()=>window.removeEventListener("message",c))),[c]),(0,ee.Y)("div",{className:"ConfirmPayment",children:(0,ee.Y)("iframe",{src:e,title:l("Checkout.WebConfirmation.Title"),allow:"payment",sandbox:"allow-modals allow-forms allow-scripts allow-same-origin allow-top-navigation",className:"ConfirmPayment__content"})})})),Zg=(0,s.ph)((0,n.EK)((e=>{const{payment:t}=(0,c.nTw)(e);return{errorKey:t.error?.messageKey,passwordHint:e.twoFaSettings.hint,savedCredentials:"regular"===t.form?.type?t.form.savedCredentials:void 0}}))((({isActive:e,errorKey:t,state:i,savedCredentials:o,passwordHint:a,onPasswordChange:r})=>{const{clearPaymentError:l}=(0,n.ko)(),c=(0,M.A)(),d=(0,Vi.A)(),[h,m]=(0,s.J0)(!1),u=(0,s.Kr)((()=>o?.length&&i.savedCredentialId?o.find((({id:e})=>e===i.savedCredentialId))?.title:void 0),[o,i.savedCredentialId]);return(0,ee.FD)("div",{className:"PaymentInfo",children:[(0,ee.Y)(yd.A,{isBig:!0,isPasswordVisible:h}),(0,ee.Y)(bl.A,{error:t&&d.withRegular(t),hint:a,description:c("PaymentConfirmationMessage",u),placeholder:c("Password"),clearError:l,shouldShowSubmit:!1,shouldResetValue:e,isPasswordVisible:h,onChangePasswordVisibility:m,onInputChange:r})]})})));var Xg=i(63173);function eA(e,t=300){(0,s.vJ)((()=>{b.TF||setTimeout((()=>{(0,r.YS)((()=>{e.current?.focus()}))}),t)}),[e,t])}const tA=i.p+"mastercard.790db81f7978635f77d8.svg",iA=i.p+"mir.e3a390b90e2e3e292621.svg",sA=i.p+"visa.fb39984c9532c0336be9.svg",nA=(0,s.ph)((({value:e,error:t,onChange:i})=>{const n=(0,M.A)(),o=(0,s.li)();eA(o);const[a,r]=(0,s.J0)(Og.Default);(0,s.vJ)((()=>{const t=Jg(e);r(t)}),[]);const l=(0,s.hb)((e=>{const t=function(e){const t=(e=e.replace(/[^\d]/g,"")).match(/.{1,4}/g);return t?t.join(" "):""}(e.target.value),s=Jg(e.target.value);r(s),i(t)}),[i]),c=function(e){switch(e){case Og.Mastercard:return(0,ee.Y)("img",{src:tA,draggable:!1,alt:""});case Og.Visa:return(0,ee.Y)("img",{src:sA,draggable:!1,alt:""});case Og.Mir:return(0,ee.Y)("img",{src:iA,draggable:!1,alt:""});default:return}}(a);return(0,ee.FD)("div",{className:"CardInput",children:[(0,ee.Y)(Q.A,{ref:o,label:n("PaymentCardNumber"),onChange:l,value:e,inputMode:"numeric",className:a?"has-right-addon":"",error:t,tabIndex:0,maxLength:19,teactExperimentControlled:!0}),(0,ee.Y)("span",{className:"right-addon",children:c})]})})),oA=(0,s.ph)((({value:e,error:t,onChange:i})=>{const n=(0,M.A)(),o=(0,s.hb)((t=>{const s=t.target.value;e.endsWith("/")&&e.length>s.length?i(s):i(function(e){const t=(e=e.replace(/[^\d]/g,"").slice(0,4)).match(/.{1,2}/g);return t?.[0]&&Number(t[0])>12&&(t[0]="12"),t?.[0]&&2===t[0].length&&!t[1]&&(t[1]=""),t?t.join("/"):""}(t.target.value))}),[i,e]);return(0,ee.Y)(Q.A,{label:n("PaymentCardExpireDate"),onChange:o,value:e,error:t,inputMode:"numeric",tabIndex:0,maxLength:5,teactExperimentControlled:!0})})),aA=(0,s.ph)((({state:e,canSaveCredentials:t,needCardholderName:i,needCountry:n,needZip:o,countryList:a,dispatch:r})=>{const l=(0,s.li)();(0,s.vJ)((()=>{l.current&&l.current.value!==e.billingCountry&&(l.current.value=e.billingCountry)}),[e.billingCountry]);const c=(0,s.hb)((e=>{r({type:"changeCardNumber",payload:e})}),[r]),d=(0,s.hb)((e=>{r({type:"changeCardholder",payload:e.target.value.toUpperCase()})}),[r]),h=(0,s.hb)((e=>{r({type:"changeExpiryDate",payload:e})}),[r]),m=(0,s.hb)((e=>{const t=e.target.value.replace(/[^0-9]/g,"");r({type:"changeCvvCode",payload:t})}),[r]),u=(0,s.hb)((e=>{r({type:"changeBillingCountry",payload:e.target.value})}),[r]),p=(0,s.hb)((e=>{r({type:"changeBillingZip",payload:e.target.value})}),[r]),v=(0,s.hb)((e=>{r({type:"changeSaveCredentials",payload:e.target.value})}),[r]),g=(0,M.A)(),A=(0,Vi.A)(),{formErrors:b={}}=e;return(0,ee.Y)("div",{className:"PaymentInfo",children:(0,ee.FD)("form",{children:[(0,ee.Y)("h5",{children:g("PaymentCardTitle")}),(0,ee.Y)(nA,{onChange:c,value:e.cardNumber,error:b.cardNumber&&A.withRegular(b.cardNumber)}),i&&(0,ee.Y)(Q.A,{label:g("Checkout.NewCard.CardholderNamePlaceholder"),onChange:d,value:e.cardholder,inputMode:"text",tabIndex:0,error:b.cardholder&&A.withRegular(b.cardholder)}),(0,ee.FD)("section",{className:"inline-inputs",children:[(0,ee.Y)(oA,{value:e.expiry,onChange:h,error:b.expiry&&A.withRegular(b.expiry)}),(0,ee.Y)(Q.A,{label:g("lng_payments_card_cvc"),onChange:m,value:e.cvv,inputMode:"numeric",maxLength:3,tabIndex:0,error:b.cvv&&A.withRegular(b.cvv),teactExperimentControlled:!0})]}),n||o?(0,ee.Y)("h5",{children:g("PaymentBillingAddress")}):void 0,(0,ee.FD)("section",{className:"inline-inputs",children:[n&&(0,ee.Y)(Xg.A,{label:g("PaymentShippingCountry"),onChange:u,value:e.billingCountry,hasArrow:Boolean(!0),id:"billing-country",error:b.billingCountry&&A.withRegular(b.billingCountry),tabIndex:0,ref:l,children:a.map((({defaultName:t,name:i})=>(0,ee.Y)("option",{value:t,className:"county-item",selected:t===e.billingCountry,children:t||i})))}),o&&(0,ee.Y)(Q.A,{label:g("PaymentShippingZipPlaceholder"),onChange:p,value:e.billingZip,inputMode:"text",tabIndex:0,maxLength:12,error:b.billingZip&&A.withRegular(b.billingZip)})]}),(0,ee.Y)("div",{className:"checkbox",children:(0,ee.Y)(en.A,{label:g("PaymentCardSavePaymentInformation"),checked:!!t&&e.saveCredentials,tabIndex:0,subLabel:g(t?"Checkout.NewCard.SaveInfoHelp":"Checkout.2FA.Text"),onChange:v,disabled:!t})})]})})})),rA=(0,s.ph)((({state:e,savedCredentials:t,dispatch:i,onNewCardClick:n})=>{const o=(0,M.A)(),a=(0,s.Kr)((()=>t?.length?t.map((({id:e,title:t})=>({label:t,value:e}))):fi.p),[t]),r=(0,s.hb)((e=>{i({type:"changeSavedCredentialId",payload:e})}),[i]);return(0,ee.Y)("div",{className:"PaymentInfo",children:(0,ee.FD)("form",{children:[(0,ee.Y)("h5",{children:o("PaymentCardTitle")}),(0,ee.Y)(X.A,{name:"saved-credentials",options:a,selected:e.savedCredentialId,onChange:r}),(0,ee.Y)(W.A,{isText:!0,onClick:n,children:o("PaymentCheckoutMethodNewCard")})]})})})),lA=(0,s.ph)((({state:e,shippingOptions:t,currency:i,dispatch:n})=>{const o=(0,M.A)(),a=(0,Vi.A)();(0,s.vJ)((()=>{t&&t.length&&!e.shipping&&n({type:"changeShipping",payload:t[0].id})}),[t,e.shipping,n]);const r=(0,s.hb)((e=>{n({type:"changeShipping",payload:e})}),[n]),l=(0,s.Kr)((()=>t.map((({id:e,title:t,amount:s})=>({label:t,subLabel:(0,ho.vv)(a,s,i),value:e})))),[t,i,a]);return(0,ee.Y)("div",{className:"Shipping",children:(0,ee.FD)("form",{children:[(0,ee.Y)("p",{children:o("PaymentShippingMethod")}),(0,ee.Y)(X.A,{name:"shipping-options",options:l,onChange:r,selected:e.shipping})]})})})),cA=(0,s.ph)((({state:e,needEmail:t,needPhone:i,needName:n,needAddress:o,countryList:a,dispatch:r})=>{const l=(0,s.li)(),c=(0,s.li)(),d=(0,s.li)();(0,s.vJ)((()=>{d.current&&d.current.value!==e.countryIso2&&(d.current.value=e.countryIso2)}),[e.countryIso2]);const h=(0,M.A)(),m=(0,Vi.A)();eA(l);const u=(0,s.hb)((e=>{r({type:"changeAddress1",payload:e.target.value})}),[r]),p=(0,s.hb)((e=>{r({type:"changeAddress2",payload:e.target.value})}),[r]),v=(0,s.hb)((e=>{r({type:"changeCity",payload:e.target.value})}),[r]),g=(0,s.hb)((e=>{r({type:"changeState",payload:e.target.value})}),[r]),A=(0,s.hb)((e=>{r({type:"changeCountry",payload:a.find((t=>t.iso2===e.target.value))})}),[a,r]),b=(0,s.hb)((e=>{r({type:"changePostCode",payload:e.target.value})}),[r]),f=(0,s.hb)((e=>{r({type:"changeFullName",payload:e.target.value})}),[r]),C=(0,s.hb)((e=>{r({type:"changeEmail",payload:e.target.value})}),[r]),S=(0,s.hb)((e=>{let{value:t}=e.target;t=`+${t.replace(/\D/g,"")}`,c.current&&(c.current.value=t),r({type:"changePhone",payload:t})}),[r]),y=(0,s.hb)((e=>{r({type:"changeSaveInfo",payload:e.target.value})}),[r]),{formErrors:k}=e;return(0,ee.Y)("div",{className:"ShippingInfo",children:(0,ee.FD)("form",{children:[o?(0,ee.FD)("div",{children:[(0,ee.Y)("h5",{children:h("PaymentShippingAddress")}),(0,ee.Y)(Q.A,{ref:l,label:h("PaymentShippingAddress1Placeholder"),onChange:u,value:e.streetLine1,inputMode:"text",tabIndex:0,error:k.streetLine1&&m.withRegular(k.streetLine1)}),(0,ee.Y)(Q.A,{label:h("PaymentShippingAddress2Placeholder"),onChange:p,value:e.streetLine2,inputMode:"text",tabIndex:0,error:k.streetLine2&&m.withRegular(k.streetLine2)}),(0,ee.Y)(Q.A,{label:h("PaymentShippingCityPlaceholder"),onChange:v,value:e.city,inputMode:"text",tabIndex:0,error:k.city&&m.withRegular(k.city)}),(0,ee.Y)(Q.A,{label:h("PaymentShippingStatePlaceholder"),onChange:g,value:e.state,inputMode:"text",error:k.state&&m.withRegular(k.state)}),(0,ee.Y)(Xg.A,{label:h("PaymentShippingCountry"),onChange:A,value:e.countryIso2,hasArrow:Boolean(!0),id:"shipping-country",error:k.countryIso2&&m.withRegular(k.countryIso2),ref:d,tabIndex:0,children:a.map((({defaultName:t,name:i,iso2:s})=>(0,ee.Y)("option",{value:s,className:"county-item",selected:s===e.countryIso2,children:t||i})))}),(0,ee.Y)(Q.A,{label:h("PaymentShippingZipPlaceholder"),onChange:b,value:e.postCode,inputMode:"text",tabIndex:0,error:k.postCode&&m.withRegular(k.postCode)})]}):void 0,n||t||i?(0,ee.Y)("h5",{children:h("PaymentShippingReceiver")}):void 0,n&&(0,ee.Y)(Q.A,{label:h("PaymentShippingName"),onChange:f,value:e.fullName,inputMode:"text",tabIndex:0,error:k.fullName&&m.withRegular(k.fullName)}),t&&(0,ee.Y)(Q.A,{label:h("PaymentShippingEmailPlaceholder"),onChange:C,value:e.email,inputMode:"email",tabIndex:0,error:k.email&&m.withRegular(k.email)}),i&&(0,ee.Y)(Q.A,{label:h("PaymentShippingPhoneNumber"),onChange:S,value:e.phone,inputMode:"tel",tabIndex:0,error:k.phone&&m.withRegular(k.phone),ref:c}),(0,ee.Y)(en.A,{label:h("PaymentShippingSave"),subLabel:h("PaymentShippingSaveInfo"),checked:Boolean(e.saveInfo),tabIndex:0,onChange:y})]})})})),dA="stripe",hA="smartglocal",mA=new Set([dA,hA]),uA=(0,s.ph)((0,n.EK)((e=>{const{form:t,step:i,shippingOptions:s,error:n,confirmPaymentUrl:o,inputInvoice:a,requestId:r,stripeCredentials:d,smartGlocalCredentials:h,temporaryPassword:m,isExtendedMedia:u,url:p}=(0,c.nTw)(e).payment,{invoice:v,nativeParams:g,nativeProvider:A}=t||{},b=e.countryList.general;let f=t?.nativeProvider;!f&&p&&(f=p.startsWith("https://payment.smart-glocal.com")?hA:void 0);const C=a&&"chatId"in a?(0,c.hds)(e,a.chatId):void 0,S=Boolean(v&&(!f||!mA.has(f))),{needCardholderName:y,needCountry:k,needZip:w}=g||{},N=t?.botId?(0,c.mBe)(e,t.botId):void 0,I=(0,l.Yg)(N);return{step:i,chat:C,shippingOptions:s,nativeProvider:f,isProviderError:S,form:t,invoice:v,needCardholderName:y,needCountry:k,needZip:w,error:n,confirmPaymentUrl:o??p,isPaymentFormUrl:Boolean(!A&&p),countryList:b,requestId:r,hasShippingOptions:Boolean(s?.length),smartGlocalToken:h?.token,stripeId:d?.id,passwordValidUntil:m?.validUntil,isExtendedMedia:u,botName:I}}))((({isOpen:e,onClose:t,step:i,shippingOptions:a,form:r,isProviderError:l,invoice:c,nativeProvider:d,needCardholderName:h,needCountry:m,needZip:u,confirmPaymentUrl:p,error:v,countryList:g,hasShippingOptions:A,requestId:b,smartGlocalToken:f,stripeId:C,savedCredentials:S,passwordValidUntil:y,isExtendedMedia:k,isPaymentFormUrl:w,botName:N})=>{const{loadPasswordInfo:I,validateRequestedInfo:P,sendPaymentForm:F,setPaymentStep:T,sendCredentialsInfo:B,clearPaymentError:R,validatePaymentPassword:L,setSmartGlocalCardInfo:x}=(0,n.ko)(),E=(0,M.A)(),_=(0,Vi.A)(),[U,O,K]=(0,Y.A)(),[J,G]=(0,nd.A)(jg,Gg),[j,z]=(0,s.J0)(!1),[H,$]=(0,s.J0)(!1),[Q,X]=(0,s.J0)(""),te=(0,V.A)(i,!0),ie=(0,V.A)(b),ne=i!==o.tn.ConfirmPayment,oe=(0,s.hb)((e=>{T({step:e})}),[T]);(0,s.vJ)((()=>{e&&(X(""),I(),O())}),[e,I,O]),(0,s.vJ)((()=>{!e&&U&&K()}),[K,U,e]),(0,s.vJ)((()=>{(void 0!==i||v)&&z(!1)}),[i,v,b]),(0,s.vJ)((()=>{i!==o.tn.Checkout||i!==te||b===ie||J.savedCredentialId||J.cardNumber||oe(o.tn.PaymentInfo)}),[J.cardNumber,J.savedCredentialId,ie,te,b,oe,i]),(0,s.vJ)((()=>{v?.field&&G({type:"setFormErrors",payload:{[v.field]:v.messageKey}})}),[v,G]),(0,s.vJ)((()=>{if(r?.savedInfo){const{name:e,phone:t,email:i,shippingAddress:s}=r.savedInfo,{countryIso2:n,...o}=s||{},a=n&&g.find((({iso2:e})=>e===n)).defaultName;G({type:"updateUserInfo",payload:{fullName:e,phone:t&&"+"!==t.charAt(0)?`+${t}`:t,email:i,...a&&{country:a,countryIso2:n,...o}}})}}),[r,G,g]),(0,s.vJ)((()=>{S?.length&&G({type:"changeSavedCredentialId",payload:S[0].id})}),[G,S]);const ae=(0,s.hb)((()=>{R()}),[R]),re=(0,s.Kr)((()=>i!==o.tn.Checkout?0:function(e=[],t,i,s){const n=t?vA(t,i):[];let o=s;return o=e.concat(n||[]).reduce(((e,t)=>e+t.amount),o),o}(c?.prices,a,J.shipping,J.tipAmount)),[i,c?.prices,a,J.shipping,J.tipAmount]),le=(0,s.Kr)((()=>{if(i===o.tn.Checkout)return function(e,t,i){const s=function(e){const t=Jg(e);return Kg[t]||""}(e.cardNumber),n=s&&e.cardNumber?`${s} *${e.cardNumber.slice(-4)}`:void 0,o=e.streetLine1?`${e.streetLine1}, ${e.city}, ${e.countryIso2}`:void 0,{phone:a,fullName:r}=e,l=t?pA(t,e.shipping):void 0,c=l?.title;return{paymentMethod:n,paymentProvider:i,shippingAddress:o,name:r,phone:a,shippingMethod:c}}(J,a,d||"")}),[i,J,a,d]),ce=(0,s.hb)((()=>{oe(o.tn.PaymentInfo)}),[oe]),de=(0,s.hb)((()=>{R()}),[R]),he=(0,s.hb)((()=>{F({shippingOptionId:J.shipping,saveCredentials:J.saveCredentials,savedCredentialId:J.savedCredentialId,tipAmount:J.tipAmount})}),[F,J]),ue=(0,s.hb)((e=>{const{credentials:t}=e;x(t),he()}),[he]),pe=(0,s.hb)((()=>{const{saveInfo:e}=J,t=function(e){const{streetLine1:t,streetLine2:i,city:s,state:n,countryIso2:o,postCode:a,fullName:r,phone:l,email:c}=e;return{name:r,phone:l,email:c,shippingAddress:{streetLine1:t,streetLine2:i,city:s,state:n,countryIso2:o,postCode:a}}}(J);P({requestInfo:t,saveInfo:e})}),[P,J]),ve=(0,s.hb)((()=>{const e=function(e){const{cardNumber:t,cardholder:i,expiry:s,cvv:n,billingCountry:o,billingZip:a}=e,[r,l]=s.split("/");return{data:{cardNumber:t,cardholder:i,expiryMonth:r,expiryYear:l,cvv:n,country:o,zip:a}}}(J);B({credentials:e})}),[B,J]),ge=(0,D.A)((()=>{switch(i){case o.tn.ShippingInfo:z(!0),pe();break;case o.tn.Shipping:oe(o.tn.Checkout);break;case o.tn.SavedPayments:oe(o.tn.ConfirmPassword);break;case o.tn.ConfirmPassword:if(""===Q)return;z(!0),L({password:Q});break;case o.tn.PaymentInfo:z(!0),ve(),G({type:"changeSavedCredentialId",payload:""});break;case o.tn.Checkout:{if(w)return z(!0),void oe(o.tn.ConfirmPayment);if(r?.savedInfo&&!b&&!J.shipping)return z(!0),void pe();if(J.savedCredentialId&&(!y||y<=Date.now()/1e3-3))return void oe(o.tn.ConfirmPassword);if(!J.savedCredentialId&&(d===dA&&!C||d===hA&&!f))return void oe(o.tn.PaymentInfo);const{phone:e,email:t,fullName:i}=J,s=c?.isEmailRequested&&!t||c?.isPhoneRequested&&!e||c?.isNameRequested&&!i;if(c?.isShippingAddressRequested&&!b||s)return void oe(o.tn.ShippingInfo);if(c?.isShippingAddressRequested&&!J.shipping&&a?.length)return void oe(o.tn.Shipping);z(!0),he();break}}}));(0,s.vJ)((()=>i===o.tn.ConfirmPassword?(0,Bi.A)({onEnter:ge}):void 0),[ge,i]);const Ae=(0,s.hb)((()=>{G({type:"resetState"}),$(!1),t()}),[t,G]),be=(0,s.hb)((()=>{oe(i===o.tn.ConfirmPassword?o.tn.SavedPayments:o.tn.Checkout)}),[oe,i]),fe=(0,s.Kr)((()=>{switch(i){case o.tn.Checkout:return E("PaymentCheckout");case o.tn.ShippingInfo:return E("PaymentShippingInfo");case o.tn.Shipping:return E("PaymentShippingMethod");case o.tn.SavedPayments:return E("PaymentCheckoutMethod");case o.tn.ConfirmPassword:return E("Checkout.PasswordEntry.Title");case o.tn.PaymentInfo:return E("PaymentCardInfo");case o.tn.ConfirmPayment:return E("Checkout.WebConfirmation.Title");default:return""}}),[i,E]),Ce=i===o.tn.Checkout?E("Checkout.PayPrice",(0,ho.Ad)(re,c.currency,E.code)):_("PaymentInfoDone");if(l)return(0,ee.FD)(Z.A,{className:"error",isOpen:U,onClose:K,onCloseAnimationEnd:Ae,children:[(0,ee.FD)("p",{children:["Sorry, Telegram Web A doesn't support payments with this provider yet."," ",(0,ee.Y)("br",{}),"Please use one of our mobile apps to do this."]}),(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:(0,ee.Y)(W.A,{isText:!0,onClick:K,children:E("OK")})})]});const Se=function(){if(j)return!0;switch(i){case o.tn.Checkout:return Boolean(c?.termsUrl)&&!H;case o.tn.PaymentInfo:return Boolean(""===J.cardNumber||h&&""===J.cardholder||""===J.cvv||""===J.expiry);default:return!1}}();return(0,ee.FD)(Z.A,{className:(0,me.A)("PaymentModal",c?.isRecurring&&"recurring"),isOpen:U,onClose:K,onCloseAnimationEnd:Ae,children:[(0,ee.FD)("div",{className:"header",dir:E.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:i===o.tn.Checkout?K:be,ariaLabel:"Close",children:(0,ee.Y)(q.A,{name:i===o.tn.Checkout?"close":"arrow-left"})}),(0,ee.Y)("h3",{children:fe})]}),void 0!==i?(0,ee.Y)(se.Ay,{name:"slide",activeKey:i,shouldCleanup:!0,cleanupOnlyKey:o.tn.ConfirmPayment,children:(0,ee.Y)("div",{className:"content custom-scroll",children:function(e){switch(e){case o.tn.Checkout:return(0,ee.Y)($g,{title:r.title,description:r.description,photo:r.photo,dispatch:G,shippingPrices:J.shipping&&a?vA(a,J.shipping):void 0,totalPrice:re,invoice:c,checkoutInfo:le,isPaymentFormUrl:w,hasShippingOptions:A,tipAmount:J.tipAmount,needAddress:Boolean(c?.isShippingAddressRequested),savedCredentials:S,isTosAccepted:H,onAcceptTos:$,botName:N});case o.tn.SavedPayments:return(0,ee.Y)(rA,{state:J,savedCredentials:S,dispatch:G,onNewCardClick:ce});case o.tn.ConfirmPassword:return(0,ee.Y)(Zg,{state:J,savedCredentials:S,onPasswordChange:X,isActive:e===i});case o.tn.PaymentInfo:return(0,ee.Y)(aA,{state:J,dispatch:G,canSaveCredentials:Boolean(!r.isPasswordMissing&&r.canSaveCredentials),needCardholderName:h,needCountry:m,needZip:u,countryList:g});case o.tn.ShippingInfo:return(0,ee.Y)(cA,{state:J,dispatch:G,needAddress:Boolean(c?.isShippingAddressRequested),needEmail:Boolean(c?.isEmailRequested||c?.isEmailSentToProvider),needPhone:Boolean(c?.isPhoneRequested||c?.isPhoneSentToProvider),needName:Boolean(c?.isNameRequested),countryList:g});case o.tn.Shipping:return(0,ee.Y)(lA,{state:J,dispatch:G,shippingOptions:a||[],currency:c.currency});case o.tn.ConfirmPayment:return(0,ee.Y)(Qg,{url:p,noRedirect:k,onPaymentFormSubmit:ue,onClose:K});default:return}}(i)})}):(0,ee.Y)("div",{className:"empty-content",children:(0,ee.Y)(xe.A,{color:"gray"})}),ne&&(0,ee.Y)("div",{className:"footer",children:(0,ee.Y)(W.A,{className:"button-text",type:"submit",onClick:ge,disabled:Se,isLoading:j,children:Ce})}),v&&!v.field&&function(){if(v)return(0,ee.FD)(Z.A,{className:"error",isOpen:Boolean(v),onClose:ae,children:[(0,ee.Y)("h4",{children:v.descriptionKey?_.withRegular(v.descriptionKey):_("ErrorUnspecified")}),(0,ee.Y)("div",{className:"dialog-buttons mt-2",children:(0,ee.Y)(W.A,{isText:!0,onClick:de,children:E("OK")})})]})}()]})})));function pA(e,t){return e.find((({id:e})=>e===t))}function vA(e,t){const i=pA(e,t);return i?.prices}const gA=(0,s.ph)((0,n.EK)((e=>{const{receipt:t}=(0,c.nTw)(e).payment;return{receipt:t}}))((({isOpen:e,onClose:t,receipt:i})=>{const n=(0,Vi.A)(),[o,a,r]=(0,Y.A)();(0,s.vJ)((()=>{e&&a()}),[e,a]);const l=(0,rl.A)(i),c=i||l,d=(0,s.Kr)((()=>{if(c)return function(e,t,i){if(!t)return{paymentMethod:e};const{shippingAddress:s}=t,n=s?.streetLine1?`${s.streetLine1}, ${s.city}, ${s.countryIso2}`:void 0,{phone:o,name:a}=t;return{paymentMethod:e,shippingAddress:n,name:a,phone:o,shippingMethod:i}}(c.credentialsTitle,c.info,c.shippingMethod)}),[c]);return(0,ee.Y)(Z.A,{className:"PaymentModal PaymentModal-receipt",isOpen:o,onClose:r,onCloseAnimationEnd:t,children:c&&(0,ee.FD)(ee.FK,{children:[(0,ee.FD)("div",{className:"header",dir:n.isRtl?"rtl":void 0,children:[(0,ee.Y)(W.A,{className:"close-button",color:"translucent",round:!0,size:"smaller",onClick:r,ariaLabel:"Close",children:(0,ee.Y)(q.A,{name:"close"})}),(0,ee.FD)("h3",{children:[" ",n("PaymentReceipt")," "]})]}),(0,ee.Y)("div",{className:"receipt-content custom-scroll",children:(0,ee.Y)($g,{shippingPrices:c.shippingPrices,totalPrice:c.totalAmount,tipAmount:c.tipAmount,invoice:c.invoice,checkoutInfo:d,title:c.title,description:c.description,photo:c.photo})})]})})}))),AA="Qo4PtFZI",bA="wtfpombl",fA=(0,s.ph)((0,n.EK)(((e,{modal:t})=>({chat:t?.chatId?(0,c.hds)(e,t.chatId):void 0})))((({modal:e,chat:t})=>{const{sendInviteMessages:i,closeInviteViaLinkModal:o,openPremiumModal:a}=(0,n.ko)(),{missingUsers:r}=e||{},c=(0,M.A)(),[d,h]=(0,s.J0)([]),m=(0,s.Kr)((()=>r?.map((e=>e.id))||fi.p),[r]),[u,p]=(0,s.Kr)((()=>{if(!r?.length)return[[],[]];const[e,t]=(0,bi.jB)(r,(e=>e.isRequiringPremiumToMessage));return[e.map((e=>e.id)),t.map((e=>e.id))]}),[r]),v=(0,s.Kr)((()=>r?.filter((e=>e.isRequiringPremiumToInvite||e.isRequiringPremiumToMessage)).map((e=>e.id))),[r]),g=(0,s.Kr)((()=>{if(r)return!r.some((e=>e.isRequiringPremiumToInvite&&!e.isRequiringPremiumToMessage))}),[r]),A=(0,s.Kr)((()=>{const e=(0,n.mS)().users.byId;return v?.map((t=>e[t]))}),[v]);(0,s.vJ)((()=>{h(p)}),[p]);const b=(0,D.A)((()=>o())),f=(0,s.hb)((()=>{i({chatId:t.id,userIds:d}),o()}),[d,t]),C=(0,s.hb)((()=>{a()}),[]),S=(0,s.Kr)((()=>{if(t)return Boolean(t?.isCreator||t?.adminRights?.inviteUsers)}),[t]),y=(0,s.Kr)((()=>S?c(1===r?.length?"InviteBlockedOneMessage":"InviteBlockedManyMessage"):c("InviteRestrictedUsers2",r?.length)),[S,c,r?.length]),k=(0,s.Kr)((()=>{if(!v?.length||!A?.length)return;const e=g?"InviteMessagePremiumBlocked":"InvitePremiumBlocked";let t=`${e}One`,i=[(0,l.Yg)(A[0])];return 2===v.length?(t=`${e}Two`,i=[(0,l.Yg)(A[0]),(0,l.Yg)(A[1])]):3===v.length?(t=`${e}Three`,i=[(0,l.Yg)(A[0]),(0,l.Yg)(A[1]),(0,l.Yg)(A[2])]):v.length>3&&(t=`${e}Many`,i=[(0,l.Yg)(A[0]),(0,l.Yg)(A[1]),(v.length-2).toString()]),c(t,i,void 0,A.length)}),[v,g,c,A]),w=Boolean(A?.length),N=Boolean(p?.length);return(0,ee.FD)(Z.A,{isOpen:Boolean(m&&t),contentClassName:"n8eENbaR",onClose:b,isSlim:!0,children:[(0,ee.Y)(W.A,{round:!0,color:"translucent",size:"smaller",className:"smosGkw9",ariaLabel:c("Close"),onClick:b,children:(0,ee.Y)(q.A,{name:"close"})}),k&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)(os.A,{className:"Nc3SOtKd",peers:A,size:"large"}),(0,ee.Y)("h3",{className:bA,children:c(S?"InvitePremiumBlockedTitle":"ChannelInviteViaLinkRestricted")}),(0,ee.Y)("p",{className:AA,children:(0,Ft.A)(k,["simple_markdown"])}),(0,ee.Y)(W.A,{withPremiumGradient:!0,isShiny:!0,size:"smaller",onClick:C,children:c("InvitePremiumBlockedSubscribe")})]}),w&&N&&(0,ee.Y)(ec.A,{className:"UoMeVIyC",children:c("InvitePremiumBlockedOr")}),N&&(0,ee.FD)(ee.FK,{children:[(0,ee.Y)("h3",{className:bA,children:c("InviteBlockedTitle")}),(0,ee.Y)("p",{className:AA,children:y}),(0,ee.Y)(Ci.A,{className:"nEYyTS_m",itemIds:m,selectedIds:d,lockedUnselectedIds:u,lockedUnselectedSubtitle:c("InvitePremiumBlockedUser"),onSelectedIdsChange:h,isViewOnly:!S,allowMultiple:!0,withStatus:!0,itemInputType:"checkbox"}),S&&(0,ee.Y)(W.A,{className:"Ttkq3nqt",size:"smaller",onClick:f,disabled:!d.length,children:c("SendInviteLink.ActionInvite")})]})]})})));var CA=i(84555);const SA=(0,s.ph)((({modal:e})=>{const{closeOneTimeMediaModal:t}=(0,n.ko)(),i=(0,M.A)(),s=(0,Ti.A)(e?.message,!0),{shouldRender:a,transitionClassNames:r}=(0,Oe.A)(Boolean(e)),d=(0,D.A)((()=>{})),h=(0,D.A)((()=>{t()}));if(!a||!s)return;const m=(0,l.Ie)(s),u=(0,c.SJA)((0,n.mS)()),p=i(m?"Chat.Voice.Single.Close":"Chat.Voice.Single.DeleteAndClose");return(0,ee.FD)("div",{className:(0,me.A)("c3xMWwzW",r),children:[function(){if(!s?.content)return;const{voice:e,video:t}=s.content;return e?(0,ee.Y)(Ac.Ay,{className:"VLiJWMs0",theme:u,message:s,origin:o.d9.OneTimeModal,autoPlay:!0,onPlay:d,onPause:h}):t?.isRound?(0,ee.Y)(CA.A,{className:"ML2YEpGq",message:s,origin:"oneTimeModal",onStop:h}):void 0}(),(0,ee.Y)("div",{className:"VWy1qXJL",children:(0,ee.Y)(W.A,{faded:!0,onClick:h,pill:!0,size:"smaller",color:"dark"===u?"dark":"secondary",className:"FfMrCmD9",children:p})})]})})),yA=(0,s.ph)((({isOpen:e})=>{const t=(0,M.A)(),i=(0,Vi.A)(),{closeWebAppsCloseConfirmationModal:o,closeWebAppModal:a}=(0,n.ko)(),[r,l]=(0,s.J0)(!1),c=(0,s.li)(),d=(0,s.hb)((()=>{o({shouldSkipInFuture:r})}),[r]),h=(0,s.hb)((()=>{a({shouldSkipConfirmation:!0}),o({shouldSkipInFuture:r})}),[r]),m=(0,s.hb)((e=>{-1===e&&h()}),[h]),u=(0,Bs.A)(c,e,m,".Button");return(0,ee.FD)(Z.A,{className:(0,me.A)("confirm"),title:i("CloseMiniApps"),isOpen:e,onClose:d,children:[(0,ee.Y)("p",{children:i("AreYouSureCloseMiniApps")}),(0,ee.Y)(en.A,{className:"dialog-checkbox",label:i("DoNotAskAgain"),checked:r,onCheck:l}),(0,ee.FD)("div",{className:"dialog-buttons mt-2",ref:c,onKeyDown:u,children:[(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:h,color:"danger",children:t("Confirm")}),(0,ee.Y)(W.A,{className:"confirm-dialog-button",isText:!0,onClick:d,children:t("Cancel")})]})]})})),kA=(0,s.ph)((0,n.EK)((e=>{const t=e.appConfig?.freezeUntilDate,i=e.appConfig?.freezeAppealUrl,s=e.botFreezeAppealId?(0,c.mBe)(e,e.botFreezeAppealId):void 0;return{freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:s&&(0,l.Kl)(s)}}))((({modal:e,freezeUntilDate:t,freezeAppealUrl:i,botFreezeAppealUsername:o})=>{const{closeFrozenAccountModal:a,openUrl:r}=(0,n.ko)(),l=(0,Vi.A)(),c=Boolean(e),d=(0,D.A)((()=>{a()})),h=(0,D.A)((()=>{a(),i&&r({url:i})})),m=(0,s.Kr)((()=>(0,ee.FD)("div",{className:"cW2rtp6M",children:[(0,ee.Y)(Sr.A,{size:160,tgsUrl:Cr.w.BannedDuck,noLoop:!0}),(0,ee.Y)("div",{className:"qLSm0uyC",children:l("FrozenAccountModalTitle")})]})),[l]),u=(0,s.Kr)((()=>{if(c)return(0,ee.FD)("div",{className:"Vj3QQ_JQ",children:[(0,ee.Y)(W.A,{className:"anvg3JaY",size:"smaller",onClick:h,noForcedUpperCase:!0,children:l("ButtonAppeal")}),(0,ee.Y)(W.A,{isText:!0,size:"smaller",onClick:d,noForcedUpperCase:!0,children:l("ButtonUnderstood")})]})}),[l,c]);if(!t||!o)return;const p=new Date(1e3*t),v=(0,ee.Y)(Na.A,{onClick:h,isPrimary:!0,children:(0,dc.A)(o)}),g=[["hand-stop",l("FrozenAccountViolationTitle"),l("FrozenAccountViolationSubtitle")],["lock",l("FrozenAccountReadOnlyTitle"),l("FrozenAccountReadOnlySubtitle")],["frozen-time",l("FrozenAccountAppealTitle"),l("FrozenAccountAppealSubtitle",{botLink:v,date:(0,ze.A)(p,l.code)},{withNodes:!0})]];return(0,ee.Y)(ml.A,{isOpen:c,header:m,listItemData:g,footer:u,hasBackdrop:!0,onClose:d})})))}}]);
//# sourceMappingURL=9451.ddc92e8a499ab0b273ef.js.map