define(["exports","./../common/globalize.js","./../emby-apiclient/events.js","./../common/usersettings/usersettings.js","./../common/inputmanager.js","./../common/playback/playbackmanager.js","./../input/mouse.js","./../common/methodtimer.js"],function(_exports,_globalize,_events,_usersettings,_inputmanager,_playbackmanager,_mouse,_methodtimer){function confirmStillPlaying(){var options,minIdleTime=_usersettings.default.stillWatchingTimeMs();return minIdleTime<=0||_inputmanager.default.idleTime()<minIdleTime||Date.now()-_mouse.default.lastMouseInputTime()<minIdleTime?Promise.resolve():(options={title:null,text:_globalize.default.translate("AreYouStillWatching"),confirmText:_globalize.default.translate("HeaderContinueWatching"),cancelText:_globalize.default.translate("Stop"),cancelResult:"cancel",timeout:6e4},Emby.importModule("./modules/common/dialogs/confirm.js").then(function(confirm){return confirm(options)}))}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=function(){var confirmTimeout;function clearConfirmTimer(){confirmTimeout&&(confirmTimeout.destroy(),confirmTimeout=null)}function onConfirmTimeout(){confirmStillPlaying().catch(function(result){"cancel"!==result&&"_timeout"!==result||_playbackmanager.default.stop()})}this.name="Are You Still Watching?",this.type="preplayintercept",this.id="stillplaying",this.intercept=function(options){return clearConfirmTimer(),"Video"===options.mediaType&&options.fullscreen?confirmStillPlaying():Promise.resolve()},_events.default.on(_playbackmanager.default,"playbackstart",function(e,player,state){"Video"===(state.NowPlayingItem||{}).MediaType&&player.isLocalPlayer&&!player.isExternalPlayer&&0<_usersettings.default.stillWatchingTimeMs()?(clearConfirmTimer(),confirmTimeout=new _methodtimer.default({onInterval:onConfirmTimeout,timeoutMs:3e4,type:"interval"})):clearConfirmTimer()}),_events.default.on(_playbackmanager.default,"playbackstop",clearConfirmTimer)}});