aframe-extras
Version:
Add-ons and examples for A-Frame VR.
2 lines • 167 kB
JavaScript
/*! For license information please see aframe-extras.min.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("THREE"));else if("function"==typeof define&&define.amd)define(["THREE"],t);else{var n="object"==typeof exports?t(require("THREE")):t(e.THREE);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,e=>(()=>{var t={919(){!function(e){var t="KeyboardEvent"in e;t||(e.KeyboardEvent=function(){throw TypeError("Illegal constructor")}),"DOM_KEY_LOCATION_STANDARD"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_STANDARD=0),"DOM_KEY_LOCATION_LEFT"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_LEFT=1),"DOM_KEY_LOCATION_RIGHT"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_RIGHT=2),"DOM_KEY_LOCATION_NUMPAD"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD=3);var n=window.KeyboardEvent.DOM_KEY_LOCATION_STANDARD,o=window.KeyboardEvent.DOM_KEY_LOCATION_LEFT,i=window.KeyboardEvent.DOM_KEY_LOCATION_RIGHT,s=window.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;function r(e,t){return-1!==String(e).indexOf(t)}var a=r(navigator.platform,"Win")?"win":r(navigator.platform,"Mac")?"mac":r(navigator.platform,"CrOS")?"cros":r(navigator.platform,"Linux")?"linux":r(navigator.userAgent,"iPad")||r(navigator.platform,"iPod")||r(navigator.platform,"iPhone")?"ios":"",c=r(navigator.userAgent,"Chrome/")?"chrome":r(navigator.vendor,"Apple")?"safari":r(navigator.userAgent,"MSIE")?"ie":r(navigator.userAgent,"Gecko/")?"moz":r(navigator.userAgent,"Opera/")?"opera":"",l=c+"-"+a;function d(e,t,n){l!==t&&c!==t&&a!==t||Object.keys(n).forEach(function(t){e[t]=n[t]})}var h={3:{code:"Cancel"},6:{code:"Help"},8:{code:"Backspace"},9:{code:"Tab"},12:{code:"Clear"},13:{code:"Enter"},16:{code:"Shift"},17:{code:"Control"},18:{code:"Alt"},19:{code:"Pause"},20:{code:"CapsLock"},21:{code:"KanaMode"},22:{code:"HangulMode"},23:{code:"JunjaMode"},24:{code:"FinalMode"},25:{code:"KanjiMode"},27:{code:"Escape"},28:{code:"Convert"},29:{code:"NonConvert"},30:{code:"Accept"},31:{code:"ModeChange"},32:{code:"Space"},33:{code:"PageUp"},34:{code:"PageDown"},35:{code:"End"},36:{code:"Home"},37:{code:"ArrowLeft"},38:{code:"ArrowUp"},39:{code:"ArrowRight"},40:{code:"ArrowDown"},41:{code:"Select"},42:{code:"Print"},43:{code:"Execute"},44:{code:"PrintScreen"},45:{code:"Insert"},46:{code:"Delete"},47:{code:"Help"},48:{code:"Digit0",keyCap:"0"},49:{code:"Digit1",keyCap:"1"},50:{code:"Digit2",keyCap:"2"},51:{code:"Digit3",keyCap:"3"},52:{code:"Digit4",keyCap:"4"},53:{code:"Digit5",keyCap:"5"},54:{code:"Digit6",keyCap:"6"},55:{code:"Digit7",keyCap:"7"},56:{code:"Digit8",keyCap:"8"},57:{code:"Digit9",keyCap:"9"},65:{code:"KeyA",keyCap:"a"},66:{code:"KeyB",keyCap:"b"},67:{code:"KeyC",keyCap:"c"},68:{code:"KeyD",keyCap:"d"},69:{code:"KeyE",keyCap:"e"},70:{code:"KeyF",keyCap:"f"},71:{code:"KeyG",keyCap:"g"},72:{code:"KeyH",keyCap:"h"},73:{code:"KeyI",keyCap:"i"},74:{code:"KeyJ",keyCap:"j"},75:{code:"KeyK",keyCap:"k"},76:{code:"KeyL",keyCap:"l"},77:{code:"KeyM",keyCap:"m"},78:{code:"KeyN",keyCap:"n"},79:{code:"KeyO",keyCap:"o"},80:{code:"KeyP",keyCap:"p"},81:{code:"KeyQ",keyCap:"q"},82:{code:"KeyR",keyCap:"r"},83:{code:"KeyS",keyCap:"s"},84:{code:"KeyT",keyCap:"t"},85:{code:"KeyU",keyCap:"u"},86:{code:"KeyV",keyCap:"v"},87:{code:"KeyW",keyCap:"w"},88:{code:"KeyX",keyCap:"x"},89:{code:"KeyY",keyCap:"y"},90:{code:"KeyZ",keyCap:"z"},91:{code:"OSLeft",location:o},92:{code:"OSRight",location:i},93:{code:"ContextMenu"},95:{code:"Standby"},96:{code:"Numpad0",keyCap:"0",location:s},97:{code:"Numpad1",keyCap:"1",location:s},98:{code:"Numpad2",keyCap:"2",location:s},99:{code:"Numpad3",keyCap:"3",location:s},100:{code:"Numpad4",keyCap:"4",location:s},101:{code:"Numpad5",keyCap:"5",location:s},102:{code:"Numpad6",keyCap:"6",location:s},103:{code:"Numpad7",keyCap:"7",location:s},104:{code:"Numpad8",keyCap:"8",location:s},105:{code:"Numpad9",keyCap:"9",location:s},106:{code:"NumpadMultiply",keyCap:"*",location:s},107:{code:"NumpadAdd",keyCap:"+",location:s},108:{code:"NumpadComma",keyCap:",",location:s},109:{code:"NumpadSubtract",keyCap:"-",location:s},110:{code:"NumpadDecimal",keyCap:".",location:s},111:{code:"NumpadDivide",keyCap:"/",location:s},112:{code:"F1"},113:{code:"F2"},114:{code:"F3"},115:{code:"F4"},116:{code:"F5"},117:{code:"F6"},118:{code:"F7"},119:{code:"F8"},120:{code:"F9"},121:{code:"F10"},122:{code:"F11"},123:{code:"F12"},124:{code:"F13"},125:{code:"F14"},126:{code:"F15"},127:{code:"F16"},128:{code:"F17"},129:{code:"F18"},130:{code:"F19"},131:{code:"F20"},132:{code:"F21"},133:{code:"F22"},134:{code:"F23"},135:{code:"F24"},144:{code:"NumLock",location:s},145:{code:"ScrollLock"},160:{code:"ShiftLeft",location:o},161:{code:"ShiftRight",location:i},162:{code:"ControlLeft",location:o},163:{code:"ControlRight",location:i},164:{code:"AltLeft",location:o},165:{code:"AltRight",location:i},166:{code:"BrowserBack"},167:{code:"BrowserForward"},168:{code:"BrowserRefresh"},169:{code:"BrowserStop"},170:{code:"BrowserSearch"},171:{code:"BrowserFavorites"},172:{code:"BrowserHome"},173:{code:"VolumeMute"},174:{code:"VolumeDown"},175:{code:"VolumeUp"},176:{code:"MediaTrackNext"},177:{code:"MediaTrackPrevious"},178:{code:"MediaStop"},179:{code:"MediaPlayPause"},180:{code:"LaunchMail"},181:{code:"MediaSelect"},182:{code:"LaunchApp1"},183:{code:"LaunchApp2"},186:{code:"Semicolon",keyCap:";"},187:{code:"Equal",keyCap:"="},188:{code:"Comma",keyCap:","},189:{code:"Minus",keyCap:"-"},190:{code:"Period",keyCap:"."},191:{code:"Slash",keyCap:"/"},192:{code:"Backquote",keyCap:"`"},219:{code:"BracketLeft",keyCap:"["},220:{code:"Backslash",keyCap:"\\"},221:{code:"BracketRight",keyCap:"]"},222:{code:"Quote",keyCap:"'"},226:{code:"IntlBackslash",keyCap:"\\"},229:{code:"Process"},246:{code:"Attn"},247:{code:"CrSel"},248:{code:"ExSel"},249:{code:"EraseEof"},250:{code:"Play"},251:{code:"ZoomToggle"},254:{code:"Clear"}};d(h,"moz",{59:{code:"Semicolon",keyCap:";"},61:{code:"Equal",keyCap:"="},107:{code:"Equal",keyCap:"="},109:{code:"Minus",keyCap:"-"},187:{code:"NumpadAdd",keyCap:"+",location:s},189:{code:"NumpadSubtract",keyCap:"-",location:s}}),d(h,"moz-mac",{12:{code:"NumLock",location:s},173:{code:"Minus",keyCap:"-"}}),d(h,"moz-win",{173:{code:"Minus",keyCap:"-"}}),d(h,"chrome-mac",{93:{code:"OSRight",location:i}}),d(h,"safari",{3:{code:"Enter"},25:{code:"Tab"}}),d(h,"ios",{10:{code:"Enter",location:n}}),d(h,"safari-mac",{91:{code:"OSLeft",location:o},93:{code:"OSRight",location:i},229:{code:"KeyQ",keyCap:"Q"}});var u={};"cros"===a&&(u["U+00A0"]={code:"ShiftLeft",location:o},u["U+00A1"]={code:"ShiftRight",location:i},u["U+00A2"]={code:"ControlLeft",location:o},u["U+00A3"]={code:"ControlRight",location:i},u["U+00A4"]={code:"AltLeft",location:o},u["U+00A5"]={code:"AltRight",location:i}),"chrome-mac"===l&&(u["U+0010"]={code:"ContextMenu"}),"safari-mac"===l&&(u["U+0010"]={code:"ContextMenu"}),"ios"===a&&(u["U+0010"]={code:"Function"},u["U+001C"]={code:"ArrowLeft"},u["U+001D"]={code:"ArrowRight"},u["U+001E"]={code:"ArrowUp"},u["U+001F"]={code:"ArrowDown"},u["U+0001"]={code:"Home"},u["U+0004"]={code:"End"},u["U+000B"]={code:"PageUp"},u["U+000C"]={code:"PageDown"});var p=[];p[o]={16:{code:"ShiftLeft",location:o},17:{code:"ControlLeft",location:o},18:{code:"AltLeft",location:o}},p[i]={16:{code:"ShiftRight",location:i},17:{code:"ControlRight",location:i},18:{code:"AltRight",location:i}},p[s]={13:{code:"NumpadEnter",location:s}},d(p[s],"moz",{109:{code:"NumpadSubtract",location:s},107:{code:"NumpadAdd",location:s}}),d(p[o],"moz-mac",{224:{code:"OSLeft",location:o}}),d(p[i],"moz-mac",{224:{code:"OSRight",location:i}}),d(p[i],"moz-win",{91:{code:"OSRight",location:i}}),d(p[i],"mac",{93:{code:"OSRight",location:i}}),d(p[s],"chrome-mac",{12:{code:"NumLock",location:s}}),d(p[s],"safari-mac",{12:{code:"NumLock",location:s},187:{code:"NumpadAdd",location:s},189:{code:"NumpadSubtract",location:s},190:{code:"NumpadDecimal",location:s},191:{code:"NumpadDivide",location:s}});var f={ShiftLeft:{key:"Shift"},ShiftRight:{key:"Shift"},ControlLeft:{key:"Control"},ControlRight:{key:"Control"},AltLeft:{key:"Alt"},AltRight:{key:"Alt"},OSLeft:{key:"OS"},OSRight:{key:"OS"},NumpadEnter:{key:"Enter"},Space:{key:" "},Digit0:{key:"0",shiftKey:")"},Digit1:{key:"1",shiftKey:"!"},Digit2:{key:"2",shiftKey:"@"},Digit3:{key:"3",shiftKey:"#"},Digit4:{key:"4",shiftKey:"$"},Digit5:{key:"5",shiftKey:"%"},Digit6:{key:"6",shiftKey:"^"},Digit7:{key:"7",shiftKey:"&"},Digit8:{key:"8",shiftKey:"*"},Digit9:{key:"9",shiftKey:"("},KeyA:{key:"a",shiftKey:"A"},KeyB:{key:"b",shiftKey:"B"},KeyC:{key:"c",shiftKey:"C"},KeyD:{key:"d",shiftKey:"D"},KeyE:{key:"e",shiftKey:"E"},KeyF:{key:"f",shiftKey:"F"},KeyG:{key:"g",shiftKey:"G"},KeyH:{key:"h",shiftKey:"H"},KeyI:{key:"i",shiftKey:"I"},KeyJ:{key:"j",shiftKey:"J"},KeyK:{key:"k",shiftKey:"K"},KeyL:{key:"l",shiftKey:"L"},KeyM:{key:"m",shiftKey:"M"},KeyN:{key:"n",shiftKey:"N"},KeyO:{key:"o",shiftKey:"O"},KeyP:{key:"p",shiftKey:"P"},KeyQ:{key:"q",shiftKey:"Q"},KeyR:{key:"r",shiftKey:"R"},KeyS:{key:"s",shiftKey:"S"},KeyT:{key:"t",shiftKey:"T"},KeyU:{key:"u",shiftKey:"U"},KeyV:{key:"v",shiftKey:"V"},KeyW:{key:"w",shiftKey:"W"},KeyX:{key:"x",shiftKey:"X"},KeyY:{key:"y",shiftKey:"Y"},KeyZ:{key:"z",shiftKey:"Z"},Numpad0:{key:"0"},Numpad1:{key:"1"},Numpad2:{key:"2"},Numpad3:{key:"3"},Numpad4:{key:"4"},Numpad5:{key:"5"},Numpad6:{key:"6"},Numpad7:{key:"7"},Numpad8:{key:"8"},Numpad9:{key:"9"},NumpadMultiply:{key:"*"},NumpadAdd:{key:"+"},NumpadComma:{key:","},NumpadSubtract:{key:"-"},NumpadDecimal:{key:"."},NumpadDivide:{key:"/"},Semicolon:{key:";",shiftKey:":"},Equal:{key:"=",shiftKey:"+"},Comma:{key:",",shiftKey:"<"},Minus:{key:"-",shiftKey:"_"},Period:{key:".",shiftKey:">"},Slash:{key:"/",shiftKey:"?"},Backquote:{key:"`",shiftKey:"~"},BracketLeft:{key:"[",shiftKey:"{"},Backslash:{key:"\\",shiftKey:"|"},BracketRight:{key:"]",shiftKey:"}"},Quote:{key:"'",shiftKey:'"'},IntlBackslash:{key:"\\",shiftKey:"|"}};d(f,"mac",{OSLeft:{key:"Meta"},OSRight:{key:"Meta"}});var m,y,g,v={Esc:"Escape",Nonconvert:"NonConvert",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Menu:"ContextMenu",MediaNextTrack:"MediaTrackNext",MediaPreviousTrack:"MediaTrackPrevious",SelectMedia:"MediaSelect",HalfWidth:"Hankaku",FullWidth:"Zenkaku",RomanCharacters:"Romaji",Crsel:"CrSel",Exsel:"ExSel",Zoom:"ZoomToggle"},b=(m=h,y="code",g={},Object.keys(m).forEach(function(e){var t=m[e];y in t&&(g[t[y]]=t)}),g);try{var w=t&&"location"in new KeyboardEvent("")}catch(e){}function x(e){var t="keyCode"in e?e.keyCode:"which"in e?e.which:0,n=function(){if(w||"keyLocation"in e){var n=w?e.location:e.keyLocation;if(n&&t in p[n])return p[n][t]}return"keyIdentifier"in e&&e.keyIdentifier in u?u[e.keyIdentifier]:t in h?h[t]:null}();if(!n)return null;var o,i=(o=f[n.code])?e.shiftKey&&"shiftKey"in o?o.shiftKey:o.key:n.code;return{code:n.code,key:i,location:n.location,keyCap:n.keyCap}}"KeyboardEvent"in e&&"defineProperty"in Object&&function(){function e(e,t,n){t in e||Object.defineProperty(e,t,n)}if(e(KeyboardEvent.prototype,"code",{get:function(){var e=x(this);return e?e.code:""}}),"key"in KeyboardEvent.prototype){var t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,"key");Object.defineProperty(KeyboardEvent.prototype,"key",{get:function(){var e=t.get.call(this);return v.hasOwnProperty(e)?v[e]:e}})}e(KeyboardEvent.prototype,"key",{get:function(){var e=x(this);return e&&"key"in e?e.key:"Unidentified"}}),e(KeyboardEvent.prototype,"location",{get:function(){var e=x(this);return e&&"location"in e?e.location:n}}),e(KeyboardEvent.prototype,"locale",{get:function(){return""}})}(),"queryKeyCap"in e.KeyboardEvent||(e.KeyboardEvent.queryKeyCap=function(e,t){if(e=String(e),!b.hasOwnProperty(e))return"Undefined";if(t&&"en-us"!==String(t).toLowerCase())throw Error("Unsupported locale");var n=b[e];return n.keyCap||n.code||"Undefined"}),e.identifyKey=function(e){if(!("code"in e)){var t=x(e);e.code=t?t.code:"",e.key=t&&"key"in t?t.key:"Unidentified",e.location="location"in e?e.location:"keyLocation"in e?e.keyLocation:t&&"location"in t?t.location:n,e.locale=""}}}(window)},464(e){window,e.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var o,i=function(e,t){var n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)},s=function(e){return e*(Math.PI/180)},r=new Map,a=function(e){r.has(e)&&clearTimeout(r.get(e)),r.set(e,setTimeout(e,100))},c=function(e,t,n){for(var o,i=t.split(/[ ,]+/g),s=0;s<i.length;s+=1)o=i[s],e.addEventListener?e.addEventListener(o,n,!1):e.attachEvent&&e.attachEvent(o,n)},l=function(e,t,n){for(var o,i=t.split(/[ ,]+/g),s=0;s<i.length;s+=1)o=i[s],e.removeEventListener?e.removeEventListener(o,n):e.detachEvent&&e.detachEvent(o,n)},d=function(e){return e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e},h=function(){return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},u=function(e,t){t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},p=function(e,t,n){var o=f(e);for(var i in o)if(o.hasOwnProperty(i))if("string"==typeof t)o[i]=t+" "+n;else{for(var s="",r=0,a=t.length;r<a;r+=1)s+=t[r]+" "+n+", ";o[i]=s.slice(0,-2)}return o},f=function(e){var t={};return t[e]="",["webkit","Moz","o"].forEach(function(n){t[n+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},m=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},y=function(e,t){if(e.length)for(var n=0,o=e.length;n<o;n+=1)t(e[n]);else t(e)},g=!!("ontouchstart"in window),v=!!window.PointerEvent,b=!!window.MSPointerEvent,w={start:"mousedown",move:"mousemove",end:"mouseup"},x={};function k(){}v?o={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:b?o={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:g?(o={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},x=w):o=w,k.prototype.on=function(e,t){var n,o=e.split(/[ ,]+/g);this._handlers_=this._handlers_||{};for(var i=0;i<o.length;i+=1)n=o[i],this._handlers_[n]=this._handlers_[n]||[],this._handlers_[n].push(t);return this},k.prototype.off=function(e,t){return this._handlers_=this._handlers_||{},void 0===e?this._handlers_={}:void 0===t?this._handlers_[e]=null:this._handlers_[e]&&this._handlers_[e].indexOf(t)>=0&&this._handlers_[e].splice(this._handlers_[e].indexOf(t),1),this},k.prototype.trigger=function(e,t){var n,o=this,i=e.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var s=0;s<i.length;s+=1)n=i[s],o._handlers_[n]&&o._handlers_[n].length&&o._handlers_[n].forEach(function(e){e.call(o,{type:n,target:o},t)})},k.prototype.config=function(e){this.options=this.defaults||{},e&&(this.options=function(e,t){var n={};for(var o in e)e.hasOwnProperty(o)&&t.hasOwnProperty(o)?n[o]=t[o]:e.hasOwnProperty(o)&&(n[o]=e[o]);return n}(this.options,e))},k.prototype.bindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},n._domHandlers_[t]=function(){"function"==typeof n["on"+t]?n["on"+t].apply(n,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},c(e,o[t],n._domHandlers_[t]),x[t]&&c(e,x[t],n._domHandlers_[t]),n},k.prototype.unbindEvt=function(e,t){return this._domHandlers_=this._domHandlers_||{},l(e,o[t],this._domHandlers_[t]),x[t]&&l(e,x[t],this._domHandlers_[t]),delete this._domHandlers_[t],this};var E=k;function A(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=A.id,A.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}A.prototype=new E,A.constructor=A,A.id=0,A.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},A.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=function(){var e=f("borderRadius");for(var t in e)e.hasOwnProperty(t)&&(e[t]="50%");return e}(),n=p("transition","opacity",e),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",left:0,marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:this.options.color,opacity:".5"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",left:0,marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:this.options.color,opacity:".5",transform:"translate(0px, 0px)"},m(o.el,n),"circle"===this.options.shape&&m(o.back,t),m(o.front,t),this.applyStyles(o),this},A.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var n in e[t])this.ui[t].style[n]=e[t][n];return this},A.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},A.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},A.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},A.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)},t.options.fadeTime)),t},A.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var n="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=n,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){var n=t.options.restJoystick,o={};o.x=!0===n||!1!==n.x?0:t.instance.frontPosition.x,o.y=!0===n||!1!==n.y?0:t.instance.frontPosition.y,t.setPosition(e,o)}return t},A.prototype.setPosition=function(e,t){var n=this;n.frontPosition={x:t.x,y:t.y};var o=n.options.fadeTime+"ms",i={};i.front=p("transition",["transform"],o);var s={front:{}};s.front={transform:"translate("+n.frontPosition.x+"px,"+n.frontPosition.y+"px)"},n.applyStyles(i),n.applyStyles(s),n.restTimeout=setTimeout(function(){"function"==typeof e&&e.call(n),n.restCallback()},n.options.fadeTime)},A.prototype.restCallback=function(){var e={};e.front=p("transition","none",""),this.applyStyles(e),this.trigger("rested",this.instance)},A.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},A.prototype.computeDirection=function(e){var t,n,o,i=e.angle.radian,s=Math.PI/4,r=Math.PI/2;if(i>s&&i<3*s&&!e.lockX?t="up":i>-s&&i<=s&&!e.lockY?t="left":i>3*-s&&i<=-s&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=i>-r&&i<r?"left":"right"),e.lockX||(o=i>0?"up":"down"),e.force>this.options.threshold){var a,c={};for(a in this.direction)this.direction.hasOwnProperty(a)&&(c[a]=this.direction[a]);var l={};for(a in this.direction={x:n,y:o,angle:t},e.direction=this.direction,c)c[a]===this.direction[a]&&(l[a]=!0);if(l.x&&l.y&&l.angle)return e;l.x&&l.y||this.trigger("plain",e),l.x||this.trigger("plain:"+n,e),l.y||this.trigger("plain:"+o,e),l.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var T=A;function N(e,t){this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=N.id,N.id+=1,this.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},this.config(t),"static"!==this.options.mode&&"semi"!==this.options.mode||(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1);var n=getComputedStyle(this.options.zone.parentElement);return n&&"flex"===n.display&&(this.parentIsFlex=!0),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}N.prototype=new E,N.constructor=N,N.id=0,N.prototype.prepareNipples=function(){var e=this.nipples;e.on=this.on.bind(this),e.off=this.off.bind(this),e.options=this.options,e.destroy=this.destroy.bind(this),e.ids=this.ids,e.id=this.id,e.processOnMove=this.processOnMove.bind(this),e.processOnEnd=this.processOnEnd.bind(this),e.get=function(t){if(void 0===t)return e[0];for(var n=0,o=e.length;n<o;n+=1)if(e[n].identifier===t)return e[n];return!1}},N.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},N.prototype.begin=function(){var e=this.options;if("static"===e.mode){var t=this.createNipple(e.position,this.manager.getIdentifier());t.add(),this.idles.push(t)}},N.prototype.createNipple=function(e,t){var n=this.manager.scroll,o={},i=this.options,s=this.parentIsFlex?n.x:n.x+this.box.left,r=this.parentIsFlex?n.y:n.y+this.box.top;if(e.x&&e.y)o={x:e.x-s,y:e.y-r};else if(e.top||e.right||e.bottom||e.left){var a=document.createElement("DIV");a.style.display="hidden",a.style.top=e.top,a.style.right=e.right,a.style.bottom=e.bottom,a.style.left=e.left,a.style.position="absolute",i.zone.appendChild(a);var c=a.getBoundingClientRect();i.zone.removeChild(a),o=e,e={x:c.left+n.x,y:c.top+n.y}}var l=new T(this,{color:i.color,size:i.size,threshold:i.threshold,fadeTime:i.fadeTime,dataOnly:i.dataOnly,restJoystick:i.restJoystick,restOpacity:i.restOpacity,mode:i.mode,identifier:t,position:e,zone:i.zone,frontPosition:{x:0,y:0},shape:i.shape});return i.dataOnly||(u(l.ui.el,o),u(l.ui.front,l.frontPosition)),this.nipples.push(l),this.trigger("added "+l.identifier+":added",l),this.manager.trigger("added "+l.identifier+":added",l),this.bindNipple(l),l},N.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},N.prototype.bindNipple=function(e){var t,n=this,o=function(e,o){t=e.type+" "+o.id+":"+e.type,n.trigger(t,o)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",o),e.on("dir:up dir:right dir:down dir:left",o),e.on("plain:up plain:right plain:down plain:left",o)},N.prototype.pressureFn=function(e,t,n){var o=this,i=0;clearInterval(o.pressureIntervals[n]),o.pressureIntervals[n]=setInterval(function(){var n=e.force||e.pressure||e.webkitForce||0;n!==i&&(t.trigger("pressure",n),o.trigger("pressure "+t.identifier+":pressure",n),i=n)}.bind(o),100)},N.prototype.onstart=function(e){var t=this,n=t.options,o=e;return e=d(e),t.updateBox(),y(e,function(i){t.actives.length<n.maxNumberOfNipples?t.processOnStart(i):o.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(n){if(Object.values(o.touches).findIndex(function(e){return e.identifier===n})<0){var i=[e[0]];i.identifier=n,t.processOnEnd(i)}}),t.actives.length<n.maxNumberOfNipples&&t.processOnStart(i))}),t.manager.bindDocument(),!1},N.prototype.processOnStart=function(e){var t,n=this,o=n.options,s=n.manager.getIdentifier(e),r=e.force||e.pressure||e.webkitForce||0,a={x:e.pageX,y:e.pageY},c=n.getOrCreate(s,a);c.identifier!==s&&n.manager.removeIdentifier(c.identifier),c.identifier=s;var l=function(t){t.trigger("start",t),n.trigger("start "+t.id+":start",t),t.show(),r>0&&n.pressureFn(e,t,t.identifier),n.processOnMove(e)};if((t=n.idles.indexOf(c))>=0&&n.idles.splice(t,1),n.actives.push(c),n.ids.push(c.identifier),"semi"!==o.mode)l(c);else{if(!(i(a,c.position)<=o.catchDistance))return c.destroy(),void n.processOnStart(e);l(c)}return c},N.prototype.getOrCreate=function(e,t){var n,o=this.options;return/(semi|static)/.test(o.mode)?(n=this.idles[0])?(this.idles.splice(0,1),n):"semi"===o.mode?this.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):n=this.createNipple(t,e)},N.prototype.processOnMove=function(e){var t=this.options,n=this.manager.getIdentifier(e),o=this.nipples.get(n),r=this.manager.scroll;if(function(e){return isNaN(e.buttons)?0!==e.pressure:0!==e.buttons}(e)){if(!o)return console.error("Found zombie joystick with ID "+n),void this.manager.removeIdentifier(n);if(t.dynamicPage){var a=o.el.getBoundingClientRect();o.position={x:r.x+a.left,y:r.y+a.top}}o.identifier=n;var c=o.options.size/2,l={x:e.pageX,y:e.pageY};t.lockX&&(l.y=o.position.y),t.lockY&&(l.x=o.position.x);var d,h,u,p,f,m,y,g,v,b,w=i(l,o.position),x=(d=l,u=(h=o.position).x-d.x,p=h.y-d.y,function(e){return e*(180/Math.PI)}(Math.atan2(p,u))),k=s(x),E=w/c,A={distance:w,position:l};if("circle"===o.options.shape?(f=Math.min(w,c),y=o.position,g=f,b={x:0,y:0},v=s(v=x),b.x=y.x-g*Math.cos(v),b.y=y.y-g*Math.sin(v),m=b):(m=function(e,t,n){return{x:Math.min(Math.max(e.x,t.x-n),t.x+n),y:Math.min(Math.max(e.y,t.y-n),t.y+n)}}(l,o.position,c),f=i(m,o.position)),t.follow){if(w>c){var T=l.x-m.x,N=l.y-m.y;o.position.x+=T,o.position.y+=N,o.el.style.top=o.position.y-(this.box.top+r.y)+"px",o.el.style.left=o.position.x-(this.box.left+r.x)+"px",w=i(l,o.position)}}else l=m,w=f;var M=l.x-o.position.x,C=l.y-o.position.y;o.frontPosition={x:M,y:C},t.dataOnly||(o.ui.front.style.transform="translate("+M+"px,"+C+"px)");var D={identifier:o.identifier,position:l,force:E,pressure:e.force||e.pressure||e.webkitForce||0,distance:w,angle:{radian:k,degree:x},vector:{x:M/c,y:-C/c},raw:A,instance:o,lockX:t.lockX,lockY:t.lockY};(D=o.computeDirection(D)).angle={radian:s(180-x),degree:180-x},o.trigger("move",D),this.trigger("move "+o.id+":move",D)}else this.processOnEnd(e)},N.prototype.processOnEnd=function(e){var t=this,n=t.options,o=t.manager.getIdentifier(e),i=t.nipples.get(o),s=t.manager.removeIdentifier(i.identifier);i&&(n.dataOnly||i.hide(function(){"dynamic"===n.mode&&(i.trigger("removed",i),t.trigger("removed "+i.id+":removed",i),t.manager.trigger("removed "+i.id+":removed",i),i.destroy())}),clearInterval(t.pressureIntervals[i.identifier]),i.resetDirection(),i.trigger("end",i),t.trigger("end "+i.id+":end",i),t.ids.indexOf(i.identifier)>=0&&t.ids.splice(t.ids.indexOf(i.identifier),1),t.actives.indexOf(i)>=0&&t.actives.splice(t.actives.indexOf(i),1),/(semi|static)/.test(n.mode)?t.idles.push(i):t.nipples.indexOf(i)>=0&&t.nipples.splice(t.nipples.indexOf(i),1),t.manager.unbindDocument(),/(semi|static)/.test(n.mode)&&(t.manager.ids[s.id]=s.identifier))},N.prototype.onDestroyed=function(e,t){this.nipples.indexOf(t)>=0&&this.nipples.splice(this.nipples.indexOf(t),1),this.actives.indexOf(t)>=0&&this.actives.splice(this.actives.indexOf(t),1),this.idles.indexOf(t)>=0&&this.idles.splice(this.idles.indexOf(t),1),this.ids.indexOf(t.identifier)>=0&&this.ids.splice(this.ids.indexOf(t.identifier),1),this.manager.removeIdentifier(t.identifier),this.manager.unbindDocument()},N.prototype.destroy=function(){for(var e in this.unbindEvt(this.options.zone,"start"),this.nipples.forEach(function(e){e.destroy()}),this.pressureIntervals)this.pressureIntervals.hasOwnProperty(e)&&clearInterval(this.pressureIntervals[e]);this.trigger("destroyed",this.nipples),this.manager.unbindDocument(),this.off()};var M=N;function C(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=h(),t.config(e),t.prepareCollections();var n=function(){var e;t.collections.forEach(function(n){n.forEach(function(n){e=n.el.getBoundingClientRect(),n.position={x:t.scroll.x+e.left,y:t.scroll.y+e.top}})})};c(window,"resize",function(){a(n)});var o=function(){t.scroll=h()};return c(window,"scroll",function(){a(o)}),t.collections}C.prototype=new E,C.constructor=C,C.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var n;return e.collections.every(function(e){return!(n=e.get(t))}),n}},C.prototype.create=function(e){return this.createCollection(e)},C.prototype.createCollection=function(e){var t=new M(this,e);return this.bindCollection(t),this.collections.push(t),t},C.prototype.bindCollection=function(e){var t,n=this,o=function(e,o){t=e.type+" "+o.id+":"+e.type,n.trigger(t,o)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",o),e.on("dir:up dir:right dir:down dir:left",o),e.on("plain:up plain:right plain:down plain:left",o)},C.prototype.bindDocument=function(){this.binded||(this.bindEvt(document,"move").bindEvt(document,"end"),this.binded=!0)},C.prototype.unbindDocument=function(e){Object.keys(this.ids).length&&!0!==e||(this.unbindEvt(document,"move").unbindEvt(document,"end"),this.binded=!1)},C.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},C.prototype.removeIdentifier=function(e){var t={};for(var n in this.ids)if(this.ids[n]===e){t.id=n,t.identifier=this.ids[n],delete this.ids[n];break}return t},C.prototype.onmove=function(e){return this.onAny("move",e),!1},C.prototype.onend=function(e){return this.onAny("end",e),!1},C.prototype.oncancel=function(e){return this.onAny("end",e),!1},C.prototype.onAny=function(e,t){var n,o=this,i="processOn"+e.charAt(0).toUpperCase()+e.slice(1);return t=d(t),y(t,function(e){n=o.getIdentifier(e),y(o.collections,function(e,t,n){n.ids.indexOf(t)>=0&&(n[i](e),e._found_=!0)}.bind(null,e,n)),e._found_||o.removeIdentifier(n)}),!1},C.prototype.destroy=function(){this.unbindDocument(!0),this.ids={},this.index=0,this.collections.forEach(function(e){e.destroy()}),this.off()},C.prototype.onDestroyed=function(e,t){if(this.collections.indexOf(t)<0)return!1;this.collections.splice(this.collections.indexOf(t),1)};var D=new C;t.default={create:function(e){return D.create(e)},factory:D}}]).default},804(){AFRAME.registerComponent("checkpoint-controls",{schema:{enabled:{default:!0},mode:{default:"teleport",oneOf:["teleport","animate"]},animateSpeed:{default:3}},init:function(){this.active=!0,this.checkpoint=null,this.isNavMeshConstrained=!1,this.offset=new THREE.Vector3,this.position=new THREE.Vector3,this.targetPosition=new THREE.Vector3},play:function(){this.active=!0},pause:function(){this.active=!1},setCheckpoint:function(e){const t=this.el;this.active&&this.checkpoint!==e&&(this.checkpoint&&t.emit("navigation-end",{checkpoint:this.checkpoint}),this.checkpoint=e,this.sync(),this.position.distanceTo(this.targetPosition)<.1?this.checkpoint=null:(t.emit("navigation-start",{checkpoint:e}),"teleport"===this.data.mode&&(this.el.setAttribute("position",this.targetPosition),this.checkpoint=null,t.emit("navigation-end",{checkpoint:e}),t.components["movement-controls"].updateNavLocation())))},isVelocityActive:function(){return!(!this.active||!this.checkpoint)},getVelocity:function(){if(!this.active)return;const e=this.data,t=this.offset,n=this.position,o=this.targetPosition,i=this.checkpoint;return this.sync(),n.distanceTo(o)<.1?(this.checkpoint=null,this.el.emit("navigation-end",{checkpoint:i}),t.set(0,0,0)):(t.setLength(e.animateSpeed),t)},sync:function(){const e=this.offset,t=this.position,n=this.targetPosition;t.copy(this.el.getAttribute("position")),this.checkpoint.object3D.getWorldPosition(n),n.add(this.checkpoint.components.checkpoint.getOffset()),e.copy(n).sub(t)}})},914(e,t,n){"use strict";n(804);const o=Object.assign(function(){},{FACE_1:0,FACE_2:1,FACE_3:2,FACE_4:3,L_SHOULDER_1:4,R_SHOULDER_1:5,L_SHOULDER_2:6,R_SHOULDER_2:7,SELECT:8,START:9,DPAD_UP:12,DPAD_DOWN:13,DPAD_LEFT:14,DPAD_RIGHT:15,VENDOR:16}),i=function(e,t,n){this.type=e,this.index=t,this.pressed=n.pressed,this.value=n.value},s=.2,r="left",a="right";AFRAME.registerComponent("gamepad-controls",{GamepadButton:o,schema:{enabled:{default:!0},rotationSensitivity:{default:2}},init:function(){const e=this.el.sceneEl;this.system=e.systems["tracked-controls"]||e.systems["tracked-controls-webxr"]||{controllers:[]},this.prevTime=window.performance.now(),this.buttons={};const t=this.el.object3D.rotation;this.pitch=new THREE.Object3D,this.pitch.rotation.x=t.x,this.yaw=new THREE.Object3D,this.yaw.position.y=10,this.yaw.rotation.y=t.y,this.yaw.add(this.pitch),this._lookVector=new THREE.Vector2,this._moveVector=new THREE.Vector2,this._dpadVector=new THREE.Vector2,e.addBehavior(this)},update:function(){this.tick()},tick:function(e,t){this.updateButtonState(),this.updateRotation(t)},remove:function(){},isVelocityActive:function(){if(!this.data.enabled||!this.isConnected())return!1;const e=this._dpadVector,t=this._moveVector;this.getDpad(e),this.getJoystick(1,t);const n=e.x||t.x,o=e.y||t.y;return Math.abs(n)>s||Math.abs(o)>s},getVelocityDelta:function(){const e=this._dpadVector,t=this._moveVector;this.getDpad(e),this.getJoystick(1,t);const n=e.x||t.x,o=e.y||t.y,i=new THREE.Vector3;return Math.abs(n)>s&&(i.x+=n),Math.abs(o)>s&&(i.z+=o),i},isRotationActive:function(){if(!this.data.enabled||!this.isConnected())return!1;const e=this._lookVector;return this.getJoystick(2,e),Math.abs(e.x)>s||Math.abs(e.y)>s},updateRotation:function(e){if(!this.isRotationActive())return;const t=this.data,n=this.yaw,o=this.pitch;n.rotation.y=this.el.object3D.rotation.y,o.rotation.x=this.el.object3D.rotation.x;const i=this._lookVector;this.getJoystick(2,i),Math.abs(i.x)<=s&&(i.x=0),Math.abs(i.y)<=s&&(i.y=0),i.multiplyScalar(t.rotationSensitivity*e/1e3),n.rotation.y-=i.x,o.rotation.x-=i.y,o.rotation.x=Math.max(-Math.PI/2,Math.min(Math.PI/2,o.rotation.x)),this.el.object3D.rotation.set(o.rotation.x,n.rotation.y,0)},updateButtonState:function(){const e=this.getGamepad(a);if(this.data.enabled&&e)for(var t=0;t<e.buttons.length;t++)e.buttons[t].pressed&&!this.buttons[t]?this.emit(new i("gamepadbuttondown",t,e.buttons[t])):!e.buttons[t].pressed&&this.buttons[t]&&this.emit(new i("gamepadbuttonup",t,e.buttons[t])),this.buttons[t]=e.buttons[t].pressed;else for(const e in this.buttons)this.buttons[e]=!1},emit:function(e){this.el.emit(e.type,e),this.el.emit(e.type+":"+e.index,new i(e.type,e.index,e))},getGamepad:function(){const e=[],t=[];return function(n){const o=this.el.sceneEl.components["proxy-controls"],i=o&&o.isConnected()&&o.getGamepad(0);if(i)return i;e.length=0;for(let t=0;t<this.system.controllers.length;t++){const o=this.system.controllers[t],i=o?o.gamepad:null;if(e.push(i),i&&o.handedness===n)return i}const s=navigator.getGamepads?navigator.getGamepads():t;for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.hand===n)return t}return e[0]||s[0]}}(),getButton:function(e){return this.getGamepad(a).buttons[e]},getAxis:function(e){return this.getGamepad(e>1?a:r).axes[e]},getJoystick:function(e,t){const n=this.getGamepad(1===e?r:a);if(!n)return t.set(0,0);if("xr-standard"===n.mapping)switch(e){case 1:return t.set(n.axes[2],n.axes[3]);case 2:return t.set(n.axes[2],0)}else switch(e){case 1:return t.set(n.axes[0],n.axes[1]);case 2:return t.set(n.axes[2],n.axes[3])}throw new Error('Unexpected joystick index "%d".',e)},getDpad:function(e){const t=this.getGamepad(r);return t&&t.buttons[o.DPAD_RIGHT]?e.set((t.buttons[o.DPAD_RIGHT].pressed?1:0)+(t.buttons[o.DPAD_LEFT].pressed?-1:0),(t.buttons[o.DPAD_UP].pressed?-1:0)+(t.buttons[o.DPAD_DOWN].pressed?1:0)):e.set(0,0)},isConnected:function(){const e=this.getGamepad(r);return!(!e||!e.connected)},getID:function(){return this.getGamepad(r).id}}),n(919);const c=window.KeyboardEvent;AFRAME.registerComponent("keyboard-controls",{schema:{enabled:{default:!0},debug:{default:!1}},init:function(){this.dVelocity=new THREE.Vector3,this.localKeys={},this.listeners={keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this),blur:this.onBlur.bind(this),onContextMenu:this.onContextMenu.bind(this)}},isVelocityActive:function(){return this.data.enabled&&!!Object.keys(this.getKeys()).length},getVelocityDelta:function(){const e=this.data,t=this.getKeys();return this.dVelocity.set(0,0,0),e.enabled&&((t.KeyW||t.ArrowUp)&&(this.dVelocity.z-=1),(t.KeyA||t.ArrowLeft)&&(this.dVelocity.x-=1),(t.KeyS||t.ArrowDown)&&(this.dVelocity.z+=1),(t.KeyD||t.ArrowRight)&&(this.dVelocity.x+=1),t.ShiftLeft&&(this.dVelocity=this.dVelocity.multiplyScalar(2))),this.dVelocity.clone()},play:function(){this.attachEventListeners()},pause:function(){this.removeEventListeners()},attachEventListeners:function(){window.addEventListener("contextmenu",this.listeners.onContextMenu,!1),window.addEventListener("keydown",this.listeners.keydown,!1),window.addEventListener("keyup",this.listeners.keyup,!1),window.addEventListener("blur",this.listeners.blur,!1)},onContextMenu:function(){for(const e in this.localKeys)this.localKeys.hasOwnProperty(e)&&delete this.localKeys[e]},removeEventListeners:function(){window.removeEventListener("keydown",this.listeners.keydown),window.removeEventListener("keyup",this.listeners.keyup),window.removeEventListener("blur",this.listeners.blur)},onKeyDown:function(e){AFRAME.utils.shouldCaptureKeyEvent(e)&&(this.localKeys[e.code]=!0,this.emit(e))},onKeyUp:function(e){AFRAME.utils.shouldCaptureKeyEvent(e)&&(delete this.localKeys[e.code],this.emit(e))},onBlur:function(){for(const e in this.localKeys)this.localKeys.hasOwnProperty(e)&&delete this.localKeys[e]},emit:function(e){"__keyboard-controls-proxy"in e&&this.el.emit(e.type,e),this.el.emit(e.type+":"+e.code,new c(e.type,e)),this.data.debug&&console.log(e.type+":"+e.code)},isPressed:function(e){return e in this.getKeys()},getKeys:function(){return this.isProxied()?this.el.sceneEl.components["proxy-controls"].getKeyboard():this.localKeys},isProxied:function(){const e=this.el.sceneEl.components["proxy-controls"];return e&&e.isConnected()}}),n(267),n(537),n(822);var l=n(464),d=n.n(l);AFRAME.registerComponent("nipple-controls",{schema:{enabled:{default:!0},mode:{default:"dynamic",oneOf:["static","semi","dynamic"]},rotationSensitivity:{default:1},moveJoystickEnabled:{default:!0},lookJoystickEnabled:{default:!0},sideMargin:{default:"30px"},bottomMargin:{default:"70px"},moveJoystickPosition:{default:"left",oneOf:["left","right"]},lookJoystickPosition:{default:"right",oneOf:["left","right"]}},init(){this.dVelocity=new THREE.Vector3,this.lookVector=new THREE.Vector2;const e=this.el.querySelector("[look-controls]").components["look-controls"];this.pitchObject=e.pitchObject,this.yawObject=e.yawObject,this.rigRotation=this.el.object3D.rotation,this.moveData=void 0,this.lookData=void 0,this.moving=!1,this.rotating=!1},update(e){this.data.moveJoystickPosition===e.moveJoystickPosition&&this.data.sideMargin===e.sideMargin&&this.data.bottomMargin===e.bottomMargin&&this.data.mode===e.mode||this.removeMoveJoystick(),this.data.lookJoystickPosition===e.lookJoystickPosition&&this.data.sideMargin===e.sideMargin&&this.data.bottomMargin===e.bottomMargin&&this.data.mode===e.mode||this.removeLookJoystick(),this.data.enabled&&this.data.moveJoystickEnabled?this.createMoveJoystick():this.removeMoveJoystick(),this.data.enabled&&this.data.lookJoystickEnabled?this.createLookJoystick():this.removeLookJoystick()},pause(){this.moving=!1,this.rotating=!1},remove(){this.removeMoveJoystick(),this.removeLookJoystick()},isVelocityActive(){return this.data.enabled&&this.moving},getVelocityDelta(){if(this.dVelocity.set(0,0,0),this.isVelocityActive()){const e=this.moveData.force<1?this.moveData.force:1,t=this.moveData.angle.radian,n=Math.cos(t)*e,o=-Math.sin(t)*e;this.dVelocity.set(n,0,o)}return this.dVelocity},isRotationActive(){return this.data.enabled&&this.rotating},updateRotation(e){if(!this.isRotationActive())return;const t=this.lookData.force<1?this.lookData.force:1,n=this.lookData.angle.radian,o=this.lookVector;o.x=Math.cos(n)*t,o.y=Math.sin(n)*t,o.multiplyScalar(this.data.rotationSensitivity*e/1e3),this.yawObject.rotation.y-=o.x;let i=this.pitchObject.rotation.x+o.y;i=Math.max(-Math.PI/2,Math.min(Math.PI/2,i)),this.pitchObject.rotation.x=i},tick:function(e,t){this.updateRotation(t)},initLeftZone(){const e=document.createElement("div");e.setAttribute("id","joystickLeftZone"),e.setAttribute("style",`position:absolute;${this.data.moveJoystickPosition}:${this.data.sideMargin};bottom:${this.data.bottomMargin};z-index:1`),this.el.sceneEl.appendChild(e),this.leftZone=e},initRightZone(){const e=document.createElement("div");e.setAttribute("id","joystickRightZone"),e.setAttribute("style",`position:absolute;${this.data.lookJoystickPosition}:${this.data.sideMargin};bottom:${this.data.bottomMargin};z-index:1`),this.el.sceneEl.appendChild(e),this.rightZone=e},createMoveJoystick(){if(this.moveJoystick)return;this.initLeftZone();const e={mode:this.data.mode,zone:this.leftZone,color:"white",fadeTime:0};this.leftZone.style.width="100px","static"===this.data.mode?(this.leftZone.style.height="100px",e.position={left:"50%",bottom:"50%"}):this.leftZone.style.height="400px",this.moveJoystick=d().create(e),this.moveJoystick.on("move",(e,t)=>{this.moveData=t,this.moving=!0}),this.moveJoystick.on("end",(e,t)=>{this.moving=!1})},createLookJoystick(){if(this.lookJoystick)return;this.initRightZone();const e={mode:this.data.mode,zone:this.rightZone,color:"white",fadeTime:0};this.rightZone.style.width="100px","static"===this.data.mode?(this.rightZone.style.height="100px",e.position={left:"50%",bottom:"50%"}):this.rightZone.style.height="400px",this.lookJoystick=d().create(e),this.lookJoystick.on("move",(e,t)=>{this.lookData=t,this.rotating=!0}),this.lookJoystick.on("end",(e,t)=>{this.rotating=!1})},removeMoveJoystick(){this.moveJoystick&&(this.moveJoystick.destroy(),this.moveJoystick=void 0),this.moveData=void 0,this.leftZone&&this.leftZone.parentNode&&(this.leftZone.remove(),this.leftZone=void 0)},removeLookJoystick(){this.lookJoystick&&(this.lookJoystick.destroy(),this.lookJoystick=void 0),this.lookData=void 0,this.rightZone&&this.rightZone.parentNode&&(this.rightZone.remove(),this.rightZone=void 0)}})},537(){const e="-controls";AFRAME.registerComponent("movement-controls",{dependencies:["rotation"],schema:{enabled:{default:!0},controls:{default:["gamepad","trackpad","keyboard","touch"]},speed:{default:.3,min:0},fly:{default:!1},constrainToNavMesh:{default:!1},camera:{default:"[movement-controls] [camera]",type:"selector"}},init:function(){const e=this.el;this.data.camera||(this.data.camera=e.querySelector("[camera]")),this.velocityCtrl=null,this.velocity=new THREE.Vector3,this.heading=new THREE.Quaternion,this.eventDetail={},this.navGroup=null,this.navNode=null,e.sceneEl.hasLoaded?this.injectControls():e.sceneEl.addEventListener("loaded",this.injectControls.bind(this))},update:function(t){const n=this.el,o=this.data,i=n.sceneEl.systems.nav;if(n.sceneEl.hasLoaded&&this.injectControls(),i&&o.constrainToNavMesh!==t.constrainToNavMesh&&(o.constrainToNavMesh?i.addAgent(this):i.removeAgent(this)),o.enabled!==t.enabled)for(let t=0;t<o.controls.length;t++){const n=o.controls[t]+e;this.el.setAttribute(n,{enabled:this.data.enabled})}},injectControls:function(){const t=this.data;for(let n=0;n<t.controls.length;n++){const o=t.controls[n]+e;this.el.setAttribute(o,{enabled:this.data.enabled})}},updateNavLocation:function(){this.navGroup=null,this.navNode=null},tick:function(){const e=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;return function(i,s){if(!s)return;const r=this.el,a=this.data;if(!a.enabled)return;this.updateVelocityCtrl();const c=this.velocityCtrl,l=this.velocity,d=this.el.sceneEl.is("vr-mode");if(c||d)if(s/1e3>.2?l.set(0,0,0):this.updateVelocity(s),a.constrainToNavMesh&&(!c&&d||!1!==c.isNavMeshConstrained)){if(l.lengthSq()<1e-5)return;e.copy(r.object3D.position),d&&(a.camera.object3D.getWorldPosition(o),r.object3D.parent&&r.object3D.parent.worldToLocal(o),o.sub(r.object3D.position),o.y=0,e.add(o)),c?t.copy(l).multiplyScalar(s/1e3).add(e):t.copy(e);const i=r.sceneEl.systems.nav;this.navGroup=null===this.navGroup?i.getGroup(e):this.navGroup,this.navNode=this.navNode||i.getNode(e,this.navGroup),this.navNode=i.clampStep(e,t,this.navGroup,this.navNode,n),d&&n.sub(o),r.object3D.position.copy(n)}else c&&r.hasAttribute("velocity")?r.setAttribute("velocity",l):c&&(r.object3D.position.x+=l.x*s/1e3,r.object3D.position.y+=l.y*s/1e3,r.object3D.position.z+=l.z*s/1e3)}}(),updateVelocityCtrl:function(){const t=this.data;if(t.enabled){for(let n=0,o=t.controls.length;n<o;n++){const o=this.el.components[t.controls[n]+e];if(o&&o.isVelocityActive())return void(this.velocityCtrl=o)}this.velocityCtrl=null}},updateVelocity:function(){const e=new THREE.Vector2,t=new THREE.Quaternion;return function(n){let o;const i=this.el,s=this.velocityCtrl,r=this.velocity,a=this.data;if(s){if(!s.getVelocityDelta){if(s.getVelocity)return void r.copy(s.getVelocity());if(s.getPositionDelta)return void r.copy(s.getPositionDelta(n).multiplyScalar(1e3/n));throw new Error("Incompatible movement controls: ",s)}o=s.getVelocityDelta(n)}if(i.hasAttribute("velocity")&&!a.constrainToNavMesh&&r.copy(this.el.getAttribute("velocity")),o&&a.enabled){const n=a.camera;t.copy(n.object3D.quaternion),t.premultiply(i.object3D.quaternion),o.applyQuaternion(t);const s=o.length();a.fly?(r.copy(o),r.multiplyScalar(16.66667*this.data.speed)):(e.set(o.x,o.z),e.setLength(s*this.data.speed*16.66667),r.x=e.x,r.y=0,r.z=e.y),0===r.x&&0===r.y&&0===r.z||(this.eventDetail.velocity=r,this.el.emit("moved",this.eventDetail))}}}()})},267(){AFRAME.registerComponent("touch-controls",{schema:{enabled:{default:!0},reverseEnabled:{default:!0}},init:function(){this.dVelocity=new THREE.Vector3,this.bindMethods(),this.direction=0},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.dVelocity.set(0,0,0)},remove:function(){this.pause()},addEventListeners:function(){const e=this.el.sceneEl,t=e.canvas;if(!t)return void e.addEventListener("render-target-loaded",this.addEventListeners.bind(this));t.addEventListener("touchstart",this.onTouchStart,{passive:!0}),t.addEventListener("touchend",this.onTouchEnd,{passive:!0});const n=e.getAttribute("vr-mode-ui");n&&n.cardboardModeEnabled&&e.addEventListener("enter-vr",this.onEnterVR)},removeEventListeners:function(){const e=this.el.sceneEl&&this.el.sceneEl.canvas;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("touchend",this.onTouchEnd),this.el.sceneEl.removeEventListener("enter-vr",this.onEnterVR))},isVelocityActive:function(){return this.data.enabled&&!!this.direction},getVelocityDelta:function(){return this.dVelocity.z=this.direction,this.dVelocity.clone()},bindMethods:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},onTouchStart:function(e){this.direction=-1,this.data.reverseEnabled&&e.touches&&2===e.touches.length&&(this.direction=1),e.preventDefault()},onTouchEnd:function(e){this.direction=0,e.preventDefault()},onEnterVR:function(){const e=this.el.sceneEl.xrSession;e&&(e.addEventListener("selectstart",this.onTouchStart),e.addEventListener("selectend",this.onTouchEnd))}})},822(){AFRAME.registerComponent("trackpad-controls",{schema:{enabled:{default:!0},enableNegX:{default:!0},enablePosX:{default:!0},enableNegZ:{default:!0},enablePosZ:{default:!0},mode:{default:"touch",oneOf:["swipe","touch","press"]}},init:function(){this.dVelocity=new THREE.Vector3,this.zVel=0,this.xVel=0,this.bindMethods()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.dVelocity.set(0,0,0)},remove:function(){this.pause()},addEventListeners:function(){const e=this.data,t=this.el.sceneEl;switch(t.addEventListener("axismove",this.onAxisMove),e.mode){case"swipe":case"touch":t.addEventListener("trackpadtouchstart",this.onTouchStart),t.addEventListener("trackpadtouchend",this.onTouchEnd);break;case"press":t.addEventListener("