Build 574548stable
Module 885576
2,186 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";let i;n.d(t,{A:()=>R});var r=n(111956),s=n.n(r),a=n(17928),o=n(228366),l=n(730852),u=n(77729),c=n(885386),d=n(927813),_=n(723702),h=n(280450),f=n(652215),E=n(731854);let p=Date.now(),m=!1,g=!1,A=!1,I=!1,T=!1;function S(){return A||I||(0,_.isAndroid)()&&T}function N(){let e;Date.now()-p>f.sdF||S()?m||o.h.dispatch({type:"IDLE",idle:!0,idleSince:p}):m&&o.h.dispatch({type:"IDLE",idle:!1}),0===(e=c.cU.getSetting())||null!=i||Date.now()-p>Math.min(e*d.A.Millis.SECOND,f.sdF)||S()?g||o.h.dispatch({type:"AFK",afk:!0}):g&&o.h.dispatch({type:"AFK",afk:!1})}function C(e){e&&(i=Date.now()),N()}if(!__OVERLAY__){_.isPlatformEmbedded&&u.A?.powerMonitor!=null?(!function e(){let t=t=>{let n=Date.now()-t;(null==i||n>i)&&(p=Math.max(n,p),i=null),N(),setTimeout(e,10*d.A.Millis.SECOND)};if(u.A?.powerMonitor?.getSystemIdleTimeMs!=null){let e=u.A.powerMonitor.getSystemIdleTimeMs();e instanceof Promise?e.then(t):t(e)}}(),u.A.powerMonitor.on("resume",()=>{A=!1,C(!1)}),u.A.powerMonitor.on("suspend",()=>{A=!0,C(!0),l.default.disconnect()}),u.A.powerMonitor.on("lock-screen",()=>{I=!0,C(!0)}),u.A.powerMonitor.on("unlock-screen",()=>{I=!1,C(!1)})):setInterval(N,30*d.A.Millis.SECOND);let e=s()(()=>{y({})},500);window.addEventListener("mouseup",e),window.addEventListener("wheel",e),window.addEventListener("keypress",e)}function y(e){let{timestamp:t,type:n,bypassIdleUpdate:r}=e,s="OVERLAY_SET_NOT_IDLE"===n&&null!=t;return(!s||!(t<=p))&&!r&&(i=null,p=s?t:Date.now(),__OVERLAY__?o.h.dispatch({type:"OVERLAY_SET_NOT_IDLE",timestamp:p}):N(),!1)}class O extends a.Ay.Store{initialize(){this.waitFor(h.default)}static displayName="IdleStore";isIdle(){return m}isAFK(){return g}getIdleSince(){return m?p:null}getSystemSuspended(){return A}getSystemLocked(){return I}}let R=new O(o.h,{IDLE:function(e){m=e.idle},AFK:function(e){g=e.afk},SPEAKING:function(e){let{userId:t,speakingFlags:n}=e;return n!==E.ME.NONE&&t===h.default.getId()&&y({}),!1},APP_STATE_UPDATE:function(e){let{state:t}=e;return T=t===f.g6G.BACKGROUND,i=null,p=Date.now(),N(),!1},OVERLAY_SET_NOT_IDLE:y,CHANNEL_SELECT:y,VOICE_CHANNEL_SELECT:y,WINDOW_FOCUS:y,OVERLAY_INITIALIZE:y,OVERLAY_SET_INPUT_LOCKED:y})}