"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[84348],{84348:function(e,n,a){a.r(n),a(84734);var t=a(22622),o=!1,i=!1,c=!1,r=!1,d=!1,u=!1,s=!1,f=!1,l=null,m=!1,p=!1,v=[12,13,14,15,0,1],g=function(){return m},w=function(e){var n=z(m,e,"GamepadA",13,!1,!0,l);m=e,e?null!=n&&(l=n):l=null},b=function(){return p},k=function(e){z(p,e,"GamepadB",27),p=e},h=function(e){z(o,e,"GamepadLeftThumbStickUp",38,!0),o=e},G=function(e){z(i,e,"GamepadLeftThumbStickDown",40,!0),i=e},L=function(e){z(c,e,"GamepadLeftThumbStickLeft",37,!0),c=e},E=function(e){z(r,e,"GamepadLeftThumbStickRight",39,!0),r=e},D=function(){return d},T=function(e){z(d,e,"GamepadDPadUp",38,!0),d=e},y=function(){return u},P=function(e){z(u,e,"GamepadDPadDown",40,!0),u=e},S=function(){return s},A=function(e){z(s,e,"GamepadDPadLeft",37,!0),s=e},C=function(){return f},F=function(e){z(f,e,"GamepadDPadRight",39,!0),f=e},x={};function I(e){x[e]=(new Date).getTime()}var O,R=-1!==navigator.userAgent.toLowerCase().indexOf("electron");function U(){return!(!R&&document.hidden)&&"Minimized"!==t.g.getWindowState()}function q(e,n,a){if(U()){var t=new Event(e,{bubbles:!0,cancelable:!0});return t.key=n,t.keyCode=a,(document.activeElement||document.body).dispatchEvent(t),t}}function z(e,n,a,t,o,i,c){var r,d=null;if(!0===n){var u=!1;!1===e?(u=!0,I(a)):o&&(u=function(e){var n=x[e]||0;return(new Date).getTime()-n>=200}(a)),u&&t&&(d=q("keydown",a,t))}else if(!1===n&&!0===e){var s;I(a),t&&(d=q("keyup",a,t)),!i||null!=c&&c.defaultPrevented||null!==(s=d)&&void 0!==s&&s.defaultPrevented||(r=document.activeElement||window,U()&&r.click())}return d}function B(){for(var e=navigator.getGamepads(),n=0,a=e.length;n<a;n++){var t=e[n];if(t){var o=t.axes,i=o[0],c=o[1];i>.75?E(!0):i<-.75?L(!0):c<-.75?h(!0):c>.75?G(!0):(L(!1),E(!1),h(!1),G(!1));for(var r=t.buttons,d=0,u=r.length;d<u;d++)if(-1!==v.indexOf(d))if(r[d].pressed)switch(d){case 12:T(!0);break;case 13:P(!0);break;case 14:A(!0);break;case 15:F(!0);break;case 0:w(!0);break;case 1:k(!0)}else switch(d){case 12:D()&&T(!1);break;case 13:y()&&P(!1);break;case 14:S()&&A(!1);break;case 15:C()&&F(!1);break;case 0:g()&&w(!1);break;case 1:b()&&k(!1)}}}O=requestAnimationFrame(B)}function M(){for(var e=navigator.getGamepads(),n=0,a=e.length;n<a;n++){var t=e[n];if(null!=t&&t.connected)return!0}return!1}function N(){M()&&document.hasFocus()&&(console.log("Gamepad connected! Starting input loop"),O||B())}function W(){M()&&document.hasFocus()?console.log("Gamepad disconnected! There are gamepads still connected."):(console.log("Gamepad disconnected! No other gamepads are connected, stopping input loop"),cancelAnimationFrame(O),O=void 0)}window.addEventListener("gamepaddisconnected",W),window.addEventListener("gamepadconnected",N),window.addEventListener("blur",W),window.addEventListener("focus",N),N(),window.navigator&&"string"==typeof window.navigator.gamepadInputEmulation&&(window.navigator.gamepadInputEmulation="gamepad")}}]);