Loading
function(e,t,n){"use strict";let i;var r=n(649852),a=n.n(r),s=n(855986),l=n(73153),o=n(597798),d=n(77729),c=n(253932),u=n(927813),_=n(723702),E=n(46653),A=n(652215),f=n(731854);let h=Date.now(),I=!1,p=!1,m=!1,T=!1,g=!1;function S(){return m||T||(0,_.m0)()&&g}function N(){let e;Date.now()-h>6e5||S()?I||l.h.dispatch({type:"IDLE",idle:!0,idleSince:h}):I&&l.h.dispatch({type:"IDLE",idle:!1}),0===(e=c.cU.getSetting())||null!=i||Date.now()-h>Math.min(e*u.A.Millis.SECOND,6e5)||S()?p||l.h.dispatch({type:"AFK",afk:!0}):p&&l.h.dispatch({type:"AFK",afk:!1})}function C(e){e&&(i=Date.now()),N()}if(!__OVERLAY__){_.isPlatformEmbedded&&d.A?.powerMonitor!=null?(!function e(){function t(t){let n=Date.now()-t;(null==i||n>i)&&(h=Math.max(n,h),i=null),N(),setTimeout(e,10*u.A.Millis.SECOND)}if(d.A?.powerMonitor?.getSystemIdleTimeMs!=null){let e=d.A.powerMonitor.getSystemIdleTimeMs();e instanceof Promise?e.then(t):t(e)}}(),d.A.powerMonitor.on("resume",()=>{m=!1,C(!1)}),d.A.powerMonitor.on("suspend",()=>{m=!0,C(!0),o.default.disconnect()}),d.A.powerMonitor.on("lock-screen",()=>{T=!0,C(!0)}),d.A.powerMonitor.on("unlock-screen",()=>{T=!1,C(!1)})):setInterval(N,30*u.A.Millis.SECOND);let e=a()(()=>{O({})},500);window.addEventListener("mouseup",e),window.addEventListener("wheel",e),window.addEventListener("keypress",e)}function O(e){let{timestamp:t,type:n,bypassIdleUpdate:r}=e,a="OVERLAY_SET_NOT_IDLE"===n&&null!=t;return(!a||!(t<=h))&&!r&&(i=null,h=a?t:Date.now(),__OVERLAY__?l.h.dispatch({type:"OVERLAY_SET_NOT_IDLE",timestamp:h}):N(),!1)}class R extends s.Ay.Store{initialize(){this.waitFor(E.default)}static displayName="IdleStore";isIdle(){return I}isAFK(){return p}getIdleSince(){return I?h:null}getSystemSuspended(){return m}getSystemLocked(){return T}}let L=new R(l.h,{IDLE:function(e){I=e.idle},AFK:function(e){p=e.afk},SPEAKING:function(e){let{userId:t,speakingFlags:n}=e;return n!==f.ME.NONE&&t===E.default.getId()&&O({}),!1},APP_STATE_UPDATE:function(e){let{state:t}=e;return g=t===A.g6G.BACKGROUND,i=null,h=Date.now(),N(),!1},OVERLAY_SET_NOT_IDLE:O,CHANNEL_SELECT:O,VOICE_CHANNEL_SELECT:O,WINDOW_FOCUS:O,OVERLAY_INITIALIZE:O,OVERLAY_SET_INPUT_LOCKED:O});n.d(t,{},{A:L})}