Loading
function(t,e,n){n.d(e,{pD:()=>tu,cH:()=>to}),n(321073);var i=n(731738),l=n(136722),a=n(17928),r=n(506774),o=n(765178),u=n(228366),s=n(308528),d=n(367513),c=n(66834),A=n(264686),f=n(730852),_=n(77729),E=n(883600),N=n(963027),g=n(47167),T=n(435470),I=n(707592),h=n(741231),C=n(380335),S=n(320095),p=n(807393),O=n(535586),m=n(944043),y=n(571524),U=n(181370),P=n.n(U),D=n(695515),R=n(976860),v=n(378570),L=n(790535),k=n(446600),w=n(747926),G=n(885386),V=n(718446),M=n(260509),b=n(734057),F=n(71393),W=n(232835),H=n(803224),Y=n(576705),B=n(568548),x=n(994500),K=n(309010),q=n(461213),J=n(351906),j=n(870570),X=n(287809),$=n(977997),z=n(174459),Q=n(562153),Z=n(723702),tt=n(427262),te=n(479975),tn=n(652215),ti=n(988794),tl=n(672396),ta=n(355097),tr=n(375708);let to="message1",tu=.4,ts=_.A?.features.supports("notifications")?20:1,td="discord_dismissed_notification_shown",tc=document.hasFocus(),tA=null,tf=new Set,t_=["FR","GF","PF","TF","RE","GP","MQ","YT","NC","PM","WF"],tE=new class{_channels={};track(t,e,n){let i=this._channels[t];for(null==i&&(i=[],this._channels[t]=i),i.push({notification:e,trackingProps:n});i.length>ts;){let t=i.shift();t?.notification?.close!=null&&(t.notification.close(),z.default.track(tn.HAw.NOTIFICATION_ACTION,{action:"REMOVE",...t.trackingProps}))}}clearChannel(t){let e=this._channels[t];null!=e&&(delete this._channels[t],e.forEach(t=>{let{notification:e,trackingProps:n}=t;e.close(),z.default.track(tn.HAw.NOTIFICATION_ACTION,{action:"ACK",...n})}))}};function tN(){return!!(H.A.getDesktopType()===tn.nRU.NEVER||q.A.getStatus()===tn.clD.DND||G.NO.getSetting()||D.A.isCurrentUserInRestrictedHours())}function tg(t){p.A.increment({name:i.K.NOTIFICATION_SOUND_PLAYBACK_ATTEMPT,tags:[`reason:${t?"played":"disabled_by_user"}`]})}function tT(t){return null!=$.A.getVoiceStateForChannel(t)}class tI extends a.Ay.Store{static displayName="NotificationStore";initialize(){this.waitFor(E.A,b.A,D.A,F.A,C.A,W.A,H.A,Y.A,B.Ay,x.A,K.A,q.A,k.A,J.A,j.A,X.default,$.A)}}new tI(u.h,__OVERLAY__?{}:{NOTIFICATIONS_SET_PERMISSION_STATE:function(t){let{enabled:e}=t;e!==tn.kCE.ENABLED||Z.isPlatformEmbedded||te.A.showNotification(n(705194),tr.intl.string(tr.t.VSgOVg),tr.intl.string(tr.t["1UJvqc"]),{notif_type:"NOTIFICATIONS_SET_PERMISSION_STATE"},{sound:to,volume:tu,tag:"hello",onClick:()=>{window.focus()},isUserAvatar:!1})},NOTIFICATION_CREATE:function(t){let{icon:e,title:n,body:i,trackingProps:l,options:a}=t;return!tN()&&(te.A.showNotification(e,n,i,l,a),!1)},WINDOW_FOCUS:function(t){if(tc=t.focused){let t=K.A.getChannelId();null!=t&&tE.clearChannel(t)}},MESSAGE_CREATE:function(t){let{channelId:e,message:l,optimistic:a}=t;if(a)return!1;let r=b.A.getChannel(e),s=X.default.getUser(l.author?.id),c=X.default.getCurrentUser();if(null==r||null==s||null==c)return!1;let f=W.A.getMessage(e,l.id)??(0,S.rh)(l),_=B.Ay.getMentionCount(e);(0,B.Wm)(f,c)&&_>0&&o.O.announce((0,N.Ay)({channel:r,mentionCount:_}));let g=(0,m.lx)(l,e,!tc),T=H.A.getNotifyMessagesInSelectedChannel()&&(0,m.kY)(l,e);if(!g&&!T)return!1;if(D.A.isCurrentUserInRestrictedHours())return p.A.increment({name:i.K.NOTIFICATION_SOUND_PLAYBACK_ATTEMPT,tags:["reason:restricted_hours"]}),!1;if(j.A.hasAction())return p.A.increment({name:i.K.NOTIFICATION_SOUND_PLAYBACK_ATTEMPT,tags:["reason:required_action"]}),!1;if(l.type===tn.lAJ.CHANGELOG&&(null==l.changelog_id||E.A.latestChangelogId()!==l.changelog_id))return!1;let I=!H.A.isSoundDisabled(to);if(T&&(tg(I),I&&te.A.playNotificationSound("message3",.4),!tc)||!g)return!1;let h=n(773371).default,C=n(592598).A;if(null!=h.getFocusedPID()&&!C.isNotificationDisabled(tl.KS.TextChat)&&!J.A.disableNotifications)return!1;let{icon:y,title:U,body:R,emoji:L}=(0,m.TB)(r,l,s),k=!function(t){let e;return null!=t&&((e=P().v3(String(t)))<0&&(e+=0x100000000),e%0x7fffffff<21474836.47)}(c?.id);if(u.h.dispatch({type:"RPC_NOTIFICATION_CREATE",channelId:r.id,message:l,icon:y,title:U,body:R}),(0,O.n)(l,r.guild_id),H.A.getDesktopType()===tn.nRU.NEVER)return tg(I),I&&te.A.playNotificationSound(to,tu),!1;tg(I),te.A.showNotification(y,U,R,{notif_type:"MESSAGE_CREATE",notif_user_id:l.author?.id,message_id:l.id,message_type:l.type,channel_id:r.id,channel_type:r.type,guild_id:r.guild_id,badge:(0,B.Wm)(f,c)},{omitViewTracking:k,tag:l.id,sound:I?to:void 0,volume:tu,onClick(){(0,v.iN)(r.id),(r.type===tn.rbe.GUILD_VOICE||r.type===tn.rbe.GUILD_STAGE_VOICE)&&d.A.updateChatOpen(r.id,!0),A.default.clickedNotification()},isUserAvatar:!0,messageRecord:f,fallbackDeepLink:(0,te.I)(tn.BVt.CHANNEL(r.guild_id,r.id,l.id)),emoji:L}).then(t=>{null!=t&&tE.track(r.id,t.notification,t.trackingProps)})},CHANNEL_SELECT:function(t){let{channelId:e}=t;return null!=e&&tE.clearChannel(e),!1},MESSAGE_ACK:function(t){let{channelId:e}=t;return tE.clearChannel(e),!1},ACTIVITY_START:function(t){let{userId:e,activity:n}=t;if(tN()||n.type!==tn.$pd.PLAYING)return!1;{let t=X.default.getUser(e);if(null==t)return!1;let i=tt.Ay.getName(t),l=n.name,a=t.getAvatarURL(void 0,128),r=tr.intl.string(tr.t.XoTWsI),o=tr.intl.formatToPlainString(tr.t.o4Aipn,{username:i,gameName:l});return te.A.showNotification(a,r,o,{notif_type:"ACTIVITY_START",activity_type:tn.$pd.PLAYING,notif_user_id:e,activity_name:l},{sound:"message2",playSoundIfDisabled:!1,volume:.4,onClick(){s.A.openPrivateChannel({recipientIds:e})},isUserAvatar:!0}),!1}},VOICE_STATE_UPDATES:function(t){let{voiceStates:e}=t;if(tN())return;let n=X.default.getCurrentUser();if(null==n)return;let i=e.find(t=>t.userId===n.id);if(null==i)return;let{channelId:l,guildId:a,suppress:r,requestToSpeakTimestamp:o}=i;if(null==l||null==a||!(!r&&null!=o))return;let u=F.A.getGuild(a),s=b.A.getChannel(l),d=k.A.getStageInstanceByChannel(l);null!=u&&null!=s&&null!=d&&te.A.showNotification((0,M.Iv)(u,128),(0,g.m1)(s,X.default,x.A),tr.intl.formatToPlainString(tr.t.sqnsSP,{channelName:(0,g.m1)(s,X.default,x.A),channelTopic:d?.topic}),{notif_type:"Stage Speak Invite"},{isUserAvatar:!1})},STAGE_INSTANCE_UPDATE:function(t){let{instance:e}=t;if(tN()||!e.send_start_notification||tT(e.channel_id))return!1;let n=X.default.getCurrentUser(),i=F.A.getGuild(e.guild_id),a=b.A.getChannel(e.channel_id),r=X.default.getUser(e.host_id);if(null==n||null==a||null==i||null==r||!(0,m.Wv)(n,r,a)||!Y.A.can(l.kg(tn.xBc.CONNECT,tn.xBc.VIEW_CHANNEL),a)||tf.has(e.id))return!1;tf.add(e.id),te.A.showNotification((0,M.Iv)(i,128),tr.intl.formatToPlainString(tr.t.bZ4Okd,{guildName:i.name}),tr.intl.formatToPlainString(tr.t.qTelnO,{username:Q.Ay.getName(i.id,a.id,r),topic:e.topic}),{notif_type:"STAGE_INSTANCE_CREATE",guild_id:i.id,channel_id:a.id},{onClick(){(0,L.av)(a)},isUserAvatar:!1})},STAGE_INSTANCE_DELETE:function(t){let{instance:e}=t;tf.delete(e.id)},GUILD_SCHEDULED_EVENT_UPDATE:function(t){let{guildScheduledEvent:e}=t;if(tN()||null==e.notification_type)return!1;e.notification_type===ti.b8.EVENT_START?e.entity_type===ti.Ps.STAGE_INSTANCE||e.entity_type===ti.Ps.VOICE?function(t){if(tN())return;let e=t.channel_id;if(null==e||tT(e))return;let n=X.default.getCurrentUser(),i=F.A.getGuild(t.guild_id),a=b.A.getChannel(t.channel_id),r=X.default.getUser(t.host_id);null!=n&&null!=a&&null!=i&&null!=r&&Y.A.can(l.kg(tn.xBc.CONNECT,tn.xBc.VIEW_CHANNEL),a)&&te.A.showNotification((0,M.Iv)(i,128),tr.intl.formatToPlainString(tr.t.bOu6Wn,{guildName:i.name}),tr.intl.formatToPlainString(tr.t.GV9L8u,{topic:t.name,username:Q.Ay.getName(i.id,a.id,r)}),{notif_type:"GUILD_SCHEDULED_EVENT_UPDATE",guild_id:i.id,channel_id:a.id},{onClick(){t.entity_type===ti.Ps.STAGE_INSTANCE&&(0,L.av)(a),t.entity_type===ti.Ps.VOICE&&f.default.selectVoiceChannel(a.id)},isUserAvatar:!1})}(e):e.entity_type===ti.Ps.EXTERNAL&&function(t){if(tN())return;let e=X.default.getCurrentUser(),n=F.A.getGuild(t.guild_id);null==e||null==n||te.A.showNotification((0,M.Iv)(n,128),tr.intl.formatToPlainString(tr.t.bOu6Wn,{guildName:n.name}),tr.intl.formatToPlainString(tr.t.mYyaRB,{topic:t.name}),{notif_type:"GUILD_SCHEDULED_EVENT_UPDATE",guild_id:n.id},{onClick(){c.A.transitionToGuildSync(t.guild_id),(0,I.uR)({eventId:t.id})},isUserAvatar:!1})}(e):e.notification_type},THREAD_CREATE:function(t){let{channel:e,isNewlyCreated:n}=t;if(tN())return!1;let i=b.A.getChannel(e.parent_id);if(null==i||!tn.kvI.GUILD_THREADS_ONLY.has(i.type)||!n||!(0,m.q1)(e,i,!tc))return!1;let{author:l,user:a}=(0,T.tY)(e);if(null==a)return!1;let r=F.A.getGuild(i.guild_id);if(null==r)return!1;let o=tr.intl.formatToPlainString(tr.t["2IGVl5"],{channelName:(0,g.m1)(i,X.default,x.A),guildName:r.name}),u=tr.intl.formatToPlainString(tr.t.jPhTvT,{channelName:(0,g.m1)(e,X.default,x.A),userUsername:l?.nick??a?.username}),s=a.getAvatarURL(void 0,128);te.A.showNotification(s,o,u,{notif_type:"THREAD_CREATE",notif_user_id:a.id},{onClick(){(0,w.JA)(e)},isUserAvatar:!0})},GENERIC_PUSH_NOTIFICATION_SENT:function(t){let e,{icon:n,title:i,body:l,route:a,trackingType:r,tag:o}=t;if(tN()||null==i||null==l||null==r||"reactions_push_notification"===r.toLowerCase())return!1;te.A.showNotification(n,i,l,{notif_type:r},{onClick(){null!=a&&((0,h.A)(a),A.default.clickedNotification())},tag:o,isUserAvatar:!1}).then(t=>{null!=t&&null!=e&&tE.track(e,t.notification,t.trackingProps)})},REACTION_NOTIFICATION_SENT:function(t){let{icon:e,title:n,body:i,route:l,trackingType:a,message:r,reactorUserId:o}=t;if(tN()||null==n||null==i||null==a)return!1;let u=r.channel_id;if(null==u)return!1;let s=b.A.getChannel(u);if(null==s)return!1;let d=X.default.getUser(o);if(!(0,m.nR)({message:r,channel:s,reactor:d,includeSelectedChannel:!tc}))return!1;if(s.type===tn.rbe.GROUP_DM){let t=X.default.getCurrentUser();if(r.author?.id!==t?.id&&!y.A.getConfig({location:"desktopNotification"}).showSettingsToggle)return!1}te.A.showNotification(e,n,i,{notif_type:a,notif_user_id:o,message_id:r.id},{onClick(){null!=l&&((0,h.A)(l),A.default.clickedNotification())},isUserAvatar:!0}).then(t=>{null!=t&&null!=u&&tE.track(u,t.notification,t.trackingProps)})},WINDOW_HIDDEN:function(){let t=(0,Z.isWindows)(),e=(0,Z.isLinux)();if(!(!r.w.get(td,!1)&&Z.isPlatformEmbedded&&(t||e)))return!1;let i=!1;return null!=tA&&(i=t_.includes(tA)),!!i&&(te.A.showNotification(n(608598),tr.intl.string(tr.t.VSgOVg),tr.intl.string(tr.t["+J/F66"]),{notif_type:"WINDOW_HIDDEN"},{overrideStreamerMode:!0,onClick:()=>{(0,R.pX)((0,V.settingsPathToRoute)(t?ta.od.WINDOWS:ta.od.LINUX))},onShown:()=>{r.w.set(td,!0)},isUserAvatar:!1}),!1)},LOGOUT:function(){return r.w.remove(td),!1},CONNECTION_OPEN:function(t){let{countryCode:e,guilds:n}=t;tA=e,tf.clear(),n.forEach(t=>t.stage_instances.forEach(t=>tf.add(t.id)))},MESSAGE_REMINDER_DUE:function(t){let{savedMessage:e}=t;if(tN())return!1;let n=e.message;if(null==n||null==n.author)return!1;let i=b.A.getChannel(e.saveData.channelId);if(null==i)return!1;let{icon:l,body:a}=(0,m.TB)(i,n,n.author);te.A.showNotification(l,tr.intl.string(tr.t.IjZJB5),a,{notif_type:"MESSAGE_REMINDER_DUE"},{onClick(){(0,h.A)(tn.BVt.CHANNEL(i?.getGuildId(),i.id,n.id))},isUserAvatar:!0})},RESTRICTED_HOURS_WARNING:function(t){let{title:e,subtitle:i}=t;if(tN()||!H.A.screenDowntimeReminder)return!1;te.A.showNotification(n(608598),e,i,{notif_type:"RESTRICTED_HOURS_WARNING"},{isUserAvatar:!1})}})}