aframe-extras
Version:
Add-ons and examples for A-Frame VR.
1 lines • 171 kB
JavaScript
!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={862:e=>{e.exports=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})},964:e=>{e.exports=function(e,t,n){this.type=e,this.index=t,this.pressed=n.pressed,this.value=n.value}},37:e=>{function t(e){const t=document.getElementById(e),n=t.parentNode;try{n&&n.removeChild(t)}catch(e){}}e.exports=function(e){return e=e||{},function(n,o){return function(e,n,o){return new o((function(o,i){const s=n.timeout||5e3,r="script_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),a=function(e,t){var n=document.createElement("script");return n.type="text/javascript",n.async=!0,n.id=t,n.src=e,n}(e,r),c=setTimeout((function(){i(new Error("Script request to "+e+" timed out")),t(r)}),s),l=function(e){clearTimeout(e)};a.addEventListener("load",(function(e){o({ok:!0}),l(c),t(r)})),a.addEventListener("error",(function(n){i(new Error("Script request to "+e+" failed "+n)),l(c),t(r)})),function(e){const t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}(a)}))}(n,o=o||{},e.Promise||Promise)}}},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 M(e,t){this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=M.id,M.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}M.prototype=new E,M.constructor=M,M.id=0,M.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}},M.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},M.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)}},M.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},M.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},M.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)},M.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)},M.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},M.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},M.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)},M.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,M=l.y-m.y;o.position.x+=T,o.position.y+=M,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 N=l.x-o.position.x,C=l.y-o.position.y;o.frontPosition={x:N,y:C},t.dataOnly||(o.ui.front.style.transform="translate("+N+"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:N/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)},M.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))},M.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()},M.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 N=M;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 N(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},570:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Pathfinding:()=>a,PathfindingHelper:()=>c});var o=n(612);class i{static roundNumber(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}static sample(e){return e[Math.floor(Math.random()*e.length)]}static distanceToSquared(e,t){var n=e.x-t.x,o=e.y-t.y,i=e.z-t.z;return n*n+o*o+i*i}static isPointInPoly(e,t){for(var n=!1,o=-1,i=e.length,s=i-1;++o<i;s=o)(e[o].z<=t.z&&t.z<e[s].z||e[s].z<=t.z&&t.z<e[o].z)&&t.x<(e[s].x-e[o].x)*(t.z-e[o].z)/(e[s].z-e[o].z)+e[o].x&&(n=!n);return n}static isVectorInPolygon(e,t,n){var o=1e5,i=-1e5,s=[];return t.vertexIds.forEach((e=>{o=Math.min(n[e].y,o),i=Math.max(n[e].y,i),s.push(n[e])})),!!(e.y<i+.5&&e.y>o-.5&&this.isPointInPoly(s,e))}static triarea2(e,t,n){return(n.x-e.x)*(t.z-e.z)-(t.x-e.x)*(n.z-e.z)}static vequal(e,t){return this.distanceToSquared(e,t)<1e-5}static mergeVertices(e,t=1e-4){t=Math.max(t,Number.EPSILON);for(var n={},i=e.getIndex(),s=e.getAttribute("position"),r=i?i.count:s.count,a=0,c=[],l=[],d=Math.log10(1/t),h=Math.pow(10,d),u=0;u<r;u++){var p=i?i.getX(u):u,f="";f+=~~(s.getX(p)*h)+",",f+=~~(s.getY(p)*h)+",",(f+=~~(s.getZ(p)*h)+",")in n?c.push(n[f]):(l.push(s.getX(p)),l.push(s.getY(p)),l.push(s.getZ(p)),n[f]=a,c.push(a),a++)}const m=new o.BufferAttribute(new Float32Array(l),s.itemSize,s.normalized),y=new o.BufferGeometry;return y.setAttribute("position",m),y.setIndex(c),y}}class s{constructor(e){this.content=[],this.scoreFunction=e}push(e){this.content.push(e),this.sinkDown(this.content.length-1)}pop(){const e=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),e}remove(e){const t=this.content.indexOf(e),n=this.content.pop();t!==this.content.length-1&&(this.content[t]=n,this.scoreFunction(n)<this.scoreFunction(e)?this.sinkDown(t):this.bubbleUp(t))}size(){return this.content.length}rescoreElement(e){this.sinkDown(this.content.indexOf(e))}sinkDown(e){const t=this.content[e];for(;e>0;){const n=(e+1>>1)-1,o=this.content[n];if(!(this.scoreFunction(t)<this.scoreFunction(o)))break;this.content[n]=t,this.content[e]=o,e=n}}bubbleUp(e){const t=this.content.length,n=this.content[e],o=this.scoreFunction(n);for(;;){const i=e+1<<1,s=i-1;let r,a=null;if(s<t&&(r=this.scoreFunction(this.content[s]),r<o&&(a=s)),i<t&&this.scoreFunction(this.content[i])<(null===a?o:r)&&(a=i),null===a)break;this.content[e]=this.content[a],this.content[a]=n,e=a}}}class r{constructor(){this.portals=[]}push(e,t){void 0===t&&(t=e),this.portals.push({left:e,right:t})}stringPull(){const e=this.portals,t=[];let n,o,s,r=0,a=0,c=0;n=e[0].left,o=e[0].left,s=e[0].right,t.push(n);for(let l=1;l<e.length;l++){const d=e[l].left,h=e[l].right;if(i.triarea2(n,s,h)<=0){if(!(i.vequal(n,s)||i.triarea2(n,o,h)>0)){t.push(o),n=o,r=a,o=n,s=n,a=r,c=r,l=r;continue}s=h,c=l}if(i.triarea2(n,o,d)>=0){if(!(i.vequal(n,o)||i.triarea2(n,s,d)<0)){t.push(s),n=s,r=c,o=n,s=n,a=r,c=r,l=r;continue}o=d,a=l}}return 0!==t.length&&i.vequal(t[t.length-1],e[e.length-1].left)||t.push(e[e.length-1].left),this.path=t,t}}class a{constructor(){this.zones={}}static createZone(e,t=1e-4){return class{static buildZone(e,t){const n=this._buildNavigationMesh(e,t),s={};n.vertices.forEach((e=>{e.x=i.roundNumber(e.x,2),e.y=i.roundNumber(e.y,2),e.z=i.roundNumber(e.z,2)})),s.vertices=n.vertices;const r=this._buildPolygonGroups(n);return s.groups=new Array(r.length),r.forEach(((e,t)=>{const n=new Map;e.forEach(((e,t)=>{n.set(e,t)}));const r=new Array(e.length);e.forEach(((e,t)=>{const a=[];e.neighbours.forEach((e=>a.push(n.get(e))));const c=[];e.neighbours.forEach((t=>c.push(this._getSharedVerticesInOrder(e,t))));const l=new o.Vector3(0,0,0);l.add(s.vertices[e.vertexIds[0]]),l.add(s.vertices[e.vertexIds[1]]),l.add(s.vertices[e.vertexIds[2]]),l.divideScalar(3),l.x=i.roundNumber(l.x,2),l.y=i.roundNumber(l.y,2),l.z=i.roundNumber(l.z,2),r[t]={id:t,neighbours:a,vertexIds:e.vertexIds,centroid:l,portals:c}})),s.groups[t]=r})),s}static _buildNavigationMesh(e,t){return e=i.mergeVertices(e,t),this._buildPolygonsFromGeometry(e)}static _spreadGroupId(e){let t=new Set([e]);for(;t.size>0;){const n=t;t=new Set,n.forEach((n=>{n.group=e.group,n.neighbours.forEach((e=>{void 0===e.group&&t.add(e)}))}))}}static _buildPolygonGroups(e){const t=[];return e.polygons.forEach((e=>{void 0!==e.group?t[e.group].push(e):(e.group=t.length,this._spreadGroupId(e),t.push([e]))})),t}static _buildPolygonNeighbours(e,t){const n=new Set,o=t[e.vertexIds[1]],i=t[e.vertexIds[2]];return t[e.vertexIds[0]].forEach((t=>{t!==e&&(o.includes(t)||i.includes(t))&&n.add(t)})),o.forEach((t=>{t!==e&&i.includes(t)&&n.add(t)})),n}static _buildPolygonsFromGeometry(e){const t=[],n=[],i=e.attributes.position,s=e.index,r=[];for(let e=0;e<i.count;e++)n.push((new o.Vector3).fromBufferAttribute(i,e)),r[e]=[];for(let n=0;n<e.index.count;n+=3){const e=s.getX(n),o=s.getX(n+1),i=s.getX(n+2),a={vertexIds:[e,o,i],neighbours:null};t.push(a),r[e].push(a),r[o].push(a),r[i].push(a)}return t.forEach((e=>{e.neighbours=this._buildPolygonNeighbours(e,r)})),{polygons:t,vertices:n}}static _getSharedVerticesInOrder(e,t){const n=e.vertexIds,o=n[0],i=n[1],s=n[2],r=t.vertexIds,a=r.includes(o),c=r.includes(i),l=r.includes(s);return a&&c&&l?Array.from(n):a&&c?[o,i]:c&&l?[i,s]:a&&l?[s,o]:(console.warn("Error processing navigation mesh neighbors; neighbors with <2 shared vertices found."),[])}}.buildZone(e,t)}setZoneData(e,t){this.zones[e]=t}getRandomNode(e,t,n,s){if(!this.zones[e])return new o.Vector3;n=n||null,s=s||0;const r=[];return this.zones[e].groups[t].forEach((e=>{n&&s?i.distanceToSquared(n,e.centroid)<s*s&&r.push(e.centroid):r.push(e.centroid)})),i.sample(r)||new o.Vector3}getClosestNode(e,t,n,o=!1){const s=this.zones[t].vertices;let r=null,a=1/0;return this.zones[t].groups[n].forEach((t=>{const n=i.distanceToSquared(t.centroid,e);n<a&&(!o||i.isVectorInPolygon(e,t,s))&&(r=t,a=n)})),r}findPath(e,t,n,a){const c=this.zones[n].groups[a],l=this.zones[n].vertices,d=this.getClosestNode(e,n,a,!0),h=this.getClosestNode(t,n,a,!0);if(!d||!h)return null;const u=class{static init(e){for(let t=0;t<e.length;t++){const n=e[t];n.f=0,n.g=0,n.h=0,n.cost=1,n.visited=!1,n.closed=!1,n.parent=null}}static cleanUp(e){for(let t=0;t<e.length;t++){const n=e[t];delete n.f,delete n.g,delete n.h,delete n.cost,delete n.visited,delete n.closed,delete n.parent}}static heap(){return new s((function(e){return e.f}))}static search(e,t,n){this.init(e);const o=this.heap();for(o.push(t);o.size()>0;){const t=o.pop();if(t===n){let e=t;const n=[];for(;e.parent;)n.push(e),e=e.parent;return this.cleanUp(n),n.reverse()}t.closed=!0;const i=this.neighbours(e,t);for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s.closed)continue;const r=t.g+s.cost,a=s.visited;if(!a||r<s.g){if(s.visited=!0,s.parent=t,!s.centroid||!n.centroid)throw new Error("Unexpected state");s.h=s.h||this.heuristic(s.centroid,n.centroid),s.g=r,s.f=s.g+s.h,a?o.rescoreElement(s):o.push(s)}}}return[]}static heuristic(e,t){return i.distanceToSquared(e,t)}static neighbours(e,t){const n=[];for(let o=0;o<t.neighbours.length;o++)n.push(e[t.neighbours[o]]);return n}}.search(c,d,h),p=function(e,t){for(var n=0;n<e.neighbours.length;n++)if(e.neighbours[n]===t.id)return e.portals[n]},f=new r;f.push(e);for(let e=0;e<u.length;e++){const t=u[e],n=u[e+1];if(n){const e=p(t,n);f.push(l[e[0]],l[e[1]])}}f.push(t),f.stringPull();const m=f.path.map((e=>new o.Vector3(e.x,e.y,e.z)));return m.shift(),m}}a.prototype.getGroup=function(){const e=new o.Plane;return function(t,n,o=!1){if(!this.zones[t])return null;let s=null,r=Math.pow(50,2);const a=this.zones[t];for(let t=0;t<a.groups.length;t++){const c=a.groups[t];for(const l of c){if(o&&(e.setFromCoplanarPoints(a.vertices[l.vertexIds[0]],a.vertices[l.vertexIds[1]],a.vertices[l.vertexIds[2]]),Math.abs(e.distanceToPoint(n))<.01)&&i.isPointInPoly([a.vertices[l.vertexIds[0]],a.vertices[l.vertexIds[1]],a.vertices[l.vertexIds[2]]],n))return t;const c=i.distanceToSquared(l.centroid,n);c<r&&(s=t,r=c)}}return s}}(),a.prototype.clampStep=function(){const e=new o.Vector3,t=new o.Plane,n=new o.Triangle,i=new o.Vector3;let s,r,a=new o.Vector3;return function(o,c,l,d,h,u){const p=this.zones[d].vertices,f=this.zones[d].groups[h],m=[l],y={};y[l.id]=0,s=void 0,a.set(0,0,0),r=1/0,t.setFromCoplanarPoints(p[l.vertexIds[0]],p[l.vertexIds[1]],p[l.vertexIds[2]]),t.projectPoint(c,e),i.copy(e);for(let t=m.pop();t;t=m.pop()){n.set(p[t.vertexIds[0]],p[t.vertexIds[1]],p[t.vertexIds[2]]),n.closestPointToPoint(i,e),e.distanceToSquared(i)<r&&(s=t,a.copy(e),r=e.distanceToSquared(i));const o=y[t.id];if(!(o>2))for(let e=0;e<t.neighbours.length;e++){const n=f[t.neighbours[e]];n.id in y||(m.push(n),y[n.id]=o+1)}}return u.copy(a),s}}();class c extends o.Object3D{constructor(){super(),this._playerMarker=new o.Mesh(new o.SphereGeometry(.25,32,32),new o.MeshBasicMaterial({color:15631215})),this._targetMarker=new o.Mesh(new o.BoxGeometry(.3,.3,.3),new o.MeshBasicMaterial({color:14469912})),this._nodeMarker=new o.Mesh(new o.BoxGeometry(.1,.8,.1),new o.MeshBasicMaterial({color:4417387})),this._stepMarker=new o.Mesh(new o.BoxGeometry(.1,1,.1),new o.MeshBasicMaterial({color:14472114})),this._pathMarker=new o.Object3D,this._pathLineMaterial=new o.LineBasicMaterial({color:41903,linewidth:2}),this._pathPointMaterial=new o.MeshBasicMaterial({color:41903}),this._pathPointGeometry=new o.SphereGeometry(.08),this._markers=[this._playerMarker,this._targetMarker,this._nodeMarker,this._stepMarker,this._pathMarker],this._markers.forEach((e=>{e.visible=!1,this.add(e)}))}setPath(e){for(;this._pathMarker.children.length;)this._pathMarker.children[0].visible=!1,this._pathMarker.remove(this._pathMarker.children[0]);e=[this._playerMarker.position].concat(e);const t=new o.BufferGeometry;t.setAttribute("position",new o.BufferAttribute(new Float32Array(3*e.length),3));for(let n=0;n<e.length;n++)t.attributes.position.setXYZ(n,e[n].x,e[n].y+.2,e[n].z);this._pathMarker.add(new o.Line(t,this._pathLineMaterial));for(let t=0;t<e.length-1;t++){const n=new o.Mesh(this._pathPointGeometry,this._pathPointMaterial);n.position.copy(e[t]),n.position.y+=.2,this._pathMarker.add(n)}return this._pathMarker.visible=!0,this}setPlayerPosition(e){return this._playerMarker.position.copy(e),this._playerMarker.visible=!0,this}setTargetPosition(e){return this._targetMarker.position.copy(e),this._targetMarker.visible=!0,this}setNodePosition(e){return this._nodeMarker.position.copy(e),this._nodeMarker.visible=!0,this}setStepPosition(e){return this._stepMarker.position.copy(e),this._stepMarker.visible=!0,this}reset(){for(;this._pathMarker.children.length;)this._pathMarker.children[0].visible=!1,this._pathMarker.remove(this._pathMarker.children[0]);return this._markers.forEach((e=>{e.visible=!1})),this}}},804:e=>{e.exports=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)}})},863:(e,t,n)=>{const o=n(862),i=n(964),s=.2,r="left",a="right";e.exports=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}})},727:(e,t,n)=>{n(804),n(863),n(769),n(267),n(537),n(822),n(356)},769:(e,t,n)=>{n(919);const o=window.KeyboardEvent;e.exports=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),