0&&(d.began=!0,y("begin"),y("loopBegin")),m<=r&&0!==d.currentTime&&v(0),(m>=p&&d.currentTime!==i||!i)&&v(i),m>r&&m=i&&(s=0,d.remaining&&!0!==d.remaining&&d.remaining--,d.remaining?(n=o,y("loopComplete"),y("loopBegin"),"alternate"===d.direction&&A()):(d.paused=!0,d.completed||(d.completed=!0,y("loopComplete"),y("complete"),"Promise"in window&&(c(),u=h()))))}return d.reset=function(){var e=d.direction;d.passThrough=!1,d.currentTime=0,d.progress=0,d.paused=!0,d.began=!1,d.changeBegan=!1,d.completed=!1,d.changeCompleted=!1,d.reversePlayback=!1,d.reversed="reverse"===e,d.remaining=d.loop,t=d.children;for(var n=l=t.length;n--;)d.children[n].reset();(d.reversed&&!0!==d.loop||"alternate"===e&&1===d.loop)&&d.remaining++,v(0)},d.set=function(e,t){return le(e,t),d},d.tick=function(e){o=e,n||(n=o),E((o+(s-n))*me.speed)},d.seek=function(e){E(f(e))},d.pause=function(){d.paused=!0,m()},d.play=function(){d.paused&&(d.paused=!1,pe.push(d),m(),ue||fe())},d.reverse=function(){A(),m()},d.restart=function(){d.reset(),d.play()},d.finished=u,d.reset(),d.autoplay&&d.play(),d}function ge(e,t){for(var n=t.length;n--;)S(e,t[n].animatable.target)&&t.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var e=0,t=pe.length;e-1&&pe.splice(s,1);for(var l=0;l{var i=n(7510),r=n(4502),s=n(83),o=n(2259);e.exports=function(e){return new a(e)};class a extends THREE.BufferGeometry{constructor(e){super(),"string"==typeof e&&(e={text:e}),this._opt=Object.assign({},e),e&&this.update(e)}update(e){if("string"==typeof e&&(e={text:e}),!(e=Object.assign({},this._opt,e)).font)throw new TypeError("must specify a { font } in options");this.layout=i(e);var t=!1!==e.flipY,n=e.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(e){var t=e.data;return t.width*t.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,t),u=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(u),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var d=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(d,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():o.computeBox(t,e)}}},2259:e=>{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var r=new Float32Array(4*e.length*2),s=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,u=a/t,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=h})),r},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,r=e.position[0]+i.xoffset,s=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=r,t[n++]=s,t[n++]=r,t[n++]=s+a,t[n++]=r+o,t[n++]=s+a,t[n++]=r+o,t[n++]=s})),t}},5542:function(e,t,n){e.exports=function(){"use strict";var e="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};var t,i=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},r=function(e,t){for(var n=0,i=e.length;nl)},b=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},x=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},C=function(e){if(d())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},w=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},_=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},M=function(e,t,n,i){var r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,t),e.compileShader(r);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,n),e.compileShader(s);var o=e.createProgram();for(var a in e.attachShader(o,r),e.attachShader(o,s),i)e.bindAttribLocation(o,i[a],a);return e.linkProgram(o),e.deleteShader(r),e.deleteShader(s),o},S=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r="",s=0;s1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(e.w)},O=(i={},function(e,t){void 0===i[e]&&(console.warn("webvr-polyfill: "+t),i[e]=!0)}),F=function(e,t){O(e,e+" has been deprecated. This may not work on native WebVR displays. "+(t?"Please use "+t+" instead.":""))};function N(e,t,n){if(t){for(var i=[],r=null,s=0;se.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),i.push(null,null);break}r||(r=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(l),i.push(e.getParameter(o),null);break;case e.ACTIVE_TEXTURE:r=e.getParameter(e.ACTIVE_TEXTURE),i.push(null);break;default:i.push(e.getParameter(o))}for(n(e),s=0;se.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_2D,a);break;case e.TEXTURE_BINDING_CUBE_MAP:var l;if((l=t[++s])e.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_CUBE_MAP,a);break;case e.VIEWPORT:e.viewport(a[0],a[1],a[2],a[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:a?e.enable(o):e.disable(o);break;default:console.log("No GL restore behavior for 0x"+o.toString(16))}r&&e.activeTexture(r)}}else n(e)}var k=N,Q=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),G=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function z(e,t,n,i){this.gl=e,this.cardboardUI=t,this.bufferScale=n,this.dirtySubmitFrameBindings=i,this.ctxAttribs=e.getContextAttributes(),this.instanceExt=e.getExtension("ANGLE_instanced_arrays"),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,u()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=M(e,Q,G,this.attribs),this.uniforms=S(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}z.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},z.prototype.onResize=function(){var e=this.gl,t=this,n=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];k(e,n,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)})),this.cardboardUI&&this.cardboardUI.onResize()},z.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,n=this.gl;u()||(t.width=b()*this.bufferScale,t.height=x()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(n){e.bufferWidth=n,e.realCanvasWidth.set.call(t,n),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(n){e.bufferHeight=n,e.realCanvasHeight.set.call(t,n),e.onResize()}})),this.lastBoundFramebuffer=n.getParameter(n.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,i){e.lastBoundFramebuffer=i||e.framebuffer,e.realBindFramebuffer.call(n,t,e.lastBoundFramebuffer)},this.cullFace=n.getParameter(n.CULL_FACE),this.depthTest=n.getParameter(n.DEPTH_TEST),this.blend=n.getParameter(n.BLEND),this.scissorTest=n.getParameter(n.SCISSOR_TEST),this.stencilTest=n.getParameter(n.STENCIL_TEST),n.enable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!0;break;case n.DEPTH_TEST:e.depthTest=!0;break;case n.BLEND:e.blend=!0;break;case n.SCISSOR_TEST:e.scissorTest=!0;break;case n.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(n,t)},n.disable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!1;break;case n.DEPTH_TEST:e.depthTest=!1;break;case n.BLEND:e.blend=!1;break;case n.SCISSOR_TEST:e.scissorTest=!1;break;case n.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(n,t)},this.colorMask=n.getParameter(n.COLOR_WRITEMASK),n.colorMask=function(t,i,r,s){e.colorMask[0]=t,e.colorMask[1]=i,e.colorMask[2]=r,e.colorMask[3]=s,e.realColorMask.call(n,t,i,r,s)},this.clearColor=n.getParameter(n.COLOR_CLEAR_VALUE),n.clearColor=function(t,i,r,s){e.clearColor[0]=t,e.clearColor[1]=i,e.clearColor[2]=r,e.clearColor[3]=s,e.realClearColor.call(n,t,i,r,s)},this.viewport=n.getParameter(n.VIEWPORT),n.viewport=function(t,i,r,s){e.viewport[0]=t,e.viewport[1]=i,e.viewport[2]=r,e.viewport[3]=s,e.realViewport.call(n,t,i,r,s)},this.isPatched=!0,R(t)}},z.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;u()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout((function(){R(t)}),1)}},z.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},z.prototype.submitFrame=function(){var e=this.gl,t=this,n=[];if(this.dirtySubmitFrameBindings||n.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),k(e,n,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null);var n=0,i=0;t.instanceExt&&(n=e.getVertexAttrib(t.attribs.position,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),i=e.getVertexAttrib(t.attribs.texCoord,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||u())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),t.instanceExt&&(0!=n&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,0),0!=i&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,0)),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor),t.instanceExt&&(0!=n&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,n),0!=i&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,i))})),u()){var i=e.canvas;i.width==t.bufferWidth&&i.height==t.bufferHeight||(t.bufferWidth=i.width,t.bufferHeight=i.height,t.onResize())}},z.prototype.updateDeviceInfo=function(e){var t=this.gl,n=this,i=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];k(t,i,(function(t){var i=n.computeMeshVertices_(n.meshWidth,n.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,n.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW),!n.indexCount){var r=n.computeMeshIndices_(n.meshWidth,n.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW),n.indexCount=r.length}}))},z.prototype.computeMeshVertices_=function(e,t,n){for(var i=new Float32Array(2*e*t*5),r=n.getLeftEyeVisibleTanAngles(),s=n.getLeftEyeNoLensTanAngles(),o=n.getLeftEyeVisibleScreenRect(s),a=0,l=0;l<2;l++){for(var c=0;cr-s&&i.clientXn.clientHeight-s?e(i):i.clientX1e-4;){var r=e-this.distort(n),s=n-r*((n-t)/(r-i));t=n,n=s,i=r}return n},ne.prototype.distort=function(e){for(var t=e*e,n=0,i=0;i=1)return this.w=s,this.x=n,this.y=i,this.z=r,this;var a=Math.acos(o),l=Math.sqrt(1-o*o);if(Math.abs(l)<.001)return this.w=.5*(s+this.w),this.x=.5*(n+this.x),this.y=.5*(i+this.y),this.z=.5*(r+this.z),this;var c=Math.sin((1-t)*a)/l,h=Math.sin(t*a)/l;return this.w=s*c+this.w*h,this.x=n*c+this.x*h,this.y=i*c+this.y*h,this.z=r*c+this.z*h,this},setFromUnitVectors:(le=1e-6,function(e,t){return void 0===oe&&(oe=new se),(ae=e.dot(t)+1)Math.abs(e.z)?oe.set(-e.y,e.x,0):oe.set(0,-e.z,e.y)):oe.crossVectors(e,t),this.x=oe.x,this.y=oe.y,this.z=oe.z,this.w=ae,this.normalize(),this})};var ue=new he({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),de=new he({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),pe={CardboardV1:new fe({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new fe({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};function Ae(e,t){this.viewer=pe.CardboardV2,this.updateDeviceParams(e),this.distortion=new ne(this.viewer.distortionCoefficients);for(var n=0;n=200&&n.status<=299?(i.dpdb=JSON.parse(n.response),i.recalculateDeviceParams_()):console.error("Error loading online DPDB!")})),n.send()}}function ve(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function ye(e,t){this.set(e,t)}function Ee(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new ye,this.currentGyroMeasurement=new ye,this.previousGyroMeasurement=new ye,u()?this.filterQ=new ce(-1,0,0,1):this.filterQ=new ce(1,0,0,1),this.previousFilterQ=new ce,this.previousFilterQ.copy(this.filterQ),this.accelQ=new ce,this.isOrientationInitialized=!1,this.estimatedGravity=new se,this.measuredGravity=new se,this.gyroIntegralQ=new ce}function be(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new ce,this.previousTimestampS=null,this.deltaQ=new ce,this.outQ=new ce}function xe(e,t,n,i){this.yawOnly=n,this.accelerometer=new se,this.gyroscope=new se,this.filter=new Ee(e,i),this.posePredictor=new be(t,i),this.isFirefoxAndroid=A(),this.isIOS=u();var r=f();this.isDeviceMotionInRadians=!this.isIOS&&r&&r<66,this.isWithoutDeviceMotion=g()||m(),this.filterToWorldQ=new ce,u()?this.filterToWorldQ.setFromAxisAngle(new se(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new se(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new ce,this.worldToScreenQ=new ce,this.originalPoseAdjustQ=new ce,this.originalPoseAdjustQ.setFromAxisAngle(new se(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),y()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new ce,this.orientationOut_=new Float32Array(4),this.start()}ge.prototype.getDeviceParams=function(){return this.deviceParams},ge.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},ge.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,n=b(),i=x();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var r=0;rl?(O("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=i)):(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(v()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,i)),this.filter.addAccelMeasurement(this.accelerometer,i),void(this.previousTimestampS=i))},xe.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},xe.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},xe.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new se(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new se(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},xe.prototype.start=function(){this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),u()&&D()&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},xe.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var Ce=60,we=new se(1,0,0),_e=new se(0,0,1),Me=new ce;Me.setFromAxisAngle(we,-Math.PI/2),Me.multiply((new ce).setFromAxisAngle(_e,Math.PI/2));var Se=function(){function e(t){r(this,e),this.config=t,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new ce,this._outQ=new ce,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return s(e,[{key:"init",value:function(){var e=null;try{(e=new RelativeOrientationSensor({frequency:Ce,referenceFrame:"screen"})).addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new xe(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG),this.sensor&&(this.sensor.removeEventListener("reading",this._onSensorRead),this.sensor.removeEventListener("error",this._onSensorError),this.sensor=null)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(Me),t.multiply(this._sensorQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),e}(),Ie="";function Be(){this.loadIcon_();var e=document.createElement("div");(s=e.style).position="fixed",s.top=0,s.right=0,s.bottom=0,s.left=0,s.backgroundColor="gray",s.fontFamily="sans-serif",s.zIndex=1e6;var t=document.createElement("img");t.src=this.icon,(s=t.style).marginLeft="25%",s.marginTop="25%",s.width="50%",e.appendChild(t);var n=document.createElement("div");(s=n.style).textAlign="center",s.fontSize="16px",s.lineHeight="24px",s.margin="24px 25%",s.width="50%",n.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(n);var i=document.createElement("div");(s=i.style).backgroundColor="#CFD8DC",s.position="fixed",s.bottom=0,s.width="100%",s.height="48px",s.padding="14px 24px",s.boxSizing="border-box",s.color="#656A6B",e.appendChild(i);var r=document.createElement("div");r.style.float="left",r.innerHTML="No Cardboard viewer?";var s,o=document.createElement("a");o.href="https://www.google.com/get/cardboard/get-cardboard/",o.innerHTML="get one",o.target="_blank",(s=o.style).float="right",s.fontWeight=600,s.textTransform="uppercase",s.borderLeft="1px solid gray",s.paddingLeft="24px",s.textDecoration="none",s.color="#656A6B",i.appendChild(r),i.appendChild(o),this.overlay=e,this.text=n,this.hide()}Be.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img").style;y()?(t.width="20%",t.marginLeft="40%",t.marginTop="3%"):(t.width="50%",t.marginLeft="25%",t.marginTop="25%")},Be.prototype.hide=function(){this.overlay.style.display="none"},Be.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},Be.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},Be.prototype.update=function(){this.disableShowTemporarily(),!y()&&B()?this.show():this.hide()},Be.prototype.loadIcon_=function(){this.icon=c("image/svg+xml",Ie)};var Te="CardboardV1",Re="WEBVR_CARDBOARD_VIEWER",Le="webvr-polyfill-viewer-selector";function De(e){try{this.selectedKey=localStorage.getItem(Re)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=e||Te),this.dialog=this.createDialog_(Ae.Viewers),this.root=null,this.onChangeCallbacks_=[]}function Pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ue(e,t){return e(t={exports:{}},t.exports),t.exports}De.prototype.show=function(e){this.root=e,e.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},De.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},De.prototype.getCurrentViewer=function(){return Ae.Viewers[this.selectedKey]},De.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},De.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},De.prototype.fireOnChange_=function(e){for(var t=0;t.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return i(e,[{key:"enable",value:function(){o?(this.disable(),this.noSleepTimer=window.setInterval((function(){window.location.href="/",window.setTimeout(window.stop,0)}),15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){o?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=a},function(e,t,n){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])}))})),Fe=Pe(Oe),Ne=1e3,ke=[0,0,.5,1],Qe=[.5,0,.5,1],Ge=window.requestAnimationFrame,ze=window.cancelAnimationFrame;function He(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function Ve(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return F("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function We(e){var t=!("wakelock"in(e=e||{}))||e.wakelock;this.isPolyfilled=!0,this.displayId=Ne++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return F("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new Ve({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&B()&&(this.wakelock_=new Fe)}We.prototype.getFrameData=function(e){return L(e,this._getPose(),this)},We.prototype.getPose=function(){return F("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},We.prototype.resetPose=function(){return F("VRDisplay.prototype.resetPose"),this._resetPose()},We.prototype.getImmediatePose=function(){return F("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},We.prototype.requestAnimationFrame=function(e){return Ge(e)},We.prototype.cancelAnimationFrame=function(e){return ze(e)},We.prototype.wrapForFullscreen=function(e){if(u())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var n=this.fullscreenElement_.parentElement;n.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),n.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var i=this;function r(){if(i.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];i.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}return r(),this.fullscreenWrapper_},We.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},We.prototype.requestPresent=function(e){var t=this.isPresenting,n=this;return e instanceof Array||(F("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise((function(i,r){if(n.capabilities.canPresent)if(0==e.length||e.length>n.capabilities.maxLayers)r(new Error("Invalid number of layers."));else{var s=e[0];if(s.source){var o=s.leftBounds||ke,a=s.rightBounds||Qe;if(t){var l=n.layer_;l.source!==s.source&&(l.source=s.source);for(var c=0;c<4;c++)l.leftBounds[c]=o[c],l.rightBounds[c]=a[c];return n.wrapForFullscreen(n.layer_.source),n.updatePresent_(),void i()}if(n.layer_={predistorted:s.predistorted,source:s.source,leftBounds:o.slice(0),rightBounds:a.slice(0)},n.waitingForPresent_=!1,n.layer_&&n.layer_.source){var h=n.wrapForFullscreen(n.layer_.source),p=function(){var e=_();n.isPresenting=h===e,n.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch((function(e){console.error("screen.orientation.lock() failed due to",e.message)})),n.waitingForPresent_=!1,n.beginPresent_(),i()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),n.removeFullscreenWrapper(),n.disableWakeLock(),n.endPresent_(),n.removeFullscreenListeners_()),n.fireVRDisplayPresentChange_()},A=function(){n.waitingForPresent_&&(n.removeFullscreenWrapper(),n.removeFullscreenListeners_(),n.disableWakeLock(),n.waitingForPresent_=!1,n.isPresenting=!1,r(new Error("Unable to present.")))};n.addFullscreenListeners_(h,p,A),C(h)?(n.enableWakeLock(),n.waitingForPresent_=!0):(u()||d())&&(n.enableWakeLock(),n.isPresenting=!0,n.beginPresent_(),n.fireVRDisplayPresentChange_(),i())}n.waitingForPresent_||u()||(w(),r(new Error("Unable to present.")))}else i()}else r(new Error("VRDisplay is not capable of presenting."))}))},We.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise((function(n,i){e?(!w()&&u()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),d()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),n()):i(new Error("Was not presenting to VRDisplay."))}))},We.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},We.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},We.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},We.prototype.addFullscreenListeners_=function(e,t,n){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=n,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),n&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",n,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",n,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",n,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",n,!1))},We.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var n=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",n,!1),e.removeEventListener("webkitfullscreenerror",n,!1),document.removeEventListener("mozfullscreenerror",n,!1),e.removeEventListener("msfullscreenerror",n,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},We.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},We.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},We.prototype.beginPresent_=function(){},We.prototype.endPresent_=function(){},We.prototype.submitFrame=function(e){},We.prototype.getEyeParameters=function(e){return null};var je={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},qe={LEFT:"left",RIGHT:"right"};function Xe(e){var t=T({},je);e=T(t,e||{}),We.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new Ve({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new Se(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new ge(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new Ae(this.dpdb_.getDeviceParams(),e.ADDITIONAL_VIEWERS),this.viewerSelector_=new De(e.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new Be),u()&&window.addEventListener("resize",this.onResize_.bind(this))}return Xe.prototype=Object.create(We.prototype),Xe.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},Xe.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},Xe.prototype._getFieldOfView=function(e){var t;if(e==qe.LEFT)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=qe.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},Xe.prototype._getEyeOffset=function(e){var t;if(e==qe.LEFT)t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=qe.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return t},Xe.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),n=this._getFieldOfView(e),i={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(i,"fieldOfView",{enumerable:!0,get:function(){return F("VRFieldOfView","VRFrameData's projection matrices"),n}}),i},Xe.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},Xe.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},Xe.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=b()*this.bufferScale_,e.canvas.height=x()*this.bufferScale_,this.cardboardUI_=new te(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new te(e)),this.distorter_=new z(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(y()&&B()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},Xe.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},Xe.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},Xe.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var n=t.canvas;n.width==this.lastWidth&&n.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=n.width,this.lastHeight=n.height,this.cardboardUI_.render()}},Xe.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},Xe.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var n=["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"];t.canvas.setAttribute("style",n.join("; ")+";"),R(t.canvas)}},Xe.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},Xe.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},Xe.VRFrameData=He,Xe.VRDisplay=We,Xe}()})),a=(t=o)&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,l={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",PROVIDE_MOBILE_VRDISPLAY:!0,MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1};function c(e){this.config=s(s({},l),e),this.polyfillDisplays=[],this.enabled=!1,this.hasNative="getVRDisplays"in navigator,this.native={},this.native.getVRDisplays=navigator.getVRDisplays,this.native.VRFrameData=window.VRFrameData,this.native.VRDisplay=window.VRDisplay,(!this.hasNative||this.config.PROVIDE_MOBILE_VRDISPLAY&&i())&&(this.enable(),this.getVRDisplays().then((function(e){e&&e[0]&&e[0].fireVRDisplayConnect_&&e[0].fireVRDisplayConnect_()})))}c.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(i()){var e=new a({ADDITIONAL_VIEWERS:this.config.ADDITIONAL_VIEWERS,DEFAULT_VIEWER:this.config.DEFAULT_VIEWER,MOBILE_WAKE_LOCK:this.config.MOBILE_WAKE_LOCK,DEBUG:this.config.DEBUG,DPDB_URL:this.config.DPDB_URL,CARDBOARD_UI_DISABLED:this.config.CARDBOARD_UI_DISABLED,K_FILTER:this.config.K_FILTER,PREDICTION_TIME_S:this.config.PREDICTION_TIME_S,ROTATE_INSTRUCTIONS_DISABLED:this.config.ROTATE_INSTRUCTIONS_DISABLED,YAW_ONLY:this.config.YAW_ONLY,BUFFER_SCALE:this.config.BUFFER_SCALE,DIRTY_SUBMIT_FRAME_BINDINGS:this.config.DIRTY_SUBMIT_FRAME_BINDINGS});this.polyfillDisplays.push(e)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},c.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var e=this.native.VRFrameData,t=new this.native.VRFrameData,n=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(i){i instanceof e?n.call(this,i):(n.call(this,t),i.pose=t.pose,r(t.leftProjectionMatrix,i.leftProjectionMatrix),r(t.rightProjectionMatrix,i.rightProjectionMatrix),r(t.leftViewMatrix,i.leftViewMatrix),r(t.rightViewMatrix,i.rightViewMatrix))}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=a.VRDisplay,window.VRFrameData=a.VRFrameData},c.prototype.getVRDisplays=function(){var e=this;return this.config,this.hasNative?this.native.getVRDisplays.call(navigator).then((function(t){return t.length>0?t:e.getPolyfillDisplays()})):Promise.resolve(this.getPolyfillDisplays())},c.version="0.10.12",c.VRFrameData=a.VRFrameData,c.VRDisplay=a.VRDisplay;var h=Object.freeze({default:c}),u=h&&c||h;return void 0!==e&&e.window&&(e.document||(e.document=e.window.document),e.navigator||(e.navigator=e.window.navigator)),u}()},9443:e=>{var t=/\n/,n="\n",i=/\s/;function r(e,t,n,i){var r=e.indexOf(t,n);return-1===r||r>i?i:r}function s(e){return i.test(e)}function o(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,i){if(0===(i=i||{}).width&&"nowrap"!==i.mode)return[];e=e||"";var a="number"==typeof i.width?i.width:Number.MAX_VALUE,l=Math.max(0,i.start||0),c="number"==typeof i.end?i.end:e.length,h=i.mode,u=i.measure||o;return"pre"===h?function(e,n,i,r,s){for(var o=[],a=i,l=i;li&&!s(t.charAt(p));)p--;if(p===i)A>i+n.length&&A--,p=A;else for(A=p;p>i&&s(t.charAt(p-n.length));)p--}if(p>=i){var f=e(t,i,p,h);c.push(f)}i=A}return c}(u,e,l,c,a,h)}},7377:(e,t,n)=>{"use strict";var i=n(1192),r=n(6534),s=n(9069),o=n(2786);function a(e,t,n){var i=e;return r(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=o(t,{uri:e}),i.callback=n,i}function l(e,t,n){return c(t=a(e,t,n))}function c(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(){var e=void 0;if(e=h.response?h.response:h.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(h),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,v)}function o(){if(!c){var t;clearTimeout(u),t=e.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==t?(r={body:i(),statusCode:t,method:p,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=e.xhr||null;h||(h=e.cors||e.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var u,d=h.url=e.uri||e.url,p=h.method=e.method||"GET",A=e.body||e.data,f=h.headers=e.headers||{},m=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:h};if("json"in e&&!1!==e.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===e.json?A:e.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,d,!m,e.username,e.password),m||(h.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(u=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(A||null),h}e.exports=l,e.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var n=0;n{e.exports=void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},2786:e=>{e.exports=function(){for(var e={},n=0;n{var i=n(3515).registerComponent,r=n(8903).debug("components:anchored:warn");e.exports.Component=i("anchored",{schema:{persistent:{default:!1}},init:function(){var e=this.el.sceneEl.getAttribute("webxr"),t=e.optionalFeatures;-1===t.indexOf("anchors")&&(t.push("anchors"),this.el.sceneEl.setAttribute("webxr",e)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var e,t,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(e=i.frame,t=r.getReferenceSpace(),n=e.getPose(this.anchor.anchorSpace,t),s.matrix.elements=n.transform.matrix,s.matrix.decompose(s.position,s.rotation,s.scale)))},createAnchor:async function(e,t){var n,i,s,o,a=this.el.sceneEl,l=a.renderer.xr,c=this.el.object3D;e=e||c.position,t=t||this.auxQuaternion.setFromEuler(c.rotation),function(e){var t=e.renderer.xr.getSession();return t&&t.restorePersistentAnchor}(a)?(this.anchor&&this.deleteAnchor(),n=a.frame,i=l.getReferenceSpace(),s=new XRRigidTransform({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z,w:t.w}),this.requestAnchorPending=!1,o=await n.createAnchor(s,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await o.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):r("The anchor won't be persisted because the entity has no assigned id.")),a.object3D.attach(this.el.object3D),this.anchor=o):r("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var e,t=this.el.sceneEl.renderer.xr.getSession(),n=t.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return r("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){e=localStorage.getItem(this.el.id);for(var i=0;i{var i=n(2446).Z,r=n(3515).components,s=n(3515).registerComponent,o=n(2666),a=n(8903),l=new o.Color,c=new o.Color,h=a.entity.getComponentProperty,u=a.entity.setComponentProperty,d={},p="color",A="rotation",f="scale",m="components";function g(e){e.x=o.MathUtils.degToRad(e.x),e.y=o.MathUtils.degToRad(e.y),e.z=o.MathUtils.degToRad(e.z)}function v(e,t,n){var i;for(i=0;i=1),C(s)?b(o,s.property,n,s.type):u(o,s.property,n))})},updateConfigForVector:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el;for(e in t=""!==s.from?a.coordinates.parse(s.from):h(o,s.property),n=a.coordinates.parse(s.to),s.property===A&&(g(t),g(n)),this.targetsArray.length=0,this.targetsArray.push(t),r.targets=this.targetsArray,n)r[e]=n[e];"position"!==s.property&&s.property!==A&&s.property!==f?r.update=function(){var e={};return function(t){var n=t.animatables[0].target;n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,u(o,s.property,n))}}():r.update=(i={},function(e){var t=e.animatables[0].target;s.property===f&&(t.x=Math.max(1e-4,t.x),t.y=Math.max(1e-4,t.y),t.z=Math.max(1e-4,t.z)),t.x===i.x&&t.y===i.y&&t.z===i.z||(i.x=t.x,i.y=t.y,i.z=t.z,o.object3D[s.property].set(t.x,t.y,t.z))})},updateConfig:function(){var e,t,n,i,s,o,a;t=this.el,n=this.data.property,s=(o=n.split("."))[0],a=o[1],e=(i=t.components[s]||r[s])?a&&!i.schema[a]?null:a?i.schema[a].type:i.schema.type:null,C(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===e||"vec3"===e||"vec4"===e?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(e){var t,n=this.data,r=this.el,s=this;return""===n.from&&!!n.property.startsWith(m)&&(t=x(n.property)[1],!r.components[t]&&(r.addEventListener("componentinitialized",(function n(o){o.detail.name===t&&(e(),s.animation=i(s.config),r.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var e,t;for(t in this.el.components)e=this.el.components[t],t!==this.attrName&&"animation"===e.name&&e.animationIsPlaying&&e.data.property===this.data.property&&(e.animationIsPlaying=!1)},addEventListeners:function(){var e=this.data,t=this.el;v(t,e.startEvents,this.onStartEvent),v(t,e.pauseEvents,this.pauseAnimation),v(t,e.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var e=this.data,t=this.el;y(t,e.startEvents,this.onStartEvent),y(t,e.pauseEvents,this.pauseAnimation),y(t,e.resumeEvents,this.resumeAnimation)},setColorConfig:function(e,t){l.set(e),c.set(t),e=this.fromColor,t=this.toColor,e.r=l.r,e.g=l.g,e.b=l.b,t.r=c.r,t.g=c.g,t.b=c.b}})},9541:(e,t,n)=>{var i=n(3515).registerComponent,r=n(2666);e.exports.Component=i("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new r.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,n=this.camera;n.aspect=t.aspect||window.innerWidth/window.innerHeight,n.far=t.far,n.fov=t.fov,n.near=t.near,n.zoom=t.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.active===t.active||t.spectator||(t.active&&i.activeCameraEl!==n?i.setActiveCamera(n):t.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.spectator===t.spectator||(t.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):t.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},57:(e,t,n)=>{var i,r,s,o,a=n(3515).registerComponent,l=n(8903),c=l.bind,h="click",u="mouseup",d="cursor-fusing",p="cursor-hovering",A="cursor-hovered",f={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},m={DOWN:["selectstart"],UP:["selectend"]},g="a-mouse-cursor-hover";e.exports.Component=a("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:l.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},multiple:!0,init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=l.debounce((function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=c(this.onCursorDown,this),this.onCursorUp=c(this.onCursorUp,this),this.onIntersection=c(this.onIntersection,this),this.onIntersectionCleared=c(this.onIntersectionCleared,this),this.onMouseMove=c(this.onMouseMove,this),this.onEnterVR=c(this.onEnterVR,this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&this.updateMouseEventListeners()},tick:function(){var e=this.el.sceneEl.frame,t=this.activeXRInput;"xrselect"===this.data.rayOrigin&&e&&t&&this.onMouseMove({frame:e,inputSource:t,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(p),e.removeState(d),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(A),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,i=this;function r(){e=n.sceneEl.canvas,t.downEvents.length||t.upEvents.length||(f.DOWN.forEach((function(t){e.addEventListener(t,i.onCursorDown)})),f.UP.forEach((function(t){e.addEventListener(t,i.onCursorUp)})))}(e=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),t.downEvents.forEach((function(e){n.addEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.addEventListener(e,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,i=this;!(e=n.sceneEl.canvas)||t.downEvents.length||t.upEvents.length||(f.DOWN.forEach((function(t){e.removeEventListener(t,i.onCursorDown)})),f.UP.forEach((function(t){e.removeEventListener(t,i.onCursorUp)}))),t.downEvents.forEach((function(e){n.removeEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.removeEventListener(e,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds)},updateMouseEventListeners:function(){var e,t=this.el;(e=t.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove,!1),e.addEventListener("touchmove",this.onMouseMove,!1),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},onMouseMove:(i=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector3,o={origin:s,direction:i},function(e){var t,n,a,l,c,h,u,d=this.canvasBounds,p=this.el.sceneEl.camera;p.parent.updateMatrixWorld(),t=(n="touchmove"===e.type||"touchstart"===e.type?e.touches.item(0):e).clientX-d.left,a=n.clientY-d.top,r.x=t/d.width*2-1,r.y=-a/d.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==e.type&&"fakeselectevent"!==e.type?"fakeselectout"===e.type?(i.set(0,1,0),s.set(0,9999,0)):p&&p.isPerspectiveCamera?(s.setFromMatrixPosition(p.matrixWorld),i.set(r.x,r.y,.5).unproject(p).sub(s).normalize()):p&&p.isOrthographicCamera?(s.set(r.x,r.y,(p.near+p.far)/(p.near-p.far)).unproject(p),i.set(0,0,-1).transformDirection(p.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+p.type):(l=e.frame,c=e.inputSource,h=this.el.renderer.xr.getReferenceSpace(),u=l.getPose(c.targetRaySpace,h).transform,i.set(0,0,-1),i.applyQuaternion(u.orientation),s.copy(u.position)),this.el.setAttribute("raycaster",o),"touchmove"===e.type&&e.preventDefault()}),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===e.type&&(this.activeXRInput=e.inputSource,this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",e),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(u,e),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(u,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin&&"xrselect"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(h,e),"xrselect"===t.rayOrigin&&this.activeXRInput===e.inputSource&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,i,r,s=this.el;n=e.detail.els[0]===s?1:0,r=e.detail.intersections[n],(i=e.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0);var e=this.el.sceneEl.xrSession,t=this;e&&"mouse"!==this.data.rayOrigin&&(m.DOWN.forEach((function(n){e.addEventListener(n,t.onCursorDown)})),m.UP.forEach((function(n){e.addEventListener(n,t.onCursorUp)})))},setIntersection:function(e,t){var n=this.el,i=this.data,r=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(p),e.addState(A),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(g),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(d),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(d),r.twoWayEmit(h)}),i.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(A),i.removeState(p),i.removeState(d),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(g),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&0!==(n=this.el.components.raycaster.intersections).length&&(t=n[n[0].object.el===i?1:0])&&this.setIntersection(t.object.el,t))},twoWayEmit:function(e,t){var n,i=this.el,r=this.intersectedEl;function s(e,n){t instanceof MouseEvent?e.mouseEvent=t:"undefined"!=typeof TouchEvent&&t instanceof TouchEvent&&(e.touchEvent=t)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(e,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(e,this.intersectedEventDetail))}})},9577:(e,t,n)=>{var i=n(3515).registerComponent,r=n(7629),s=n(6600),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="generic";e.exports.Component=i("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},orientationOffset:{type:"vec3"},disabled:{default:!1}},mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=r(this.removeControllersUpdateListener,this),this.onAxisMoved=r(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.lastControllerCheck=0,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(t){t.detail.name!==e.name&&(e.wasControllerConnected=!0,e.removeEventListeners(),e.removeControllersUpdateListener())}))},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;o(this,c,{hand:t,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:c,orientationOffset:t.orientationOffset,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){a(this,this.mapping.axes,e)},initDefaultModel:function(){var e=this.modelEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:.03}),e.setAttribute("material",{color:this.data.color}),this.el.appendChild(e),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}})},2503:(e,t,n)=>{var i=n(4863).xZ,r=n(4863).ib,s=n(3515).registerComponent,o=n(2666),a=new o.BufferGeometry;e.exports.Component=s("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:r,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(e),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(t=i.getObject3D("mesh"))?t.geometry=this.geometry:((t=new o.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(t.material=new o.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=a,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,n=e.primitive,r=i[n]&&i[n].schema;if(!r)throw new Error("Unknown geometry schema `"+n+"`");t&&t===n||this.extendSchema(r)}})},3647:(e,t,n)=>{var i=n(3515).registerComponent,r=n(2666),s=n(8903).debug("components:gltf-model:warn");e.exports.Component=i("gltf-model",{schema:{type:"model"},init:function(){var e=this,t=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new r.GLTFLoader,t&&this.loader.setDRACOLoader(t),this.ready=n?n.then((function(t){e.loader.setMeshoptDecoder(t)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var e=this,t=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){e.loader.load(n,(function(n){e.model=n.scene||n.scenes[0],e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}),void 0,(function(e){var i=e&&e.message?e.message:"Failed to load glTF model";s(i),t.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},3924:(e,t,n)=>{(0,n(3515).registerComponent)("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}})},2346:(e,t,n)=>{var i=n(3515).registerComponent,r=n(8309).AFRAME_CDN_ROOT,s={toonLeft:r+"controllers/hands/leftHand.glb",toonRight:r+"controllers/hands/rightHand.glb",lowPolyLeft:r+"controllers/hands/leftHandLow.glb",lowPolyRight:r+"controllers/hands/rightHandLow.glb",highPolyLeft:r+"controllers/hands/leftHandHigh.glb",highPolyRight:r+"controllers/hands/rightHandHigh.glb"},o="Point",a="Fist",l="Thumb Up",c={};function h(e,t){var n;if(e)return"grip"===(n=c[e])?n+(t?"close":"open"):"point"===n?n+(t?"up":"down"):"pointing"===n||"pistol"===n?n+(t?"start":"end"):void 0}c[a]="grip",c[l]="pistol",c[o]="pointing",e.exports.Component=i("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},init:function(){var e=this,t=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){e.handleButton("grip","down")},this.onGripUp=function(){e.handleButton("grip","up")},this.onTrackpadDown=function(){e.handleButton("trackpad","down")},this.onTrackpadUp=function(){e.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){e.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){e.handleButton("trackpad","touchend")},this.onTriggerDown=function(){e.handleButton("trigger","down")},this.onTriggerUp=function(){e.handleButton("trigger","up")},this.onTriggerTouchStart=function(){e.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){e.handleButton("trigger","touchend")},this.onGripTouchStart=function(){e.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){e.handleButton("grip","touchend")},this.onThumbstickDown=function(){e.handleButton("thumbstick","down")},this.onThumbstickUp=function(){e.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){e.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){e.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){e.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){e.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){e.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){e.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected),t.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(t/1e3)},onControllerConnected:function(){this.el.object3D.visible=!0},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var e=this.el;e.addEventListener("gripdown",this.onGripDown),e.addEventListener("gripup",this.onGripUp),e.addEventListener("trackpaddown",this.onTrackpadDown),e.addEventListener("trackpadup",this.onTrackpadUp),e.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.addEventListener("triggerdown",this.onTriggerDown),e.addEventListener("triggerup",this.onTriggerUp),e.addEventListener("triggertouchstart",this.onTriggerTouchStart),e.addEventListener("triggertouchend",this.onTriggerTouchEnd),e.addEventListener("griptouchstart",this.onGripTouchStart),e.addEventListener("griptouchend",this.onGripTouchEnd),e.addEventListener("thumbstickdown",this.onThumbstickDown),e.addEventListener("thumbstickup",this.onThumbstickUp),e.addEventListener("abuttontouchstart",this.onAorXTouchStart),e.addEventListener("abuttontouchend",this.onAorXTouchEnd),e.addEventListener("bbuttontouchstart",this.onBorYTouchStart),e.addEventListener("bbuttontouchend",this.onBorYTouchEnd),e.addEventListener("xbuttontouchstart",this.onAorXTouchStart),e.addEventListener("xbuttontouchend",this.onAorXTouchEnd),e.addEventListener("ybuttontouchstart",this.onBorYTouchStart),e.addEventListener("ybuttontouchend",this.onBorYTouchEnd),e.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var e=this.el;e.removeEventListener("gripdown",this.onGripDown),e.removeEventListener("gripup",this.onGripUp),e.removeEventListener("trackpaddown",this.onTrackpadDown),e.removeEventListener("trackpadup",this.onTrackpadUp),e.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.removeEventListener("triggerdown",this.onTriggerDown),e.removeEventListener("triggerup",this.onTriggerUp),e.removeEventListener("triggertouchstart",this.onTriggerTouchStart),e.removeEventListener("triggertouchend",this.onTriggerTouchEnd),e.removeEventListener("griptouchstart",this.onGripTouchStart),e.removeEventListener("griptouchend",this.onGripTouchEnd),e.removeEventListener("thumbstickdown",this.onThumbstickDown),e.removeEventListener("thumbstickup",this.onThumbstickUp),e.removeEventListener("abuttontouchstart",this.onAorXTouchStart),e.removeEventListener("abuttontouchend",this.onAorXTouchEnd),e.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),e.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),e.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),e.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),e.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),e.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),e.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(e){var t,n=this.el,i=this.data.hand,r=this.data.handModelStyle,o=this.data.color,a=this;if(t={hand:i,model:!1},i!==e){var l=s[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(l,(function(e){var r=e.scene.children[0],s="left"===i?Math.PI/2:-Math.PI/2,l=n.sceneEl.hasWebXR?-Math.PI/2:0;r.mixer=new THREE.AnimationMixer(r),a.clips=e.animations,n.setObject3D("mesh",r),r.traverse((function(e){e.isMesh&&(e.material.color=new THREE.Color(o))})),r.position.set(0,0,0),r.rotation.set(l,0,s),n.setAttribute("magicleap-controls",t),n.setAttribute("vive-controls",t),n.setAttribute("oculus-touch-controls",t),n.setAttribute("pico-controls",t),n.setAttribute("windows-motion-controls",t),n.setAttribute("hp-mixed-reality-controls",t)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(e,t){var n,i="down"===t,r="touchstart"===t;if(0===t.indexOf("touch")){if(r===this.touchedButtons[e])return;this.touchedButtons[e]=r}else{if(i===this.pressedButtons[e])return;this.pressedButtons[e]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var e,t,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,c=this.pressedButtons.trigger||this.touchedButtons.trigger,h=this.touchedButtons.AorX||this.touchedButtons.BorY;return t=this.el.components["tracked-controls"],(n=t&&t.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||c?e=a:s&&(e=o):i?e=r||h||s?c?a:o:c?l:"Point + Thumb":c&&(e="Hold"),e},getClip:function(e){var t,n;for(n=0;n{var i,r=n(3515).registerComponent,s=n(7629),o=n(6600).checkControllerPresentAndSetup,a=n(8309).AFRAME_CDN_ROOT,l=a+"controllers/oculus-hands/v4/left.glb",c=a+"controllers/oculus-hands/v4/right.glb",h=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];e.exports.Component=r("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"}},bindMethods:function(){this.onControllersUpdate=s(this.onControllersUpdate,this),this.checkIfControllerPresent=s(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=s(this.removeControllersUpdateListener,this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var e=0;ethis.pinchDistance+.1*this.pinchDistance&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{id:"",hand:t.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==e.getObject3D("mesh")&&e.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var e,t=this.el;this.checkIfControllerPresent(),e=t.components["tracked-controls"]&&t.components["tracked-controls"].controller,this.mesh&&e&&e.hand&&e.hand instanceof XRHand&&t.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var e=this.data;"dots"===e.modelStyle&&this.initDotsModel(),"mesh"===e.modelStyle&&this.initMeshHandModel()},initDotsModel:function(){if(0===this.jointEls.length)for(var e=0;e{var i=n(3515).registerComponent,r=n(2666);i("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var e,t=this.el,n=this.data;e="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",t.setAttribute("hand-tracking-controls",{hand:n.hand}),t.setAttribute("obb-collider",{trackedObject3D:e,size:.04}),this.auxMatrix=new r.Matrix4,this.auxQuaternion=new r.Quaternion,this.auxQuaternion2=new r.Quaternion,this.auxVector=new r.Vector3,this.auxVector2=new r.Vector3,this.grabbingObjectPosition=new r.Vector3,this.grabbedObjectPosition=new r.Vector3,this.grabbedObjectPositionDelta=new r.Vector3,this.grabDeltaPosition=new r.Vector3,this.grabInitialRotation=new r.Quaternion,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded),this.onPinchMoved=this.onPinchMoved.bind(this),this.el.addEventListener("pinchmoved",this.onPinchMoved)},transferEntityOwnership:function(){for(var e,t=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n{var i=n(3515).registerComponent;e.exports.Component=i("hide-on-enter-ar",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("ar-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},9359:(e,t,n)=>{var i=n(7629),r=n(3515).registerComponent,s=n(2666),o=n(6600),a=o.checkControllerPresentAndSetup,l=o.emitIfAxesChanged,c=o.onButtonEvent,h="hp-mixed-reality",u=n(8309).AFRAME_CDN_ROOT+"controllers/hp/mixed-reality/",d={x:0,y:0,z:.06},p={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"};e.exports.Component=r("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){c(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){c(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){c(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){c(t.detail.id,"touchstart",e,e.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;a(this,h,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:h,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",u+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t=e.detail.model;this.data.model&&(t.position.copy(d),t.rotation.copy(p),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new s.Vector3(0,0,0)}))},onAxisMoved:function(e){l(this,this.mapping.axes,e)}})},8686:(e,t,n)=>{n(4649),n(9715),n(9541),n(57),n(2503),n(9577),n(3647),n(3924),n(6655),n(5290),n(2346),n(4228),n(9359),n(1714),n(7152),n(4893),n(9234),n(109),n(7479),n(240),n(9115),n(5921),n(4269),n(9536),n(5569),n(8497),n(4854),n(7454),n(4914),n(3689),n(1684),n(5538),n(6957),n(2761),n(1125),n(8666),n(8057),n(3798),n(8367),n(9507),n(6296),n(7872),n(3431),n(2819),n(1135),n(4046),n(1277),n(3969),n(3638),n(7445),n(4310),n(7579),n(5670),n(467),n(5834),n(3807)},7152:(e,t,n)=>{var i=n(3515).registerComponent,r=n(8903);i("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var e=this.config,t=this.data,n=this.el,i=this,s={hand:t.hand,model:t.model};function o(t){var s=e[t.detail.name];if(s){var o=r.extend({showLine:!0},s.raycaster||{});t.detail.rayOrigin&&(o.origin=t.detail.rayOrigin.origin,o.direction=t.detail.rayOrigin.direction,o.showLine=!0),t.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",o):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",r.extend({fuse:!1},s.cursor))}}n.setAttribute("hp-mixed-reality-controls",s),n.setAttribute("magicleap-controls",s),n.setAttribute("oculus-go-controls",s),n.setAttribute("oculus-touch-controls",s),n.setAttribute("pico-controls",s),n.setAttribute("valve-index-controls",s),n.setAttribute("vive-controls",s),n.setAttribute("vive-focus-controls",s),n.setAttribute("windows-motion-controls",s),n.setAttribute("generic-tracked-controller-controls",{hand:s.hand}),n.addEventListener("controllerconnected",o),n.addEventListener("controllerdisconnected",(function(t){e[t.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(e){o(e),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"oculus-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}})},1714:(e,t,n)=>{var i=n(3515).registerComponent,r=n(8903).debug("components:layer:warn");e.exports.Component=i("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var e=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=e.createFramebuffer();var t=this.el.sceneEl.getAttribute("webxr"),n=t.optionalFeatures;-1===n.indexOf("layers")&&(n.push("laters"),this.el.sceneEl.setAttribute("webxr",t)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(e){this.data.src!==e.src&&this.updateSrc()},updateSrc:function(){var e=this.data.type;this.texture=void 0,"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var e,t=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(e=t.getSubImage(this.layer,n),this.loadCubeMapImage(e.colorTexture,i,0)):(e=t.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(e.colorTexture,i,0),e=t.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(e.colorTexture,i,6))))},loadQuadImage:function(){var e=this.data.src,t=this;this.el.sceneEl.systems.material.loadTexture(e,{src:e},(function(n){t.el.sceneEl.renderer.initTexture(n),t.texture=n,"VIDEO"===e.tagName&&setTimeout((function(){t.textureIsVideo=!0}),1e3),t.layer&&(t.layer.height=t.data.height/2||t.texture.image.height/1e3,t.layer.width=t.data.width/2||t.texture.image.width/1e3,t.needsRedraw=!0),t.updateQuadPanel()}))},preGenerateCubeMapTextures:function(e,t){"monocubemap"===this.data.type?this.generateCubeMapTextures(e,0,t):(this.generateCubeMapTextures(e,0,t),this.generateCubeMapTextures(e,6,t))},generateCubeMapTextures:function(e,t,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(e.width,e.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var u=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(u.save(),u.translate(o,o),u.rotate(Math.PI))),u.drawImage(e,(c+t)*a,0,a,a,0,0,o,o),u.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(e,t,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,e),i=!t.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(t,n);var s=0;i.forEach((function(e,t){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,r.RGBA,r.UNSIGNED_BYTE,e),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&(!this.layer&&this.el.sceneEl.is("vr-mode")&&this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var e=this,t=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(t){e.visibilityChanged="hidden"!==t.session.visibilityState},"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var e=this.el.sceneEl,t=e.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(e.xrSession,t);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),e.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var e=this.data.src,t=this.el.sceneEl,n=t.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(e.width,e.height)),s=this.xrGLFactory=new XRWebGLBinding(t.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),t.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var e=this.cubeFaceSize,t=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=e;var r=i.getContext("2d");i.width=i.height=e,r.fillStyle="black",r.fillRect(0,0,e,e),2!==n&&3!==n&&(r.translate(e,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",e/2,e/2)),t.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(e){this.layerEnabled=e,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var e=this.quadPanelEl;this.quadPanelEl||(e=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(e)),e.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),e.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var e=this.el.sceneEl,t=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,e.frame),i=e.renderer.properties.get(this.texture).__webglTexture,r=t.getParameter(t.FRAMEBUFFER_BINDING);t.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n.colorTexture,0),function(e,t,n,i){var r=e.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(e.bindTexture(e.TEXTURE_2D,t),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,e.RGB,e.UNSIGNED_BYTE,i)),e.bindFramebuffer(e.READ_FRAMEBUFFER,r),e.framebufferTexture2D(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.readBuffer(e.COLOR_ATTACHMENT0),e.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,e.COLOR_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.deleteFramebuffer(r)}(t,i,n,this.data.src),t.bindFramebuffer(t.FRAMEBUFFER,r)},updateTransform:function(){var e=this.el,t=this.position,n=this.quaternion;e.object3D.updateMatrixWorld(),t.setFromMatrixPosition(e.object3D.matrixWorld),n.setFromRotationMatrix(e.object3D.matrixWorld),this.layerEnabled||t.set(0,0,1e8),this.layer.transform=new XRRigidTransform(t,n)},onEnterVR:function(){var e=this.el.sceneEl,t=e.xrSession;e.hasWebXR&&XRWebGLBinding&&t?(t.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.needsRedraw=!0,this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):r("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(e){this.referenceSpace=e}})},4893:(e,t,n)=>{var i,r,s,o,a,l,c=n(7629),h=n(8903),u=h.diff,d=n(4219),p=n(3515).registerComponent,A=n(2666),f=n(3437),m=A.MathUtils.degToRad,g=d("components:light:warn"),v=new A.CubeTextureLoader,y={};e.exports.Component=p("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:1,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(e)},update:function(e){var t=this.data,n=u(t,e),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(e){var n=t[e];switch(e){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=m(n);break;case"target":null===n?"spot"!==t.type&&"directional"!==t.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",c(r.onSetTarget,r,n,i));break;case"envMap":r.updateProbeMap(t,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":t.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[e]=n}}))}},tick:(i=new A.Box3,r=new A.Vector3,s=new A.Vector3,o=new A.Matrix4,a=new A.Sphere,l=new A.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof A.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var e=this.light.shadow.camera;e.getWorldDirection(r),e.getWorldPosition(s),o.copy(e.matrixWorld),o.invert(),e.near=1,e.left=1e5,e.right=-1e5,e.top=-1e5,e.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(t){i.setFromObject(t.object3D),i.getBoundingSphere(a);var n=f.distanceOfPointFromPlane(s,r,a.center),c=f.nearestPointInPlane(s,r,a.center,l).applyMatrix4(o);e.near=Math.min(-n-a.radius-1,e.near),e.left=Math.min(-a.radius+c.x,e.left),e.right=Math.max(a.radius+c.x,e.right),e.top=Math.max(a.radius+c.y,e.top),e.bottom=Math.min(-a.radius+c.y,e.bottom)})),e.updateProjectionMatrix()}}),setLight:function(e){var t=this.el,n=this.getLight(e);n&&(this.light&&t.removeObject3D("light"),this.light=n,this.light.el=t,t.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||t.getObject3D("light").translateY(-1),"spot"===e.type&&(t.setObject3D("light-target",this.defaultTarget),t.getObject3D("light-target").position.set(0,0,-1)),e.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var e=this.el,t=this.data,n=this.light;n.castShadow=t.castShadow;var i=e.getObject3D("cameraHelper");if(t.shadowCameraVisible&&!i?e.setObject3D("cameraHelper",new A.CameraHelper(n.shadow.camera)):!t.shadowCameraVisible&&i&&e.removeObject3D("cameraHelper"),!t.castShadow)return n;n.shadow.bias=t.shadowBias,n.shadow.radius=t.shadowRadius,n.shadow.mapSize.height=t.shadowMapHeight,n.shadow.mapSize.width=t.shadowMapWidth,n.shadow.camera.near=t.shadowCameraNear,n.shadow.camera.far=t.shadowCameraFar,n.shadow.camera instanceof A.OrthographicCamera?(n.shadow.camera.top=t.shadowCameraTop,n.shadow.camera.right=t.shadowCameraRight,n.shadow.camera.bottom=t.shadowCameraBottom,n.shadow.camera.left=t.shadowCameraLeft):n.shadow.camera.fov=t.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(e){var t=e.angle,n=new A.Color(e.color);n=n.getHex();var i=e.decay,r=e.distance,s=new A.Color(e.groundColor);s=s.getHex();var o=e.intensity,a=e.type,l=e.target,h=null;switch(a.toLowerCase()){case"ambient":return new A.AmbientLight(n,o);case"directional":return h=new A.DirectionalLight(n,o),this.defaultTarget=h.target,l&&(l.hasLoaded?this.onSetTarget(l,h):l.addEventListener("loaded",c(this.onSetTarget,this,l,h))),h;case"hemisphere":return new A.HemisphereLight(n,s,o);case"point":return new A.PointLight(n,o,r,i);case"spot":return h=new A.SpotLight(n,o,r,m(t),e.penumbra,i),this.defaultTarget=h.target,l&&(l.hasLoaded?this.onSetTarget(l,h):l.addEventListener("loaded",c(this.onSetTarget,this,l,h))),h;case"probe":return h=new A.LightProbe,this.updateProbeMap(e,h),h;default:g("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(e,t){e.envMap||t.copy(new A.LightProbe),y[e.envMap]instanceof window.Promise&&y[e.envMap].then((function(e){t.copy(e)})),y[e.envMap]instanceof A.LightProbe&&t.copy(y[e.envMap]),y[e.envMap]=new window.Promise((function(n){h.srcLoader.validateCubemapSrc(e.envMap,(function(n){v.load(n,(function(n){var i=A.LightProbeGenerator.fromCubeTexture(n);y[e.envMap]=i,t.copy(i)}))}))}))},onSetTarget:function(e,t){t.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}})},9234:(e,t,n)=>{var i=n(3515).registerComponent;function r(e,t){return!(!e||!t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}e.exports.Component=i("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var e,t,n=this.data;t=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(e=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(e,t),this.el.setObject3D(this.attrName,this.line)},update:function(e){var t=this.data,n=this.geometry,i=!1,s=this.material,o=n.attributes.position.array;r(t.start,e.start)||(o[0]=t.start.x,o[1]=t.start.y,o[2]=t.start.z,i=!0),r(t.end,e.end)||(o[3]=t.end.x,o[4]=t.end.y,o[5]=t.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),s.color.setStyle(t.color),s.opacity=t.opacity,s.transparent=t.opacity<1,s.visible=t.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}})},109:(e,t,n)=>{var i,r,s,o,a,l,c,h,u=n(3515).registerComponent,d=n(9644).registerShader,p=n(2666);e.exports.Component=u("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new p.Quaternion,this.hiddenEls=[]},update:function(e){var t,n,i=this.data,r=this.el;i.visualAspectEnabled&&(this.initVisualAspect(),t=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",t),r.setAttribute("material","strokeColor",n),i.on!==e.on&&this.updateEventListener(),void 0!==e.peekMode&&i.peekMode!==e.peekMode&&this.updatePeekMode(),i.image&&e.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src))},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double"}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),i.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),t.setAttribute("visible",!1),i.appendChild(t),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:(a=new p.Vector3,l=new p.Vector3,c=new p.Quaternion,h=new p.Vector3,function(){var e,t,n=this.el,i=n.object3D,r=n.sceneEl.camera,s=this.textEl;if(this.data.visualAspectEnabled)if(i.updateMatrixWorld(),r.parent.updateMatrixWorld(),r.updateMatrixWorld(),i.matrix.decompose(l,c,h),l.setFromMatrixPosition(i.matrixWorld),a.setFromMatrixPosition(r.matrixWorld),(t=l.distanceTo(a))>20)this.previousQuaternion||(this.quaternionClone.copy(c),this.previousQuaternion=this.quaternionClone),i.lookAt(a);else{if(e=this.calculateCameraPortalOrientation(),t<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;s.setAttribute("text","width",1.5),e<=0?(s.setAttribute("position","0 0 0.75"),s.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(s.setAttribute("position","0 0 -0.75"),s.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=e}else e<=0?s.setAttribute("rotation","0 180 0"):s.setAttribute("rotation","0 0 0"),s.setAttribute("text","width",5),s.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(i.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}),hideAll:function(){var e=this.el,t=this.hiddenEls,n=this;t.length>0||e.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==e.sceneEl.object3D&&i.el!==e&&i.el!==n.sphereEl&&i.el!==e.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),t.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(e){e.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(i=new p.Matrix4,r=new p.Vector3,s=new p.Vector3(0,0,1),o=new p.Vector3(0,0,0),function(){var e=this.el,t=e.sceneEl.camera;return r.set(0,0,0),s.set(0,0,1),o.set(0,0,0),e.object3D.matrixWorld.extractRotation(i),s.applyMatrix4(i),e.object3D.updateMatrixWorld(),e.object3D.localToWorld(o),t.parent.parent.updateMatrixWorld(),t.parent.updateMatrixWorld(),t.updateMatrixWorld(),t.localToWorld(r),r.sub(o).normalize(),s.normalize(),Math.sign(s.dot(r))}),remove:function(){this.removeEventListener()}}),d("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / 15.0), 2.0), 0.0, 1.0));","}","}"].join("\n")})},7479:(e,t,n)=>{var i=n(3515).registerComponent,r=n(2666),s=n(8903),o=s.bind,a=Math.PI/2;e.exports.Component=i("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new r.Vector3,this.hmdQuaternion=new r.Quaternion,this.magicWindowAbsoluteEuler=new r.Euler,this.magicWindowDeltaEuler=new r.Euler,this.position=new r.Vector3,this.magicWindowObject=new r.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new r.Vector3,rotation:new r.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;(s.device.isMobile()||s.device.isMobileDeviceRequestingDesktopSite())&&(e=this.magicWindowControls=new r.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){e.enabled=t.magicWindowTrackingEnabled}))))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=o(this.onMouseDown,this),this.onMouseMove=o(this.onMouseMove,this),this.onMouseUp=o(this.onMouseUp,this),this.onTouchStart=o(this.onTouchStart,this),this.onTouchMove=o(this.onTouchMove,this),this.onTouchEnd=o(this.onTouchEnd,this),this.onEnterVR=o(this.onEnterVR,this),this.onExitVR=o(this.onExitVR,this),this.onPointerLockChange=o(this.onPointerLockChange,this),this.onPointerLockError=o(this.onPointerLockError,this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new r.Object3D,this.yawObject=new r.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart),window.addEventListener("touchmove",this.onTouchMove),window.addEventListener("touchend",this.onTouchEnd),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):e.addEventListener("render-target-loaded",o(this.addEventListeners,this))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=this.el.object3D,t=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),e.rotation.x=this.magicWindowDeltaEuler.x+t.rotation.x,e.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,e.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,n,i,r=this.pitchObject,s=this.previousMouseEvent,o=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=e.movementX||e.mozMovementX||0,i=e.movementY||e.mozMovementY||0):(n=e.screenX-s.screenX,i=e.screenY-s.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,o.rotation.y+=.002*n*t,r.rotation.x+=.002*i*t,r.rotation.x=Math.max(-a,Math.min(a,r.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")&&!t.is("ar-mode")||!t.checkHeadsetConnected())&&0===e.button){var n=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1!==e.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/i.clientWidth,t=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){var t=this.el.sceneEl;function n(){t.canvas.classList.add("a-grab-cursor")}function i(){t.canvas.classList.remove("a-grab-cursor")}t.canvas?e?n():i():e?t.addEventListener("render-target-loaded",n):t.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}})},240:(e,t,n)=>{var i=n(7629),r=n(3515).registerComponent,s=n(6600),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="magicleap-one",h=n(8309).AFRAME_CDN_ROOT+"controllers/magicleap/magicleap-one-controller.glb";e.exports.Component=r("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){},setButtonColor:function(e,t){}})},9115:(e,t,n)=>{var i=n(8903),r=n(3515),s=n(2666),o=n(9644),a=i.debug("components:material:error"),l=r.registerComponent,c=o.shaders,h=o.shaderNames;function u(e,t){e.dispose(),t.unregisterMaterial(e)}e.exports.Component=l("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:h,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,n,i,r;n=e&&e.shader,t=this.oldData&&this.oldData.shader,(i=c[r=n||t]&&c[r].schema)||a("Unknown shader schema "+r),t&&n===t||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var e,t,n=this.el.sceneEl,i=this.schema,r=this;function s(e,n){var i;for(i in t)t[i]=e;r.shader.update(t)}for(e in this.tick=void 0,t={},i)"time"===i[e].type&&(this.tick=s,t[e]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(e){var t,n=this.data,i=c[e]&&c[e].Shader;if(!i)throw new Error("Unknown shader "+e);(t=this.shader=new i).el=this.el,t.init(n),this.setMaterial(t.material),this.updateSchema(n)},updateMaterial:function(e){var t,n=this.data,i=this.material;for(t in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(e){switch(e){case"back":return s.BackSide;case"double":return s.DoubleSide;default:return s.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(e){switch(e){case"none":return s.NoBlending;case"additive":return s.AdditiveBlending;case"subtractive":return s.SubtractiveBlending;case"multiply":return s.MultiplyBlending;default:return s.NormalBlending}}(n.blending),i.dithering=n.dithering,e)break;!t||e.alphaTest===n.alphaTest&&e.side===n.side&&e.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var e=new s.MeshBasicMaterial,t=this.material,n=this.el.getObject3D("mesh");n&&(n.material=e),u(t,this.system)},setMaterial:function(e){var t,n=this.el,i=this.system;this.material&&u(this.material,i),this.material=e,i.registerMaterial(e),(t=n.getObject3D("mesh"))?t.material=e:n.addEventListener("object3dset",(function t(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=e,n.removeEventListener("object3dset",t))}))}})},5921:(e,t,n)=>{var i,r,s,o,a=n(3515).registerComponent,l=n(2666);a("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=new l.Vector3,this.auxEuler=new l.Euler,this.boundingBox=new l.Box3,this.boundingBoxSize=new l.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var e,t=this.el,n=t.components["gltf-model"]&&t.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),e=(new l.Box3).setFromObject(n).getCenter(new l.Vector3),n.position.x+=n.position.x-e.x,n.position.y+=n.position.y-e.y,n.position.z+=n.position.z-e.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var e=this.el,t=this.boundingBoxSize,n=this.aabb=this.aabb||new l.OBB;this.obb=this.obb||new l.OBB,e.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(t).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):e.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var e=this.renderColliderMesh,t=this.boundingBoxSize;e?(e.geometry.dispose(),e.geometry=new l.BoxGeometry(t.x,t.y,t.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var e,t,n;e=this.boundingBoxSize,t=this.renderColliderGeometry=new l.BoxGeometry(e.x,e.y,e.z),(n=this.renderColliderMesh=new l.Mesh(t,new l.MeshLambertMaterial({color:65280,side:l.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:function(){var e=this.auxEuler,t=this.boundingBox,n=this.data.size,i=this.trackedObject3D||this.el.object3D,r=this.boundingBoxSize,s=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);this.previousScale.copy(i.scale),e.copy(i.rotation),i.rotation.set(0,0,0),i.updateMatrixWorld(!0),t.setFromObject(i,!0),t.getSize(r),r.x=r.x{var i=n(4219),r=n(3515).registerComponent,s=n(2666),o=i("components:obj-model:warn");e.exports.Component=r("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new s.OBJLoader,this.mtlLoader=new s.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(t){e.model&&"material"===t.detail.name&&e.applyMaterial()}))},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.model&&this.resetMesh()},resetMesh:function(){this.el.removeObject3D("mesh")},loadObj:function(e,t){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,a=this.el.sceneEl.systems.renderer,l=t.substr(0,t.lastIndexOf("/")+1);if(t)return i.hasAttribute("material")&&o("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(l),void r.load(t,(function(t){t.preload(),s.setMaterials(t),s.load(e,(function(e){n.model=e,n.model.traverse((function(e){if(e.isMesh){var t=e.material;t.map&&a.applyColorCorrection(t.map),t.emissiveMap&&a.applyColorCorrection(t.emissiveMap)}})),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))}));s.load(e,(function(e){n.model=e,n.applyMaterial(),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse((function(t){t instanceof s.Mesh&&(t.material=e.material)}))}})},9536:(e,t,n)=>{var i=n(3515).registerComponent,r=n(7629),s=n(6600),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(8903).device.isWebXRAvailable,h=n(8309).AFRAME_CDN_ROOT+"controllers/oculus/go/oculus-go-controller.gltf",u=c?"oculus-go":"Oculus Go",d=c?{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]};e.exports.Component=i("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:d,bindMethods:function(){this.onModelLoaded=r(this.onModelLoaded,this),this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=r(this.removeControllersUpdateListener,this),this.onAxisMoved=r(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,u,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,hand:t.hand,idPrefix:u,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),t.trackpad=n.getObjectByName("oculus_go_touchpad"),t.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var i;switch(t){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[e].material.color.set(i)}}})},5569:(e,t,n)=>{var i=n(7629),r=n(3515).registerComponent,s=n(2666),o=n(6600),a=o.checkControllerPresentAndSetup,l=o.emitIfAxesChanged,c=o.onButtonEvent,h=n(8903).device.isWebXRAvailable,u="oculus-touch",d=h?u:"Oculus Touch",p=n(8309).AFRAME_CDN_ROOT,A=p+"controllers/oculus/oculus-touch-controller-",f=p+"controllers/meta/",m={left:{modelUrl:A+"left.gltf",rayOrigin:{origin:{x:.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new s.Vector3(-.005,.003,-.055),modelPivotRotation:new s.Euler(0,0,0)},right:{modelUrl:A+"right.gltf",rayOrigin:{origin:{x:-.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new s.Vector3(.005,.003,-.055),modelPivotRotation:new s.Euler(0,0,0)}},g={left:{modelUrl:A+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new s.Vector3(-.005,.036,-.037),modelPivotRotation:new s.Euler(Math.PI/4.5,0,0)},right:{modelUrl:A+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new s.Vector3(.005,.036,-.037),modelPivotRotation:new s.Euler(Math.PI/4.5,0,0)}},v="oculus-touch",y={"oculus-touch":h?g:m,"oculus-touch-v2":{left:{modelUrl:A+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new s.Vector3(0,-.007,-.021),modelPivotRotation:new s.Euler(-Math.PI/4,0,0)},right:{modelUrl:A+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new s.Vector3(0,-.007,-.021),modelPivotRotation:new s.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:A+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new s.Vector3(0,0,0),modelPivotRotation:new s.Euler(0,0,0)},right:{modelUrl:A+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new s.Vector3(0,0,0),modelPivotRotation:new s.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:f+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new s.Vector3(0,0,0),modelPivotRotation:new s.Euler(0,0,0)},right:{modelUrl:f+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new s.Vector3(0,0,0),modelPivotRotation:new s.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:f+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new s.Vector3(0,0,0),modelPivotRotation:new s.Euler(0,0,0)},right:{modelUrl:f+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new s.Vector3(0,0,0),modelPivotRotation:new s.Euler(0,0,0)}}},E=h?{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}}:{left:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","abutton","bbutton","surface"]}};function b(e){e.traverse((function(t){var n;"Mesh"===t.type&&(n=t.material.clone(),e.originalColor=t.material.color,t.material.dispose(),t.material=n)}))}e.exports.Component=r("oculus-touch-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]},orientationOffset:{type:"vec3",default:{x:43,y:0,z:0}}},mapping:E,bindMethods:function(){this.onButtonChanged=i(this.onButtonChanged,this),this.onThumbstickMoved=i(this.onThumbstickMoved,this),this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.onAxisMoved=i(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonDown=function(t){c(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){c(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchStart=function(t){c(t.detail.id,"touchstart",e,e.data.hand)},this.onButtonTouchEnd=function(t){c(t.detail.id,"touchend",e,e.data.hand)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new s.Euler},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){a(this,d,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(e){var t,n=this.data;if(n.model)if(this.controllerObject3D)this.el.setObject3D("mesh",this.controllerObject3D);else{if(this.displayModel=y[n.controllerType]||y[v],"auto"===n.controllerType){var i=this.el.sceneEl.systems["tracked-controls-webvr"];if(i&&i.vrDisplay){var r=i.vrDisplay.displayName;/^Oculus Quest$/.test(r)&&(this.displayModel=y["oculus-touch-v2"])}else{t=v;for(var s=Object.keys(y),o=0;o{var i=n(7629),r=n(3515).registerComponent,s=n(2666),o=n(6600),a=o.checkControllerPresentAndSetup,l=o.emitIfAxesChanged,c=o.onButtonEvent,h="pico-4",u=n(8309).AFRAME_CDN_ROOT+"controllers/pico/pico4/";e.exports.Component=r("pico-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","squeeze","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","squeeze","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){c(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){c(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){c(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){c(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;a(this,h,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:h,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",u+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new s.Vector3(0,0,0)})},onAxisMoved:function(e){l(this,this.mapping.axes,e)}})},4854:(e,t,n)=>{var i=n(3515).registerComponent;e.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},7454:(e,t,n)=>{var i,r,s=n(3515).registerComponent,o=n(2666),a=n(8903).debug("components:raycaster:warn"),l=/^[\w\s-.,[\]#]*$/,c={childList:!0,attributes:!0,subtree:!0},h="raycaster-intersected-cleared",u="raycaster-intersection-cleared";function d(e,t){var n;for(e.length=t.length,n=0;n0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var e,t=this.el,n=this.intersections;n.length&&(e=n[0].object.el===t&&n[1]?n[1].distance:n[0].distance),this.drawLine(e)},getIntersection:function(e){var t,n;for(t=0;t{var i=n(2666).MathUtils.degToRad,r=n(3515).registerComponent;e.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var e=this.data,t=this.el.object3D;t.rotation.set(i(e.x),i(e.y),i(e.z)),t.rotation.order="YXZ"},remove:function(){this.el.object3D.rotation.set(0,0,0)}})},3689:(e,t,n)=>{var i=n(3515).registerComponent,r=1e-5;e.exports.Component=i("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var e=this.data,t=this.el.object3D,n=0===e.x?r:e.x,i=0===e.y?r:e.y,s=0===e.z?r:e.z;t.scale.set(n,i,s)},remove:function(){this.el.object3D.scale.set(1,1,1)}})},3431:(e,t,n)=>{var i,r,s,o=n(3515).registerComponent,a=n(2666),l=(i=new a.Quaternion,r=new a.Vector3,function(e,t,n){t.position.copy(e.transform.position),t.quaternion.copy(e.transform.orientation),r.copy(n),i.copy(e.transform.orientation),r.applyQuaternion(i),t.position.sub(r)});function c(e,t){this.renderer=e,this.xrHitTestSource=null,e.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),e.xr.addEventListener("sessionstart",function(){this.sessionStart(t)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(t)}function h(e){console.warn(e.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from ?')}l.tempFakePose={transform:{orientation:new a.Quaternion,position:new a.Vector3}},c.prototype.previousFrameAnchors=new Set,c.prototype.anchorToObject3D=new Map,c.prototype.sessionStart=function(e){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?e.space?this.session.requestHitTestSource(e).then(function(e){this.xrHitTestSource=e}.bind(this)).catch(h):e.profile&&this.session.requestHitTestSourceForTransientInput(e).then(function(e){this.xrHitTestSource=e,this.transient=!0}.bind(this)).catch(h):h({message:"No requestHitTestSource on the session."})},c.prototype.anchorFromLastHitTestResult=function(e,t){var n=this.lastHitTest;if(n){var i={object3D:e,offset:t};Array.from(this.anchorToObject3D.entries()).forEach(function(t){var n=t[1].object3D,i=t[0];n===e&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(e){this.anchorToObject3D.set(e,i)}.bind(this)).catch((function(e){console.warn(e.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from ?')}))}},c.prototype.doHit=function(e){if(this.renderer.xr.isPresenting){var t,n,i=this.renderer.xr.getReferenceSpace(),r=e.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(t=e.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=t[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(t=e.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=t[0],t[0].getPose(i)):void 0}},c.updateAnchorPoses=function(e,t){var n=e.trackedAnchors||c.prototype.previousFrameAnchors;c.prototype.previousFrameAnchors.forEach((function(e){n.has(e)||c.prototype.anchorToObject3D.delete(e)})),n.forEach((function(n){var i,r,s,o;try{i=e.getPose(n.anchorSpace,t)}catch(e){}i&&(s=(r=c.prototype.anchorToObject3D.get(n)).offset,o=r.object3D,l(i,o,s))}))},e.exports.Component=o("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new a.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new a.WebGLRenderTarget(512,512,{}),this.basicMaterial=new a.MeshBasicMaterial({color:0,side:a.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new a.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var e=this.el.getAttribute("webxr"),t=e.optionalFeatures;t.includes("hit-test")&&t.includes("anchors")||(t.push("hit-test"),t.push("anchors"),this.el.setAttribute("webxr",e)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var e=this.el.sceneEl.renderer,t=this.session=e.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,s||(s=new Map),t.requestReferenceSpace("viewer").then(function(t){this.hitTest=new c(e,{space:t}),s.set(t,this.hitTest),this.el.emit("ar-hit-test-start")}.bind(this));var n="generic-touchscreen",i=new c(e,{profile:n});t.addEventListener("selectstart",function(t){if(!0===this.data.enabled){var r=t.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:r,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),r.profiles[0]===n?this.hitTest=i:(this.hitTest=s.get(r)||new c(e,{space:r.targetRaySpace}),s.set(r,this.hitTest)))}}.bind(this)),t.addEventListener("selectend",function(e){if(this.hitTest&&!0===this.data.enabled){var t,n=e.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(t=this.data.target.object3D)&&(l.tempFakePose.transform.position.copy(this.bboxMesh.position),l.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),l(l.tempFakePose,t,this.bboxOffset),t.visible=!0,this.hitTest.anchorFromLastHitTestResult(t,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion})),this.hitTest=null}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new a.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(e){e.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var e=new a.PlaneGeometry(1,1),t=new a.MeshBasicMaterial({transparent:!0,color:16777215});e.rotateX(-Math.PI/2),e.rotateY(-Math.PI/2),this.bbox=new a.Box3,this.bboxMesh=new a.Mesh(e,t),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var e,t,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),t=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(t),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),e=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==e.data[4*s+3]&&255!==e.data[4*s+3]&&(e.data[4*s+3]=128);this.context.putImageData(e,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var e,t,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&c.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?t=this.textureCache.get(this.data.src):(t=(new a.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,t)),this.bboxMesh.material.map=t,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(e=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(e.transform.position),this.bboxMesh.quaternion.copy(e.transform.orientation))}})},2819:(e,t,n)=>{var i=n(3515).registerComponent,r=n(3515).components;e.exports.Component=i("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},update:function(){var e=this.data,t=this.el.object3D;e.transparent?t.background=null:t.background=new THREE.Color(e.color)},remove:function(){var e=this.data,t=this.el.object3D;e.transparent?t.background=null:t.background=r[this.name].schema.color.default}})},1135:(e,t,n)=>{var i=n(3515).registerComponent;e.exports.Component=i("debug",{schema:{default:!0}})},4046:(e,t,n)=>{var i=n(3515).registerComponent,r=n(8903).bind,s=n(8309),o="a-dialog-buttons-container",a="a-dialog-button";function l(e,t){var n,i,r,o;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(s.AFRAME_INJECTED,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(s.AFRAME_INJECTED,""),n.appendChild(i),(r=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(r),(o=document.createElement("div")).classList.add("a-dialog-text"),o.innerHTML=e,r.appendChild(o),i.appendChild(t),n}e.exports.Component=i("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},init:function(){var e=this;this.data.enabled&&("localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&"http:"===location.protocol&&this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=r(this.onDeviceMotionDialogAllowClicked,this),this.onDeviceMotionDialogDenyClicked=r(this.onDeviceMotionDialogDenyClicked,this),DeviceOrientationEvent.requestPermission().then((function(){e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0})).catch((function(){var t,n,i,r,c,h,u,d;e.devicePermissionDialogEl=(t=e.data.denyButtonText,n=e.data.allowButtonText,i=e.data.deviceMotionMessage,r=e.onDeviceMotionDialogAllowClicked,c=e.onDeviceMotionDialogDenyClicked,(h=document.createElement("div")).classList.add(o),(u=document.createElement("button")).classList.add(a,"a-dialog-deny-button"),u.setAttribute(s.AFRAME_INJECTED,""),u.innerHTML=t,h.appendChild(u),(d=document.createElement("button")).classList.add(a,"a-dialog-allow-button"),d.setAttribute(s.AFRAME_INJECTED,""),d.innerHTML=n,h.appendChild(d),d.addEventListener("click",(function(e){e.stopPropagation(),r()})),u.addEventListener("click",(function(e){e.stopPropagation(),c()})),l(i,h)),e.el.appendChild(e.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var e,t,n,i,r,c=this,h=(e=c.data.cancelButtonText,t=c.data.httpsMessage,n=function(){c.el.removeChild(h)},(i=document.createElement("div")).classList.add(o),(r=document.createElement("button")).classList.add(a,"a-dialog-ok-button"),r.setAttribute(s.AFRAME_INJECTED,""),r.innerHTML=e,i.appendChild(r),r.addEventListener("click",(function(e){e.stopPropagation(),n()})),l(t,i));this.el.appendChild(h)},onDeviceMotionDialogAllowClicked:function(){var e=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(t){"granted"===t?(e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0):e.el.emit("deviceorientationpermissionrejected"),e.remove()})).catch(console.error)}})},1277:(e,t,n)=>{var i=n(3515).registerComponent;e.exports.Component=i("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},update:function(){var e=this.el,t=e.querySelector(".a-enter-vr");!0===this.data?(t&&t.classList.add("embedded"),e.removeFullScreenStyles()):(t&&t.classList.remove("embedded"),e.addFullScreenStyles())}})},3638:(e,t,n)=>{var i=n(3515).registerComponent,r=n(2666),s=n(4219)("components:fog:warn");e.exports.Component=i("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},update:function(){var e=this.data,t=this.el,n=this.el.object3D.fog;if(t.isScene)return n&&e.type===n.name?void Object.keys(this.schema).forEach((function(t){var i=e[t];"color"===t&&(i=new r.Color(i)),n[t]=i})):(t.object3D.fog=function(e){var t;return(t="exponential"===e.type?new r.FogExp2(e.color,e.density):new r.Fog(e.color,e.near,e.far)).name=e.type,t}(e),void t.systems.material.updateMaterials());s("Fog component can only be applied to ")},remove:function(){var e=this.el.object3D.fog;e&&(e.far=0,e.near=.1)}})},3969:(e,t,n)=>{var i,r=n(8309).AFRAME_INJECTED,s=n(4147),o=n(3515).registerComponent,a=n(8903),l="https://unpkg.com/aframe-inspector@"+((i=s.version.split("."))[2]="x",i.join(".")+"/dist/aframe-inspector.min.js");e.exports.Component=o("inspector",{schema:{url:{default:l}},init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=a.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector...'},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var t,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(e):(this.showLoader(),(t=document.createElement("script")).src=this.data.url,t.setAttribute("data-name","aframe-inspector"),t.setAttribute(r,""),t.onload=function(){AFRAME.INSPECTOR.open(e),n.hideLoader(),n.removeEventListeners()},t.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(t),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})},7445:(e,t,n)=>{var i=n(3515).registerComponent,r=n(8903).shouldCaptureKeyEvent;e.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},init:function(){this.onKeyup=this.onKeyup.bind(this)},update:function(e){var t=this.data;this.enterVREnabled=t.enterVR},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;r(e)&&(this.enterVREnabled&&70===e.keyCode&&t.enterVR(),this.enterVREnabled&&27===e.keyCode&&t.exitVR())}})},4310:(e,t,n)=>{var i=n(4219),r=n(3515).registerComponent,s=i("components:pool:warn");e.exports.Component=r("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},multiple:!0,initPool:function(){var e;for(this.availableEls=[],this.usedEls=[],this.data.mixin||s("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||s("Container "+this.data.container+" not found.")),this.container=this.container||this.el,e=0;e{var i,r=n(3515).registerComponent,s=n(2666);e.exports.Component=r("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},init:function(){var e=this.el.getAttribute("webxr"),t=e.requiredFeatures;-1===t.indexOf("mesh-detection")&&(t.push("mesh-detection"),this.el.setAttribute("webxr",e)),-1===t.indexOf("plane-detection")&&(t.push("plane-detection"),this.el.setAttribute("webxr",e)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var e,t,n,i=this.data,r=this.el,s=(r.renderer.xr,this.meshEntities),o=!1,a=[],l=this.data.filterLabels;e=(n=r.frame).detectedMeshes,t=n.detectedPlanes;for(var c=0;c{var i=n(3515).registerComponent;e.exports.Component=i("reflection",{schema:{directionalLight:{type:"selector"}},init:function(){var e=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var t=this.el.getAttribute("webxr"),n=t.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",t)),this.el.addEventListener("enter-vr",(function(){e.el.renderer.xr.getSession().requestLightProbe&&e.el.is("ar-mode")&&e.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){e.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var e=this.el.renderer,t=e.xr.getSession(),n=this,i=e.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(t.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(t,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),t.requestLightProbe().then((function(e){n.xrLightProbe=e,e.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(e){console.warn("Lighting estimation not supported: "+e.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from ?')}))},updateXRCubeMap:function(){var e=this.el.renderer,t=this.glBinding.getReflectionCubeMap(this.xrLightProbe);t&&(e.properties.get(this.lightingEstimationTexture).__webglTexture=t,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var e=this.el.object3D,t=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(e,t,n,i){var r=Math.max(e.primaryLightIntensity.x,Math.max(e.primaryLightIntensity.y,e.primaryLightIntensity.z));t.sh.fromArray(e.sphericalHarmonicsCoefficients),t.intensity=1,n&&(n.color.setRGB(e.primaryLightIntensity.x/r,e.primaryLightIntensity.y/r,e.primaryLightIntensity.z/r),n.intensity=r,i.copy(e.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(e.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(t,e),e.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}})},467:(e,t,n)=>{var i=n(3515).registerComponent,r=n(2666),s=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),o=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");e.exports.Component=i("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},init:function(){var e=this.el,t=this;function n(){var n=e.renderer.getContext();n&&(t.cubeMapSize=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),t.material=new r.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:s,fragmentShader:o,side:r.DoubleSide}),t.quad=new r.Mesh(new r.PlaneGeometry(1,1),t.material),t.quad.visible=!1,t.camera=new r.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),t.canvas=document.createElement("canvas"),t.ctx=t.canvas.getContext("2d"),e.object3D.add(t.quad),t.onKeyDown=t.onKeyDown.bind(t))}e.renderer?n():e.addEventListener("render-target-loaded",n)},getRenderTarget:function(e,t){return new r.WebGLRenderTarget(e,t,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:r.LinearFilter,magFilter:r.LinearFilter,wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,format:r.RGBAFormat,type:r.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var n=e.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(e){var t,n,i,s,o=this.el;return"perspective"===e?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||o.camera,t={width:this.data.width,height:this.data.height}):(n=this.camera,s=new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:r.RGBFormat,generateMipmaps:!0,minFilter:r.LinearMipmapLinearFilter,colorSpace:r.SRGBColorSpace}),i=new r.CubeCamera(o.camera.near,o.camera.far,s),o.camera.getWorldPosition(i.position),o.camera.getWorldQuaternion(i.quaternion),i.update(o.renderer,o.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:t,projection:e}},capture:function(e){var t,n=this.el.renderer.xr.enabled,i=this.el.renderer;i.xr.enabled=!1,t=this.setCapture(e),this.renderCapture(t.camera,t.size,t.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(e){var t=this.el.renderer.xr.enabled,n=this.el.renderer,i=this.setCapture(e);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=t,this.canvas},renderCapture:function(e,t,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(t.width,t.height),s=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,e),l.autoClear=o,l.readRenderTargetPixels(r,0,0,t.width,t.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,t.width,t.height)),i=new ImageData(new Uint8ClampedArray(s),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(e,t,n){for(var i=e.slice(0),r=0;r{var i=n(3515).registerComponent,r=n(1326),s=n(8903);n(9625),n(1543);var o=window.aframeStats,a=s.bind,l="a-hidden",c=window.threeStats;e.exports.Component=i("stats",{schema:{default:!0},init:function(){var e=this.el;"false"!==s.getUrlParameter("stats")&&(this.stats=function(e){var t=new c(e.renderer),n=new o(e),i=e.isMobile?[]:[t,n];return new r({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(e),this.statsEl=document.querySelector(".rs-base"),this.hideBound=a(this.hide,this),this.showBound=a(this.show,this),e.addEventListener("enter-vr",this.hideBound),e.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var e=this.stats;e&&(e("rAF").tick(),e("FPS").frame(),e().update())},hide:function(){this.statsEl.classList.add(l)},show:function(){this.statsEl.classList.remove(l)}})},3807:(e,t,n)=>{var i=n(3515).registerComponent,r=n(8309),s=n(8903),o=s.bind,a="a-hidden";function l(e){e.addEventListener("touchstart",(function(){e.classList.remove("resethover")})),e.addEventListener("touchend",(function(){e.classList.add("resethover")}))}e.exports.Component=i("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},cardboardModeEnabled:{default:!1},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},init:function(){var e=this,t=this.el;"false"!==s.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),t.addEventListener("enter-vr",this.updateEnterInterfaces),t.addEventListener("exit-vr",this.updateEnterInterfaces),t.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(t){"loaderReady"===t.data.type&&(e.insideLoader=!0,e.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=o(this.onEnterVRButtonClick,this),this.onEnterARButtonClick=o(this.onEnterARButtonClick,this),this.onModalClick=o(this.onModalClick,this),this.toggleOrientationModalIfNeeded=o(this.toggleOrientationModalIfNeeded,this),this.updateEnterInterfaces=o(this.updateEnterInterfaces,this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var e,t,n,i=this.data,o=this.el;if(!i.enabled||this.insideLoader||"false"===s.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(e=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(r.AFRAME_INJECTED,""),(t=document.createElement("button")).className="a-enter-vr-button",t.setAttribute("title","Enter VR mode with a headset or fullscreen without"),t.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&l(t),n.appendChild(t),t.addEventListener("click",(function(t){e(),t.stopPropagation()})),n),o.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(e,t){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),t&&i.classList.add("xr"),i.setAttribute(r.AFRAME_INJECTED,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&l(n),i.appendChild(n),n.addEventListener("click",(function(t){e(),t.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),o.appendChild(this.enterAREl))),this.orientationModalEl=function(e){var t=document.createElement("div");t.className="a-orientation-modal",t.classList.add(a),t.setAttribute(r.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(r.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",e),t.appendChild(n),t}(this.onModalClick),o.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var e=this.el;this.enterVREl&&(e.is("vr-mode")||(e.isMobile||s.device.isMobileDeviceRequestingDesktopSite())&&!this.data.cardboardModeEnabled&&!s.device.checkVRSupport()?this.enterVREl.classList.add(a):(s.device.checkVRSupport()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(a)))},toggleEnterARButtonIfNeeded:function(){var e=this.el;this.enterAREl&&(e.is("vr-mode")||!s.device.checkARSupport()?this.enterAREl.classList.add(a):this.enterAREl.classList.remove(a))},toggleOrientationModalIfNeeded:function(){var e=this.el,t=this.orientationModalEl;t&&e.isMobile&&(!s.device.isLandscape()&&e.is("vr-mode")?t.classList.remove(a):t.classList.add(a))}})},1684:(e,t,n)=>{var i=n(3515),r=n(2666),s=n(7629),o=i.registerComponent;e.exports.Component=o("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=s(this.update,this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var e=this.data;this.updateDescendants(e.cast,e.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(e,t){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof r.Mesh&&(i.castShadow=e,i.receiveShadow=t,n.hasLoaded&&i.material))for(var s=Array.isArray(i.material)?i.material:[i.material],o=0;o{var i=n(3515).registerComponent,r=n(4219),s=n(2666),o=r("components:sound:warn");e.exports.Component=i("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var e=this;this.listener=null,this.audioLoader=new s.AudioLoader,this.pool=new s.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){e.playSound()}},update:function(e){var t,n,i=this.data,r=i.src!==e.src;if(r){if(!i.src)return;this.setupSound()}for(t=0;t0&&(this.stopSound(),n.removeObject3D("sound"));var o=this.listener=i.audioListener||new s.AudioListener;for(i.audioListener=o,i.camera&&i.camera.add(o),i.addEventListener("camera-set-active",(function(e){e.detail.cameraEl.getObject3D("camera").add(o)})),this.pool=new s.Group,e=0;e{var i=n(6559),r=n(1880),s=n(3515).registerComponent,o=n(9644),a=n(2666),l=n(8903),c=l.debug("components:text:error"),h=o.shaders,u=l.debug("components:text:warn"),d=n(8309).AFRAME_CDN_ROOT+"fonts/",p={aileronsemibold:d+"Aileron-Semibold.fnt",dejavu:d+"DejaVu-sdf.fnt",exo2bold:d+"Exo2Bold.fnt",exo2semibold:d+"Exo2SemiBold.fnt",kelsonsans:d+"KelsonSans.fnt",monoid:d+"Monoid.fnt",mozillavr:d+"mozillavr.fnt",roboto:d+"Roboto-msdf.json",sourcecodepro:d+"SourceCodePro.fnt"},A=["roboto"],f="roboto";e.exports.FONTS=p;var m,g,v,y,E=new function(){var e=this.cache={};this.get=function(t,n){return t in e||(e[t]=n()),e[t]}},b={},x={},C=/^\w+:/;function w(e,t,n){return e||(.5+t)*n}e.exports.Component=s("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:f},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:h},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=i(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(e){var t=this.data,n=this.currentFont;x[t.font]?this.texture=x[t.font]:(this.texture=x[t.font]=new a.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),e.font===t.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var e,t,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==A.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in p&&-1===A.indexOf(i.font)&&(n="sdf"),e=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(e){switch(e){case"back":return a.FrontSide;case"double":return a.DoubleSide;default:return a.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!e)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);t=function(e,t,n){var i,r;return(r=new h[t].Shader).el=e,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=t.material,this.shaderObject=t.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var e,t=this.data,n=this.el,i=this.geometry,s=this;t.font||u("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),e=this.lookupFont(t.font||f)||t.font,E.get(e,(function(){return n=e,i=t.yOffset,new Promise((function(e,t){r(n,(function(r,s){if(r)return c("Error loading font",n),void t(r);n.indexOf("/Roboto-msdf.json")>=0&&(i=30),i&&s.chars.map((function(e){e.yoffset+=i})),e(s)}))}));var n,i})).then((function(r){var o;if(1!==r.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");b[e]||(r.widthFactor=b[r]=function(e){var t=0,n=0,i=0;return e.chars.map((function(e){t+=e.xadvance,e.id>=48&&e.id<=57&&(i++,n+=e.xadvance)})),i?n/i:t/e.chars.length}(r)),s.currentFont=r,o=s.getFontImageSrc(),E.get(o,(function(){return e=o,new Promise((function(t,n){(new a.ImageLoader).load(e,(function(e){t(e)}),void 0,(function(){c("Error loading font image",e),n(null)}))}));var e})).then((function(e){var o=s.texture;o&&(o.image=e,o.needsUpdate=!0,x[t.font]=o,s.texture=o,s.initMesh(),s.currentFont=r,s.updateGeometry(i,r),s.updateLayout(),s.mesh.visible=!0,n.emit("textfontset",{font:t.font,fontObj:r}))})).catch((function(e){c(e.message),c(e.stack)}))})).catch((function(e){c(e.message),c(e.stack)}))},initMesh:function(){this.mesh||(this.mesh=new a.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var e=this.lookupFont(this.data.font||f)||this.data.font,t=this.currentFont.pages[0];return t.match(C)&&0!==t.indexOf("http")?e.replace(/(\.fnt)|(\.json)/,".png"):a.LoaderUtils.extractUrlBase(e)+t},updateLayout:function(){var e,t,n,i,r,s,o,a,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/w(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=u.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(e="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===e)a=-1*r.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);a=-1*r.width/2}if("bottom"===(t=h.baseline))l=0;else if("top"===t)l=-1*r.height+r.ascender;else{if("center"!==t)throw new TypeError("Invalid text.baseline property value",t);l=-1*r.height/2}d.position.x=a*s+h.xOffset,d.position.y=l*s,d.position.z=h.zOffset,d.scale.set(s,-1*s,s)}},lookupFont:function(e){return p[e]},updateGeometry:(m={},g={},v=/\\n/g,y=/\\t/g,function(e,t){var n=this.data;g.font=t,g.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:t.common.lineHeight,g.text=n.value.toString().replace(v,"\n").replace(y,"\t"),g.width=w(n.wrapPixels,n.wrapCount,t.widthFactor),e.update(l.extend(m,n,g))})})},1125:(e,t,n)=>{var i=n(3515).registerComponent,r=n(6600),s=n(8309).DEFAULT_CAMERA_HEIGHT,o=n(2666),a=n(8309).DEFAULT_HANDEDNESS,l={touches:[]};e.exports.Component=i("tracked-controls-webvr",{schema:{autoHide:{default:!0},controller:{default:0},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"}},init:function(){this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.changedAxes=[],this.targetControllerNumber=this.data.controller,this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.deltaControllerPosition=new o.Vector3,this.controllerQuaternion=new o.Quaternion,this.controllerEuler=new o.Euler,this.updateGamepad(),this.buttonEventDetails={}},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.update&&n.update(t/1e3),this.updateGamepad(),this.updatePose(),this.updateButtons()},defaultUserHeight:function(){return s},getHeadElement:function(){return this.data.headElement||this.el.sceneEl.camera.el},updateGamepad:function(){var e=this.data,t=r.findMatchingControllerWebVR(this.system.controllers,e.id,e.idPrefix,e.hand,e.controller);this.controller=t,this.el.components["tracked-controls"].controller=t,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},applyArmModel:function(e){var t,n,i,r,s=this.controller,o=this.controllerEuler,l=this.controllerQuaternion,c=this.deltaControllerPosition;n=this.getHeadElement().object3D,r=this.defaultUserHeight(),i=s.pose,t=(s?s.hand:void 0)||a,e.copy(n.position),c.set(.175*("left"===t?-1:"right"===t?1:0),-.3,-.03),c.multiplyScalar(r),c.applyAxisAngle(n.up,n.rotation.y),e.add(c),c.set(0,0,-.175),c.multiplyScalar(r),i.orientation?l.fromArray(i.orientation):l.copy(n.quaternion),o.setFromQuaternion(l),o.set(o.x,o.y,0),c.applyEuler(o),e.add(c)},updatePose:function(){var e,t,n=this.controller,i=this.data,r=this.el.object3D,s=this.system.vrDisplay;n&&((e=n.pose).position?r.position.fromArray(e.position):i.armModel&&this.applyArmModel(r.position),e.orientation&&r.quaternion.fromArray(e.orientation),s&&e.position&&(t=this.el.sceneEl.renderer.xr.getStandingMatrix(),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrix.multiplyMatrices(t,r.matrix),r.matrix.decompose(r.position,r.quaternion,r.scale)),r.rotateX(this.data.orientationOffset.x*o.MathUtils.DEG2RAD),r.rotateY(this.data.orientationOffset.y*o.MathUtils.DEG2RAD),r.rotateZ(this.data.orientationOffset.z*o.MathUtils.DEG2RAD))},updateButtons:function(){var e,t,n=this.controller;if(n){for(t=0;t{var i=n(6600),r=n(3515).registerComponent;e.exports.Component=r("tracked-controls-webxr",{schema:{id:{type:"string",default:""},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},index:{type:"int",default:-1},iterateControllerProfiles:{default:!1},space:{type:"string",oneOf:["targetRaySpace","gripSpace"],default:"gripSpace"}},init:function(){this.updateController=this.updateController.bind(this),this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes}},update:function(){this.updateController()},play:function(){var e=this.el.sceneEl;this.updateController(),e.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(e){return!(!this.controller||this.controller.gamepad||"none"!==e.inputSource.handedness&&e.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=i.findMatchingControllerWebXR(this.system.controllers,this.data.id,this.data.hand,this.data.index,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},tick:function(){var e=this.el.sceneEl,t=this.controller,n=e.frame;t&&e.frame&&this.system.referenceSpace&&(t.hand||(this.pose=n.getPose(t[this.data.space],this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var e=this.el.object3D,t=this.pose;t&&(e.matrix.elements=t.transform.matrix,e.matrix.decompose(e.position,e.rotation,e.scale))},updateButtons:function(){var e,t,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,t=0;t{var i=n(3515).registerComponent;e.exports.Component=i("tracked-controls",{schema:{autoHide:{default:!0},controller:{default:-1},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},handTrackingEnabled:{default:!1},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"},iterateControllerProfiles:{default:!1},space:{type:"string",oneOf:["targetRaySpace","gripSpace"],default:"targetRaySpace"}},update:function(){var e=this.data,t=this.el;t.sceneEl.hasWebXR?t.setAttribute("tracked-controls-webxr",{id:e.id,hand:e.hand,index:e.controller,iterateControllerProfiles:e.iterateControllerProfiles,handTrackingEnabled:e.handTrackingEnabled,space:e.space}):t.setAttribute("tracked-controls-webvr",e)}})},3798:(e,t,n)=>{var i=n(3515).registerComponent,r=n(7629),s=n(2666),o=n(6600),a=o.checkControllerPresentAndSetup,l=o.emitIfAxesChanged,c=o.onButtonEvent,h=n(8309).AFRAME_CDN_ROOT+"controllers/valve/index/valve-index-",u={left:h+"left.glb",right:h+"right.glb"},d="valve",p=n(8903).device.isWebXRAvailable,A={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},f=p?A:{left:{_x:.692295102620542,_y:-.0627618864318427,_z:-.06265893149611756,_order:"XYZ"},right:{_x:.6484021229942998,_y:-.032563619881892894,_z:-.1327973171917482,_order:"XYZ"}},m=p?{left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}}:{left:{x:-.00023692678902063457,y:.04724540367838371,z:-.061959880395271096},right:{x:.002471558599671131,y:.055765208987076195,z:-.061068168708348844}};e.exports.Component=i("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){c(t.detail.id,"down",e)},this.onButtonUp=function(t){c(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){c(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){c(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=r(this.onModelLoaded,this),this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=r(this.removeControllersUpdateListener,this),this.onAxisMoved=r(this.onAxisMoved,this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t="right"===e.hand?0:"left"===e.hand?1:2;a(this,d,{index:t,iterateControllerProfiles:!0,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,controller:"right"===t.hand?1:"left"===t.hand?0:2,hand:t.hand,orientationOffset:t.orientationOffset}),this.loadModel()},loadModel:function(){var e=this.data;e.model&&this.el.setAttribute("gltf-model",""+u[e.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-t*(Math.PI/40))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=t.trigger.rotation.x,Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.copy(m[this.data.hand]),n.rotation.copy(f[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controlls",model:this.data.model,rayOrigin:new s.Vector3(0,0,0)}))},onAxisMoved:function(e){l(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){}})},8057:(e,t,n)=>{var i=n(3515).registerComponent;e.exports.Component=i("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}})},8367:(e,t,n)=>{var i=n(3515).registerComponent,r=n(7629),s=n(6600),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(8309).AFRAME_CDN_ROOT,h=c+"controllers/vive/vr_controller_vive.obj",u=c+"controllers/vive/vr_controller_vive.mtl",d=n(8903).device.isWebXRAvailable,p=d?"htc-vive":"OpenVR ",A=d?{axes:{thumbstick:[0,1]},buttons:["trigger","grip","trackpad","none","menu"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger","grip","menu","system"]};e.exports.Component=i("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:A,init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=r(this.onModelLoaded,this),this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=r(this.removeControllersUpdateListener,this),this.onAxisMoved=r(this.onAxisMoved,this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,p,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:p,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:h,mtl:u})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-t*(Math.PI/12))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){var n=this.buttonMeshes;if(n)return"grip"===e?(n.grip.left.material.color.set(t),void n.grip.right.material.color.set(t)):void n[e].material.color.set(t)}})},9507:(e,t,n)=>{var i=n(3515).registerComponent,r=n(7629),s=n(6600),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="HTC Vive Focus",h=n(8309).AFRAME_CDN_ROOT+"controllers/vive/focus-controller/focus-controller.gltf";e.exports.Component=i("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]},bindMethods:function(){this.onModelLoaded=r(this.onModelLoaded,this),this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=r(this.removeControllersUpdateListener,this),this.onAxisMoved=r(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){o(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,idPrefix:c,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),t.triggerPressed=n.getObjectByName("BumperKey_Press"),t.triggerPressed&&(t.triggerPressed.visible=!1),t.trackpad=n.getObjectByName("TouchPad"),t.trackpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpadPressed&&(t.trackpadPressed.visible=!1))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes,i=e+"Pressed";if(n&&n[e]&&n[i]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[e].visible=!r}}})},6296:(e,t,n)=>{var i,r,s=n(8309).keyboardevent.KEYCODE_TO_CODE,o=n(3515).registerComponent,a=n(2666),l=n(8903),c=l.bind,h=l.shouldCaptureKeyEvent,u=1e-5,d=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];e.exports.Component=o("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},init:function(){this.keys={},this.easing=1.1,this.velocity=new a.Vector3,this.onBlur=c(this.onBlur,this),this.onContextMenu=c(this.onContextMenu,this),this.onFocus=c(this.onFocus,this),this.onKeyDown=c(this.onKeyDown,this),this.onKeyUp=c(this.onKeyUp,this),this.onVisibilityChange=c(this.onVisibilityChange,this),this.attachVisibilityEventListeners()},tick:function(e,t){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(e){var t;for(t in e)return!1;return!0}(this.keys))&&(t/=1e3,this.updateVelocity(t),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(t)))},update:function(e){e.adAxis!==this.data.adAxis&&(this.velocity[e.adAxis]=0),e.wsAxis!==this.data.wsAxis&&(this.velocity[e.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(e){var t,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,e>.2)return l[n]=0,void(l[r]=0);var c=Math.pow(1/this.easing,60*e);0!==l[n]&&(l[n]=l[n]*c),0!==l[r]&&(l[r]=l[r]*c),Math.abs(l[n]){var i,r=n(3515).registerComponent,s=n(7629),o=n(6600),a=o.checkControllerPresentAndSetup,l=o.emitIfAxesChanged,c=o.onButtonEvent,h=n(8903),u=h.debug("components:windows-motion-controls:debug"),d=h.debug("components:windows-motion-controls:warn"),p=n(8309).DEFAULT_HANDEDNESS,A=n(8309).AFRAME_CDN_ROOT+"controllers/microsoft/",f={left:"left.glb",right:"right.glb",default:"universal.glb"},m=n(8903).device.isWebXRAvailable,g=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,v=m?"windows-mixed-reality":"Spatial Controller (Spatial Interaction Source) ",y=m?{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"}:{axes:{thumbstick:[0,1],trackpad:[2,3]},buttons:["thumbstick","trigger","grip","menu","trackpad"],axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"};e.exports.Component=r("windows-motion-controls",{schema:{hand:{default:p},pair:{default:0},model:{default:!0},hideDisconnected:{default:!0}},mapping:y,bindMethods:function(){this.onModelError=s(this.onModelError,this),this.onModelLoaded=s(this.onModelLoaded,this),this.onControllersUpdate=s(this.onControllersUpdate,this),this.checkIfControllerPresent=s(this.checkIfControllerPresent,this),this.onAxisMoved=s(this.onAxisMoved,this)},init:function(){var e=this,t=this.el;this.onButtonChanged=s(this.onButtonChanged,this),this.onButtonDown=function(t){c(t.detail.id,"down",e)},this.onButtonUp=function(t){c(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){c(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){c(t.detail.id,"touchend",e)},this.onControllerConnected=function(){e.setModelVisibility(!0)},this.onControllerDisconnected=function(){e.setModelVisibility(!1)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-error",this.onModelError),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-error",this.onModelError),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){a(this,v,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var e=this.createControllerModelUrl();this.loadModel(e)}else this.modelReady()},createControllerModelUrl:function(e){var t=this.el.components["tracked-controls"],n=t?t.controller:null,i="default",r=this.data.hand;if(n&&!window.hasNativeWebXRImplementation&&(r=n.hand,!e)){var s=n.id.match(g);i=s&&s[0]||i}return A+i+"/"+(f[r]||f.default)},injectTrackedControls:function(){var e=this.data;this.el.setAttribute("tracked-controls",{idPrefix:v,controller:e.pair,hand:e.hand,armModel:!1}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(e){var t=this.createControllerModelUrl(!0);e.detail.src!==t?(d("Failed to load controller model for device, attempting to load default."),this.loadModel(t)):d("Failed to load default controller model.")},loadModel:function(e){this.el.setAttribute("gltf-model","url("+e+")")},onModelLoaded:function(e){var t,n,i,r,s=this.controllerModel=e.detail.model,o=this.loadedMeshInfo;if(u("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(t=0;t{e.exports={AFRAME_CDN_ROOT:window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",AFRAME_INJECTED:"aframe-injected",DEFAULT_CAMERA_HEIGHT:1.6,DEFAULT_HANDEDNESS:"right",keyboardevent:n(5065)}},5065:e=>{e.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}}},2385:(e,t,n)=>{var i=n(9721).X,r=n(7629),s=n(4219),o=n(2666),a=new o.FileLoader,l=s("core:a-assets:warn");function c(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise((function(t,n){if(4===e.readyState)return t();if(e.error)return n();function i(){for(var n=0,i=0;i=e.duration&&("VIDEO"===e.tagName&&o.Cache.add(e.getAttribute("src"),e),t())}e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),e.addEventListener("error",n,!1)}))}function h(e){var t=function(e){var t,n,i;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if((i=(n=t).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return e}return l('Cross-origin element (e.g., ) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., )',t),e.crossOrigin="anonymous",e.cloneNode(!0)}(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function u(e){var t=d(e),n=t.lastIndexOf(".");return n>=0&&".glb"===t.slice(n,e.search(/\?|#|$/))?"arraybuffer":"text"}function d(e){var t=document.createElement("a");t.href=e;var n=t.search.replace(/^\?/,""),i=e.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}customElements.define("a-assets",class extends i{constructor(){super(),this.isAssets=!0,this.fileLoader=a,this.timeout=null}connectedCallback(){"complete"===document.readyState?this.doConnectedCallback():document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){var e,t,n,i,s,a,u=this,d=[];if(super.connectedCallback(),!this.parentNode.isScene)throw new Error(" must be a child of a .");for(s=this.querySelectorAll("img"),e=0;e{var i=n(4219)("core:cubemap:warn");class r extends HTMLElement{constructor(e){return super(e)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?r.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var e,t=this.querySelectorAll("[src]"),n=[];if(6===t.length){for(e=0;e did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",r)},1956:(e,t,n)=>{var i=n(9721).X,r=n(3515).components,s=n(2666),o=n(8903),a=o.debug("core:a-entity:debug"),l=o.debug("core:a-entity:warn"),c="__",h=["position","rotation","scale","visible"],u={once:!0};class d extends i{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new s.Group,this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(e,t,n){var i=this.components[e];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(e,t,n)}connectedCallback(){"complete"===document.readyState?d.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){var e,t,n=this;super.connectedCallback(),t=this.sceneEl,this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(e){return this.object3DMap[e]}setObject3D(e,t){var n,i=this;if(!(t instanceof s.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(e))&&this.object3D.remove(n),t.el=this,t.children.length&&t.traverse((function(e){e.el=i})),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}removeObject3D(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):l("Tried to remove `Object3D` of type:",e,"which was not defined.")}getOrCreateObject3D(e,t){var n=this.getObject3D(e);return!n&&t&&(n=new t,this.setObject3D(e,n)),l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}addToParent(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}removeFromParent(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}load(){var e=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())}))}remove(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var e=this.children,t=[],n=0;n2?l.slice(1).join("__"):l[1],r[h]&&(p(this,e)||void 0!==t||n)&&!(e in this.components)){if(this.initComponentDependencies(h),s&&!r[h].multiple)throw new Error("Trying to initialize multiple components of type `"+h+"`. There can only be one component of this type per entity.");i=new r[h].Component(this,t,s),this.isPlaying&&i.play(),this.hasAttribute(e)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),a("Component initialized: %s",e)}}initComponentDependencies(e){var t,n;if(r[e]&&(t=r[e].dependencies))for(n=0;n0?e.substring(0,l):e,!r[a])return"mixin"===e&&this.mixinUpdate(t),void super.setAttribute.call(this,e,t);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),void 0!==n&&"string"==typeof t&&t.length>0&&"string"==typeof o.styleParser.parse(t)){for(h in u)delete u[h];(i=u)[t]=n,s=!1}else i=t,s=!0===n;this.updateComponent(e,i,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[e].flushToDOM()}flushToDOM(e){var t,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(e)for(n=0;n{var i=n(9721).X,r=n(3515).components,s=n(8903);customElements.define("a-mixin",class extends i{constructor(){super(),this.componentCache={},this.isMixin=!0}connectedCallback(){"complete"===document.readyState?this.doConnectedCallback():document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){super.connectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(),this.cacheAttribute(e,n),this.updateEntities()}setAttribute(e,t){window.HTMLElement.prototype.setAttribute.call(this,e,t),this.cacheAttribute(e,t)}cacheAttribute(e,t){var n,i;i=s.split(e,"__")[0],(n=r[i])&&(void 0===t&&(t=window.HTMLElement.prototype.getAttribute.call(this,e)),this.componentCache[e]=n.parseAttrValueForCache(t))}getAttribute(e){return this.componentCache[e]||window.HTMLElement.prototype.getAttribute.call(this,e)}cacheAttributes(){var e,t,n=this.attributes;for(t=0;t{var i=n(8903),r=i.debug("core:a-node:warn"),s={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function o(e){return e.tagName.toLowerCase()in s||e.isNode}class a extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?a.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){var e;this.sceneEl=this.closestScene(),this.sceneEl||r("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)}attributeChangedCallback(e,t,n){n!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(n,t))}closestScene(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}closest(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!t.call(n,e);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(e,t){var n,i=this;this.hasLoaded||(t=t||o,n=this.getChildren().filter(t).map((function(e){return new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(t){t.forEach((function(e){"rejected"===e.status&&r("Rendering scene with errors on node: ",e.reason.target)})),i.hasLoaded=!0,i.setupMutationObserver(),e&&e(),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var e=this;new MutationObserver((function(t){var n;for(n=0;n{var i=n(5941),r=n(1435),s=n(365),o=n(8903),a=e.exports.components={},l=i.parseProperties,c=i.parseProperty,h=i.process,u=i.isSingleProperty,d=i.stringifyProperties,p=i.stringifyProperty,A=o.styleParser,f=o.debug("core:component:warn"),m=document.currentScript,g=new RegExp("[A-Z]+"),v={},y=e.exports.Component=function(e,t,n){var i=this;this.el=e,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=v[this.name];var r=this.events;this.events={},function(e,t){var n;for(n in t)e.events[n]=t[n].bind(e)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.nextData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.nextData,this.schema),this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.previousOldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.previousOldData,this.schema),this.parsingAttrValue=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.parsingAttrValue,this.schema)):(this.nextData=void 0,this.oldData=void 0,this.previousOldData=void 0,this.parsingAttrValue=void 0),this.throttledEmitComponentChanged=o.throttleLeadingAndTrailing((function(){e.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(t)};if(y.prototype={schema:{},init:function(){},events:{},update:function(e){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},parse:function(e,t){var n=this.schema;return this.isSingleProperty?c(e,n):l(A.parse(e),n,!0,this.name,t)},stringify:function(e){var t=this.schema;return"string"==typeof e?e:this.isSingleProperty?p(e,t):(e=d(e,t),A.stringify(e))},updateCachedAttrValue:function(e,t){var n,i,r;if(void 0!==e){if(null===e)return this.isObjectBased&&this.attrValue&&this.objectPool.recycle(this.attrValue),void(this.attrValue=void 0);if(e instanceof Object&&!(e instanceof window.HTMLElement)?(i=this.objectPool.use(),n=o.extend(i,e)):n=this.parseAttrValueForCache(e),this.isObjectBased&&!t&&this.attrValue)for(r in this.attrValue)void 0===n[r]&&(n[r]=this.attrValue[r]);this.isObjectBased&&!this.attrValue&&(this.attrValue=this.objectPool.use()),o.objectPool.clearObject(this.attrValue),this.attrValue=x(this.attrValue,n,this.isObjectBased),o.objectPool.clearObject(i)}},parseAttrValueForCache:function(e){var t;return"string"!=typeof e?e:(this.isSingleProperty?"string"==typeof(t=this.schema.parse(e))&&(t=e):(o.objectPool.clearObject(this.parsingAttrValue),t=A.parse(e,this.parsingAttrValue)),t)},flushToDOM:function(e){var t=e?this.data:this.attrValue;null!=t&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(t))},updateProperties:function(e,t){this.el.hasLoaded?(null!==e&&(e=this.parseAttrValueForCache(e)),this.updateCachedAttrValue(e,t),this.initialized?(this.updateComponent(e,t),this.callUpdateHandler()):this.initComponent()):this.updateCachedAttrValue(e)},initComponent:function(){var e,t=this.el;this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!1,!0)),this.data=this.buildData(this.attrValue),t.initializingComponents[this.name]||(t.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete t.initializingComponents[this.name],this.oldData=x(this.oldData,this.data,this.isObjectBased),e=this.isObjectBased?this.objectPool.use():void 0,this.update(e),this.isObjectBased&&this.objectPool.recycle(e),t.isPlaying&&this.play(),t.emit("componentinitialized",this.evtDetail,!1))},updateComponent:function(e,t){var n,i;if(t)return this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!0,!0)),void(this.data=this.buildData(this.attrValue,!0,!1));if(this.isSingleProperty)return this.isObjectBased&&c(e,this.schema),void(this.data=e);if(l(e,this.schema,!0,this.name),this.schemaChangeKeys.length)for(n in e)if(this.schema[n].schemaChange){i=!0;break}if(i)return this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!0,!0)),void(this.data=this.buildData(this.attrValue,!0,!1));for(n in e)void 0!==e[n]&&(this.data[n]=e[n])},callUpdateHandler:function(){var e;this.previousOldData instanceof Object&&o.objectPool.clearObject(this.previousOldData),this.isObjectBased?b(this.previousOldData,this.oldData):this.previousOldData=this.oldData,e=!o.deepEqual(this.oldData,this.data),(this.isPositionRotationScale||e)&&(this.oldData instanceof Object&&o.objectPool.clearObject(this.oldData),this.oldData=x(this.oldData,this.data,this.isObjectBased),this.update(this.previousOldData),this.throttledEmitComponentChanged())},handleMixinUpdate:function(){this.data=this.buildData(this.attrValue),this.callUpdateHandler()},resetProperty:function(e){if(this.isObjectBased){if(!(e in this.attrValue))return;delete this.attrValue[e],this.data[e]=this.schema[e].default}else this.attrValue=this.schema.default,this.data=this.schema.default;this.updateProperties(this.attrValue)},extendSchema:function(e){var t;t=o.extend({},a[this.name].schema),o.extend(t,e),this.schema=h(t),this.el.emit("schemachanged",this.evtDetail)},buildData:function(e,t,n){var i,r,s,a,h,u,d,p=this.nextData,A=this.schema,f=this.el.mixinEls;if(i=e&&e.constructor===Array?e.length:null!=e,this.isObjectBased&&o.objectPool.clearObject(p),this.isSingleProperty)r=this.isObjectBased?b(p,A.default):_(A.default)?o.clone(A.default):A.default;else for(a in r=(d=!t&&this.attrValue)instanceof Object?b(p,d):p,A)s=A[a].default,void 0===r[a]&&(r[a]=_(s)?o.clone(s):s);for(u=0;u tag after the scene. Component