define(["inputManager","focusManager","browser","layoutManager","events","dom"],function(inputmanager,focusManager,browser,layoutManager,events,dom){"use strict";var isMouseIdle,lastPointerMoveData,lastMouseInputTime=Date.now();function removeIdleClasses(){isMouseIdle=!1;var classList=document.body.classList;classList.remove("mouseIdle"),classList.remove("mouseIdle-tv")}function addIdleClasses(){isMouseIdle=!0;var classList=document.body.classList;classList.add("mouseIdle"),layoutManager.tv&&classList.add("mouseIdle-tv")}var mouseInterval,undefinedString="undefined";function onPointerMove(e){var eventX=e.screenX,eventY=e.screenY;if(typeof eventX!==undefinedString||typeof eventY!==undefinedString){var obj=lastPointerMoveData;obj?Math.abs(eventX-obj.x)<10&&Math.abs(eventY-obj.y)<10||(obj.x=eventX,obj.y=eventY,lastMouseInputTime=Date.now(),inputmanager.notifyMouseMove(),isMouseIdle&&removeIdleClasses()):lastPointerMoveData={x:eventX,y:eventY}}}function onPointerEnter(e){if("mouse"===(e.pointerType||(layoutManager.mobile?"touch":"mouse"))&&!isMouseIdle){var parent=focusManager.focusableParent(e.target);parent&&focusManager.focus(parent)}}function onMouseInterval(){!isMouseIdle&&5e3<=Date.now()-lastMouseInputTime&&addIdleClasses()}function initMouse(){mouseInterval&&(clearInterval(mouseInterval),mouseInterval=null),layoutManager.tv?addIdleClasses():removeIdleClasses(),dom.removeEventListener(document,"pointermove",onPointerMove,{passive:!0}),dom.removeEventListener(document,"mousemove",onPointerMove,{passive:!0}),layoutManager.mobile||(mouseInterval=mouseInterval||setInterval(onMouseInterval,5e3),window.PointerEvent?dom.addEventListener(document,"pointermove",onPointerMove,{passive:!0}):dom.addEventListener(document,"mousemove",onPointerMove,{passive:!0})),dom.removeEventListener(document,window.PointerEvent?"pointerenter":"mouseenter",onPointerEnter,{capture:!0,passive:!0}),layoutManager.tv&&!browser.web0s&&browser.tv&&dom.addEventListener(document,window.PointerEvent?"pointerenter":"mouseenter",onPointerEnter,{capture:!0,passive:!0})}return initMouse(),events.on(layoutManager,"modechange",initMouse),{}});