require(["apphost"],function(appHost){"use strict";function throttle(key){var time=times[key]||0,now=(new Date).getTime();return now-time>=200}function resetThrottle(key){times[key]=(new Date).getTime()}function allowInput(){return!document.hidden}function raiseEvent(name,key,keyCode){if(allowInput()){var event=document.createEvent("Event");event.initEvent(name,!0,!0),event.key=key,event.keyCode=keyCode,(document.activeElement||document.body).dispatchEvent(event)}}function clickElement(elem){allowInput()&&elem.click()}function raiseKeyEvent(oldPressedState,newPressedState,key,keyCode,enableRepeatKeyDown,clickonKeyUp){if(newPressedState===!0){var fire=!1;oldPressedState===!1?(fire=!0,resetThrottle(key)):enableRepeatKeyDown&&(fire=throttle(key)),fire&&keyCode&&raiseEvent("keydown",key,keyCode)}else newPressedState===!1&&oldPressedState===!0&&(resetThrottle(key),keyCode&&raiseEvent("keyup",key,keyCode),clickonKeyUp&&clickElement(document.activeElement||window))}function runInputLoop(){var gamepads;navigator.getGamepads?gamepads=navigator.getGamepads():navigator.webkitGetGamepads&&(gamepads=navigator.webkitGetGamepads()),gamepads=gamepads||[];var i,j,len;for(i=0,len=gamepads.length;i_THUMB_STICK_THRESHOLD?_ButtonPressedState.setleftThumbstickRight(!0):leftStickX<-_THUMB_STICK_THRESHOLD?_ButtonPressedState.setleftThumbstickLeft(!0):leftStickY<-_THUMB_STICK_THRESHOLD?_ButtonPressedState.setleftThumbstickUp(!0):leftStickY>_THUMB_STICK_THRESHOLD?_ButtonPressedState.setleftThumbstickDown(!0):(_ButtonPressedState.setleftThumbstickLeft(!1),_ButtonPressedState.setleftThumbstickRight(!1),_ButtonPressedState.setleftThumbstickUp(!1),_ButtonPressedState.setleftThumbstickDown(!1));var buttons=gamepad.buttons;for(j=0,len=buttons.length;j