!function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){!function(t){return t?void(t.aframeCore||t).registerComponent("gamepad-controls",i(1)):void console.error("Component attempted to register before AFRAME was available.")}(window.AFRAME)},function(t,e,i){var n=i(2),o=i(3),a=200,s=Math.PI/2,r=.2;t.exports={GamepadButton:n,schema:{controller:{"default":0,oneOf:[0,1,2,3]},enabled:{"default":!0},movementEnabled:{"default":!0},lookEnabled:{"default":!0},flyEnabled:{"default":!1},invertAxisY:{"default":!1},easing:{"default":20},acceleration:{"default":65},sensitivity:{"default":.04},pitchAxis:{"default":"x",oneOf:["x","y","z"]},yawAxis:{"default":"y",oneOf:["x","y","z"]},rollAxis:{"default":"z",oneOf:["x","y","z"]},debug:{"default":!1}},init:function(){this.velocity=new THREE.Vector3(0,0,0),this.direction=new THREE.Vector3(0,0,0),this.pitch=new THREE.Object3D,this.yaw=new THREE.Object3D,this.yaw.position.y=10,this.yaw.add(this.pitch),this.buttons={},this.getGamepad()||console.warn("Gamepad #%d not found. Connect controller and press any button to continue.",this.data.controller)},tick:function(t,e){this.updateRotation(e),this.updatePosition(e),this.updateButtonState()},updatePosition:function(t){var e=this.data,i=e.acceleration,n=e.easing,o=this.velocity,s=e.rollAxis,d=e.pitchAxis,u=this.el,c=this.getGamepad();if(t>a)return o[s]=0,void(o[d]=0);o[s]-=o[s]*n*t/1e3,o[d]-=o[d]*n*t/1e3;var h=u.getAttribute("position");if(e.enabled&&e.movementEnabled&&c){var l=this.getDpad(),p=l.x||this.getJoystick(0).x,E=l.y||this.getJoystick(0).y;Math.abs(p)>r&&(o[d]+=p*i*t/1e3),Math.abs(E)>r&&(o[s]+=E*i*t/1e3)}var f=this.getMovementVector(t);u.object3D.translateX(f.x),u.object3D.translateY(f.y),u.object3D.translateZ(f.z),u.setAttribute("position",{x:h.x+f.x,y:h.y+f.y,z:h.z+f.z})},getMovementVector:function(t){if(this._getMovementVector)return this._getMovementVector(t);var e=new THREE.Euler(0,0,0,"YXZ"),i=new THREE.Vector3;return this._getMovementVector=function(t){return i.copy(this.el.getAttribute("rotation")),this.direction.copy(this.velocity),this.direction.multiplyScalar(t/1e3),i?(this.data.flyEnabled||(i.x=0),e.set(THREE.Math.degToRad(i.x),THREE.Math.degToRad(i.y),0),this.direction.applyEuler(e),this.direction):this.direction},this._getMovementVector(t)},updateRotation:function(){if(this._updateRotation)return this._updateRotation();var t,e=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3,o=0,a=0,d=1e-4,u=500;return this._updateRotation=function(){if(this.data.lookEnabled&&this.getGamepad()){if(t=Date.now(),e.copy(this.el.getAttribute("rotation")||e),e.distanceToSquared(i)>d&&e.distanceToSquared(n)>d)return i.copy(e),void(a=t);if(i.copy(e),!(u>t-a)){var c=this.getJoystick(1);Math.abs(c.x)<=r&&(c.x=0),Math.abs(c.y)<=r&&(c.y=0),this.data.invertAxisY&&(c.y=-c.y),a>o&&!c.lengthSq()||(c.multiplyScalar(this.data.sensitivity),this.yaw.rotation.y-=c.x,this.pitch.rotation.x-=c.y,this.pitch.rotation.x=Math.max(-s,Math.min(s,this.pitch.rotation.x)),this.el.setAttribute("rotation",{x:THREE.Math.radToDeg(this.pitch.rotation.x),y:THREE.Math.radToDeg(this.yaw.rotation.y),z:0}),n.copy(this.el.getAttribute("rotation")),o=t)}}},this._updateRotation()},updateButtonState:function(){var t=this.getGamepad();if(this.data.enabled&&t)for(var e=0;e