define(["inputManager","focusManager","browser","layoutManager","events","dom"],function(inputmanager,focusManager,browser,layoutManager,events,dom){"use strict";var isMouseIdle,lastPointerMoveData,self={},lastMouseInputTime=Date.now();function removeIdleClasses(){isMouseIdle=!1,document.body.classList.remove("mouseIdle","mouseIdle-tv")}function addIdleClasses(){isMouseIdle=!0;var classList=document.body.classList;layoutManager.tv?classList.add("mouseIdle","mouseIdle-tv"):classList.add("mouseIdle")}var mouseInterval,undefinedString="undefined";function onPointerMove(e){var obj,eventX=e.screenX,eventY=e.screenY;typeof eventX===undefinedString&&typeof eventY===undefinedString||((obj=lastPointerMoveData)?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){var parent,pointerType=e.pointerType;pointerType&&"mouse"!==pointerType||isMouseIdle||(parent=focusManager.focusableParent(e.target))&&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}),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&&self.tizen&&dom.addEventListener(document,window.PointerEvent?"pointerenter":"mouseenter",onPointerEnter,{capture:!0,passive:!0})}return initMouse(),events.on(layoutManager,"modechange",initMouse),self});