From f6031050dc0fba1c0cf8c82bc9a6bd04badb8d87 Mon Sep 17 00:00:00 2001 From: AXRBLK Date: Mon, 11 Nov 2024 10:38:41 +0100 Subject: [PATCH] tooltip --- build/asset-manifest.json | 6 ++-- build/index.html | 2 +- .../js/{main.509cfb6f.js => main.e4914d60.js} | 6 ++-- ...CENSE.txt => main.e4914d60.js.LICENSE.txt} | 0 ...n.509cfb6f.js.map => main.e4914d60.js.map} | 2 +- src/App.js | 34 +++++++++++++------ 6 files changed, 31 insertions(+), 19 deletions(-) rename build/static/js/{main.509cfb6f.js => main.e4914d60.js} (99%) rename build/static/js/{main.509cfb6f.js.LICENSE.txt => main.e4914d60.js.LICENSE.txt} (100%) rename build/static/js/{main.509cfb6f.js.map => main.e4914d60.js.map} (65%) diff --git a/build/asset-manifest.json b/build/asset-manifest.json index aab1147..aaac876 100644 --- a/build/asset-manifest.json +++ b/build/asset-manifest.json @@ -1,15 +1,15 @@ { "files": { "main.css": "/mycelialnet-g/static/css/main.f855e6bc.css", - "main.js": "/mycelialnet-g/static/js/main.509cfb6f.js", + "main.js": "/mycelialnet-g/static/js/main.e4914d60.js", "static/js/453.74927aeb.chunk.js": "/mycelialnet-g/static/js/453.74927aeb.chunk.js", "index.html": "/mycelialnet-g/index.html", "main.f855e6bc.css.map": "/mycelialnet-g/static/css/main.f855e6bc.css.map", - "main.509cfb6f.js.map": "/mycelialnet-g/static/js/main.509cfb6f.js.map", + "main.e4914d60.js.map": "/mycelialnet-g/static/js/main.e4914d60.js.map", "453.74927aeb.chunk.js.map": "/mycelialnet-g/static/js/453.74927aeb.chunk.js.map" }, "entrypoints": [ "static/css/main.f855e6bc.css", - "static/js/main.509cfb6f.js" + "static/js/main.e4914d60.js" ] } \ No newline at end of file diff --git a/build/index.html b/build/index.html index 522a85b..8bb3b1a 100644 --- a/build/index.html +++ b/build/index.html @@ -1 +1 @@ -Myceliated.Net
\ No newline at end of file +Myceliated.Net
\ No newline at end of file diff --git a/build/static/js/main.509cfb6f.js b/build/static/js/main.e4914d60.js similarity index 99% rename from build/static/js/main.509cfb6f.js rename to build/static/js/main.e4914d60.js index 66d50b7..1723716 100644 --- a/build/static/js/main.509cfb6f.js +++ b/build/static/js/main.e4914d60.js @@ -1,3 +1,3 @@ -/*! For license information please see main.509cfb6f.js.LICENSE.txt */ -(()=>{var e={3832:(t,e,n)=>{n(36),n(7486),n(2206),n(8166),n(8244)},5525:t=>{t.exports=THREE.ColladaLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.ColladaLoader.prototype={constructor:THREE.ColladaLoader,crossOrigin:"anonymous",load:function(t,e,n,i){var r=this,o=void 0===r.path?THREE.LoaderUtils.extractUrlBase(t):r.path,a=new THREE.FileLoader(r.manager);a.setPath(r.path),a.load(t,(function(t){e(r.parse(t,o))}),n,i)},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},options:{set convertUpAxis(t){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},setCrossOrigin:function(t){return this.crossOrigin=t,this},parse:function(t,e){function n(t,e){for(var n=[],i=t.childNodes,r=0,o=i.length;r0&&e.push(new THREE.VectorKeyframeTrack(i+".position",r,o)),a.length>0&&e.push(new THREE.QuaternionKeyframeTrack(i+".quaternion",r,a)),s.length>0&&e.push(new THREE.VectorKeyframeTrack(i+".scale",r,s)),e}function b(t,e,n){var i,r,o,a=!0;for(r=0,o=t.length;r=0;){var i=t[e];if(null!==i.value[n])return i;e--}return null}function w(t,e,n){for(;e>>0));e="tga"===(n=n.toLowerCase())?zt:Ht;return e}(n);if(void 0!==r){var o=r.load(n),a=t.extra;if(void 0!==a&&void 0!==a.technique&&!1===s(a.technique)){var l=a.technique;o.wrapS=l.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,o.wrapT=l.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,o.offset.set(l.offsetU||0,l.offsetV||0),o.repeat.set(l.repeatU||1,l.repeatV||1)}else o.wrapS=THREE.RepeatWrapping,o.wrapT=THREE.RepeatWrapping;return o}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",n),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",t.id),null}n.name=t.name;var l=r.parameters;for(var c in l){var h=l[c];switch(c){case"diffuse":h.color&&n.color.fromArray(h.color),h.texture&&(n.map=a(h.texture));break;case"specular":h.color&&n.specular&&n.specular.fromArray(h.color),h.texture&&(n.specularMap=a(h.texture));break;case"bump":h.texture&&(n.normalMap=a(h.texture));break;case"ambient":h.texture&&(n.lightMap=a(h.texture));break;case"shininess":h.float&&n.shininess&&(n.shininess=h.float);break;case"emission":h.color&&n.emissive&&n.emissive.fromArray(h.color),h.texture&&(n.emissiveMap=a(h.texture))}}var u=l.transparent,p=l.transparency;if(void 0===p&&u&&(p={float:1}),void 0===u&&p&&(u={opaque:"A_ONE",data:{color:[1,1,1,1]}}),u&&p)if(u.data.texture)n.transparent=!0;else{var f=u.data.color;switch(u.opaque){case"A_ONE":n.opacity=f[3]*p.float;break;case"RGB_ZERO":n.opacity=1-f[0]*p.float;break;case"A_ZERO":n.opacity=1-f[3]*p.float;break;case"RGB_ONE":n.opacity=f[0]*p.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',u.opaque)}n.opacity<1&&(n.transparent=!0)}return void 0!==o&&void 0!==o.technique&&1===o.technique.double_sided&&(n.side=THREE.DoubleSide),n}function X(t){return d(Wt.materials[t],q)}function K(t){for(var e=0;e0?l+h:l;e.inputs[u]={id:s,offset:c},e.stride=Math.max(e.stride,c+1),"TEXCOORD"===l&&(e.hasUV=!0);break;case"vcount":e.vcount=o(r.textContent);break;case"p":e.p=o(r.textContent)}}return e}function st(t){for(var e=0,n=0,i=t.length;n0&&e0&&p.addAttribute("position",new THREE.Float32BufferAttribute(r.array,r.stride)),o.array.length>0&&p.addAttribute("normal",new THREE.Float32BufferAttribute(o.array,o.stride)),l.array.length>0&&p.addAttribute("color",new THREE.Float32BufferAttribute(l.array,l.stride)),a.array.length>0&&p.addAttribute("uv",new THREE.Float32BufferAttribute(a.array,a.stride)),s.array.length>0&&p.addAttribute("uv2",new THREE.Float32BufferAttribute(s.array,s.stride)),c.length>0&&p.addAttribute("skinIndex",new THREE.Float32BufferAttribute(c,h)),u.length>0&&p.addAttribute("skinWeight",new THREE.Float32BufferAttribute(u,d)),i.data=p,i.type=t[0].type,i.materialKeys=f,i}function ht(t,e,n,i){var r=t.p,o=t.stride,a=t.vcount;function s(t){for(var e=r[t+n]*c,o=e+c;e4)for(var v=1,A=p-2;v<=A;v++){f=h+o*v,m=h+o*(v+1);s(h+0*o),s(f),s(m)}h+=o*p}else for(u=0,d=r.length;u=e.limits.max&&(e.static=!0),e.middlePosition=(e.limits.min+e.limits.max)/2,e}function gt(t){for(var e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]},n=0;ni.limits.max||e{t.exports=Object.assign((function(){}),{FACE_1:0,FACE_2:1,FACE_3:2,FACE_4:3,L_SHOULDER_1:4,R_SHOULDER_1:5,L_SHOULDER_2:6,R_SHOULDER_2:7,SELECT:8,START:9,DPAD_UP:12,DPAD_DOWN:13,DPAD_LEFT:14,DPAD_RIGHT:15,VENDOR:16})},9823:t=>{t.exports=function(t,e,n){this.type=t,this.index=e,this.pressed=n.pressed,this.value=n.value}},510:t=>{function e(t){const e=document.getElementById(t),n=e.parentNode;try{n&&n.removeChild(e)}catch(i){}}function n(t,n,i){return new i((function(i,r){const o=n.timeout||5e3,a="script_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),s=function(t,e){var n=document.createElement("script");return n.type="text/javascript",n.async=!0,n.id=e,n.src=t,n}(t,a),l=setTimeout((function(){r(new Error("Script request to "+t+" timed out")),e(a)}),o),c=function(t){clearTimeout(t)};s.addEventListener("load",(function(t){i({ok:!0}),c(l),e(a)})),s.addEventListener("error",(function(n){r(new Error("Script request to "+t+" failed "+n)),c(l),e(a)})),function(t){const e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}(s)}))}t.exports=function(t){return t=t||{},function(e,i){return n(e,i=i||{},t.Promise||Promise)}}},1742:()=>{!function(t){var e="KeyboardEvent"in t;e||(t.KeyboardEvent=function(){throw TypeError("Illegal constructor")}),"DOM_KEY_LOCATION_STANDARD"in t.KeyboardEvent||(t.KeyboardEvent.DOM_KEY_LOCATION_STANDARD=0),"DOM_KEY_LOCATION_LEFT"in t.KeyboardEvent||(t.KeyboardEvent.DOM_KEY_LOCATION_LEFT=1),"DOM_KEY_LOCATION_RIGHT"in t.KeyboardEvent||(t.KeyboardEvent.DOM_KEY_LOCATION_RIGHT=2),"DOM_KEY_LOCATION_NUMPAD"in t.KeyboardEvent||(t.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD=3);var n=window.KeyboardEvent.DOM_KEY_LOCATION_STANDARD,i=window.KeyboardEvent.DOM_KEY_LOCATION_LEFT,r=window.KeyboardEvent.DOM_KEY_LOCATION_RIGHT,o=window.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;function a(t,e){return-1!==String(t).indexOf(e)}var s=a(navigator.platform,"Win")?"win":a(navigator.platform,"Mac")?"mac":a(navigator.platform,"CrOS")?"cros":a(navigator.platform,"Linux")?"linux":a(navigator.userAgent,"iPad")||a(navigator.platform,"iPod")||a(navigator.platform,"iPhone")?"ios":"",l=a(navigator.userAgent,"Chrome/")?"chrome":a(navigator.vendor,"Apple")?"safari":a(navigator.userAgent,"MSIE")?"ie":a(navigator.userAgent,"Gecko/")?"moz":a(navigator.userAgent,"Opera/")?"opera":"",c=l+"-"+s;function h(t,e,n){c!==e&&l!==e&&s!==e||Object.keys(n).forEach((function(e){t[e]=n[e]}))}var u={3:{code:"Cancel"},6:{code:"Help"},8:{code:"Backspace"},9:{code:"Tab"},12:{code:"Clear"},13:{code:"Enter"},16:{code:"Shift"},17:{code:"Control"},18:{code:"Alt"},19:{code:"Pause"},20:{code:"CapsLock"},21:{code:"KanaMode"},22:{code:"HangulMode"},23:{code:"JunjaMode"},24:{code:"FinalMode"},25:{code:"KanjiMode"},27:{code:"Escape"},28:{code:"Convert"},29:{code:"NonConvert"},30:{code:"Accept"},31:{code:"ModeChange"},32:{code:"Space"},33:{code:"PageUp"},34:{code:"PageDown"},35:{code:"End"},36:{code:"Home"},37:{code:"ArrowLeft"},38:{code:"ArrowUp"},39:{code:"ArrowRight"},40:{code:"ArrowDown"},41:{code:"Select"},42:{code:"Print"},43:{code:"Execute"},44:{code:"PrintScreen"},45:{code:"Insert"},46:{code:"Delete"},47:{code:"Help"},48:{code:"Digit0",keyCap:"0"},49:{code:"Digit1",keyCap:"1"},50:{code:"Digit2",keyCap:"2"},51:{code:"Digit3",keyCap:"3"},52:{code:"Digit4",keyCap:"4"},53:{code:"Digit5",keyCap:"5"},54:{code:"Digit6",keyCap:"6"},55:{code:"Digit7",keyCap:"7"},56:{code:"Digit8",keyCap:"8"},57:{code:"Digit9",keyCap:"9"},65:{code:"KeyA",keyCap:"a"},66:{code:"KeyB",keyCap:"b"},67:{code:"KeyC",keyCap:"c"},68:{code:"KeyD",keyCap:"d"},69:{code:"KeyE",keyCap:"e"},70:{code:"KeyF",keyCap:"f"},71:{code:"KeyG",keyCap:"g"},72:{code:"KeyH",keyCap:"h"},73:{code:"KeyI",keyCap:"i"},74:{code:"KeyJ",keyCap:"j"},75:{code:"KeyK",keyCap:"k"},76:{code:"KeyL",keyCap:"l"},77:{code:"KeyM",keyCap:"m"},78:{code:"KeyN",keyCap:"n"},79:{code:"KeyO",keyCap:"o"},80:{code:"KeyP",keyCap:"p"},81:{code:"KeyQ",keyCap:"q"},82:{code:"KeyR",keyCap:"r"},83:{code:"KeyS",keyCap:"s"},84:{code:"KeyT",keyCap:"t"},85:{code:"KeyU",keyCap:"u"},86:{code:"KeyV",keyCap:"v"},87:{code:"KeyW",keyCap:"w"},88:{code:"KeyX",keyCap:"x"},89:{code:"KeyY",keyCap:"y"},90:{code:"KeyZ",keyCap:"z"},91:{code:"OSLeft",location:i},92:{code:"OSRight",location:r},93:{code:"ContextMenu"},95:{code:"Standby"},96:{code:"Numpad0",keyCap:"0",location:o},97:{code:"Numpad1",keyCap:"1",location:o},98:{code:"Numpad2",keyCap:"2",location:o},99:{code:"Numpad3",keyCap:"3",location:o},100:{code:"Numpad4",keyCap:"4",location:o},101:{code:"Numpad5",keyCap:"5",location:o},102:{code:"Numpad6",keyCap:"6",location:o},103:{code:"Numpad7",keyCap:"7",location:o},104:{code:"Numpad8",keyCap:"8",location:o},105:{code:"Numpad9",keyCap:"9",location:o},106:{code:"NumpadMultiply",keyCap:"*",location:o},107:{code:"NumpadAdd",keyCap:"+",location:o},108:{code:"NumpadComma",keyCap:",",location:o},109:{code:"NumpadSubtract",keyCap:"-",location:o},110:{code:"NumpadDecimal",keyCap:".",location:o},111:{code:"NumpadDivide",keyCap:"/",location:o},112:{code:"F1"},113:{code:"F2"},114:{code:"F3"},115:{code:"F4"},116:{code:"F5"},117:{code:"F6"},118:{code:"F7"},119:{code:"F8"},120:{code:"F9"},121:{code:"F10"},122:{code:"F11"},123:{code:"F12"},124:{code:"F13"},125:{code:"F14"},126:{code:"F15"},127:{code:"F16"},128:{code:"F17"},129:{code:"F18"},130:{code:"F19"},131:{code:"F20"},132:{code:"F21"},133:{code:"F22"},134:{code:"F23"},135:{code:"F24"},144:{code:"NumLock",location:o},145:{code:"ScrollLock"},160:{code:"ShiftLeft",location:i},161:{code:"ShiftRight",location:r},162:{code:"ControlLeft",location:i},163:{code:"ControlRight",location:r},164:{code:"AltLeft",location:i},165:{code:"AltRight",location:r},166:{code:"BrowserBack"},167:{code:"BrowserForward"},168:{code:"BrowserRefresh"},169:{code:"BrowserStop"},170:{code:"BrowserSearch"},171:{code:"BrowserFavorites"},172:{code:"BrowserHome"},173:{code:"VolumeMute"},174:{code:"VolumeDown"},175:{code:"VolumeUp"},176:{code:"MediaTrackNext"},177:{code:"MediaTrackPrevious"},178:{code:"MediaStop"},179:{code:"MediaPlayPause"},180:{code:"LaunchMail"},181:{code:"MediaSelect"},182:{code:"LaunchApp1"},183:{code:"LaunchApp2"},186:{code:"Semicolon",keyCap:";"},187:{code:"Equal",keyCap:"="},188:{code:"Comma",keyCap:","},189:{code:"Minus",keyCap:"-"},190:{code:"Period",keyCap:"."},191:{code:"Slash",keyCap:"/"},192:{code:"Backquote",keyCap:"`"},219:{code:"BracketLeft",keyCap:"["},220:{code:"Backslash",keyCap:"\\"},221:{code:"BracketRight",keyCap:"]"},222:{code:"Quote",keyCap:"'"},226:{code:"IntlBackslash",keyCap:"\\"},229:{code:"Process"},246:{code:"Attn"},247:{code:"CrSel"},248:{code:"ExSel"},249:{code:"EraseEof"},250:{code:"Play"},251:{code:"ZoomToggle"},254:{code:"Clear"}};h(u,"moz",{59:{code:"Semicolon",keyCap:";"},61:{code:"Equal",keyCap:"="},107:{code:"Equal",keyCap:"="},109:{code:"Minus",keyCap:"-"},187:{code:"NumpadAdd",keyCap:"+",location:o},189:{code:"NumpadSubtract",keyCap:"-",location:o}}),h(u,"moz-mac",{12:{code:"NumLock",location:o},173:{code:"Minus",keyCap:"-"}}),h(u,"moz-win",{173:{code:"Minus",keyCap:"-"}}),h(u,"chrome-mac",{93:{code:"OSRight",location:r}}),h(u,"safari",{3:{code:"Enter"},25:{code:"Tab"}}),h(u,"ios",{10:{code:"Enter",location:n}}),h(u,"safari-mac",{91:{code:"OSLeft",location:i},93:{code:"OSRight",location:r},229:{code:"KeyQ",keyCap:"Q"}});var d={};"cros"===s&&(d["U+00A0"]={code:"ShiftLeft",location:i},d["U+00A1"]={code:"ShiftRight",location:r},d["U+00A2"]={code:"ControlLeft",location:i},d["U+00A3"]={code:"ControlRight",location:r},d["U+00A4"]={code:"AltLeft",location:i},d["U+00A5"]={code:"AltRight",location:r}),"chrome-mac"===c&&(d["U+0010"]={code:"ContextMenu"}),"safari-mac"===c&&(d["U+0010"]={code:"ContextMenu"}),"ios"===s&&(d["U+0010"]={code:"Function"},d["U+001C"]={code:"ArrowLeft"},d["U+001D"]={code:"ArrowRight"},d["U+001E"]={code:"ArrowUp"},d["U+001F"]={code:"ArrowDown"},d["U+0001"]={code:"Home"},d["U+0004"]={code:"End"},d["U+000B"]={code:"PageUp"},d["U+000C"]={code:"PageDown"});var p=[];p[i]={16:{code:"ShiftLeft",location:i},17:{code:"ControlLeft",location:i},18:{code:"AltLeft",location:i}},p[r]={16:{code:"ShiftRight",location:r},17:{code:"ControlRight",location:r},18:{code:"AltRight",location:r}},p[o]={13:{code:"NumpadEnter",location:o}},h(p[o],"moz",{109:{code:"NumpadSubtract",location:o},107:{code:"NumpadAdd",location:o}}),h(p[i],"moz-mac",{224:{code:"OSLeft",location:i}}),h(p[r],"moz-mac",{224:{code:"OSRight",location:r}}),h(p[r],"moz-win",{91:{code:"OSRight",location:r}}),h(p[r],"mac",{93:{code:"OSRight",location:r}}),h(p[o],"chrome-mac",{12:{code:"NumLock",location:o}}),h(p[o],"safari-mac",{12:{code:"NumLock",location:o},187:{code:"NumpadAdd",location:o},189:{code:"NumpadSubtract",location:o},190:{code:"NumpadDecimal",location:o},191:{code:"NumpadDivide",location:o}});var f={ShiftLeft:{key:"Shift"},ShiftRight:{key:"Shift"},ControlLeft:{key:"Control"},ControlRight:{key:"Control"},AltLeft:{key:"Alt"},AltRight:{key:"Alt"},OSLeft:{key:"OS"},OSRight:{key:"OS"},NumpadEnter:{key:"Enter"},Space:{key:" "},Digit0:{key:"0",shiftKey:")"},Digit1:{key:"1",shiftKey:"!"},Digit2:{key:"2",shiftKey:"@"},Digit3:{key:"3",shiftKey:"#"},Digit4:{key:"4",shiftKey:"$"},Digit5:{key:"5",shiftKey:"%"},Digit6:{key:"6",shiftKey:"^"},Digit7:{key:"7",shiftKey:"&"},Digit8:{key:"8",shiftKey:"*"},Digit9:{key:"9",shiftKey:"("},KeyA:{key:"a",shiftKey:"A"},KeyB:{key:"b",shiftKey:"B"},KeyC:{key:"c",shiftKey:"C"},KeyD:{key:"d",shiftKey:"D"},KeyE:{key:"e",shiftKey:"E"},KeyF:{key:"f",shiftKey:"F"},KeyG:{key:"g",shiftKey:"G"},KeyH:{key:"h",shiftKey:"H"},KeyI:{key:"i",shiftKey:"I"},KeyJ:{key:"j",shiftKey:"J"},KeyK:{key:"k",shiftKey:"K"},KeyL:{key:"l",shiftKey:"L"},KeyM:{key:"m",shiftKey:"M"},KeyN:{key:"n",shiftKey:"N"},KeyO:{key:"o",shiftKey:"O"},KeyP:{key:"p",shiftKey:"P"},KeyQ:{key:"q",shiftKey:"Q"},KeyR:{key:"r",shiftKey:"R"},KeyS:{key:"s",shiftKey:"S"},KeyT:{key:"t",shiftKey:"T"},KeyU:{key:"u",shiftKey:"U"},KeyV:{key:"v",shiftKey:"V"},KeyW:{key:"w",shiftKey:"W"},KeyX:{key:"x",shiftKey:"X"},KeyY:{key:"y",shiftKey:"Y"},KeyZ:{key:"z",shiftKey:"Z"},Numpad0:{key:"0"},Numpad1:{key:"1"},Numpad2:{key:"2"},Numpad3:{key:"3"},Numpad4:{key:"4"},Numpad5:{key:"5"},Numpad6:{key:"6"},Numpad7:{key:"7"},Numpad8:{key:"8"},Numpad9:{key:"9"},NumpadMultiply:{key:"*"},NumpadAdd:{key:"+"},NumpadComma:{key:","},NumpadSubtract:{key:"-"},NumpadDecimal:{key:"."},NumpadDivide:{key:"/"},Semicolon:{key:";",shiftKey:":"},Equal:{key:"=",shiftKey:"+"},Comma:{key:",",shiftKey:"<"},Minus:{key:"-",shiftKey:"_"},Period:{key:".",shiftKey:">"},Slash:{key:"/",shiftKey:"?"},Backquote:{key:"`",shiftKey:"~"},BracketLeft:{key:"[",shiftKey:"{"},Backslash:{key:"\\",shiftKey:"|"},BracketRight:{key:"]",shiftKey:"}"},Quote:{key:"'",shiftKey:'"'},IntlBackslash:{key:"\\",shiftKey:"|"}};h(f,"mac",{OSLeft:{key:"Meta"},OSRight:{key:"Meta"}});var m={Esc:"Escape",Nonconvert:"NonConvert",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Menu:"ContextMenu",MediaNextTrack:"MediaTrackNext",MediaPreviousTrack:"MediaTrackPrevious",SelectMedia:"MediaSelect",HalfWidth:"Hankaku",FullWidth:"Zenkaku",RomanCharacters:"Romaji",Crsel:"CrSel",Exsel:"ExSel",Zoom:"ZoomToggle"},g=function(t,e){var n={};return Object.keys(t).forEach((function(i){var r=t[i];e in r&&(n[r[e]]=r)})),n}(u,"code");try{var v=e&&"location"in new KeyboardEvent("")}catch(y){}function A(t){var e="keyCode"in t?t.keyCode:"which"in t?t.which:0,n=function(){if(v||"keyLocation"in t){var n=v?t.location:t.keyLocation;if(n&&e in p[n])return p[n][e]}return"keyIdentifier"in t&&t.keyIdentifier in d?d[t.keyIdentifier]:e in u?u[e]:null}();if(!n)return null;var i=function(){var e=f[n.code];return e?t.shiftKey&&"shiftKey"in e?e.shiftKey:e.key:n.code}();return{code:n.code,key:i,location:n.location,keyCap:n.keyCap}}"KeyboardEvent"in t&&"defineProperty"in Object&&function(){function t(t,e,n){e in t||Object.defineProperty(t,e,n)}if(t(KeyboardEvent.prototype,"code",{get:function(){var t=A(this);return t?t.code:""}}),"key"in KeyboardEvent.prototype){var e=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,"key");Object.defineProperty(KeyboardEvent.prototype,"key",{get:function(){var t=e.get.call(this);return m.hasOwnProperty(t)?m[t]:t}})}t(KeyboardEvent.prototype,"key",{get:function(){var t=A(this);return t&&"key"in t?t.key:"Unidentified"}}),t(KeyboardEvent.prototype,"location",{get:function(){var t=A(this);return t&&"location"in t?t.location:n}}),t(KeyboardEvent.prototype,"locale",{get:function(){return""}})}(),"queryKeyCap"in t.KeyboardEvent||(t.KeyboardEvent.queryKeyCap=function(t,e){if(t=String(t),!g.hasOwnProperty(t))return"Undefined";if(e&&"en-us"!==String(e).toLowerCase())throw Error("Unsupported locale");var n=g[t];return n.keyCap||n.code||"Undefined"}),t.identifyKey=function(t){if(!("code"in t)){var e=A(t);t.code=e?e.code:"",t.key=e&&"key"in e?e.key:"Unidentified",t.location="location"in t?t.location:"keyLocation"in t?t.keyLocation:e&&"location"in e?e.location:n,t.locale=""}}}(window)},6491:t=>{t.exports=AFRAME.registerComponent("checkpoint-controls",{schema:{enabled:{default:!0},mode:{default:"teleport",oneOf:["teleport","animate"]},animateSpeed:{default:3}},init:function(){this.active=!0,this.checkpoint=null,this.isNavMeshConstrained=!1,this.offset=new THREE.Vector3,this.position=new THREE.Vector3,this.targetPosition=new THREE.Vector3},play:function(){this.active=!0},pause:function(){this.active=!1},setCheckpoint:function(t){const e=this.el;this.active&&this.checkpoint!==t&&(this.checkpoint&&e.emit("navigation-end",{checkpoint:this.checkpoint}),this.checkpoint=t,this.sync(),this.position.distanceTo(this.targetPosition)<.1?this.checkpoint=null:(e.emit("navigation-start",{checkpoint:t}),"teleport"===this.data.mode&&(this.el.setAttribute("position",this.targetPosition),this.checkpoint=null,e.emit("navigation-end",{checkpoint:t}),e.components["movement-controls"].updateNavLocation())))},isVelocityActive:function(){return!(!this.active||!this.checkpoint)},getVelocity:function(){if(!this.active)return;const t=this.data,e=this.offset,n=this.position,i=this.targetPosition,r=this.checkpoint;return this.sync(),n.distanceTo(i)<.1?(this.checkpoint=null,this.el.emit("navigation-end",{checkpoint:r}),e.set(0,0,0)):(e.setLength(t.animateSpeed),e)},sync:function(){const t=this.offset,e=this.position,n=this.targetPosition;e.copy(this.el.getAttribute("position")),this.checkpoint.object3D.getWorldPosition(n),n.add(this.checkpoint.components.checkpoint.getOffset()),t.copy(n).sub(e)}})},2022:(t,e,n)=>{const i=n(5591),r=n(9823),o=.2,a="left",s="right",l=1,c=2;t.exports=AFRAME.registerComponent("gamepad-controls",{GamepadButton:i,schema:{enabled:{default:!0},rotationSensitivity:{default:2}},init:function(){const t=this.el.sceneEl;this.system=t.systems["tracked-controls-webxr"]||{controllers:[]},this.prevTime=window.performance.now(),this.buttons={};const e=this.el.object3D.rotation;this.pitch=new THREE.Object3D,this.pitch.rotation.x=e.x,this.yaw=new THREE.Object3D,this.yaw.position.y=10,this.yaw.rotation.y=e.y,this.yaw.add(this.pitch),this._lookVector=new THREE.Vector2,this._moveVector=new THREE.Vector2,this._dpadVector=new THREE.Vector2,t.addBehavior(this)},update:function(){this.tick()},tick:function(t,e){this.updateButtonState(),this.updateRotation(e)},remove:function(){},isVelocityActive:function(){if(!this.data.enabled||!this.isConnected())return!1;const t=this._dpadVector,e=this._moveVector;this.getDpad(t),this.getJoystick(l,e);const n=t.x||e.x,i=t.y||e.y;return Math.abs(n)>o||Math.abs(i)>o},getVelocityDelta:function(){const t=this._dpadVector,e=this._moveVector;this.getDpad(t),this.getJoystick(l,e);const n=t.x||e.x,i=t.y||e.y,r=new THREE.Vector3;return Math.abs(n)>o&&(r.x+=n),Math.abs(i)>o&&(r.z+=i),r},isRotationActive:function(){if(!this.data.enabled||!this.isConnected())return!1;const t=this._lookVector;return this.getJoystick(c,t),Math.abs(t.x)>o||Math.abs(t.y)>o},updateRotation:function(t){if(!this.isRotationActive())return;const e=this.data,n=this.yaw,i=this.pitch;n.rotation.y=this.el.object3D.rotation.y,i.rotation.x=this.el.object3D.rotation.x;const r=this._lookVector;this.getJoystick(c,r),Math.abs(r.x)<=o&&(r.x=0),Math.abs(r.y)<=o&&(r.y=0),r.multiplyScalar(e.rotationSensitivity*t/1e3),n.rotation.y-=r.x,i.rotation.x-=r.y,i.rotation.x=Math.max(-Math.PI/2,Math.min(Math.PI/2,i.rotation.x)),this.el.object3D.rotation.set(i.rotation.x,n.rotation.y,0)},updateButtonState:function(){const t=this.getGamepad(s);if(this.data.enabled&&t)for(var e=0;e1?s:a).axes[t]},getJoystick:function(t,e){const n=this.getGamepad(t===l?a:s);if(!n)return e.set(0,0);if("xr-standard"===n.mapping)switch(t){case l:return e.set(n.axes[2],n.axes[3]);case c:return e.set(n.axes[2],0)}else switch(t){case l:return e.set(n.axes[0],n.axes[1]);case c:return e.set(n.axes[2],n.axes[3])}throw new Error('Unexpected joystick index "%d".',t)},getDpad:function(t){const e=this.getGamepad(a);return e&&e.buttons[i.DPAD_RIGHT]?t.set((e.buttons[i.DPAD_RIGHT].pressed?1:0)+(e.buttons[i.DPAD_LEFT].pressed?-1:0),(e.buttons[i.DPAD_UP].pressed?-1:0)+(e.buttons[i.DPAD_DOWN].pressed?1:0)):t.set(0,0)},isConnected:function(){const t=this.getGamepad(a);return!(!t||!t.connected)},getID:function(){return this.getGamepad(a).id}})},36:(t,e,n)=>{n(6491),n(2022),n(1698),n(8918),n(262),n(9117),n(8007)},1698:(t,e,n)=>{n(1742);const i=window.KeyboardEvent;t.exports=AFRAME.registerComponent("keyboard-controls",{schema:{enabled:{default:!0},debug:{default:!1}},init:function(){this.dVelocity=new THREE.Vector3,this.localKeys={},this.listeners={keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this),blur:this.onBlur.bind(this),onContextMenu:this.onContextMenu.bind(this)}},isVelocityActive:function(){return this.data.enabled&&!!Object.keys(this.getKeys()).length},getVelocityDelta:function(){const t=this.data,e=this.getKeys();return this.dVelocity.set(0,0,0),t.enabled&&((e.KeyW||e.ArrowUp)&&(this.dVelocity.z-=1),(e.KeyA||e.ArrowLeft)&&(this.dVelocity.x-=1),(e.KeyS||e.ArrowDown)&&(this.dVelocity.z+=1),(e.KeyD||e.ArrowRight)&&(this.dVelocity.x+=1),e.ShiftLeft&&(this.dVelocity=this.dVelocity.multiplyScalar(2))),this.dVelocity.clone()},play:function(){this.attachEventListeners()},pause:function(){this.removeEventListeners()},attachEventListeners:function(){window.addEventListener("contextmenu",this.listeners.onContextMenu,!1),window.addEventListener("keydown",this.listeners.keydown,!1),window.addEventListener("keyup",this.listeners.keyup,!1),window.addEventListener("blur",this.listeners.blur,!1)},onContextMenu:function(){for(const t in this.localKeys)this.localKeys.hasOwnProperty(t)&&delete this.localKeys[t]},removeEventListeners:function(){window.removeEventListener("keydown",this.listeners.keydown),window.removeEventListener("keyup",this.listeners.keyup),window.removeEventListener("blur",this.listeners.blur)},onKeyDown:function(t){AFRAME.utils.shouldCaptureKeyEvent(t)&&(this.localKeys[t.code]=!0,this.emit(t))},onKeyUp:function(t){AFRAME.utils.shouldCaptureKeyEvent(t)&&(delete this.localKeys[t.code],this.emit(t))},onBlur:function(){for(const t in this.localKeys)this.localKeys.hasOwnProperty(t)&&delete this.localKeys[t]},emit:function(t){"__keyboard-controls-proxy"in t&&this.el.emit(t.type,t),this.el.emit(t.type+":"+t.code,new i(t.type,t)),this.data.debug&&console.log(t.type+":"+t.code)},isPressed:function(t){return t in this.getKeys()},getKeys:function(){return this.isProxied()?this.el.sceneEl.components["proxy-controls"].getKeyboard():this.localKeys},isProxied:function(){const t=this.el.sceneEl.components["proxy-controls"];return t&&t.isConnected()}})},262:t=>{const e="-controls";t.exports=AFRAME.registerComponent("movement-controls",{dependencies:["rotation"],schema:{enabled:{default:!0},controls:{default:["gamepad","trackpad","keyboard","touch"]},speed:{default:.3,min:0},fly:{default:!1},constrainToNavMesh:{default:!1},camera:{default:"[movement-controls] [camera]",type:"selector"}},init:function(){const t=this.el;this.data.camera||(this.data.camera=t.querySelector("[camera]")),this.velocityCtrl=null,this.velocity=new THREE.Vector3,this.heading=new THREE.Quaternion,this.eventDetail={},this.navGroup=null,this.navNode=null,t.sceneEl.hasLoaded?this.injectControls():t.sceneEl.addEventListener("loaded",this.injectControls.bind(this))},update:function(t){const n=this.el,i=this.data,r=n.sceneEl.systems.nav;if(n.sceneEl.hasLoaded&&this.injectControls(),r&&i.constrainToNavMesh!==t.constrainToNavMesh&&(i.constrainToNavMesh?r.addAgent(this):r.removeAgent(this)),i.enabled!==t.enabled)for(let o=0;o.2?l.set(0,0,0):this.updateVelocity(r),a.constrainToNavMesh&&!1!==s.isNavMeshConstrained){if(l.lengthSq()<1e-5)return;t.copy(o.object3D.position),e.copy(l).multiplyScalar(r/1e3).add(t);const i=o.sceneEl.systems.nav;this.navGroup=null===this.navGroup?i.getGroup(t):this.navGroup,this.navNode=this.navNode||i.getNode(t,this.navGroup),this.navNode=i.clampStep(t,e,this.navGroup,this.navNode,n),o.object3D.position.copy(n)}else o.hasAttribute("velocity")?o.setAttribute("velocity",l):(o.object3D.position.x+=l.x*r/1e3,o.object3D.position.y+=l.y*r/1e3,o.object3D.position.z+=l.z*r/1e3)}}(),updateVelocityCtrl:function(){const t=this.data;if(t.enabled){for(let n=0,i=t.controls.length;n{"use strict";n.r(e);var i=n(6601),r=n.n(i);AFRAME.registerComponent("nipple-controls",{schema:{enabled:{default:!0},mode:{default:"dynamic",oneOf:["static","semi","dynamic"]},rotationSensitivity:{default:1},moveJoystickEnabled:{default:!0},lookJoystickEnabled:{default:!0},sideMargin:{default:"30px"},bottomMargin:{default:"70px"},moveJoystickPosition:{default:"left",oneOf:["left","right"]},lookJoystickPosition:{default:"right",oneOf:["left","right"]}},init(){this.dVelocity=new THREE.Vector3,this.lookVector=new THREE.Vector2;const t=this.el.querySelector("[look-controls]").components["look-controls"];this.pitchObject=t.pitchObject,this.yawObject=t.yawObject,this.rigRotation=this.el.object3D.rotation,this.moveData=void 0,this.lookData=void 0,this.moving=!1,this.rotating=!1},update(t){this.data.moveJoystickPosition===t.moveJoystickPosition&&this.data.sideMargin===t.sideMargin&&this.data.bottomMargin===t.bottomMargin&&this.data.mode===t.mode||this.removeMoveJoystick(),this.data.lookJoystickPosition===t.lookJoystickPosition&&this.data.sideMargin===t.sideMargin&&this.data.bottomMargin===t.bottomMargin&&this.data.mode===t.mode||this.removeLookJoystick(),this.data.enabled&&this.data.moveJoystickEnabled?this.createMoveJoystick():this.removeMoveJoystick(),this.data.enabled&&this.data.lookJoystickEnabled?this.createLookJoystick():this.removeLookJoystick()},pause(){this.moving=!1,this.rotating=!1},remove(){this.removeMoveJoystick(),this.removeLookJoystick()},isVelocityActive(){return this.data.enabled&&this.moving},getVelocityDelta(){if(this.dVelocity.set(0,0,0),this.isVelocityActive()){const t=this.moveData.force<1?this.moveData.force:1,e=this.moveData.angle.radian,n=Math.cos(e)*t,i=-Math.sin(e)*t;this.dVelocity.set(n,0,i)}return this.dVelocity},isRotationActive(){return this.data.enabled&&this.rotating},updateRotation(t){if(!this.isRotationActive())return;const e=this.lookData.force<1?this.lookData.force:1,n=this.lookData.angle.radian,i=this.lookVector;i.x=Math.cos(n)*e,i.y=Math.sin(n)*e,i.multiplyScalar(this.data.rotationSensitivity*t/1e3),this.yawObject.rotation.y-=i.x;let r=this.pitchObject.rotation.x+i.y;r=Math.max(-Math.PI/2,Math.min(Math.PI/2,r)),this.pitchObject.rotation.x=r},tick:function(t,e){this.updateRotation(e)},initLeftZone(){const t=document.createElement("div");t.setAttribute("id","joystickLeftZone"),t.setAttribute("style",`position:absolute;${this.data.moveJoystickPosition}:${this.data.sideMargin};bottom:${this.data.bottomMargin};z-index:1`),document.body.appendChild(t),this.leftZone=t},initRightZone(){const t=document.createElement("div");t.setAttribute("id","joystickRightZone"),t.setAttribute("style",`position:absolute;${this.data.lookJoystickPosition}:${this.data.sideMargin};bottom:${this.data.bottomMargin};z-index:1`),document.body.appendChild(t),this.rightZone=t},createMoveJoystick(){if(this.moveJoystick)return;this.initLeftZone();const t={mode:this.data.mode,zone:this.leftZone,color:"white",fadeTime:0};this.leftZone.style.width="100px","static"===this.data.mode?(this.leftZone.style.height="100px",t.position={left:"50%",bottom:"50%"}):this.leftZone.style.height="400px",this.moveJoystick=r().create(t),this.moveJoystick.on("move",((t,e)=>{this.moveData=e,this.moving=!0})),this.moveJoystick.on("end",((t,e)=>{this.moving=!1}))},createLookJoystick(){if(this.lookJoystick)return;this.initRightZone();const t={mode:this.data.mode,zone:this.rightZone,color:"white",fadeTime:0};this.rightZone.style.width="100px","static"===this.data.mode?(this.rightZone.style.height="100px",t.position={left:"50%",bottom:"50%"}):this.rightZone.style.height="400px",this.lookJoystick=r().create(t),this.lookJoystick.on("move",((t,e)=>{this.lookData=e,this.rotating=!0})),this.lookJoystick.on("end",((t,e)=>{this.rotating=!1}))},removeMoveJoystick(){this.moveJoystick&&(this.moveJoystick.destroy(),this.moveJoystick=void 0),this.moveData=void 0,this.leftZone&&this.leftZone.parentNode&&(this.leftZone.remove(),this.leftZone=void 0)},removeLookJoystick(){this.lookJoystick&&(this.lookJoystick.destroy(),this.lookJoystick=void 0),this.lookData=void 0,this.rightZone&&this.rightZone.parentNode&&(this.rightZone.remove(),this.rightZone=void 0)}})},8918:t=>{t.exports=AFRAME.registerComponent("touch-controls",{schema:{enabled:{default:!0},reverseEnabled:{default:!0}},init:function(){this.dVelocity=new THREE.Vector3,this.bindMethods(),this.direction=0},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.dVelocity.set(0,0,0)},remove:function(){this.pause()},addEventListeners:function(){const t=this.el.sceneEl,e=t.canvas;if(!e)return void t.addEventListener("render-target-loaded",this.addEventListeners.bind(this));e.addEventListener("touchstart",this.onTouchStart),e.addEventListener("touchend",this.onTouchEnd);const n=t.getAttribute("vr-mode-ui");n&&n.cardboardModeEnabled&&t.addEventListener("enter-vr",this.onEnterVR)},removeEventListeners:function(){const t=this.el.sceneEl&&this.el.sceneEl.canvas;t&&(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchend",this.onTouchEnd),this.el.sceneEl.removeEventListener("enter-vr",this.onEnterVR))},isVelocityActive:function(){return this.data.enabled&&!!this.direction},getVelocityDelta:function(){return this.dVelocity.z=this.direction,this.dVelocity.clone()},bindMethods:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},onTouchStart:function(t){this.direction=-1,this.data.reverseEnabled&&t.touches&&2===t.touches.length&&(this.direction=1),t.preventDefault()},onTouchEnd:function(t){this.direction=0,t.preventDefault()},onEnterVR:function(){const t=this.el.sceneEl.xrSession;t&&(t.addEventListener("selectstart",this.onTouchStart),t.addEventListener("selectend",this.onTouchEnd))}})},9117:t=>{t.exports=AFRAME.registerComponent("trackpad-controls",{schema:{enabled:{default:!0},enableNegX:{default:!0},enablePosX:{default:!0},enableNegZ:{default:!0},enablePosZ:{default:!0},mode:{default:"touch",oneOf:["swipe","touch","press"]}},init:function(){this.dVelocity=new THREE.Vector3,this.zVel=0,this.xVel=0,this.bindMethods()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.dVelocity.set(0,0,0)},remove:function(){this.pause()},addEventListeners:function(){const t=this.data,e=this.el.sceneEl;switch(e.addEventListener("axismove",this.onAxisMove),t.mode){case"swipe":case"touch":e.addEventListener("trackpadtouchstart",this.onTouchStart),e.addEventListener("trackpadtouchend",this.onTouchEnd);break;case"press":e.addEventListener("trackpaddown",this.onTouchStart),e.addEventListener("trackpadup",this.onTouchEnd)}},removeEventListeners:function(){const t=this.el.sceneEl;t.removeEventListener("axismove",this.onAxisMove),t.removeEventListener("trackpadtouchstart",this.onTouchStart),t.removeEventListener("trackpadtouchend",this.onTouchEnd),t.removeEventListener("trackpaddown",this.onTouchStart),t.removeEventListener("trackpadup",this.onTouchEnd)},isVelocityActive:function(){return this.data.enabled&&this.isMoving},getVelocityDelta:function(){return this.dVelocity.z=this.isMoving?-this.zVel:1,this.dVelocity.x=this.isMoving?this.xVel:1,this.dVelocity.clone()},bindMethods:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onAxisMove=this.onAxisMove.bind(this)},onTouchStart:function(t){switch(this.data.mode){case"swipe":this.canRecordAxis=!0,this.startingAxisData=[];break;case"touch":case"press":this.isMoving=!0}t.preventDefault()},onTouchEnd:function(t){"swipe"==this.data.mode&&(this.startingAxisData=[]),this.isMoving=!1,t.preventDefault()},onAxisMove:function(t){switch(this.data.mode){case"swipe":return this.handleSwipeAxis(t);case"touch":case"press":return this.handleTouchAxis(t)}},handleSwipeAxis:function(t){const e=this.data,n=t.detail.axis;if(0===this.startingAxisData.length&&this.canRecordAxis&&(this.canRecordAxis=!1,this.startingAxisData[0]=n[0],this.startingAxisData[1]=n[1]),this.startingAxisData.length>0){let t=0,i=0;e.enableNegX&&n[0]this.startingAxisData[0]&&(t=1),e.enablePosZ&&n[1]>this.startingAxisData[1]&&(i=-1),e.enableNegZ&&n[1]r?(this.zVel=0,this.xVel=t,this.isMoving=!0):(this.xVel=0,this.zVel=i,this.isMoving=!0)}},handleTouchAxis:function(t){const e=this.data,n=t.detail.axis;let i=0,r=0;e.enableNegX&&n[0]<0&&(i=-1),e.enablePosX&&n[0]>0&&(i=1),e.enablePosZ&&n[1]>0&&(r=-1),e.enableNegZ&&n[1]<0&&(r=1),Math.abs(n[0])>Math.abs(n[1])?(this.zVel=0,this.xVel=i):(this.xVel=0,this.zVel=r)}})},172:t=>{const e={once:THREE.LoopOnce,repeat:THREE.LoopRepeat,pingpong:THREE.LoopPingPong};function n(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}t.exports=AFRAME.registerComponent("animation-mixer",{schema:{clip:{default:"*"},useRegExp:{default:!1},duration:{default:0},clampWhenFinished:{default:!1,type:"boolean"},crossFadeDuration:{default:0},loop:{default:"repeat",oneOf:Object.keys(e)},repetitions:{default:1/0,min:0},timeScale:{default:1},startAt:{default:0}},init:function(){this.model=null,this.mixer=null,this.activeActions=[];const t=this.el.getObject3D("mesh");t?this.load(t):this.el.addEventListener("model-loaded",(t=>{this.load(t.detail.model)}))},load:function(t){const e=this.el;this.model=t,this.mixer=new THREE.AnimationMixer(t),this.mixer.addEventListener("loop",(t=>{e.emit("animation-loop",{action:t.action,loopDelta:t.loopDelta})})),this.mixer.addEventListener("finished",(t=>{e.emit("animation-finished",{action:t.action,direction:t.direction})})),this.data.clip&&this.update({})},remove:function(){this.mixer&&this.mixer.stopAllAction()},update:function(t){if(!t)return;const n=this.data,i=AFRAME.utils.diff(n,t);if("clip"in i)return this.stopAction(),void(n.clip&&this.playAction());this.activeActions.forEach((t=>{"duration"in i&&n.duration&&t.setDuration(n.duration),"clampWhenFinished"in i&&(t.clampWhenFinished=n.clampWhenFinished),("loop"in i||"repetitions"in i)&&t.setLoop(e[n.loop],n.repetitions),"timeScale"in i&&t.setEffectiveTimeScale(n.timeScale)}))},stopAction:function(){const t=this.data;for(let e=0;e{THREE.ColladaLoader=n(5525),t.exports.Component=AFRAME.registerComponent("collada-model-legacy",{schema:{type:"asset"},init:function(){this.model=null,this.loader=new THREE.ColladaLoader},update:function(){var t=this,e=this.el,n=this.data,i=this.el.sceneEl.systems.renderer;n&&(this.remove(),this.loader.load(n,(function(n){t.model=n.scene,t.model.traverse((function(t){if(t.isMesh){var e=t.material;e.color&&i.applyColorCorrection(e.color),e.map&&i.applyColorCorrection(e.map),e.emissive&&i.applyColorCorrection(e.emissive),e.emissiveMap&&i.applyColorCorrection(e.emissiveMap)}})),e.setObject3D("mesh",t.model),e.emit("model-loaded",{format:"collada",model:t.model})})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},8990:()=>{"use strict";const t="164",e=100,n="attached",i=303,r=1e3,o=1001,a=1002,s=1003,l=1006,c=1008,h=1009,u=1014,d=1015,p=1020,f=1023,m=1026,g=1027,v=2300,A=2301,y=2302,_=2400,x=2401,b=2402,E=2500,w="",M="srgb",C="srgb-linear",S="display-p3",T="display-p3-linear",R="linear",I="srgb",L="rec709",B="p3",P=7680,D=35044,O=2e3,N=2001;class k{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+U[t>>16&255]+U[t>>24&255]+"-"+U[255&e]+U[e>>8&255]+"-"+U[e>>16&15|64]+U[e>>24&255]+"-"+U[63&n|128]+U[n>>8&255]+"-"+U[n>>16&255]+U[n>>24&255]+U[255&i]+U[i>>8&255]+U[i>>16&255]+U[i>>24&255]).toLowerCase()}function j(t,e,n){return Math.max(e,Math.min(n,t))}function G(t,e){return(t%e+e)%e}function Q(t,e,n){return(1-n)*t+n*e}function W(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function q(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const X={DEG2RAD:z,RAD2DEG:V,generateUUID:H,clamp:j,euclideanModulo:G,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Q,damp:function(t,e,n,i){return Q(t,e,1-Math.exp(-n*i))},pingpong:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e-Math.abs(G(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(F=t);let e=F+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*z},radToDeg:function(t){return t*V},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,i,r){const o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((e+i)/2),h=a((e+i)/2),u=o((e-i)/2),d=a((e-i)/2),p=o((i-e)/2),f=a((i-e)/2);switch(r){case"XYX":t.set(s*h,l*u,l*d,s*c);break;case"YZY":t.set(l*d,s*h,l*u,s*c);break;case"ZXZ":t.set(l*u,l*d,s*h,s*c);break;case"XZX":t.set(s*h,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*h,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:q,denormalize:W};class K{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;K.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(j(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Y{constructor(t,e,n,i,r,o,a,s,l){Y.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,o,a,s,l)}set(t,e,n,i,r,o,a,s,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],A=i[4],y=i[7],_=i[2],x=i[5],b=i[8];return r[0]=o*f+a*v+s*_,r[3]=o*m+a*A+s*x,r[6]=o*g+a*y+s*b,r[1]=l*f+c*v+h*_,r[4]=l*m+c*A+h*x,r[7]=l*g+c*y+h*b,r[2]=u*f+d*v+p*_,r[5]=u*m+d*A+p*x,r[8]=u*g+d*y+p*b,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8];return e*o*c-e*a*l-n*r*c+n*a*s+i*r*l-i*o*s}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],h=c*o-a*l,u=a*s-c*r,d=l*r-o*s,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(a*n-i*o)*f,t[3]=u*f,t[4]=(c*e-i*s)*f,t[5]=(i*r-a*e)*f,t[6]=d*f,t[7]=(n*s-l*e)*f,t[8]=(o*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,a){const s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*o+l*a)+o+t,-i*l,i*s,-i*(-l*o+s*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(J.makeScale(t,e)),this}rotate(t){return this.premultiply(J.makeRotation(-t)),this}translate(t,e){return this.premultiply(J.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const J=new Y;function Z(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function $(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const tt={};function et(t){t in tt||(tt[t]=!0,console.warn(t))}const nt=(new Y).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),it=(new Y).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),rt={[C]:{transfer:R,primaries:L,toReference:t=>t,fromReference:t=>t},[M]:{transfer:I,primaries:L,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[T]:{transfer:R,primaries:B,toReference:t=>t.applyMatrix3(it),fromReference:t=>t.applyMatrix3(nt)},[S]:{transfer:I,primaries:B,toReference:t=>t.convertSRGBToLinear().applyMatrix3(it),fromReference:t=>t.applyMatrix3(nt).convertLinearToSRGB()}},ot=new Set([C,T]),at={enabled:!0,_workingColorSpace:C,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!ot.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;const i=rt[e].toReference;return(0,rt[n].fromReference)(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return rt[t].primaries},getTransfer:function(t){return t===w?R:rt[t].transfer}};function st(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function lt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let ct;class ht{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"===typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ct&&(ct=$("canvas")),ct.width=t.width,ct.height=t.height;const n=ct.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ct}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap){const e=$("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:null;this.isSource=!0,Object.defineProperty(this,"id",{value:ut++}),this.uuid=H(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e0&&void 0!==arguments[0]?arguments[0]:mt.DEFAULT_IMAGE,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mt.DEFAULT_MAPPING,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:l,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:c,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:f,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:h,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:mt.DEFAULT_ANISOTROPY,p=arguments.length>9&&void 0!==arguments[9]?arguments[9]:w;super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ft++}),this.uuid=H(),this.name="",this.source=new dt(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=d,this.format=s,this.internalFormat=null,this.type=u,this.offset=new K(0,0),this.repeat=new K(1,1),this.center=new K(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Y,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t){void 0===t&&(t=null),this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case r:t.x=t.x-Math.floor(t.x);break;case o:t.x=t.x<0?0:1;break;case a:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case r:t.y=t.y-Math.floor(t.y);break;case o:t.y=t.y<0?0:1;break;case a:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}mt.DEFAULT_IMAGE=null,mt.DEFAULT_MAPPING=300,mt.DEFAULT_ANISOTROPY=1;class gt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;gt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=.01,a=.1,s=t.elements,l=s[0],c=s[4],h=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(c-u)s&&t>v?tv?s1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class vt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,o,a){let s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(0===a)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===a)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||s!==u||l!==d||c!==p){let t=1-a;const e=s*u+l*d+c*p+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,a=Math.sin(a*o)/r}const r=a*n;if(s=s*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-a){const t=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=t,l*=t,c*=t,h*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const a=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[o],u=r[o+1],d=r[o+2],p=r[o+3];return t[e]=a*p+c*h+s*d-l*u,t[e+1]=s*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-s*h,t[e+3]=c*p-a*h-s*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=t._x,i=t._y,r=t._z,o=t._order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=s(n/2),d=s(i/2),p=s(r/2);switch(o){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],a=e[5],s=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-s)*t,this._y=(r-l)*t,this._z=(o-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-s)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(o-i)/t,this._x=(r+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(j(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+o*a+i*l-r*s,this._y=i*c+o*s+r*a-n*l,this._z=r*c+o*l+n*s-i*a,this._w=o*c-n*a-i*s-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const s=1-a*a;if(s<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const l=Math.sqrt(s),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class At{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;At.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(_t.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(_t.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,l=2*(o*i-a*n),c=2*(a*e-r*i),h=2*(r*n-o*e);return this.x=e+s*l+o*h-a*c,this.y=n+s*c+a*l-r*h,this.z=i+s*h+r*c-o*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return yt.copy(this).projectOnVector(t),this.sub(yt)}reflect(t){return this.sub(yt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(j(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const yt=new At,_t=new vt;class xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new At(1/0,1/0,1/0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new At(-1/0,-1/0,-1/0);this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Et),Et.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Lt),Bt.subVectors(this.max,Lt),Mt.subVectors(t.a,Lt),Ct.subVectors(t.b,Lt),St.subVectors(t.c,Lt),Tt.subVectors(Ct,Mt),Rt.subVectors(St,Ct),It.subVectors(Mt,St);let e=[0,-Tt.z,Tt.y,0,-Rt.z,Rt.y,0,-It.z,It.y,Tt.z,0,-Tt.x,Rt.z,0,-Rt.x,It.z,0,-It.x,-Tt.y,Tt.x,0,-Rt.y,Rt.x,0,-It.y,It.x,0];return!!Ot(e,Mt,Ct,St,Bt)&&(e=[1,0,0,0,1,0,0,0,1],!!Ot(e,Mt,Ct,St,Bt)&&(Pt.crossVectors(Tt,Rt),e=[Pt.x,Pt.y,Pt.z],Ot(e,Mt,Ct,St,Bt)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Et).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Et).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(bt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),bt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),bt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),bt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),bt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),bt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),bt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),bt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(bt)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const bt=[new At,new At,new At,new At,new At,new At,new At,new At],Et=new At,wt=new xt,Mt=new At,Ct=new At,St=new At,Tt=new At,Rt=new At,It=new At,Lt=new At,Bt=new At,Pt=new At,Dt=new At;function Ot(t,e,n,i,r){for(let o=0,a=t.length-3;o<=a;o+=3){Dt.fromArray(t,o);const a=r.x*Math.abs(Dt.x)+r.y*Math.abs(Dt.y)+r.z*Math.abs(Dt.z),s=e.dot(Dt),l=n.dot(Dt),c=i.dot(Dt);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>a)return!1}return!0}const Nt=new xt,kt=new At,Ut=new At;class Ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new At,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Nt.setFromPoints(t).getCenter(n);let i=0;for(let r=0,o=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;kt.subVectors(t,this.center);const e=kt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(kt,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Ut.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(kt.copy(t.center).add(Ut)),this.expandByPoint(kt.copy(t.center).sub(Ut))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const zt=new At,Vt=new At,Ht=new At,jt=new At,Gt=new At,Qt=new At,Wt=new At;class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new At,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new At(0,0,-1);this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,zt)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=zt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(zt.copy(this.origin).addScaledVector(this.direction,e),zt.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Vt.copy(t).add(e).multiplyScalar(.5),Ht.copy(e).sub(t).normalize(),jt.copy(this.origin).sub(Vt);const r=.5*t.distanceTo(e),o=-this.direction.dot(Ht),a=jt.dot(this.direction),s=-jt.dot(Ht),l=jt.lengthSq(),c=Math.abs(1-o*o);let h,u,d,p;if(c>0)if(h=o*s-a,u=o*a-s,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+o*u+2*a)+u*(o*h+u+2*s)+l}else u=r,h=Math.max(0,-(o*u+a)),d=-h*h+u*(u+2*s)+l;else u=-r,h=Math.max(0,-(o*u+a)),d=-h*h+u*(u+2*s)+l;else u<=-p?(h=Math.max(0,-(-o*r+a)),u=h>0?-r:Math.min(Math.max(-r,-s),r),d=-h*h+u*(u+2*s)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-s),r),d=u*(u+2*s)+l):(h=Math.max(0,-(o*r+a)),u=h>0?r:Math.min(Math.max(-r,-s),r),d=-h*h+u*(u+2*s)+l);else u=o>0?-r:r,h=Math.max(0,-(o*u+a)),d=-h*h+u*(u+2*s)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Vt).addScaledVector(Ht,u),d}intersectSphere(t,e){zt.subVectors(t.center,this.origin);const n=zt.dot(this.direction),i=zt.dot(zt)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,s=n+o;return s<0?null:a<0?this.at(s,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,a,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,o=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,o=(t.min.y-u.y)*c),n>o||r>i?null:((r>n||isNaN(n))&&(n=r),(o=0?(a=(t.min.z-u.z)*h,s=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,s=(t.min.z-u.z)*h),n>s||a>i?null:((a>n||n!==n)&&(n=a),(s=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,zt)}intersectTriangle(t,e,n,i,r){Gt.subVectors(e,t),Qt.subVectors(n,t),Wt.crossVectors(Gt,Qt);let o,a=this.direction.dot(Wt);if(a>0){if(i)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}jt.subVectors(this.origin,t);const s=o*this.direction.dot(Qt.crossVectors(jt,Qt));if(s<0)return null;const l=o*this.direction.dot(Gt.cross(jt));if(l<0)return null;if(s+l>a)return null;const c=-o*jt.dot(Wt);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Xt{constructor(t,e,n,i,r,o,a,s,l,c,h,u,d,p,f,m){Xt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,o,a,s,l,c,h,u,d,p,f,m)}set(t,e,n,i,r,o,a,s,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Xt).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Kt.setFromMatrixColumn(t,0).length(),r=1/Kt.setFromMatrixColumn(t,1).length(),o=1/Kt.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*c,n=o*h,i=a*c,r=a*h;e[0]=s*c,e[4]=-s*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*s,e[2]=r-t*l,e[6]=i+n*l,e[10]=o*s}else if("YXZ"===t.order){const t=s*c,n=s*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=o*l,e[1]=o*h,e[5]=o*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=o*s}else if("ZXY"===t.order){const t=s*c,n=s*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-o*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=o*c,e[9]=r-t*a,e[2]=-o*l,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){const t=o*c,n=o*h,i=a*c,r=a*h;e[0]=s*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=s*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){const t=o*s,n=o*l,i=a*s,r=a*l;e[0]=s*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*s,n=o*l,i=a*s,r=a*l;e[0]=s*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=o*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Jt,t,Zt)}lookAt(t,e,n){const i=this.elements;return ee.subVectors(t,e),0===ee.lengthSq()&&(ee.z=1),ee.normalize(),$t.crossVectors(n,ee),0===$t.lengthSq()&&(1===Math.abs(n.z)?ee.x+=1e-4:ee.z+=1e-4,ee.normalize(),$t.crossVectors(n,ee)),$t.normalize(),te.crossVectors(ee,$t),i[0]=$t.x,i[4]=te.x,i[8]=ee.x,i[1]=$t.y,i[5]=te.y,i[9]=ee.y,i[2]=$t.z,i[6]=te.z,i[10]=ee.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],A=n[7],y=n[11],_=n[15],x=i[0],b=i[4],E=i[8],w=i[12],M=i[1],C=i[5],S=i[9],T=i[13],R=i[2],I=i[6],L=i[10],B=i[14],P=i[3],D=i[7],O=i[11],N=i[15];return r[0]=o*x+a*M+s*R+l*P,r[4]=o*b+a*C+s*I+l*D,r[8]=o*E+a*S+s*L+l*O,r[12]=o*w+a*T+s*B+l*N,r[1]=c*x+h*M+u*R+d*P,r[5]=c*b+h*C+u*I+d*D,r[9]=c*E+h*S+u*L+d*O,r[13]=c*w+h*T+u*B+d*N,r[2]=p*x+f*M+m*R+g*P,r[6]=p*b+f*C+m*I+g*D,r[10]=p*E+f*S+m*L+g*O,r[14]=p*w+f*T+m*B+g*N,r[3]=v*x+A*M+y*R+_*P,r[7]=v*b+A*C+y*I+_*D,r[11]=v*E+A*S+y*L+_*O,r[15]=v*w+A*T+y*B+_*N,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*s*h-i*l*h-r*a*u+n*l*u+i*a*d-n*s*d)+t[7]*(+e*s*d-e*l*u+r*o*u-i*o*d+i*l*c-r*s*c)+t[11]*(+e*l*h-e*a*d-r*o*h+n*o*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*s*h+e*a*u+i*o*h-n*o*u+n*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*u*l+f*s*d-a*m*d-h*s*g+a*u*g,A=p*u*l-c*m*l-p*s*d+o*m*d+c*s*g-o*u*g,y=c*f*l-p*h*l+p*a*d-o*f*d-c*a*g+o*h*g,_=p*h*s-c*f*s-p*a*u+o*f*u+c*a*m-o*h*m,x=e*v+n*A+i*y+r*_;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return t[0]=v*b,t[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*b,t[2]=(a*m*r-f*s*r+f*i*l-n*m*l-a*i*g+n*s*g)*b,t[3]=(h*s*r-a*u*r-h*i*l+n*u*l+a*i*d-n*s*d)*b,t[4]=A*b,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*b,t[6]=(p*s*r-o*m*r-p*i*l+e*m*l+o*i*g-e*s*g)*b,t[7]=(o*u*r-c*s*r+c*i*l-e*u*l-o*i*d+e*s*d)*b,t[8]=y*b,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*b,t[10]=(o*f*r-p*a*r+p*n*l-e*f*l-o*n*g+e*a*g)*b,t[11]=(c*a*r-o*h*r-c*n*l+e*h*l+o*n*d-e*a*d)*b,t[12]=_*b,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*b,t[14]=(p*a*i-o*f*i-p*n*s+e*f*s+o*n*m-e*a*m)*b,t[15]=(o*h*i-c*a*i+c*n*s-e*h*s-o*n*u+e*a*u)*b,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,a=t.y,s=t.z,l=r*o,c=r*a;return this.set(l*o+n,l*a-i*s,l*s+i*a,0,l*a+i*s,c*a+n,c*s-i*o,0,l*s-i*a,c*s+i*o,r*s*s+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,o){return this.set(1,n,r,0,t,1,o,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,a=e._z,s=e._w,l=r+r,c=o+o,h=a+a,u=r*l,d=r*c,p=r*h,f=o*c,m=o*h,g=a*h,v=s*l,A=s*c,y=s*h,_=n.x,x=n.y,b=n.z;return i[0]=(1-(f+g))*_,i[1]=(d+y)*_,i[2]=(p-A)*_,i[3]=0,i[4]=(d-y)*x,i[5]=(1-(u+g))*x,i[6]=(m+v)*x,i[7]=0,i[8]=(p+A)*b,i[9]=(m-v)*b,i[10]=(1-(u+f))*b,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Kt.set(i[0],i[1],i[2]).length();const o=Kt.set(i[4],i[5],i[6]).length(),a=Kt.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Yt.copy(this);const s=1/r,l=1/o,c=1/a;return Yt.elements[0]*=s,Yt.elements[1]*=s,Yt.elements[2]*=s,Yt.elements[4]*=l,Yt.elements[5]*=l,Yt.elements[6]*=l,Yt.elements[8]*=c,Yt.elements[9]*=c,Yt.elements[10]*=c,e.setFromRotationMatrix(Yt),n.x=r,n.y=o,n.z=a,this}makePerspective(t,e,n,i,r,o){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:O;const s=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(a===O)d=-(o+r)/(o-r),p=-2*o*r/(o-r);else{if(a!==N)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-o/(o-r),p=-o*r/(o-r)}return s[0]=l,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=c,s[9]=u,s[13]=0,s[2]=0,s[6]=0,s[10]=d,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:O;const s=this.elements,l=1/(e-t),c=1/(n-i),h=1/(o-r),u=(e+t)*l,d=(n+i)*c;let p,f;if(a===O)p=(o+r)*h,f=-2*h;else{if(a!==N)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*h,f=-1*h}return s[0]=2*l,s[4]=0,s[8]=0,s[12]=-u,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-d,s[2]=0,s[6]=0,s[10]=f,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Kt=new At,Yt=new Xt,Jt=new At(0,0,0),Zt=new At(1,1,1),$t=new At,te=new At,ee=new At,ne=new Xt,ie=new vt;class re{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:re.DEFAULT_ORDER;this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const i=t.elements,r=i[0],o=i[4],a=i[8],s=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(j(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-j(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-j(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(j(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-j(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return ne.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ne,e,n)}setFromVector3(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(t.x,t.y,t.z,e)}reorder(t){return ie.setFromEuler(this),this.setFromQuaternion(ie,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}re.DEFAULT_ORDER="XYZ";class oe{constructor(){this.mask=1}set(t){this.mask=1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t2&&void 0!==arguments[2]?arguments[2]:[];this[t]===e&&n.push(this);const i=this.children;for(let r=0,o=i.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:new At,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new At,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new At;this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),be.subVectors(t,e),i.cross(be);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){be.subVectors(i,e),Ee.subVectors(n,e),we.subVectors(t,e);const o=be.dot(be),a=be.dot(Ee),s=be.dot(we),l=Ee.dot(Ee),c=Ee.dot(we),h=o*l-a*a;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*s-a*c)*u,p=(o*c-a*s)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Me)&&(Me.x>=0&&Me.y>=0&&Me.x+Me.y<=1)}static getInterpolation(t,e,n,i,r,o,a,s){return null===this.getBarycoord(t,e,n,i,Me)?(s.x=0,s.y=0,"z"in s&&(s.z=0),"w"in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(r,Me.x),s.addScaledVector(o,Me.y),s.addScaledVector(a,Me.z),s)}static isFrontFacing(t,e,n,i){return be.subVectors(n,e),Ee.subVectors(t,e),be.cross(Ee).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return be.subVectors(this.c,this.b),Ee.subVectors(this.a,this.b),.5*be.cross(Ee).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Be.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Be.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return Be.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Be.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Be.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let o,a;Ce.subVectors(i,n),Se.subVectors(r,n),Re.subVectors(t,n);const s=Ce.dot(Re),l=Se.dot(Re);if(s<=0&&l<=0)return e.copy(n);Ie.subVectors(t,i);const c=Ce.dot(Ie),h=Se.dot(Ie);if(c>=0&&h<=c)return e.copy(i);const u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return o=s/(s-c),e.copy(n).addScaledVector(Ce,o);Le.subVectors(t,r);const d=Ce.dot(Le),p=Se.dot(Le);if(p>=0&&d<=p)return e.copy(r);const f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(Se,a);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return Te.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Te,a);const g=1/(m+f+u);return o=f*g,a=u*g,e.copy(n).addScaledVector(Ce,o).addScaledVector(Se,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},De={h:0,s:0,l:0},Oe={h:0,s:0,l:0};function Ne(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class ke{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"===typeof e?this.setHex(e):"string"===typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,at.toWorkingColorSpace(this,e),this}setRGB(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:at.workingColorSpace;return this.r=t,this.g=e,this.b=n,at.toWorkingColorSpace(this,i),this}setHSL(t,e,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:at.workingColorSpace;if(t=G(t,1),e=j(e,0,1),n=j(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=Ne(r,i,t+1/3),this.g=Ne(r,i,t),this.b=Ne(r,i,t-1/3)}return at.toWorkingColorSpace(this,i),this}setStyle(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}if(e=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const o=e[1],a=e[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=e[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,n);if(6===r)return this.setHex(parseInt(i,16),n);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,n);return this}setColorName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;const n=Pe[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=st(t.r),this.g=st(t.g),this.b=st(t.b),this}copyLinearToSRGB(t){return this.r=lt(t.r),this.g=lt(t.g),this.b=lt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return at.fromWorkingColorSpace(Ue.copy(this),t),65536*Math.round(j(255*Ue.r,0,255))+256*Math.round(j(255*Ue.g,0,255))+Math.round(j(255*Ue.b,0,255))}getHexString(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:at.workingColorSpace;at.fromWorkingColorSpace(Ue.copy(this),e);const n=Ue.r,i=Ue.g,r=Ue.b,o=Math.max(n,i,r),a=Math.min(n,i,r);let s,l;const c=(a+o)/2;if(a===o)s=0,l=0;else{const t=o-a;switch(l=c<=.5?t/(o+a):t/(2-o-a),o){case n:s=(i-r)/t+(i1&&void 0!==arguments[1]?arguments[1]:at.workingColorSpace;return at.fromWorkingColorSpace(Ue.copy(this),e),t.r=Ue.r,t.g=Ue.g,t.b=Ue.b,t}getStyle(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;at.fromWorkingColorSpace(Ue.copy(this),t);const e=Ue.r,n=Ue.g,i=Ue.b;return t!==M?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(De),this.setHSL(De.h+t,De.s+e,De.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(De),t.getHSL(Oe);const n=Q(De.h,Oe.h,e),i=Q(De.s,Oe.s,e),r=Q(De.l,Oe.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ue=new ke;ke.NAMES=Pe;let Fe=0;class ze extends k{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Fe++}),this.uuid=H(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=e,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ke(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=P,this.stencilZFail=P,this.stencilZPass=P,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!==t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const n=void 0===t||"string"===typeof t;n&&(t={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),this.blendEquation!==e&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==P&&(i.stencilFail=this.stencilFail),this.stencilZFail!==P&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==P&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),n){const e=r(t.textures),n=r(t.images);e.length>0&&(i.textures=e),n.length>0&&(i.images=n)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Ve extends ze{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new re,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const He=new At,je=new K;class Ge{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=D,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=d,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return et("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=W(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=q(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=W(e,this.array)),e}setX(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=W(e,this.array)),e}setY(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=W(e,this.array)),e}setZ(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=W(e,this.array)),e}setW(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),n=q(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),n=q(n,this.array),i=q(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),n=q(n,this.array),i=q(i,this.array),r=q(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==D&&(t.usage=this.usage),t}}class Qe extends Ge{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class We extends Ge{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class qe extends Ge{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Xe=0;const Ke=new Xt,Ye=new xe,Je=new At,Ze=new xt,$e=new xt,tn=new At;class en extends k{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Xe++}),this.uuid=H(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Z(t)?We:Qe)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Y).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ke.makeRotationFromQuaternion(t),this.applyMatrix4(Ke),this}rotateX(t){return Ke.makeRotationX(t),this.applyMatrix4(Ke),this}rotateY(t){return Ke.makeRotationY(t),this.applyMatrix4(Ke),this}rotateZ(t){return Ke.makeRotationZ(t),this.applyMatrix4(Ke),this}translate(t,e,n){return Ke.makeTranslation(t,e,n),this.applyMatrix4(Ke),this}scale(t,e,n){return Ke.makeScale(t,e,n),this.applyMatrix4(Ke),this}lookAt(t){return Ye.lookAt(t),Ye.updateMatrix(),this.applyMatrix4(Ye.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Je).negate(),this.translate(Je.x,Je.y,Je.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const s in n){const e=n[s];t.data.attributes[s]=e.toJSON(t.data)}const i={};let r=!1;for(const s in this.morphAttributes){const e=this.morphAttributes[s],n=[];for(let i=0,r=e.length;i0&&(i[s]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const l in i){const t=i[l];this.setAttribute(l,t.clone(e))}const r=t.morphAttributes;for(const l in r){const t=[],n=r[l];for(let i=0,r=n.length;i0&&void 0!==arguments[0]?arguments[0]:new en,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ve;super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t(t.far-t.near)**2)return}nn.copy(r).invert(),rn.copy(t.ray).applyMatrix4(nn),null!==n.boundingBox&&!1===rn.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,rn)}}_computeIntersections(t,e,n){let i;const r=this.geometry,o=this.material,a=r.index,s=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(o))for(let p=0,f=u.length;pn.far?null:{distance:c,point:yn.clone(),object:t}}(t,e,n,i,sn,ln,cn,An);if(h){r&&(dn.fromBufferAttribute(r,s),pn.fromBufferAttribute(r,l),fn.fromBufferAttribute(r,c),h.uv=Be.getInterpolation(An,sn,ln,cn,dn,pn,fn,new K)),o&&(dn.fromBufferAttribute(o,s),pn.fromBufferAttribute(o,l),fn.fromBufferAttribute(o,c),h.uv1=Be.getInterpolation(An,sn,ln,cn,dn,pn,fn,new K)),a&&(mn.fromBufferAttribute(a,s),gn.fromBufferAttribute(a,l),vn.fromBufferAttribute(a,c),h.normal=Be.getInterpolation(An,sn,ln,cn,mn,gn,vn,new At),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a:s,b:l,c:c,normal:new At,materialIndex:0};Be.getNormal(sn,ln,cn,t.normal),h.face=t}return h}function bn(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function En(t){const e={};for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:50,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*V*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*z*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*V*Math.atan(Math.tan(.5*z*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Mn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Mn.x,Mn.y).multiplyScalar(-t/Mn.z),Mn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Mn.x,Mn.y).multiplyScalar(-t/Mn.z)}getViewSize(t,e){return this.getViewBounds(t,Cn,Sn),e.subVectors(Sn,Cn)}setViewOffset(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*z*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,a=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/a,i*=o.width/t,n*=o.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Rn=new At,In=new At,Ln=new Y;class Bn{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new At(1,0,0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Rn.subVectors(n,e).cross(In.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Rn),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ln.getNormalMatrix(t),i=this.coplanarPoint(Rn).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Pn=new Ft,Dn=new At;class On{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Bn,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Bn,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Bn,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Bn,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Bn,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new Bn;this.planes=[t,e,n,i,r,o]}set(t,e,n,i,r,o){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O;const n=this.planes,i=t.elements,r=i[0],o=i[1],a=i[2],s=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],A=i[14],y=i[15];if(n[0].setComponents(s-r,u-l,m-d,y-g).normalize(),n[1].setComponents(s+r,u+l,m+d,y+g).normalize(),n[2].setComponents(s+o,u+c,m+p,y+v).normalize(),n[3].setComponents(s-o,u-c,m-p,y-v).normalize(),n[4].setComponents(s-a,u-h,m-f,y-A).normalize(),e===O)n[5].setComponents(s+a,u+h,m+f,y+A).normalize();else{if(e!==N)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(a,h,f,A).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Pn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Pn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Pn)}intersectsSprite(t){return Pn.center.set(0,0,0),Pn.radius=.7071067811865476,Pn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Pn)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++){if(e[r].distanceToPoint(n)0?t.max.x:t.min.x,Dn.y=i.normal.y>0?t.max.y:t.min.y,Dn.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Dn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const Nn={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t#endif\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\t#ifndef USE_INSTANCING_MORPH\n\t\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\t#endif\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},kn={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Y},alphaMap:{value:null},alphaMapTransform:{value:new Y},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Y}},envmap:{envMap:{value:null},envMapRotation:{value:new Y},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Y}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Y}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Y},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Y},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Y},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Y}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Y}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Y}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Y},alphaTest:{value:0},uvTransform:{value:new Y}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Y},alphaMap:{value:null},alphaMapTransform:{value:new Y},alphaTest:{value:0}}},Un={basic:{uniforms:En([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.fog]),vertexShader:Nn.meshbasic_vert,fragmentShader:Nn.meshbasic_frag},lambert:{uniforms:En([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.fog,kn.lights,{emissive:{value:new ke(0)}}]),vertexShader:Nn.meshlambert_vert,fragmentShader:Nn.meshlambert_frag},phong:{uniforms:En([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.fog,kn.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:Nn.meshphong_vert,fragmentShader:Nn.meshphong_frag},standard:{uniforms:En([kn.common,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.roughnessmap,kn.metalnessmap,kn.fog,kn.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Nn.meshphysical_vert,fragmentShader:Nn.meshphysical_frag},toon:{uniforms:En([kn.common,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.gradientmap,kn.fog,kn.lights,{emissive:{value:new ke(0)}}]),vertexShader:Nn.meshtoon_vert,fragmentShader:Nn.meshtoon_frag},matcap:{uniforms:En([kn.common,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.fog,{matcap:{value:null}}]),vertexShader:Nn.meshmatcap_vert,fragmentShader:Nn.meshmatcap_frag},points:{uniforms:En([kn.points,kn.fog]),vertexShader:Nn.points_vert,fragmentShader:Nn.points_frag},dashed:{uniforms:En([kn.common,kn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Nn.linedashed_vert,fragmentShader:Nn.linedashed_frag},depth:{uniforms:En([kn.common,kn.displacementmap]),vertexShader:Nn.depth_vert,fragmentShader:Nn.depth_frag},normal:{uniforms:En([kn.common,kn.bumpmap,kn.normalmap,kn.displacementmap,{opacity:{value:1}}]),vertexShader:Nn.meshnormal_vert,fragmentShader:Nn.meshnormal_frag},sprite:{uniforms:En([kn.sprite,kn.fog]),vertexShader:Nn.sprite_vert,fragmentShader:Nn.sprite_frag},background:{uniforms:{uvTransform:{value:new Y},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Nn.background_vert,fragmentShader:Nn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Y}},vertexShader:Nn.backgroundCube_vert,fragmentShader:Nn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Nn.cube_vert,fragmentShader:Nn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Nn.equirect_vert,fragmentShader:Nn.equirect_frag},distanceRGBA:{uniforms:En([kn.common,kn.displacementmap,{referencePosition:{value:new At},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Nn.distanceRGBA_vert,fragmentShader:Nn.distanceRGBA_frag},shadow:{uniforms:En([kn.lights,kn.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:Nn.shadow_vert,fragmentShader:Nn.shadow_frag}};Un.physical={uniforms:En([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Y},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Y},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Y},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Y},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Y},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Y},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Y},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Y},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Y},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Y},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Y},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Y}}]),vertexShader:Nn.meshphysical_vert,fragmentShader:Nn.meshphysical_frag};class Fn extends wn{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,o=n+t,a=i+e,s=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,a-=e*this.view.offsetY,s=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Math.sqrt(5);class zn extends mt{constructor(t,e,n,i,r,o,a,l,c,h){if((h=void 0!==h?h:m)!==m&&h!==g)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&h===m&&(n=u),void 0===n&&h===g&&(n=p),super(null,i,r,o,a,l,h,n,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:s,this.minFilter=void 0!==l?l:s,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}const Vn=new zn(1,1);Vn.compareFunction=515;new Float32Array(16),new Float32Array(9),new Float32Array(4);new Map;class Hn extends xe{constructor(){super(),this.isGroup=!0,this.type="Group"}}const jn=new At,Gn=new gt,Qn=new gt,Wn=new At,qn=new Xt,Xn=new At,Kn=new Ft,Yn=new Xt,Jn=new qt;class Zn extends _n{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=n,this.bindMatrix=new Xt,this.bindMatrixInverse=new Xt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new xt),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;super(null,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0,arguments.length>7?arguments[7]:void 0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:s,arguments.length>9&&void 0!==arguments[9]?arguments[9]:s,arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>10?arguments[10]:void 0,arguments.length>11?arguments[11]:void 0),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ei=new Xt,ni=new Xt;class ii{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.uuid=H(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t0&&void 0!==arguments[0]?arguments[0]:new en,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ri;super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;ti)return;hi.applyMatrix4(t.matrixWorld);const s=e.ray.origin.distanceTo(hi);return se.far?void 0:{distance:s,point:ui.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,object:t}}class fi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let a,s=0,l=r-1;for(;s<=l;)if(i=Math.floor(s+(l-s)/2),a=n[i]-o,a<0)s=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===o)return i/(r-1);const c=n[i];return(i+(o-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),s=e||(o.isVector2?new K:new At);return s.copy(a).sub(o).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new At,i=[],r=[],o=[],a=new At,s=new Xt;for(let d=0;d<=t;d++){const e=d/t;i[d]=this.getTangentAt(e,new At)}r[0]=new At,o[0]=new At;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let d=1;d<=t;d++){if(r[d]=r[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(j(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(s.makeRotationAxis(a,t))}o[d].crossVectors(i[d],r[d])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(s.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}const mi=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;const i=e&&e.length,r=i?e[0]*n:t.length;let o=gi(t,0,r,n,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c,h,u,d,p;if(i&&(o=function(t,e,n,i){const r=[];let o,a,s,l,c;for(o=0,a=e.length;o80*n){s=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-s,h-l),p=0!==p?32767/p:0}return Ai(o,a,n,s,l,p,0),a};function gi(t,e,n,i,r){let o,a;if(r===function(t,e,n,i){let r=0;for(let o=e,a=n-i;o0)for(o=e;o=e;o-=i)a=ki(o,t[o],t[o+1],a);return a&&Li(a,a.next)&&(Ui(a),a=a.next),a}function vi(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Li(i,i.next)&&0!==Ii(i.prev,i,i.next))i=i.next;else{if(Ui(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Ai(t,e,n,i,r,o,a){if(!t)return;!a&&o&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Ci(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,o);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,o?_i(t,i,r,o):yi(t))e.push(s.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Ui(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Ai(t=xi(vi(t),e,n),e,n,i,r,o,2):2===a&&bi(t,e,n,i,r,o):Ai(vi(t),e,n,i,r,o,1);break}}function yi(t){const e=t.prev,n=t,i=t.next;if(Ii(e,n,i)>=0)return!1;const r=e.x,o=n.x,a=i.x,s=e.y,l=n.y,c=i.y,h=ro?r>a?r:a:o>a?o:a,p=s>l?s>c?s:c:l>c?l:c;let f=i.next;for(;f!==e;){if(f.x>=h&&f.x<=d&&f.y>=u&&f.y<=p&&Ti(r,s,o,l,a,c,f.x,f.y)&&Ii(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function _i(t,e,n,i){const r=t.prev,o=t,a=t.next;if(Ii(r,o,a)>=0)return!1;const s=r.x,l=o.x,c=a.x,h=r.y,u=o.y,d=a.y,p=sl?s>c?s:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,v=Ci(p,f,e,n,i),A=Ci(m,g,e,n,i);let y=t.prevZ,_=t.nextZ;for(;y&&y.z>=v&&_&&_.z<=A;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&Ti(s,h,l,u,c,d,y.x,y.y)&&Ii(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==r&&_!==a&&Ti(s,h,l,u,c,d,_.x,_.y)&&Ii(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;y&&y.z>=v;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==r&&y!==a&&Ti(s,h,l,u,c,d,y.x,y.y)&&Ii(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=A;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==r&&_!==a&&Ti(s,h,l,u,c,d,_.x,_.y)&&Ii(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function xi(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!Li(r,o)&&Bi(r,i,i.next,o)&&Oi(r,o)&&Oi(o,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(o.i/n|0),Ui(i),Ui(i.next),i=t=o),i=i.next}while(i!==t);return vi(i)}function bi(t,e,n,i,r,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Ri(a,t)){let s=Ni(a,t);return a=vi(a,a.next),s=vi(s,s.next),Ai(a,e,n,i,r,o,0),void Ai(s,e,n,i,r,o,0)}t=t.next}a=a.next}while(a!==t)}function Ei(t,e){return t.x-e.x}function wi(t,e){const n=function(t,e){let n,i=e,r=-1/0;const o=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){const t=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=o&&t>r&&(r=t,n=i.x=i.x&&i.x>=l&&o!==i.x&&Ti(an.x||i.x===n.x&&Mi(n,i)))&&(n=i,u=h)),i=i.next}while(i!==s);return n}(t,e);if(!n)return e;const i=Ni(n,t);return vi(i,i.next),vi(n,n.next)}function Mi(t,e){return Ii(t.prev,t,e.prev)<0&&Ii(e.next,t,t.next)<0}function Ci(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Si(t){let e=t,n=t;do{(e.x=(t-a)*(o-s)&&(t-a)*(i-s)>=(n-a)*(e-s)&&(n-a)*(o-s)>=(r-a)*(i-s)}function Ri(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Bi(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Oi(t,e)&&Oi(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!==n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(Ii(t.prev,t,e.prev)||Ii(t,e.prev,e))||Li(t,e)&&Ii(t.prev,t,t.next)>0&&Ii(e.prev,e,e.next)>0)}function Ii(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Li(t,e){return t.x===e.x&&t.y===e.y}function Bi(t,e,n,i){const r=Di(Ii(t,e,n)),o=Di(Ii(t,e,i)),a=Di(Ii(n,i,t)),s=Di(Ii(n,i,e));return r!==o&&a!==s||(!(0!==r||!Pi(t,n,e))||(!(0!==o||!Pi(t,i,e))||(!(0!==a||!Pi(n,t,i))||!(0!==s||!Pi(n,e,i)))))}function Pi(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Di(t){return t>0?1:t<0?-1:0}function Oi(t,e){return Ii(t.prev,t,t.next)<0?Ii(t,e,t.next)>=0&&Ii(t,t.prev,e)>=0:Ii(t,e,t.prev)<0||Ii(t,t.next,e)<0}function Ni(t,e){const n=new Fi(t.i,t.x,t.y),i=new Fi(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function ki(t,e,n,i){const r=new Fi(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ui(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fi(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class zi{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Hi(t,e){for(let n=0;n=r)break t;{const a=e[1];t=r)break e}o=n,n=0}}for(;n>>1;te;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let a=0;a!==r;a++){const e=n[a];if("number"===typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,e),t=!1;break}if(null!==o&&o>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,e,o),t=!1;break}o=e}if(void 0!==i&&Wi(i))for(let a=0,s=i.length;a!==s;++a){const e=i[a];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,e),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===y,r=t.length-1;let o=1;for(let a=1;a0){t[o]=t[r];for(let t=r*n,i=o*n,a=0;a!==n;++a)e[i+a]=e[t+a];++o}return o!==t.length?(this.times=t.slice(0,o),this.values=e.slice(0,o*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}tr.prototype.TimeBufferType=Float32Array,tr.prototype.ValueBufferType=Float32Array,tr.prototype.DefaultInterpolation=A;class er extends tr{}er.prototype.ValueTypeName="bool",er.prototype.ValueBufferType=Array,er.prototype.DefaultInterpolation=v,er.prototype.InterpolantFactoryMethodLinear=void 0,er.prototype.InterpolantFactoryMethodSmooth=void 0;class nr extends tr{}nr.prototype.ValueTypeName="color";class ir extends tr{}ir.prototype.ValueTypeName="number";class rr extends Yi{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(n-e)/(i-e);let l=t*a;for(let c=l+a;l!==c;l+=4)vt.slerpFlat(r,0,o,l-a,o,l,s);return r}}class or extends tr{InterpolantFactoryMethodLinear(t){return new rr(this.times,this.values,this.getValueSize(),t)}}or.prototype.ValueTypeName="quaternion",or.prototype.DefaultInterpolation=A,or.prototype.InterpolantFactoryMethodSmooth=void 0;class ar extends tr{}ar.prototype.ValueTypeName="string",ar.prototype.ValueBufferType=Array,ar.prototype.DefaultInterpolation=v,ar.prototype.InterpolantFactoryMethodLinear=void 0,ar.prototype.InterpolantFactoryMethodSmooth=void 0;class sr extends tr{}sr.prototype.ValueTypeName="vector";class lr{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E;this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=H(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let o=0,a=n.length;o!==a;++o)e.push(cr(n[o]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,o=n.length;r!==o;++r)e.push(tr.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,o=[];for(let a=0;a1){const t=n[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],a=[];Ki(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.fps||30,a=t.blendMode;let s=t.length||-1;const l=t.hierarchy||[];for(let c=0;c{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==fr[t])return void fr[t].push({onLoad:e,onProgress:n,onError:i});fr[t]=[],fr[t].push({onLoad:e,onProgress:n,onError:i});const o=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,s=this.responseType;fetch(o).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"===typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=fr[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),o=r?parseInt(r):0,a=0!==o;let s=0;const l=new ReadableStream({start(t){!function e(){i.read().then((i=>{let{done:r,value:l}=i;if(r)t.close();else{s+=l.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:s,total:o});for(let t=0,e=n.length;t{switch(s){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{hr.add(t,e);const n=fr[t];delete fr[t];for(let t=0,i=n.length;t{const n=fr[t];if(void 0===n)throw this.manager.itemError(t),e;delete fr[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class vr extends pr{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=hr.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const a=$("img");function s(){c(),hr.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",s,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Ar extends pr{constructor(t){super(t)}load(t,e,n,i){const r=new mt,o=new vr(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class yr extends xe{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;super(),this.isLight=!0,this.type="Light",this.color=new ke(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}const _r=new Xt,xr=new At,br=new At;class Er{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.map=null,this.mapPass=null,this.matrix=new Xt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new On,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new gt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;xr.setFromMatrixPosition(t.matrixWorld),e.position.copy(xr),br.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(br),e.updateMatrixWorld(),_r.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_r)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class wr extends Er{constructor(){super(new Tn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*V*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Mr extends yr{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(xe.DEFAULT_UP),this.updateMatrix(),this.target=new xe,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new wr}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Cr=new Xt,Sr=new At,Tr=new At;class Rr extends Er{constructor(){super(new Tn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new K(4,2),this._viewportCount=6,this._viewports=[new gt(2,1,1,1),new gt(0,1,1,1),new gt(3,1,1,1),new gt(1,1,1,1),new gt(3,0,1,1),new gt(1,0,1,1)],this._cubeDirections=[new At(1,0,0),new At(-1,0,0),new At(0,0,1),new At(0,0,-1),new At(0,1,0),new At(0,-1,0)],this._cubeUps=[new At(0,1,0),new At(0,1,0),new At(0,1,0),new At(0,1,0),new At(0,0,1),new At(0,0,-1)]}updateMatrices(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Sr.setFromMatrixPosition(t.matrixWorld),n.position.copy(Sr),Tr.copy(n.position),Tr.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Tr),n.updateMatrixWorld(),i.makeTranslation(-Sr.x,-Sr.y,-Sr.z),Cr.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cr)}}class Ir extends yr{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Rr}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Lr extends Er{constructor(){super(new Fn(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Br extends yr{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(xe.DEFAULT_UP),this.updateMatrix(),this.target=new xe,this.shadow=new Lr}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class Pr extends yr{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Dr{static decodeText(t){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,r=t.length;i>1|(21845&eo)<<1;no=(61680&(no=(52428&no)>>2|(13107&no)<<2))>>4|(3855&no)<<4,to[eo]=((65280&no)>>8|(255&no)<<8)>>1}var io=function(t,e,n){for(var i=t.length,r=0,o=new jr(e);r>l]=c}else for(a=new jr(i),r=0;r>15-t[r]);return a},ro=new Hr(288);for(eo=0;eo<144;++eo)ro[eo]=8;for(eo=144;eo<256;++eo)ro[eo]=9;for(eo=256;eo<280;++eo)ro[eo]=7;for(eo=280;eo<288;++eo)ro[eo]=8;var oo=new Hr(32);for(eo=0;eo<32;++eo)oo[eo]=5;var ao=io(ro,9,1),so=io(oo,5,1),lo=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},co=function(t,e,n){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&n},ho=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},uo=function(t){return(t+7)/8|0},po=function(t,e,n){return(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length),new Hr(t.subarray(e,n))},fo=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],mo=function(t,e,n){var i=new Error(e||fo[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,mo),!n)throw i;return i},go=function(t,e,n,i){var r=t.length,o=i?i.length:0;if(!r||e.f&&!e.l)return n||new Hr(0);var a=!n,s=a||2!=e.i,l=e.i;a&&(n=new Hr(3*r));var c=function(t){var e=n.length;if(t>e){var i=new Hr(Math.max(2*e,t));i.set(n),n=i}},h=e.f||0,u=e.p||0,d=e.b||0,p=e.l,f=e.d,m=e.m,g=e.n,v=8*r;do{if(!p){h=co(t,u,1);var A=co(t,u+1,3);if(u+=3,!A){var y=t[(I=uo(u)+4)-4]|t[I-3]<<8,_=I+y;if(_>r){l&&mo(0);break}s&&c(d+y),n.set(t.subarray(I,_),d),e.b=d+=y,e.p=u=8*_,e.f=h;continue}if(1==A)p=ao,f=so,m=9,g=5;else if(2==A){var x=co(t,u,31)+257,b=co(t,u+10,15)+4,E=x+co(t,u+5,31)+1;u+=14;for(var w=new Hr(E),M=new Hr(19),C=0;C>4)<16)w[C++]=I;else{var B=0,P=0;for(16==I?(P=3+co(t,u,3),u+=2,B=w[C-1]):17==I?(P=3+co(t,u,7),u+=3):18==I&&(P=11+co(t,u,127),u+=7);P--;)w[C++]=B}}var D=w.subarray(0,x),O=w.subarray(x);m=lo(D),g=lo(O),p=io(D,m,1),f=io(O,g,1)}else mo(1);if(u>v){l&&mo(0);break}}s&&c(d+131072);for(var N=(1<>4;if((u+=15&B)>v){l&&mo(0);break}if(B||mo(2),F<256)n[d++]=F;else{if(256==F){U=u,p=null;break}var z=F-254;if(F>264){var V=Qr[C=F-257];z=co(t,u,(1<>4;H||mo(3),u+=15&H;O=$r[j];if(j>3){V=Wr[j];O+=ho(t,u)&(1<v){l&&mo(0);break}s&&c(d+131072);var G=d+z;if(d>4>7||(t[0]<<8|t[1])%31)&&mo(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&mo(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function yo(t,e){return go(t.subarray(Ao(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var _o="undefined"!=typeof TextDecoder&&new TextDecoder;try{_o.decode(vo,{stream:!0})}catch(Wo){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;function xo(t,e,n){const i=n.length-t-1;if(e>=n[i])return i-1;if(e<=n[t])return t;let r=t,o=i,a=Math.floor((r+o)/2);for(;e=n[a+1];)e=o&&(r[e][0]=r[t][0]/s[c+1][l],i=r[e][0]*s[l][c]);const h=u-1<=c?o-1:n-u;for(let n=l>=-1?1:-l;n<=h;++n)r[e][n]=(r[t][n]-r[t][n-1])/s[c+1][l+n],i+=r[e][n]*s[l+n][c];u<=c&&(r[e][o]=-r[t][o-1]/s[c+1][u],i+=r[e][o]*s[u][c]),a[o][u]=i;const d=t;t=e,e=d}}let h=n;for(let u=1;u<=i;++u){for(let t=0;t<=n;++t)a[u][t]*=h;h*=n-u}return a}(s,i,t,o,e),c=[];for(let h=0;h1&&void 0!==arguments[1]?arguments[1]:new At,n=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=function(t,e,n,i){const r=xo(t,i,e),o=bo(r,i,t,e),a=new gt(0,0,0,0);for(let s=0;s<=t;++s){const e=n[r-t+s],i=o[s],l=e.w*i;a.x+=e.x*l,a.y+=e.y*l,a.z+=e.z*l,a.w+=e.w*i}return a}(this.degree,this.knots,this.controlPoints,n);return 1!==i.w&&i.divideScalar(i.w),e.set(i.x,i.y,i.z)}getTangent(t){const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new At,n=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),i=wo(this.degree,this.knots,this.controlPoints,n,1);return e.copy(i[1]).normalize(),e}}let Co,So,To;class Ro{constructor(t,e){this.textureLoader=t,this.manager=e}parse(){So=this.parseConnections();const t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),i=this.parseDeformers(),r=(new Io).parse(i);return this.parseScene(i,r,n),To}parseConnections(){const t=new Map;if("Connections"in Co){Co.Connections.connections.forEach((function(e){const n=e[0],i=e[1],r=e[2];t.has(n)||t.set(n,{parents:[],children:[]});const o={ID:i,relationship:r};t.get(n).parents.push(o),t.has(i)||t.set(i,{parents:[],children:[]});const a={ID:n,relationship:r};t.get(i).children.push(a)}))}return t}parseImages(){const t={},e={};if("Video"in Co.Objects){const n=Co.Objects.Video;for(const i in n){const r=n[i];if(t[parseInt(i)]=r.RelativeFilename||r.Filename,"Content"in r){const t=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,o="string"===typeof r.Content&&""!==r.Content;if(t||o){const t=this.parseImage(n[i]);e[r.RelativeFilename||r.Filename]=t}}}}for(const n in t){const i=t[n];void 0!==e[i]?t[n]=e[i]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"===typeof e)return"data:"+r+";base64,"+e;{const t=new Uint8Array(e);return window.URL.createObjectURL(new Blob([t],{type:r}))}}parseTextures(t){const e=new Map;if("Texture"in Co.Objects){const n=Co.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],t);e.set(parseInt(i),r)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const i=t.WrapModeU,a=t.WrapModeV,s=void 0!==i?i.value:0,l=void 0!==a?a.value:0;if(n.wrapS=0===s?r:o,n.wrapT=0===l?r:o,"Scaling"in t){const e=t.Scaling.value;n.repeat.x=e[0],n.repeat.y=e[1]}if("Translation"in t){const e=t.Translation.value;n.offset.x=e[0],n.offset.y=e[1]}return n}loadTexture(t,e){let n;const i=this.textureLoader.path,r=So.get(t.id).children;let o;void 0!==r&&r.length>0&&void 0!==e[r[0].ID]&&(n=e[r[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const a=t.FileName.slice(-3).toLowerCase();if("tga"===a){const e=this.manager.getHandler(".tga");null===e?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),o=new mt):(e.setPath(this.textureLoader.path),o=e.load(n))}else if("dds"===a){const e=this.manager.getHandler(".dds");null===e?(console.warn("FBXLoader: DDS loader not found, creating placeholder texture for",t.RelativeFilename),o=new mt):(e.setPath(this.textureLoader.path),o=e.load(n))}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),o=new mt):o=this.textureLoader.load(n);return this.textureLoader.setPath(i),o}parseMaterials(t){const e=new Map;if("Material"in Co.Objects){const n=Co.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],t);null!==r&&e.set(parseInt(i),r)}}return e}parseMaterial(t,e){const n=t.id,i=t.attrName;let r=t.ShadingModel;if("object"===typeof r&&(r=r.value),!So.has(n))return null;const o=this.parseParameters(t,e,n);let a;switch(r.toLowerCase()){case"phong":a=new ji;break;case"lambert":a=new Gi;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new ji}return a.setValues(o),a.name=i,a}parseParameters(t,e,n){const r={};t.BumpFactor&&(r.bumpScale=t.BumpFactor.value),t.Diffuse?r.color=(new ke).fromArray(t.Diffuse.value).convertSRGBToLinear():!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(r.color=(new ke).fromArray(t.DiffuseColor.value).convertSRGBToLinear()),t.DisplacementFactor&&(r.displacementScale=t.DisplacementFactor.value),t.Emissive?r.emissive=(new ke).fromArray(t.Emissive.value).convertSRGBToLinear():!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(r.emissive=(new ke).fromArray(t.EmissiveColor.value).convertSRGBToLinear()),t.EmissiveFactor&&(r.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(r.opacity=parseFloat(t.Opacity.value)),r.opacity<1&&(r.transparent=!0),t.ReflectionFactor&&(r.reflectivity=t.ReflectionFactor.value),t.Shininess&&(r.shininess=t.Shininess.value),t.Specular?r.specular=(new ke).fromArray(t.Specular.value).convertSRGBToLinear():t.SpecularColor&&"Color"===t.SpecularColor.type&&(r.specular=(new ke).fromArray(t.SpecularColor.value).convertSRGBToLinear());const o=this;return So.get(n).children.forEach((function(t){const n=t.relationship;switch(n){case"Bump":r.bumpMap=o.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":r.aoMap=o.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=o.getTexture(e,t.ID),void 0!==r.map&&(r.map.colorSpace=M);break;case"DisplacementColor":r.displacementMap=o.getTexture(e,t.ID);break;case"EmissiveColor":r.emissiveMap=o.getTexture(e,t.ID),void 0!==r.emissiveMap&&(r.emissiveMap.colorSpace=M);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=o.getTexture(e,t.ID);break;case"ReflectionColor":r.envMap=o.getTexture(e,t.ID),void 0!==r.envMap&&(r.envMap.mapping=i,r.envMap.colorSpace=M);break;case"SpecularColor":r.specularMap=o.getTexture(e,t.ID),void 0!==r.specularMap&&(r.specularMap.colorSpace=M);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=o.getTexture(e,t.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}getTexture(t,e){return"LayeredTexture"in Co.Objects&&e in Co.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=So.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in Co.Objects){const n=Co.Objects.Deformer;for(const i in n){const r=n[i],o=So.get(parseInt(i));if("Skin"===r.attrType){const e=this.parseSkeleton(o,n);e.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),e.geometryID=o.parents[0].ID,t[i]=e}else if("BlendShape"===r.attrType){const t={id:i};t.rawTargets=this.parseMorphTargets(o,n),t.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[i]=t}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach((function(t){const i=e[t.ID];if("Cluster"!==i.attrType)return;const r={ID:t.ID,indices:[],weights:[],transformLink:(new Xt).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)})),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new ji({name:pr.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in r.attributes&&a.forEach((function(t){t.vertexColors=!0})),r.FBX_Deformer?(i=new Zn(r,o),i.normalizeSkinWeights()):i=new _n(r,o),i}createCurve(t,e){const n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),i=new ri({name:pr.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new di(n,i)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?jo(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){if("LookAtProperty"in e){So.get(t.ID).children.forEach((function(e){if("LookAtProperty"===e.relationship){const n=Co.Objects.Model[e.ID];if("Lcl_Translation"in n){const e=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(e),To.add(t.target)):t.lookAt((new At).fromArray(e))}}}))}}bindSkeleton(t,e,n){const i=this.parsePoseNodes();for(const r in t){const o=t[r];So.get(parseInt(o.ID)).parents.forEach((function(t){if(e.has(t.ID)){const e=t.ID;So.get(e).parents.forEach((function(t){if(n.has(t.ID)){n.get(t.ID).bind(new ii(o.bones),i[t.ID])}}))}}))}}parsePoseNodes(){const t={};if("Pose"in Co.Objects){const e=Co.Objects.Pose;for(const n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){const i=e[n].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new Xt).fromArray(e.Matrix.a)})):t[i.Node]=(new Xt).fromArray(i.Matrix.a)}}return t}addGlobalSceneSettings(){if("GlobalSettings"in Co){if("AmbientColor"in Co.GlobalSettings){const t=Co.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],i=t[2];if(0!==e||0!==n||0!==i){const t=new ke(e,n,i).convertSRGBToLinear();To.add(new Pr(t,1))}}"UnitScaleFactor"in Co.GlobalSettings&&(To.userData.unitScaleFactor=Co.GlobalSettings.UnitScaleFactor.value)}}}class Io{constructor(){this.negativeMaterialIndices=!1}parse(t){const e=new Map;if("Geometry"in Co.Objects){const n=Co.Objects.Geometry;for(const i in n){const r=So.get(parseInt(i)),o=this.parseGeometry(r,n[i],t);e.set(parseInt(i),o)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const i=n.skeletons,r=[],o=t.parents.map((function(t){return Co.Objects.Model[t.ID]}));if(0===o.length)return;const a=t.children.reduce((function(t,e){return void 0!==i[e.ID]&&(t=i[e.ID]),t}),null);t.children.forEach((function(t){void 0!==n.morphTargets[t.ID]&&r.push(n.morphTargets[t.ID])}));const s=o[0],l={};"RotationOrder"in s&&(l.eulerOrder=jo(s.RotationOrder.value)),"InheritType"in s&&(l.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(l.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(l.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(l.scale=s.GeometricScaling.value);const c=Ho(l);return this.genGeometry(e,a,r,c)}genGeometry(t,e,n,i){const r=new en;t.attrName&&(r.name=t.attrName);const o=this.parseGeoNode(t,e),a=this.genBuffers(o),s=new qe(a.vertex,3);if(s.applyMatrix4(i),r.setAttribute("position",s),a.colors.length>0&&r.setAttribute("color",new qe(a.colors,3)),e&&(r.setAttribute("skinIndex",new Qe(a.weightsIndices,4)),r.setAttribute("skinWeight",new qe(a.vertexWeights,4)),r.FBX_Deformer=e),a.normal.length>0){const t=(new Y).getNormalMatrix(i),e=new qe(a.normal,3);e.applyNormalMatrix(t),r.setAttribute("normal",e)}if(a.uvs.forEach((function(t,e){const n=0===e?"uv":`uv${e}`;r.setAttribute(n,new qe(a.uvs[e],2))})),o.material&&"AllSame"!==o.material.mappingType){let t=a.materialIndex[0],e=0;if(a.materialIndex.forEach((function(n,i){n!==t&&(r.addGroup(e,i-e,t),t=n,e=i)})),r.groups.length>0){const e=r.groups[r.groups.length-1],n=e.start+e.count;n!==a.materialIndex.length&&r.addGroup(n,a.materialIndex.length-n,t)}0===r.groups.length&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,t,n,i),r}parseGeoNode(t,e){const n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let e=0;for(;t.LayerElementUV[e];)t.LayerElementUV[e].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[e])),e++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:e,weight:t.weights[r]})}))}))),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,o=[],a=[],s=[],l=[],c=[],h=[];const u=this;return t.vertexIndices.forEach((function(d,p){let f,m=!1;d<0&&(d=~d,m=!0);let g=[],v=[];if(o.push(3*d,3*d+1,3*d+2),t.color){const e=Fo(p,n,d,t.color);s.push(e[0],e[1],e[2])}if(t.skeleton){if(void 0!==t.weightTable[d]&&t.weightTable[d].forEach((function(t){v.push(t.weight),g.push(t.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const t=[0,0,0,0],e=[0,0,0,0];v.forEach((function(n,i){let r=n,o=g[i];e.forEach((function(e,n,i){if(r>e){i[n]=r,r=e;const a=t[n];t[n]=o,o=a}}))})),g=t,v=e}for(;v.length<4;)v.push(0),g.push(0);for(let t=0;t<4;++t)c.push(v[t]),h.push(g[t])}if(t.normal){const e=Fo(p,n,d,t.normal);a.push(e[0],e[1],e[2])}t.material&&"AllSame"!==t.material.mappingType&&(f=Fo(p,n,d,t.material)[0],f<0&&(u.negativeMaterialIndices=!0,f=0)),t.uv&&t.uv.forEach((function(t,e){const i=Fo(p,n,d,t);void 0===l[e]&&(l[e]=[]),l[e].push(i[0]),l[e].push(i[1])})),i++,m&&(u.genFace(e,t,o,f,a,s,l,c,h,i),n++,i=0,o=[],a=[],s=[],l=[],c=[],h=[])})),e}getNormalNewell(t){const e=new At(0,0,0);for(let n=0;n.5?new At(0,1,0):new At(0,0,1)).cross(e).normalize(),i=e.clone().cross(n).normalize();return{normal:e,tangent:n,bitangent:i}}flattenVertex(t,e,n){return new K(t.dot(e),t.dot(n))}genFace(t,e,n,i,r,o,a,s,l,c){let h;if(c>3){const t=[];for(let a=0;a1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=t.get(r[0].ID);n[i]={name:e[i].attrName,layer:o}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new lr(t.name,-1,e)}generateTracks(t){const e=[];let n=new At,i=new At;if(t.transform&&t.transform.decompose(n,new vt,i),n=n.toArray(),i=i.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const i=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==i&&e.push(i)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const n=this.generateRotationTrack(t.modelName,t.R.curves,t.preRotation,t.postRotation,t.eulerOrder);void 0!==n&&e.push(n)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const n=this.generateVectorTrack(t.modelName,t.S.curves,i,"scale");void 0!==n&&e.push(n)}if(void 0!==t.DeformPercent){const n=this.generateMorphTrack(t);void 0!==n&&e.push(n)}return e}generateVectorTrack(t,e,n,i){const r=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(r,e,n);return new sr(t+"."+i,r,o)}generateRotationTrack(t,e,n,i,r){let o,a;if(void 0!==e.x&&void 0!==e.y&&void 0!==e.z){const t=this.interpolateRotations(e.x,e.y,e.z,r);o=t[0],a=t[1]}void 0!==n&&((n=n.map(X.degToRad)).push(r),n=(new re).fromArray(n),n=(new vt).setFromEuler(n)),void 0!==i&&((i=i.map(X.degToRad)).push(r),i=(new re).fromArray(i),i=(new vt).setFromEuler(i).invert());const s=new vt,l=new re,c=[];if(!a||!o)return new or(t+".quaternion",[0],[0]);for(let h=0;h2){(new vt).fromArray(c,(h-3)/3*4).dot(s)<0&&s.set(-s.x,-s.y,-s.z,-s.w)}s.toArray(c,h/3*4)}return new or(t+".quaternion",o,c)}generateMorphTrack(t){const e=t.DeformPercent.curves.morph,n=e.values.map((function(t){return t/100})),i=To.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new ir(t.modelName+".morphTargetInfluences["+i+"]",e.times,n)}getTimesForAllAxes(t){let e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),e=e.sort((function(t,e){return t-e})),e.length>1){let t=1,n=e[0];for(let i=1;i=180||d[1]>=180||d[2]>=180){const e=Math.max(...d)/180,n=new re(...l,i),s=new re(...h,i),c=(new vt).setFromEuler(n),u=(new vt).setFromEuler(s);c.dot(u)&&u.set(-u.x,-u.y,-u.z,-u.w);const p=t.times[a-1],f=t.times[a]-p,m=new vt,g=new re;for(let t=0;t<1;t+=1/e)m.copy(c.clone().slerp(u.clone(),t)),r.push(p+t*f),g.setFromQuaternion(m,i),o.push(g.x),o.push(g.y),o.push(g.z)}else r.push(t.times[a]),o.push(X.degToRad(t.values[a])),o.push(X.degToRad(e.values[a])),o.push(X.degToRad(n.values[a]))}return[r,o]}}class Bo{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new Oo,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const e=this,n=t.split(/[\r\n]+/);return n.forEach((function(t,i){const r=t.match(/^[\s\t]*;/),o=t.match(/^[\s\t]*$/);if(r||o)return;const a=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),s=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=t.match("^\\t{"+(e.currentIndent-1)+"}}");a?e.parseNodeBegin(t,a):s?e.parseNodeProperty(t,s,n[++i]):l?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)})),this.allNodes}parseNodeBegin(t,e){const n=e[1].trim().replace(/^"/,"").replace(/"$/,""),i=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),r={name:n},o=this.parseNodeAttr(i),a=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,r):n in a?("PoseNode"===n?a.PoseNode.push(r):void 0!==a[n].id&&(a[n]={},a[n][a[n].id]=a[n]),""!==o.id&&(a[n][o.id]=r)):"number"===typeof o.id?(a[n]={},a[n][o.id]=r):"Properties70"!==n&&(a[n]="PoseNode"===n?[r]:r),"number"===typeof o.id&&(r.id=o.id),""!==o.name&&(r.attrName=o.name),""!==o.type&&(r.attrType=o.type),this.pushStack(r)}parseNodeAttr(t){let e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",i="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),i=t[2]),{id:e,name:n,type:i}}parseNodeProperty(t,e,n){let i=e[1].replace(/^"/,"").replace(/"$/,"").trim(),r=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===i){const t=r.split(",").slice(1),e=parseInt(t[0]),n=parseInt(t[1]);let a=r.split(",").slice(3);a=a.map((function(t){return t.trim().replace(/^"/,"")})),i="connections",r=[e,n],function(t,e){for(let n=0,i=t.length,r=e.length;n=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},i=e>=7500?t.getUint64():t.getUint32(),r=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const o=t.getUint8(),a=t.getString(o);if(0===i)return null;const s=[];for(let u=0;u0?s[0]:"",c=s.length>1?s[1]:"",h=s.length>2?s[2]:"";for(n.singleProperty=1===r&&t.getOffset()===i;i>t.getOffset();){const i=this.parseNode(t,e);null!==i&&this.parseSubNode(a,n,i)}return n.propertyList=s,"number"===typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==a&&(n.name=a),n}parseSubNode(t,e,n){if(!0===n.singleProperty){const t=n.propertyList[0];Array.isArray(t)?(e[n.name]=n,n.a=t):e[n.name]=t}else if("Connections"===t&&"C"===n.name){const t=[];n.propertyList.forEach((function(e,n){0!==n&&t.push(e)})),void 0===e.connections&&(e.connections=[]),e.connections.push(t)}else if("Properties70"===n.name){Object.keys(n).forEach((function(t){e[t]=n[t]}))}else if("Properties70"===t&&"P"===n.name){let t=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],o=n.propertyList[3];let a;0===t.indexOf("Lcl ")&&(t=t.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),a="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[t]={type:i,type2:r,flag:o,value:a}}else void 0===e[n.name]?"number"===typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=t.getUint32(),r=t.getUint32(),o=t.getUint32();if(0===r)switch(e){case"b":case"c":return t.getBooleanArray(i);case"d":return t.getFloat64Array(i);case"f":return t.getFloat32Array(i);case"i":return t.getInt32Array(i);case"l":return t.getInt64Array(i)}const a=yo(new Uint8Array(t.getArrayBuffer(o))),s=new Do(a.buffer);switch(e){case"b":case"c":return s.getBooleanArray(i);case"d":return s.getFloat64Array(i);case"f":return s.getFloat32Array(i);case"i":return s.getInt32Array(i);case"l":return s.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class Do{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return 1===(1&this.getUint8())}getBooleanArray(t){const e=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,e,i)),this._textDecoder.decode(n)}}class Oo{add(t,e){this[t]=e}}function No(t){const e=t.match(/FBXVersion: (\d+)/);if(e){return parseInt(e[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ko(t){return t/46186158e3}const Uo=[];function Fo(t,e,n,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=t;break;case"ByPolygon":r=e;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);const o=r*i.dataSize,a=o+i.dataSize;return function(t,e,n,i){for(let r=n,o=0;r=e.length&&e===Qo(t,0,e.length)}(t))Co=(new Po).parse(t);else{const e=Qo(t);if(!function(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(e){const i=t[e-1];return t=t.slice(n+e),n++,i}for(let r=0;r{const i=n(510)(),r=function(){let t;return function(){return t=t||i("https://cdn.jsdelivr.net/gh/mrdoob/three.js@r86/examples/js/loaders/GLTFLoader.js"),t}}();t.exports=AFRAME.registerComponent("gltf-model-legacy",{schema:{type:"model"},init:function(){this.model=null,this.loader=null,this.loaderPromise=r().then((()=>{this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("Anonymous")}))},update:function(){const t=this,e=this.el,n=this.data;n&&(this.remove(),this.loaderPromise.then((()=>{this.loader.load(n,(function(n){t.model=n.scene,t.model.animations=n.animations,e.setObject3D("mesh",t.model),e.emit("model-loaded",{format:"gltf",model:t.model})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},7486:(t,e,n)=>{n(172),n(6362),n(8990),n(9081),n(7615)},7615:t=>{t.exports=AFRAME.registerComponent("object-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){let t;const e=this.data;e.src&&(this.remove(),t=new THREE.ObjectLoader,e.crossorigin&&t.setCrossOrigin(e.crossorigin),t.load(e.src,(t=>{t.traverse((t=>{t instanceof THREE.SkinnedMesh&&t.material&&(t.material.skinning=!!(t.geometry&&t.geometry.bones||[]).length)})),this.load(t)})))},load:function(t){this.model=t,this.el.setObject3D("mesh",t),this.el.emit("model-loaded",{format:"json",model:t})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},3078:t=>{t.exports=AFRAME.registerComponent("checkpoint",{schema:{offset:{default:{x:0,y:0,z:0},type:"vec3"}},init:function(){this.active=!1,this.targetEl=null,this.fire=this.fire.bind(this),this.offset=new THREE.Vector3},update:function(){this.offset.copy(this.data.offset)},play:function(){this.el.addEventListener("click",this.fire)},pause:function(){this.el.removeEventListener("click",this.fire)},remove:function(){this.pause()},fire:function(){const t=this.el.sceneEl.querySelector("[checkpoint-controls]");if(!t)throw new Error("No `checkpoint-controls` component found.");t.components["checkpoint-controls"].setCheckpoint(this.el)},getOffset:function(){return this.offset.copy(this.data.offset)}})},9760:t=>{function e(t,e,n,i){t&&(e=e||[],t.traverse((t=>{if(!t.isMesh)return;var r;((r=t.material)?Array.isArray(r)?r:r.materials?r.materials:[r]:[]).forEach((t=>{t&&!("envMap"in t)||e.length&&-1===e.indexOf(t.name)||(t.envMap=n,t.reflectivity=i,t.needsUpdate=!0)}))})))}t.exports=AFRAME.registerComponent("cube-env-map",{multiple:!0,schema:{path:{default:""},extension:{default:"jpg",oneOf:["jpg","png"]},enableBackground:{default:!1},reflectivity:{default:1,min:0,max:1},materials:{default:[]}},init:function(){const t=this.data;this.texture=(new THREE.CubeTextureLoader).load([t.path+"posx."+t.extension,t.path+"negx."+t.extension,t.path+"posy."+t.extension,t.path+"negy."+t.extension,t.path+"posz."+t.extension,t.path+"negz."+t.extension]),this.texture.format=THREE.RGBAFormat,this.object3dsetHandler=()=>{const t=this.el.getObject3D("mesh"),n=this.data;e(t,n.materials,this.texture,n.reflectivity)},this.object3dsetHandler(),this.el.addEventListener("object3dset",this.object3dsetHandler)},update:function(t){const n=this.data,i=this.el.getObject3D("mesh");let r=[],o=[];if(n.materials.length&&(t.materials?(r=n.materials.filter((e=>!t.materials.includes(e))),o=t.materials.filter((t=>!n.materials.includes(t)))):r=n.materials),r.length&&e(i,r,this.texture,n.reflectivity),o.length&&e(i,o,null,1),t.materials&&n.reflectivity!==t.reflectivity){const r=n.materials.filter((e=>t.materials.includes(e)));r.length&&e(i,r,this.texture,n.reflectivity)}this.data.enableBackground&&!t.enableBackground?this.setBackground(this.texture):!this.data.enableBackground&&t.enableBackground&&this.setBackground(null)},remove:function(){this.el.removeEventListener("object3dset",this.object3dsetHandler);const t=this.el.getObject3D("mesh"),n=this.data;e(t,n.materials,null,1),n.enableBackground&&this.setBackground(null)},setBackground:function(t){this.el.sceneEl.object3D.background=t}})},3886:t=>{t.exports=AFRAME.registerComponent("grab",{init:function(){this.system=this.el.sceneEl.systems.physics,this.GRABBED_STATE="grabbed",this.grabbing=!1,this.hitEl=null,this.physics=this.el.sceneEl.systems.physics,this.constraint=null,this.onHit=this.onHit.bind(this),this.onGripOpen=this.onGripOpen.bind(this),this.onGripClose=this.onGripClose.bind(this)},play:function(){const t=this.el;t.addEventListener("hit",this.onHit),t.addEventListener("gripdown",this.onGripClose),t.addEventListener("gripup",this.onGripOpen),t.addEventListener("trackpaddown",this.onGripClose),t.addEventListener("trackpadup",this.onGripOpen),t.addEventListener("triggerdown",this.onGripClose),t.addEventListener("triggerup",this.onGripOpen)},pause:function(){const t=this.el;t.removeEventListener("hit",this.onHit),t.removeEventListener("gripdown",this.onGripClose),t.removeEventListener("gripup",this.onGripOpen),t.removeEventListener("trackpaddown",this.onGripClose),t.removeEventListener("trackpadup",this.onGripOpen),t.removeEventListener("triggerdown",this.onGripClose),t.removeEventListener("triggerup",this.onGripOpen)},onGripClose:function(){this.grabbing=!0},onGripOpen:function(){const t=this.hitEl;this.grabbing=!1,t&&(t.removeState(this.GRABBED_STATE),this.hitEl=void 0,this.system.removeConstraint(this.constraint),this.constraint=null)},onHit:function(t){const e=t.detail.el;e.is(this.GRABBED_STATE)||!this.grabbing||this.hitEl||(e.addState(this.GRABBED_STATE),this.hitEl=e,this.constraint=new CANNON.LockConstraint(this.el.body,e.body),this.system.addConstraint(this.constraint))}})},2206:(t,e,n)=>{n(3078),n(9760),n(3886),n(8649),n(414)},8649:t=>{t.exports=AFRAME.registerComponent("normal-material",{init:function(){this.material=new THREE.MeshNormalMaterial({flatShading:!0}),this.applyMaterial=this.applyMaterial.bind(this),this.el.addEventListener("object3dset",this.applyMaterial),this.applyMaterial()},remove:function(){this.el.removeEventListener("object3dset",this.applyMaterial)},applyMaterial:function(){this.el.object3D.traverse((t=>{t.isMesh&&(t.material=this.material)}))}})},414:t=>{t.exports=AFRAME.registerComponent("sphere-collider",{schema:{enabled:{default:!0},interval:{default:80},objects:{default:""},state:{default:"collided"},radius:{default:.05},watch:{default:!0}},init:function(){this.observer=null,this.els=[],this.collisions=[],this.prevCheckTime=void 0,this.eventDetail={},this.handleHit=this.handleHit.bind(this),this.handleHitEnd=this.handleHitEnd.bind(this)},play:function(){const t=this.el.sceneEl;this.data.watch&&(this.observer=new MutationObserver(this.update.bind(this,null)),this.observer.observe(t,{childList:!0,subtree:!0}))},pause:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},update:function(){const t=this.data;let e;e=t.objects?this.el.sceneEl.querySelectorAll(t.objects):this.el.sceneEl.children,this.els=Array.prototype.slice.call(e)},tick:function(){const t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3,i=new THREE.Vector3,r=new THREE.Box3,o=[],a=new Map;return function(s){if(!this.data.enabled)return;const l=this.prevCheckTime;if(l&&s-la.get(t)>a.get(e)?1:-1)).forEach(this.handleHit),this.collisions.filter((t=>!a.has(t))).forEach(this.handleHitEnd),function(t,e){t.length=0;for(let n=0;n{n(8101),n(1587),n(6817)},1587:t=>{t.exports=AFRAME.registerComponent("nav-agent",{schema:{destination:{type:"vec3"},active:{default:!1},speed:{default:2}},init:function(){this.system=this.el.sceneEl.systems.nav,this.system.addAgent(this),this.group=null,this.path=[],this.raycaster=new THREE.Raycaster},remove:function(){this.system.removeAgent(this)},update:function(){this.path.length=0},updateNavLocation:function(){this.group=null,this.path=[]},tick:function(){const t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(i,r){const o=this.el,a=this.data,s=this.raycaster,l=a.speed*r/1e3;if(!a.active)return;if(!this.path.length){const e=this.el.object3D.position;this.group=this.group||this.system.getGroup(e),this.path=this.system.getPath(e,t.copy(a.destination),this.group)||[],o.emit("navigation-start")}if(!this.path.length)return console.warn("[nav] Unable to find path to %o.",a.destination),this.el.setAttribute("nav-agent",{active:!1}),void o.emit("navigation-end");const c=o.object3D.position,h=this.path[0];e.subVectors(h,c);let u;if(e.length(){t.exports=AFRAME.registerComponent("nav-mesh",{schema:{nodeName:{type:"string"}},init:function(){this.system=this.el.sceneEl.systems.nav,this.hasLoadedNavMesh=!1,this.nodeName=this.data.nodeName,this.el.addEventListener("object3dset",this.loadNavMesh.bind(this))},play:function(){this.hasLoadedNavMesh||this.loadNavMesh()},loadNavMesh:function(){var t=this;const e=this.el.getObject3D("mesh");this.el.sceneEl.object3D;if(!e)return;let n;if(e.traverse((e=>{!e.isMesh||t.nodeName&&e.name!==t.nodeName||(n=e)})),!n)return;const i=n.geometry.clone();n.updateWorldMatrix(!0,!1),i.applyMatrix4(n.matrixWorld),this.system.setNavMeshGeometry(i),this.hasLoadedNavMesh=!0}})},6817:(t,e,n)=>{const{Pathfinding:i}=n(4677),r=new i,o="level";t.exports=AFRAME.registerSystem("nav",{init:function(){this.navMesh=null,this.agents=new Set},setNavMeshGeometry:function(t){this.navMesh=new THREE.Mesh(t),r.setZoneData(o,i.createZone(t)),Array.from(this.agents).forEach((t=>t.updateNavLocation()))},getNavMesh:function(){return this.navMesh},addAgent:function(t){this.agents.add(t)},removeAgent:function(t){this.agents.delete(t)},getPath:function(t,e,n){return this.navMesh?r.findPath(t,e,o,n):null},getGroup:function(t){return this.navMesh?r.getGroup(o,t):null},getNode:function(t,e){return this.navMesh?r.getClosestNode(t,o,e,!0):null},clampStep:function(t,e,n,i,a){return this.navMesh?i?r.clampStep(t,e,i,o,n,a):(a.copy(e),this.getNode(e,n)):(a.copy(e),null)}})},6808:t=>{t.exports=AFRAME.registerPrimitive("a-grid",{defaultComponents:{geometry:{primitive:"plane",width:75,height:75},rotation:{x:-90,y:0,z:0},material:{src:"url(https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v1.16.3/assets/grid.png)",repeat:"75 75"}},mappings:{width:"geometry.width",height:"geometry.height",src:"material.src"}})},6696:t=>{t.exports.Primitive=AFRAME.registerPrimitive("a-ocean",{defaultComponents:{ocean:{},rotation:{x:-90,y:0,z:0}},mappings:{width:"ocean.width",depth:"ocean.depth",density:"ocean.density",amplitude:"ocean.amplitude",amplitudeVariance:"ocean.amplitudeVariance",speed:"ocean.speed",speedVariance:"ocean.speedVariance",color:"ocean.color",opacity:"ocean.opacity"}}),t.exports.Component=AFRAME.registerComponent("ocean",{schema:{width:{default:10,min:0},depth:{default:10,min:0},density:{default:10},amplitude:{default:.1},amplitudeVariance:{default:.3},speed:{default:1},speedVariance:{default:2},color:{default:"#7AD2F7",type:"color"},opacity:{default:.8}},play:function(){const t=this.el,e=this.data;let n=t.components.material;const i=new THREE.PlaneGeometry(e.width,e.depth,e.density,e.density);this.waves=[];const r=i.getAttribute("position");for(let o=0;o{t.exports.Primitive=AFRAME.registerPrimitive("a-tube",{defaultComponents:{tube:{}},mappings:{path:"tube.path",segments:"tube.segments",radius:"tube.radius","radial-segments":"tube.radialSegments",closed:"tube.closed"}}),t.exports.Component=AFRAME.registerComponent("tube",{schema:{path:{default:[]},segments:{default:64},radius:{default:1},radialSegments:{default:8},closed:{default:!1}},init:function(){const t=this.el,e=this.data;let n=t.components.material;if(!e.path.length)return void console.error("[a-tube] `path` property expected but not found.");const i=new THREE.CatmullRomCurve3(e.path.map((function(t){return t=t.split(" "),new THREE.Vector3(Number(t[0]),Number(t[1]),Number(t[2]))}))),r=new THREE.TubeGeometry(i,e.segments,e.radius,e.radialSegments,e.closed);n||(n={},n.material=new THREE.MeshPhongMaterial),this.mesh=new THREE.Mesh(r,n.material),this.el.setObject3D("mesh",this.mesh)},update:function(t){Object.keys(t).length&&(this.remove(),this.init())},remove:function(){this.mesh&&this.el.removeObject3D("mesh")}})},8244:(t,e,n)=>{n(6808),n(6696),n(1750)},64:(t,e,n)=>{if("undefined"===typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let i=n(3671);"default"in i&&(i=i.default);let r=n(3543);"default"in r&&(r=r.default);const o=function(t){return"string"===typeof t?JSON.parse(t):t},a=function(t){if("function"===typeof t)return t;const e=eval;try{return e("("+t+")")}catch(n){}return null},s=function(t){return isNaN(parseFloat(t))?a(t)?a(t):t:parseFloat(t)};AFRAME.registerComponent("forcegraph",{schema:{jsonUrl:{type:"string",default:""},nodes:{parse:o,default:[]},links:{parse:o,default:[]},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:a,default:function(){return!0}},onDagError:{parse:a,default:void 0},nodeRelSize:{type:"number",default:4},nodeId:{type:"string",default:"id"},nodeVal:{parse:s,default:"val"},nodeResolution:{type:"number",default:8},nodeVisibility:{parse:s,default:!0},nodeColor:{parse:s,default:"color"},nodeAutoColorBy:{parse:s,default:""},nodeOpacity:{type:"number",default:.75},nodeThreeObject:{parse:s,default:null},nodeThreeObjectExtend:{parse:s,default:!1},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},linkVisibility:{parse:s,default:!0},linkColor:{parse:s,default:"color"},linkAutoColorBy:{parse:s,default:""},linkOpacity:{type:"number",default:.2},linkWidth:{parse:s,default:0},linkResolution:{type:"number",default:6},linkCurvature:{parse:s,default:0},linkCurveRotation:{parse:s,default:0},linkMaterial:{parse:s,default:null},linkThreeObject:{parse:s,default:null},linkThreeObjectExtend:{parse:s,default:!1},linkPositionUpdate:{parse:a,default:null},linkDirectionalArrowLength:{parse:s,default:0},linkDirectionalArrowColor:{parse:s,default:null},linkDirectionalArrowRelPos:{parse:s,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:s,default:0},linkDirectionalParticleSpeed:{parse:s,default:.01},linkDirectionalParticleWidth:{parse:s,default:.5},linkDirectionalParticleColor:{parse:s,default:null},linkDirectionalParticleResolution:{type:"number",default:4},onNodeHover:{parse:a,default:()=>{}},onLinkHover:{parse:a,default:()=>{}},onNodeClick:{parse:a,default:()=>{}},onLinkClick:{parse:a,default:()=>{}},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:o,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:a,default:function(){}},onEngineStop:{parse:a,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new r),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new r);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new r);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},init:function(){const t=this.state={};t.infoEl=document.createElement("a-text"),t.infoEl.setAttribute("position","0 -0.1 -1"),t.infoEl.setAttribute("width",1),t.infoEl.setAttribute("align","center"),t.infoEl.setAttribute("color","lavender");const e=document.querySelector("a-entity[camera], a-camera");e.appendChild(t.infoEl),t.cameraObj=e.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(e){t.cameraObj=e.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new r),this.forceGraph.onFinishUpdate((()=>this.el.setObject3D("forcegraphGroup",this.forceGraph))).onLoading((()=>t.infoEl.setAttribute("value","Loading..."))).onFinishLoading((()=>t.infoEl.setAttribute("value",""))),this.el.addEventListener("raycaster-intersected",(e=>t.hoverDetail=e.detail)),this.el.addEventListener("raycaster-intersected-cleared",(e=>t.hoverDetail=e.detail)),this.el.addEventListener("click",(()=>t.hoverObj&&this.data["on"+("node"===t.hoverObj.__graphObjType?"Node":"Link")+"Click"](t.hoverObj.__data)))},remove:function(){this.state.infoEl.remove(),this.el.removeObject3D("forcegraphGroup")},update:function(t){const e=this,n=this.data,i=AFRAME.utils.diff(n,t);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in i})).forEach((function(t){e.forceGraph[t](""!==n[t]?n[t]:null)})),("nodes"in i||"links"in i)&&e.forceGraph.graphData({nodes:n.nodes,links:n.links})},tick:function(t,e){const n=this.state,i=this.data,r=n.hoverDetail?n.hoverDetail.getIntersection?n.hoverDetail.getIntersection(this.el):n.hoverDetail.intersection||void 0:void 0;let o=r?r.object:void 0;for(;o&&!o.hasOwnProperty("__graphObjType");)o=o.parent;if(o!==n.hoverObj){const t=n.hoverObj?n.hoverObj.__graphObjType:null,e=n.hoverObj?n.hoverObj.__data:null,r=o?o.__graphObjType:null,a=o?o.__data:null;t&&t!==r&&i["on"+("node"===t?"Node":"Link")+"Hover"](null,e),r&&i["on"+("node"===r?"Node":"Link")+"Hover"](a,t===r?e:null),n.hoverObj=o}this.forceGraph.tickFrame()}})},9256:t=>{var e;self,e=()=>(()=>{var t={"./node_modules/an-array/index.js":t=>{var e=Object.prototype.toString;t.exports=function(t){return t.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===e.call(t.buffer)||Array.isArray(t)}},"./node_modules/as-number/index.js":t=>{t.exports=function(t,e){return"number"===typeof t?t:"number"===typeof e?e:0}},"./node_modules/base64-js/index.js":(t,e)=>{"use strict";e.byteLength=function(t){var e=s(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,o=s(t),a=o[0],l=o[1],c=new r(function(t,e,n){return 3*(e+n)/4-n}(0,a,l)),h=0,u=l>0?a-4:a;for(n=0;n>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===l&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[h++]=255&e),1===l&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e),c},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,o=[],a=16383,s=0,c=i-r;sc?c:s+a));return 1===r?(e=t[i-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],i=[],r="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;function s(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,i){for(var r,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},"./node_modules/buffer-equal/index.js":(t,e,n)=>{var i=n("./node_modules/buffer/index.js").Buffer;t.exports=function(t,e){if(i.isBuffer(t)&&i.isBuffer(e)){if("function"===typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var n=0;n{"use strict";const i=n("./node_modules/base64-js/index.js"),r=n("./node_modules/ieee754/index.js"),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(t){return+t!=t&&(t=0),l.alloc(+t)},e.INSPECT_MAX_BYTES=50;const a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,n){if("number"===typeof t){if("string"===typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return c(t,e,n)}function c(t,e,n){if("string"===typeof t)return function(t,e){if("string"===typeof e&&""!==e||(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|m(t,e);let i=s(n);const r=i.write(t,e);return r!==n&&(i=i.slice(0,r)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(K(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(K(t,ArrayBuffer)||t&&K(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!==typeof SharedArrayBuffer&&(K(t,SharedArrayBuffer)||t&&K(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"===typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return l.from(i,e,n);const r=function(t){if(l.isBuffer(t)){const e=0|f(t.length),n=s(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!==typeof t.length||Y(t.length)?s(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(r)return r;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!==typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return h(t),s(t<0?0:0|f(t))}function d(t){const e=t.length<0?0:0|f(t.length),n=s(e);for(let i=0;i=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function m(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||K(t,ArrayBuffer))return t.byteLength;if("string"!==typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(r)return i?-1:W(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return C(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return R(this,e,n);case"base64":return M(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function v(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function A(t,e,n,i,r){if(0===t.length)return-1;if("string"===typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"===typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:y(t,e,n,i,r);if("number"===typeof e)return e&=255,"function"===typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,i,r){let o,a=1,s=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){let i=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){let n=!0;for(let i=0;ir&&(i=r):i=r;const o=e.length;let a;for(i>o/2&&(i=o/2),a=0;a>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function M(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function C(t,e,n){n=Math.min(t.length,n);const i=[];let r=e;for(;r239?4:e>223?3:e>191?2:1;if(r+a<=n){let n,i,s,l;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[r+1],128===(192&n)&&(l=(31&e)<<6|63&n,l>127&&(o=l));break;case 3:n=t[r+1],i=t[r+2],128===(192&n)&&128===(192&i)&&(l=(15&e)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:n=t[r+1],i=t[r+2],s=t[r+3],128===(192&n)&&128===(192&i)&&128===(192&s)&&(l=(15&e)<<18|(63&n)<<12|(63&i)<<6|63&s,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),r+=a}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let n="",i=0;for(;ii.length?(l.isBuffer(e)||(e=l.from(e)),e.copy(i,r)):Uint8Array.prototype.set.call(i,e,r);else{if(!l.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,r)}r+=e.length}return i},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(t,e,n,i,r){if(K(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0);const s=Math.min(o,a),c=this.slice(i,r),h=t.slice(e,n);for(let l=0;l>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return x(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function T(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;ri)&&(n=i);let r="";for(let o=e;on)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,n,i,r,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function D(t,e,n,i,r){H(e,i,r,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function O(t,e,n,i,r){H(e,i,r,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function N(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function U(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||B(t,e,this.length);let i=this[t],r=1,o=0;for(;++o>>=0,e>>>=0,n||B(t,e,this.length);let i=this[t+--e],r=1;for(;e>0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||B(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readBigUInt64LE=Z((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,r=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(i)+(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],r=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(i)<>>=0,e>>>=0,n||B(t,e,this.length);let i=this[t],r=1,o=0;for(;++o=r&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||B(t,e,this.length);let i=e,r=1,o=this[t+--i];for(;i>0&&(r*=256);)o+=this[t+--i]*r;return r*=128,o>=r&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return t>>>=0,e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){t>>>=0,e||B(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readBigInt64LE=Z((function(t){j(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||G(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<>>=0,e||B(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||B(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||B(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||B(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||P(this,t,e,n,Math.pow(2,8*n)-1,0);let r=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,i||P(this,t,e,n,Math.pow(2,8*n)-1,0);let r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigUInt64LE=Z((function(t){return D(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(t){return O(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);P(this,t,e,n,i-1,-i)}let r=0,o=1,a=0;for(this[e]=255&t;++r>>=0,!i){const i=Math.pow(2,8*n-1);P(this,t,e,n,i-1,-i)}let r=n-1,o=1,a=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===a&&0!==this[e+r+1]&&(a=1),this[e+r]=(t/o|0)-a&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigInt64LE=Z((function(t){return D(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(t){return O(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(t,e,n){return k(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return k(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"===typeof t)for(r=e;r=i+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function H(t,e,n,i,r,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new F.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){j(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||G(e,t.length-(n+1))}(i,r,o)}function j(t,e){if("number"!==typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,n){if(Math.floor(t)!==t)throw j(t,n),new F.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,n){let i=`The value of "${t}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=V(String(n)):"bigint"===typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=V(r)),r+="n"),i+=` It must be ${e}. Received ${r}`,i}),RangeError);const Q=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const i=t.length;let r=null;const o=[];for(let a=0;a55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;t.length%4!==0;)t+="=";return t}(t))}function X(t,e,n,i){let r;for(r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}function K(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(t){return t!==t}const J=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)e[i+r]=t[n]+t[r]}return e}();function Z(t){return"undefined"===typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},"./node_modules/css-loader/dist/runtime/api.js":t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i="undefined"!==typeof e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,r,o){"string"===typeof t&&(t=[[null,t,void 0]]);var a={};if(i)for(var s=0;s0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),e.push(h))}},e}},"./node_modules/css-loader/dist/runtime/getUrl.js":t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},"./node_modules/css-loader/dist/runtime/sourceMaps.js":t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"===typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),o="/*# ".concat(r," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},"./node_modules/debug/src/browser.js":(t,e,n)=>{e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(r=i))})),e.splice(r,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(n){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(n){}return!t&&"undefined"!==typeof process&&"env"in process&&(t={NODE_ENV:"production",PUBLIC_URL:"/mycelialnet-g",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DEBUG),t},e.useColors=function(){return!("undefined"===typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"===typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n("./node_modules/debug/src/common.js")(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},"./node_modules/debug/src/common.js":(t,e,n)=>{t.exports=function(t){function e(t){let n,r,o,a=null;function s(){for(var t=arguments.length,i=new Array(t),r=0;r{if("%%"===t)return"%";c++;const r=e.formatters[n];if("function"===typeof r){const e=i[c];t=r.call(o,e),i.splice(c,1),c--}return t})),e.formatArgs.call(o,i),(o.log||e.log).apply(o,i)}return s.namespace=t,s.useColors=e.useColors(),s.color=e.selectColor(t),s.extend=i,s.destroy=e.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(r!==e.namespaces&&(r=e.namespaces,o=e.enabled(t)),o),set:t=>{a=t}}),"function"===typeof e.init&&e.init(s),s}function i(t,n){const i=e(this.namespace+("undefined"===typeof n?":":n)+t);return i.log=this.log,i}function r(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names.map(r),...e.skips.map(r).map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){let n;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const i=("string"===typeof t?t:"").split(/[\s,]+/),r=i.length;for(n=0;n{e[n]=t[n]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e{"use strict";var i=n("./node_modules/is-obj/index.js"),r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(t,e,n){var o=e[n];if(void 0!==o&&null!==o){if(r.call(t,n)&&(void 0===t[n]||null===t[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(t,n)&&i(o)?t[n]=s(Object(t[n]),e[n]):t[n]=o}}function s(t,e){if(t===e)return t;for(var n in e=Object(e))r.call(e,n)&&a(t,e,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(e),s=0;s{t.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},"./node_modules/global/window.js":(t,e,n)=>{var i;i="undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{},t.exports=i},"./node_modules/ieee754/index.js":(t,e)=>{e.read=function(t,e,n,i,r){var o,a,s=8*r-i-1,l=(1<>1,h=-7,u=n?r-1:0,d=n?-1:1,p=t[e+u];for(u+=d,o=p&(1<<-h)-1,p>>=-h,h+=s;h>0;o=256*o+t[e+u],u+=d,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=i;h>0;a=256*a+t[e+u],u+=d,h-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,i),o-=c}return(p?-1:1)*a*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var a,s,l,c=8*o-r-1,h=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=h?(s=0,a=h):a+u>=1?(s=(e*l-1)*Math.pow(2,r),a+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,r),a=0));r>=8;t[n+p]=255&s,p+=f,s/=256,r-=8);for(a=a<0;t[n+p]=255&a,p+=f,a/=256,c-=8);t[n+p-f]|=128*m}},"./node_modules/is-buffer/index.js":t=>{function e(t){return!!t.constructor&&"function"===typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"===typeof t.readFloatLE&&"function"===typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},"./node_modules/is-function/index.js":t=>{t.exports=function(t){if(!t)return!1;var n=e.call(t);return"[object Function]"===n||"function"===typeof t&&"[object RegExp]"!==n||"undefined"!==typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},"./node_modules/is-obj/index.js":t=>{"use strict";t.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},"./node_modules/layout-bmfont-text/index.js":(t,e,n)=>{var i=n("./node_modules/word-wrapper/index.js"),r=n("./node_modules/xtend/immutable.js"),o=n("./node_modules/as-number/index.js"),a=["x","e","a","o","n","s","r","c","u","m","v","w","z"],s=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function d(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function p(t,e){if(!t.chars||0===t.chars.length)return null;var n=m(t.chars,e);return n>=0?t.chars[n]:null}function f(t,e,n){if(!t.kernings||0===t.kernings.length)return 0;for(var i=t.kernings,r=0;r=0)return t.chars[i].height}return 0}(s),this._capHeight=function(t){for(var e=0;e=0)return t.chars[i].height}return 0}(s),this._lineHeight=g,this._ascender=g-A-this._xHeight;var b=this;c.forEach((function(t,i){for(var r,o=t.start,a=t.end,l=t.width,c=o;c=0)return t.chars[i]}return 0}(t)||t.chars[0],n=this._opt.tabSize*e.xadvance;this._fallbackSpaceGlyph=e,this._fallbackTabGlyph=r(e,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(t,e){var n=p(t,e);return n||(e===c?this._fallbackTabGlyph:e===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(t,e,n,i){var r,o=this._opt.letterSpacing||0,a=this._opt.font,s=0,l=0,c=0;if(!a.chars||0===a.chars.length)return{start:e,end:e,width:0};n=Math.min(t.length,n);for(var h=e;h=i||p>=i)break;s=p,l=m,r=u}c++}return r&&(l+=r.xoffset),{start:e,end:e+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(t){Object.defineProperty(u.prototype,t,{get:d(t),configurable:!0})}))},"./node_modules/load-bmfont/browser.js":(t,e,n)=>{var i=n("./node_modules/buffer/index.js").Buffer,r=n("./node_modules/xhr/index.js"),o=function(){},a=n("./node_modules/parse-bmfont-ascii/index.js"),s=n("./node_modules/parse-bmfont-xml/lib/browser.js"),l=n("./node_modules/parse-bmfont-binary/index.js"),c=n("./node_modules/load-bmfont/lib/is-binary.js"),h=n("./node_modules/xtend/immutable.js"),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(t,e){e="function"===typeof e?e:o,"string"===typeof t?t={uri:t}:t||(t={}),t.binary&&(t=function(t){if(u)return h(t,{responseType:"arraybuffer"});if("undefined"===typeof self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:e},t)}(t)),r(t,(function(n,r,h){if(n)return e(n);if(!/^2/.test(r.statusCode))return e(new Error("http status code: "+r.statusCode));if(!h)return e(new Error("no body result"));var u,d,p=!1;if(u=h,"[object ArrayBuffer]"===Object.prototype.toString.call(u)){var f=new Uint8Array(h);h=i.from(f,"binary")}c(h)&&(p=!0,"string"===typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(t.encoding)),h=h.trim());try{var m=r.headers["content-type"];d=p?l(h):/json/.test(m)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(m)||"<"===h.charAt(0)?s(h):a(h)}catch(g){e(new Error("error parsing font "+g.message)),e=o}e(null,d)}))}},"./node_modules/load-bmfont/lib/is-binary.js":(t,e,n)=>{var i=n("./node_modules/buffer/index.js").Buffer,r=n("./node_modules/buffer-equal/index.js"),o=i.from([66,77,70,3]);t.exports=function(t){return"string"===typeof t?"BMF"===t.substring(0,3):t.length>4&&r(t.slice(0,4),o)}},"./node_modules/ms/index.js":t=>{var e=1e3,n=60*e,i=60*n,r=24*i,o=7*r,a=365.25*r;function s(t,e,n,i){var r=e>=1.5*n;return Math.round(t/n)+" "+i+(r?"s":"")}t.exports=function(t,l){l=l||{};var c=typeof t;if("string"===c&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(s){var l=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*a;case"weeks":case"week":case"w":return l*o;case"days":case"day":case"d":return l*r;case"hours":case"hour":case"hrs":case"hr":case"h":return l*i;case"minutes":case"minute":case"mins":case"min":case"m":return l*n;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}(t);if("number"===c&&isFinite(t))return l.long?function(t){var o=Math.abs(t);return o>=r?s(t,o,r,"day"):o>=i?s(t,o,i,"hour"):o>=n?s(t,o,n,"minute"):o>=e?s(t,o,e,"second"):t+" ms"}(t):function(t){var o=Math.abs(t);return o>=r?Math.round(t/r)+"d":o>=i?Math.round(t/i)+"h":o>=n?Math.round(t/n)+"m":o>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},"./node_modules/parse-bmfont-ascii/index.js":t=>{function e(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var i=t.indexOf(" ");if(-1===i)throw new Error("no named row at line "+e);var r=t.substring(0,i);t=(t=(t=(t=t.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var o=[],a=0;a{var e=[66,77,70];function n(t,e,n){if(n>e.length-1)return 0;var r=e.readUInt8(n++),o=e.readInt32LE(n);switch(n+=4,r){case 1:t.info=function(t,e){var n={};n.size=t.readInt16LE(e);var r=t.readUInt8(e+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=t.readUInt8(e+3)||"",n.stretchH=t.readUInt16LE(e+4),n.aa=t.readUInt8(e+6),n.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],n.spacing=[t.readInt8(e+11),t.readInt8(e+12)],n.outline=t.readUInt8(e+13),n.face=function(t,e){return i(t,e).toString("utf8")}(t,e+14),n}(e,n);break;case 2:t.common=function(t,e){var n={};return n.lineHeight=t.readUInt16LE(e),n.base=t.readUInt16LE(e+2),n.scaleW=t.readUInt16LE(e+4),n.scaleH=t.readUInt16LE(e+6),n.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),n.packed=0,n.alphaChnl=t.readUInt8(e+11),n.redChnl=t.readUInt8(e+12),n.greenChnl=t.readUInt8(e+13),n.blueChnl=t.readUInt8(e+14),n}(e,n);break;case 3:t.pages=function(t,e,n){for(var r=[],o=i(t,e),a=o.length+1,s=n/a,l=0;l3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var o={kernings:[],chars:[]},a=0;a<5;a++)r+=n(o,t,r);return o}},"./node_modules/parse-bmfont-xml/lib/browser.js":(t,e,n)=>{var i=n("./node_modules/parse-bmfont-xml/lib/parse-attribs.js"),r=n("./node_modules/xml-parse-from-string/index.js"),o={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function a(t){var e=function(t){for(var e=[],n=0;n element");for(var s=o.getElementsByTagName("page"),l=0;l{var e="chasrset";t.exports=function(t){for(var n in e in t&&(t.charset=t[e],delete t[e]),t)"face"!==n&&"charset"!==n&&(t[n]="padding"===n||"spacing"===n?t[n].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[n],10));return t}},"./node_modules/parse-headers/parse-headers.js":t=>{var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var n,i={},r=e(t).split("\n"),o=0;o{var i=n("./node_modules/dtype/index.js"),r=n("./node_modules/an-array/index.js"),o=n("./node_modules/is-buffer/index.js"),a=[0,2,3],s=[2,1,3];t.exports=function(t,e){t&&(r(t)||o(t))||(e=t||{},t=null);for(var n="string"===typeof(e="number"===typeof e?{count:e}:e||{}).type?e.type:"uint16",l="number"===typeof e.count?e.count:1,c=e.start||0,h=!1!==e.clockwise?a:s,u=h[0],d=h[1],p=h[2],f=6*l,m=t||new(i(n))(f),g=0,v=0;g{"use strict";n.r(e),n.d(e,{default:()=>bt});var i={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},r={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},o=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],a={CSS:{},springs:{}};function s(t,e,n){return Math.min(Math.max(t,e),n)}function l(t,e){return t.indexOf(e)>-1}function c(t,e){return t.apply(null,e)}var h=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,u=/^rgb/,d=/^hsl/,p={arr:function(t){return Array.isArray(t)},obj:function(t){return l(Object.prototype.toString.call(t),"Object")},pth:function(t){return p.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||p.svg(t)},str:function(t){return"string"===typeof t},fnc:function(t){return"function"===typeof t},und:function(t){return"undefined"===typeof t},hex:function(t){return h.test(t)},rgb:function(t){return u.test(t)},hsl:function(t){return d.test(t)},col:function(t){return p.hex(t)||p.rgb(t)||p.hsl(t)},key:function(t){return!i.hasOwnProperty(t)&&!r.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}},f=/\(([^)]+)\)/;function m(t){var e=f.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function g(t,e){var n=m(t),i=s(p.und(n[0])?1:n[0],.1,100),r=s(p.und(n[1])?100:n[1],.1,100),o=s(p.und(n[2])?10:n[2],.1,100),l=s(p.und(n[3])?0:n[3],.1,100),c=Math.sqrt(r/i),h=o/(2*Math.sqrt(r*i)),u=h<1?c*Math.sqrt(1-h*h):0,d=h<1?(h*c-l)/u:-l+c;function f(t){var n=e?e*t/1e3:t;return n=h<1?Math.exp(-n*h*c)*(1*Math.cos(u*n)+d*Math.sin(u*n)):(1+d*n)*Math.exp(-n*c),0===t||1===t?t:1-n}return e?f:function(){var e=a.springs[t];if(e)return e;for(var n=1/6,i=0,r=0;;)if(1===f(i+=n)){if(++r>=16)break}else r=0;var o=i*n*1e3;return a.springs[t]=o,o}}function v(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var n=s(t,1,10),i=s(e,.1,2);return function(t){return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function A(t){return void 0===t&&(t=10),function(e){return Math.round(e*t)*(1/t)}}var y=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function i(t){return 3*t}function r(t,r,o){return((e(r,o)*t+n(r,o))*t+i(r))*t}function o(t,r,o){return 3*e(r,o)*t*t+2*n(r,o)*t+i(r)}return function(e,n,i,a){if(0<=e&&e<=1&&0<=i&&i<=1){var s=new Float32Array(11);if(e!==n||i!==a)for(var l=0;l<11;++l)s[l]=r(l*t,e,i);return function(t){return e===n&&i===a||0===t||1===t?t:r(c(t),n,a)}}function c(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=t;--l;var c=a+(n-s[l])/(s[l+1]-s[l])*t,h=o(c,e,i);return h>=.001?function(t,e,n,i){for(var a=0;a<4;++a){var s=o(e,n,i);if(0===s)return e;e-=(r(e,n,i)-t)/s}return e}(n,c,e,i):0===h?c:function(t,e,n,i,o){var a,s,l=0;do{(a=r(s=e+(n-e)/2,i,o)-t)>0?n=s:e=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+t,e,i)}}}(),_=function(){var t=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],e={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],v],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(t,e){return function(n){return 1-v(t,e)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(t,e){return function(n){return n<.5?v(t,e)(2*n)/2:1-v(t,e)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in e)for(var r=0,o=e[i].length;r=2?arguments[1]:void 0,o=0;o1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(0==a)e=n=i=s;else{var h=s<.5?s*(1+a):s+a-s*a,u=2*s-h;e=c(u,h,o+1/3),n=c(u,h,o),i=c(u,h,o-1/3)}return"rgba("+255*e+","+255*n+","+255*i+","+l+")"}(t):void 0}var k=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function U(t){var e=k.exec(t);if(e)return e[2]}function F(t,e){return p.fnc(t)?t(e.target,e.id,e.total):t}function z(t,e){return t.getAttribute(e)}function V(t,e,n){if(S([n,"deg","rad","turn"],U(e)))return e;var i=a.CSS[e+n];if(!p.und(i))return i;var r=document.createElement(t.tagName),o=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;o.appendChild(r),r.style.position="absolute",r.style.width=100+n;var s=100/r.offsetWidth;o.removeChild(r);var l=s*parseFloat(e);return a.CSS[e+n]=l,l}function H(t,e,n){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return n?V(t,r,n):r}}function j(t,e){return p.dom(t)&&!p.inp(t)&&(z(t,e)||p.svg(t)&&t[e])?"attribute":p.dom(t)&&S(o,e)?"transform":p.dom(t)&&"transform"!==e&&H(t,e)?"css":null!=t[e]?"object":void 0}var G=/(\w+)\(([^)]*)\)/g;function Q(t){if(p.dom(t)){for(var e,n=t.style.transform||"",i=new Map;e=G.exec(n);)i.set(e[1],e[2]);return i}}function W(t,e,n,i){var r=l(e,"scale")?1:0+function(t){return l(t,"translate")||"perspective"===t?"px":l(t,"rotate")||l(t,"skew")?"deg":void 0}(e),o=Q(t).get(e)||r;return n&&(n.transforms.list.set(e,o),n.transforms.last=e),i?V(t,o,i):o}function q(t,e,n,i){switch(j(t,e)){case"transform":return W(t,e,i,n);case"css":return H(t,e,n);case"attribute":return z(t,e);default:return t[e]||0}}var X=/^(\*=|\+=|-=)/;function K(t,e){var n=X.exec(t);if(!n)return t;var i=U(t)||0,r=parseFloat(e),o=parseFloat(t.replace(n[0],""));switch(n[0][0]){case"+":return r+o+i;case"-":return r-o+i;case"*":return r*o+i}}var Y=/\s/g;function J(t,e){if(p.col(t))return N(t);var n=U(t),i=n?t.substr(0,t.length-n.length):t;return e&&!Y.test(t)?i+e:i}function Z(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $(t){for(var e,n=t.points,i=0,r=0;r0&&(i+=Z(e,o)),e=o}return i}function tt(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*z(t,"r")}(t);case"rect":return function(t){return 2*z(t,"width")+2*z(t,"height")}(t);case"line":return function(t){return Z({x:z(t,"x1"),y:z(t,"y1")},{x:z(t,"x2"),y:z(t,"y2")})}(t);case"polyline":return $(t);case"polygon":return function(t){var e=t.points;return $(t)+Z(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function et(t,e){var n=e||{},i=n.el||function(t){for(var e=t.parentNode;p.svg(e)&&(e=e.parentNode,p.svg(e.parentNode)););return e}(t),r=i.getBoundingClientRect(),o=z(i,"viewBox"),a=r.width,s=r.height,l=n.viewBox||(o?o.split(" "):[0,0,a,s]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:a/l[2],h:s/l[3]}}function nt(t,e){function n(n){void 0===n&&(n=0);var i=e+n>=1?e+n:0;return t.el.getPointAtLength(i)}var i=et(t.el,t.svg),r=n(),o=n(-1),a=n(1);switch(t.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(a.y-o.y,a.x-o.x)/Math.PI}}var it=/-?\d*\.?\d+/g;function rt(t,e){var n=J(p.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(it)?n.match(it).map(Number):[0],strings:p.str(t)||e?n.split(it):[]}}function ot(t){return w(t?M(p.arr(t)?t.map(C):C(t)):[],(function(t,e,n){return n.indexOf(t)===e}))}function at(t){var e=ot(t);return e.map((function(t,n){return{target:t,id:n,total:e.length,transforms:{list:Q(t)}}}))}var st=/^spring/;function lt(t,e){var n=T(e);if(st.test(n.easing)&&(n.duration=g(n.easing)),p.arr(t)){var i=t.length;2!==i||p.obj(t[0])?p.fnc(e.duration)||(n.duration=e.duration/i):t={value:t}}var r=p.arr(t)?t:[t];return r.map((function(t,n){var i=p.obj(t)&&!p.pth(t)?t:{value:t};return p.und(i.delay)&&(i.delay=n?0:e.delay),p.und(i.endDelay)&&(i.endDelay=n===r.length-1?e.endDelay:0),i})).map((function(t){return I(t,n)}))}function ct(t,e){var n=[],i=e.keyframes;for(var r in i&&(e=I(function(t){for(var e=w(M(t.map((function(t){return Object.keys(t)}))),(function(t){return p.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),n={},i=function(i){var r=e[i];n[r]=t.map((function(t){var e={};for(var n in t)p.key(n)?n==r&&(e.value=t[n]):e[n]=t[n];return e}))},r=0;r-1&&(vt.splice(o,1),n=vt.length)}else r.tick(e);i++}t()}else mt=cancelAnimationFrame(mt)}return t}();function _t(t){void 0===t&&(t={});var e,n=0,o=0,a=0,l=0,c=null;function h(){return window.Promise&&new Promise((function(t){return c=t}))}var u=h(),d=function(t){var e=R(i,t),n=R(r,t),o=ct(n,t),a=at(t.targets),s=pt(a,o),l=ft(s,n),c=gt;return gt++,I(e,{id:c,children:[],animatables:a,animations:s,duration:l.duration,delay:l.delay,endDelay:l.endDelay})}(t);function p(){d.reversed=!d.reversed;for(var t=0,n=e.length;t2||(y=Math.round(y*f)/f)),m.push(y)}var b=p.length;if(b){v=p[0];for(var E=0;E0&&(d.began=!0,A("begin"),A("loopBegin")),y<=r&&0!==d.currentTime&&v(0),(y>=m&&d.currentTime!==i||!i)&&v(i),y>r&&y=i&&(o=0,d.remaining&&!0!==d.remaining&&d.remaining--,d.remaining?(n=a,A("loopComplete"),A("loopBegin"),"alternate"===d.direction&&p()):(d.paused=!0,d.completed||(d.completed=!0,A("loopComplete"),A("complete"),"Promise"in window&&(c(),u=h()))))}return d.reset=function(){var t=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"===t,d.remaining=d.loop,e=d.children;for(var n=l=e.length;n--;)d.children[n].reset();(d.reversed&&!0!==d.loop||"alternate"===t&&1===d.loop)&&d.remaining++,v(0)},d.set=function(t,e){return dt(t,e),d},d.tick=function(t){a=t,n||(n=a),y((a+(o-n))*_t.speed)},d.seek=function(t){y(f(t))},d.pause=function(){d.paused=!0,m()},d.play=function(){d.paused&&(d.paused=!1,vt.push(d),m(),mt||yt())},d.reverse=function(){p(),m()},d.restart=function(){d.reset(),d.play()},d.finished=u,d.reset(),d.autoplay&&d.play(),d}function xt(t,e){for(var n=e.length;n--;)S(t,e[n].animatable.target)&&e.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var t=0,e=vt.length;t-1&&vt.splice(o,1);for(var l=0;l{var i=n("./node_modules/layout-bmfont-text/index.js"),r=n("./node_modules/quad-indices/index.js"),o=n("./node_modules/three-bmfont-text/lib/vertices.js"),a=n("./node_modules/three-bmfont-text/lib/utils.js");t.exports=function(t){return new s(t)};class s extends THREE.BufferGeometry{constructor(t){super(),"string"===typeof t&&(t={text:t}),this._opt=Object.assign({},t),t&&this.update(t)}update(t){if("string"===typeof t&&(t={text:t}),!(t=Object.assign({},this._opt,t)).font)throw new TypeError("must specify a { font } in options");this.layout=i(t);var e=!1!==t.flipY,n=t.font,a=n.common.scaleW,s=n.common.scaleH,l=this.layout.glyphs.filter((function(t){var e=t.data;return e.width*e.height>0}));this.visibleGlyphs=l;var c=o.positions(l),h=o.uvs(l,a,s,e),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)),!t.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(t.multipage){var d=o.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 t=this.attributes.position.array,e=this.attributes.position.itemSize;if(!t||!e||t.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);a.computeSphere(t,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 t=this.boundingBox,e=this.attributes.position.array,n=this.attributes.position.itemSize;!e||!n||e.length<2?t.makeEmpty():a.computeBox(e,t)}}},"./node_modules/three-bmfont-text/lib/utils.js":t=>{var e={min:[0,0],max:[0,0]};function n(t){var n=t.length/2;e.min[0]=t[0],e.min[1]=t[1],e.max[0]=t[0],e.max[1]=t[1];for(var i=0;i{t.exports.pages=function(t){var e=new Float32Array(4*t.length*1),n=0;return t.forEach((function(t){var i=t.data.page||0;e[n++]=i,e[n++]=i,e[n++]=i,e[n++]=i})),e},t.exports.uvs=function(t,e,n,i){var r=new Float32Array(4*t.length*2),o=0;return t.forEach((function(t){var a=t.data,s=a.x+a.width,l=a.y+a.height,c=a.x/e,h=a.y/n,u=s/e,d=l/n;i&&(h=(n-a.y)/n,d=(n-l)/n),r[o++]=c,r[o++]=h,r[o++]=c,r[o++]=d,r[o++]=u,r[o++]=d,r[o++]=u,r[o++]=h})),r},t.exports.positions=function(t){var e=new Float32Array(4*t.length*2),n=0;return t.forEach((function(t){var i=t.data,r=t.position[0]+i.xoffset,o=t.position[1]+i.yoffset,a=i.width,s=i.height;e[n++]=r,e[n++]=o,e[n++]=r,e[n++]=o+s,e[n++]=r+a,e[n++]=o+s,e[n++]=r+a,e[n++]=o})),e}},"./node_modules/webvr-polyfill/build/webvr-polyfill.js":function(t,e,n){t.exports=function(){"use strict";var t="undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t,e){return t(e={exports:{}},e.exports),e.exports}var r=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},o=function(t,e){for(var n=0,i=t.length;no)},A=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},y=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},_=function(t){if(c())return!1;if(t.requestFullscreen)t.requestFullscreen();else if(t.webkitRequestFullscreen)t.webkitRequestFullscreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else{if(!t.msRequestFullscreen)return!1;t.msRequestFullscreen()}return!0},x=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},b=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},E=function(t,e,n,i){var r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);var o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,n),t.compileShader(o);var a=t.createProgram();for(var s in t.attachShader(a,r),t.attachShader(a,o),i)t.bindAttribLocation(a,i[s],s);return t.linkProgram(a),t.deleteShader(r),t.deleteShader(o),a},w=function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r="",o=0;o1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(t.w)},P=function(){var t={};return function(e,n){void 0===t[e]&&(console.warn("webvr-polyfill: "+n),t[e]=!0)}}(),D=function(t,e){P(t,t+" has been deprecated. This may not work on native WebVR displays. "+(e?"Please use "+e+" instead.":""))};function O(t,e,n){if(e){for(var i=[],r=null,o=0;ot.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=t.getParameter(t.ACTIVE_TEXTURE)),t.activeTexture(l),i.push(t.getParameter(a),null);break;case t.ACTIVE_TEXTURE:r=t.getParameter(t.ACTIVE_TEXTURE),i.push(null);break;default:i.push(t.getParameter(a))}for(n(t),o=0;ot.TEXTURE31)break;t.activeTexture(l),t.bindTexture(t.TEXTURE_2D,s);break;case t.TEXTURE_BINDING_CUBE_MAP:var l;if((l=e[++o])t.TEXTURE31)break;t.activeTexture(l),t.bindTexture(t.TEXTURE_CUBE_MAP,s);break;case t.VIEWPORT:t.viewport(s[0],s[1],s[2],s[3]);break;case t.BLEND:case t.CULL_FACE:case t.DEPTH_TEST:case t.SCISSOR_TEST:case t.STENCIL_TEST:s?t.enable(a):t.disable(a);break;default:console.log("No GL restore behavior for 0x"+a.toString(16))}r&&t.activeTexture(r)}}else n(t)}var N=O,k=["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"),U=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function F(t,e,n,i){this.gl=t,this.cardboardUI=e,this.bufferScale=n,this.dirtySubmitFrameBindings=i,this.ctxAttribs=t.getContextAttributes(),this.instanceExt=t.getExtension("ANGLE_instanced_arrays"),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=t.drawingBufferWidth,this.bufferHeight=t.drawingBufferHeight,this.realBindFramebuffer=t.bindFramebuffer,this.realEnable=t.enable,this.realDisable=t.disable,this.realColorMask=t.colorMask,this.realClearColor=t.clearColor,this.realViewport=t.viewport,l()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(t.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(t.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=E(t,k,U,this.attribs),this.uniforms=w(t,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.indexCount=0,this.renderTarget=t.createTexture(),this.framebuffer=t.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=t.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=t.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=t.createRenderbuffer()),this.patch(),this.onResize()}F.prototype.destroy=function(){var t=this.gl;this.unpatch(),t.deleteProgram(this.program),t.deleteBuffer(this.vertexBuffer),t.deleteBuffer(this.indexBuffer),t.deleteTexture(this.renderTarget),t.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&t.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&t.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&t.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},F.prototype.onResize=function(){var t=this.gl,e=this,n=[t.RENDERBUFFER_BINDING,t.TEXTURE_BINDING_2D,t.TEXTURE0];N(t,n,(function(t){e.realBindFramebuffer.call(t,t.FRAMEBUFFER,null),e.scissorTest&&e.realDisable.call(t,t.SCISSOR_TEST),e.realColorMask.call(t,!0,!0,!0,!0),e.realViewport.call(t,0,0,t.drawingBufferWidth,t.drawingBufferHeight),e.realClearColor.call(t,0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),e.realBindFramebuffer.call(t,t.FRAMEBUFFER,e.framebuffer),t.bindTexture(t.TEXTURE_2D,e.renderTarget),t.texImage2D(t.TEXTURE_2D,0,e.ctxAttribs.alpha?t.RGBA:t.RGB,e.bufferWidth,e.bufferHeight,0,e.ctxAttribs.alpha?t.RGBA:t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e.renderTarget,0),e.ctxAttribs.depth&&e.ctxAttribs.stencil?(t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilBuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.bufferWidth,e.bufferHeight),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e.depthStencilBuffer)):e.ctxAttribs.depth?(t.bindRenderbuffer(t.RENDERBUFFER,e.depthBuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,e.bufferWidth,e.bufferHeight),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e.depthBuffer)):e.ctxAttribs.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,e.stencilBuffer),t.renderbufferStorage(t.RENDERBUFFER,t.STENCIL_INDEX8,e.bufferWidth,e.bufferHeight),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,e.stencilBuffer)),!t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),e.realBindFramebuffer.call(t,t.FRAMEBUFFER,e.lastBoundFramebuffer),e.scissorTest&&e.realEnable.call(t,t.SCISSOR_TEST),e.realColorMask.apply(t,e.colorMask),e.realViewport.apply(t,e.viewport),e.realClearColor.apply(t,e.clearColor)})),this.cardboardUI&&this.cardboardUI.onResize()},F.prototype.patch=function(){if(!this.isPatched){var t=this,e=this.gl.canvas,n=this.gl;l()||(e.width=A()*this.bufferScale,e.height=y()*this.bufferScale,Object.defineProperty(e,"width",{configurable:!0,enumerable:!0,get:function(){return t.bufferWidth},set:function(n){t.bufferWidth=n,t.realCanvasWidth.set.call(e,n),t.onResize()}}),Object.defineProperty(e,"height",{configurable:!0,enumerable:!0,get:function(){return t.bufferHeight},set:function(n){t.bufferHeight=n,t.realCanvasHeight.set.call(e,n),t.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(e,i){t.lastBoundFramebuffer=i||t.framebuffer,t.realBindFramebuffer.call(n,e,t.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(e){switch(e){case n.CULL_FACE:t.cullFace=!0;break;case n.DEPTH_TEST:t.depthTest=!0;break;case n.BLEND:t.blend=!0;break;case n.SCISSOR_TEST:t.scissorTest=!0;break;case n.STENCIL_TEST:t.stencilTest=!0}t.realEnable.call(n,e)},n.disable=function(e){switch(e){case n.CULL_FACE:t.cullFace=!1;break;case n.DEPTH_TEST:t.depthTest=!1;break;case n.BLEND:t.blend=!1;break;case n.SCISSOR_TEST:t.scissorTest=!1;break;case n.STENCIL_TEST:t.stencilTest=!1}t.realDisable.call(n,e)},this.colorMask=n.getParameter(n.COLOR_WRITEMASK),n.colorMask=function(e,i,r,o){t.colorMask[0]=e,t.colorMask[1]=i,t.colorMask[2]=r,t.colorMask[3]=o,t.realColorMask.call(n,e,i,r,o)},this.clearColor=n.getParameter(n.COLOR_CLEAR_VALUE),n.clearColor=function(e,i,r,o){t.clearColor[0]=e,t.clearColor[1]=i,t.clearColor[2]=r,t.clearColor[3]=o,t.realClearColor.call(n,e,i,r,o)},this.viewport=n.getParameter(n.VIEWPORT),n.viewport=function(e,i,r,o){t.viewport[0]=e,t.viewport[1]=i,t.viewport[2]=r,t.viewport[3]=o,t.realViewport.call(n,e,i,r,o)},this.isPatched=!0,T(e)}},F.prototype.unpatch=function(){if(this.isPatched){var t=this.gl,e=this.gl.canvas;l()||(Object.defineProperty(e,"width",this.realCanvasWidth),Object.defineProperty(e,"height",this.realCanvasHeight)),e.width=this.bufferWidth,e.height=this.bufferHeight,t.bindFramebuffer=this.realBindFramebuffer,t.enable=this.realEnable,t.disable=this.realDisable,t.colorMask=this.realColorMask,t.clearColor=this.realClearColor,t.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&t.bindFramebuffer(t.FRAMEBUFFER,null),this.isPatched=!1,setTimeout((function(){T(e)}),1)}},F.prototype.setTextureBounds=function(t,e){t||(t=[0,0,.5,1]),e||(e=[.5,0,.5,1]),this.viewportOffsetScale[0]=t[0],this.viewportOffsetScale[1]=t[1],this.viewportOffsetScale[2]=t[2],this.viewportOffsetScale[3]=t[3],this.viewportOffsetScale[4]=e[0],this.viewportOffsetScale[5]=e[1],this.viewportOffsetScale[6]=e[2],this.viewportOffsetScale[7]=e[3]},F.prototype.submitFrame=function(){var t=this.gl,e=this,n=[];if(this.dirtySubmitFrameBindings||n.push(t.CURRENT_PROGRAM,t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING,t.TEXTURE_BINDING_2D,t.TEXTURE0),N(t,n,(function(t){e.realBindFramebuffer.call(t,t.FRAMEBUFFER,null);var n=0,i=0;e.instanceExt&&(n=t.getVertexAttrib(e.attribs.position,e.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),i=t.getVertexAttrib(e.attribs.texCoord,e.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)),e.cullFace&&e.realDisable.call(t,t.CULL_FACE),e.depthTest&&e.realDisable.call(t,t.DEPTH_TEST),e.blend&&e.realDisable.call(t,t.BLEND),e.scissorTest&&e.realDisable.call(t,t.SCISSOR_TEST),e.stencilTest&&e.realDisable.call(t,t.STENCIL_TEST),e.realColorMask.call(t,!0,!0,!0,!0),e.realViewport.call(t,0,0,t.drawingBufferWidth,t.drawingBufferHeight),(e.ctxAttribs.alpha||l())&&(e.realClearColor.call(t,0,0,0,1),t.clear(t.COLOR_BUFFER_BIT)),t.useProgram(e.program),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.indexBuffer),t.bindBuffer(t.ARRAY_BUFFER,e.vertexBuffer),t.enableVertexAttribArray(e.attribs.position),t.enableVertexAttribArray(e.attribs.texCoord),t.vertexAttribPointer(e.attribs.position,2,t.FLOAT,!1,20,0),t.vertexAttribPointer(e.attribs.texCoord,3,t.FLOAT,!1,20,8),e.instanceExt&&(0!=n&&e.instanceExt.vertexAttribDivisorANGLE(e.attribs.position,0),0!=i&&e.instanceExt.vertexAttribDivisorANGLE(e.attribs.texCoord,0)),t.activeTexture(t.TEXTURE0),t.uniform1i(e.uniforms.diffuse,0),t.bindTexture(t.TEXTURE_2D,e.renderTarget),t.uniform4fv(e.uniforms.viewportOffsetScale,e.viewportOffsetScale),t.drawElements(t.TRIANGLES,e.indexCount,t.UNSIGNED_SHORT,0),e.cardboardUI&&e.cardboardUI.renderNoState(),e.realBindFramebuffer.call(e.gl,t.FRAMEBUFFER,e.framebuffer),e.ctxAttribs.preserveDrawingBuffer||(e.realClearColor.call(t,0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)),e.dirtySubmitFrameBindings||e.realBindFramebuffer.call(t,t.FRAMEBUFFER,e.lastBoundFramebuffer),e.cullFace&&e.realEnable.call(t,t.CULL_FACE),e.depthTest&&e.realEnable.call(t,t.DEPTH_TEST),e.blend&&e.realEnable.call(t,t.BLEND),e.scissorTest&&e.realEnable.call(t,t.SCISSOR_TEST),e.stencilTest&&e.realEnable.call(t,t.STENCIL_TEST),e.realColorMask.apply(t,e.colorMask),e.realViewport.apply(t,e.viewport),!e.ctxAttribs.alpha&&e.ctxAttribs.preserveDrawingBuffer||e.realClearColor.apply(t,e.clearColor),e.instanceExt&&(0!=n&&e.instanceExt.vertexAttribDivisorANGLE(e.attribs.position,n),0!=i&&e.instanceExt.vertexAttribDivisorANGLE(e.attribs.texCoord,i))})),l()){var i=t.canvas;i.width==e.bufferWidth&&i.height==e.bufferHeight||(e.bufferWidth=i.width,e.bufferHeight=i.height,e.onResize())}},F.prototype.updateDeviceInfo=function(t){var e=this.gl,n=this,i=[e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING];N(e,i,(function(e){var i=n.computeMeshVertices_(n.meshWidth,n.meshHeight,t);if(e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW),!n.indexCount){var r=n.computeMeshIndices_(n.meshWidth,n.meshHeight);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW),n.indexCount=r.length}}))},F.prototype.computeMeshVertices_=function(t,e,n){for(var i=new Float32Array(2*t*e*5),r=n.getLeftEyeVisibleTanAngles(),o=n.getLeftEyeNoLensTanAngles(),a=n.getLeftEyeVisibleScreenRect(o),l=0,c=0;c<2;c++){for(var h=0;hr-o&&i.clientXn.clientHeight-o?t(i):i.clientX1e-4;){var r=t-this.distort(n),o=n-r*((n-e)/(r-i));e=n,n=o,i=r}return n},$.prototype.distort=function(t){for(var e=t*t,n=0,i=0;i=1)return this.w=o,this.x=n,this.y=i,this.z=r,this;var s=Math.acos(a),l=Math.sqrt(1-a*a);if(Math.abs(l)<.001)return this.w=.5*(o+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-e)*s)/l,h=Math.sin(e*s)/l;return this.w=o*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:function(){var t,e,n=1e-6;return function(i,r){return void 0===t&&(t=new nt),(e=i.dot(r)+1)Math.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,r),this.x=t.x,this.y=t.y,this.z=t.z,this.w=e,this.normalize(),this}}()};var ot=new rt({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),at=new rt({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),st={CardboardV1:new ct({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 ct({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 lt(t,e){this.viewer=st.CardboardV2,this.updateDeviceParams(t),this.distortion=new $(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 dt(t){this.xdpi=t.xdpi,this.ydpi=t.ydpi,this.bevelMm=t.bevelMm}function pt(t,e){this.set(t,e)}function ft(t,e){this.kFilter=t,this.isDebug=e,this.currentAccelMeasurement=new pt,this.currentGyroMeasurement=new pt,this.previousGyroMeasurement=new pt,l()?this.filterQ=new it(-1,0,0,1):this.filterQ=new it(1,0,0,1),this.previousFilterQ=new it,this.previousFilterQ.copy(this.filterQ),this.accelQ=new it,this.isOrientationInitialized=!1,this.estimatedGravity=new nt,this.measuredGravity=new nt,this.gyroIntegralQ=new it}function mt(t,e){this.predictionTimeS=t,this.isDebug=e,this.previousQ=new it,this.previousTimestampS=null,this.deltaQ=new it,this.outQ=new it}function gt(t,e,n,i){this.yawOnly=n,this.accelerometer=new nt,this.gyroscope=new nt,this.filter=new ft(t,i),this.posePredictor=new mt(e,i),this.isFirefoxAndroid=u(),this.isIOS=l();var r=d();this.isDeviceMotionInRadians=!this.isIOS&&r&&r<66,this.isWithoutDeviceMotion=f()||p(),this.filterToWorldQ=new it,l()?this.filterToWorldQ.setFromAxisAngle(new nt(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new nt(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new it,this.worldToScreenQ=new it,this.originalPoseAdjustQ=new it,this.originalPoseAdjustQ.setFromAxisAngle(new nt(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),g()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new it,this.orientationOut_=new Float32Array(4),this.start()}ut.prototype.getDeviceParams=function(){return this.deviceParams},ut.prototype.recalculateDeviceParams_=function(){var t=this.calcDeviceParams_();t?(this.deviceParams=t,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},ut.prototype.calcDeviceParams_=function(){var t=this.dpdb;if(!t)return console.error("DPDB not available."),null;if(1!=t.format)return console.error("DPDB has unexpected format version."),null;if(!t.devices||!t.devices.length)return console.error("DPDB does not have a devices section."),null;var e=navigator.userAgent||navigator.vendor||window.opera,n=A(),i=y();if(!t.devices)return console.error("DPDB has no devices section."),null;for(var r=0;ro?(P("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=i)):(this.accelerometer.set(-e.x,-e.y,-e.z),n&&(m()?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))},gt.prototype.onOrientationChange_=function(t){this.setScreenTransform_()},gt.prototype.onMessage_=function(t){var e=t.data;e&&e.type&&"devicemotion"===e.type.toLowerCase()&&this.updateDeviceMotion_(e.deviceMotionEvent)},gt.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new nt(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new nt(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},gt.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),l()&&I()&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},gt.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var vt=60,At=new nt(1,0,0),yt=new nt(0,0,1),_t=new it;_t.setFromAxisAngle(At,-Math.PI/2),_t.multiply((new it).setFromAxisAngle(yt,Math.PI/2));var xt=function(){function t(n){e(this,t),this.config=n,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new it,this._outQ=new it,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return n(t,[{key:"init",value:function(){var t=null;try{(t=new RelativeOrientationSensor({frequency:vt,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)}t&&(this.api="sensor",this.sensor=t,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new gt(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 t=this.sensor.quaternion;this._sensorQ.set(t[0],t[1],t[2],t[3]);var e=this._outQ;return e.copy(_t),e.multiply(this._sensorQ),this.config.YAW_ONLY&&(e.x=e.z=0,e.normalize()),this._out[0]=e.x,this._out[1]=e.y,this._out[2]=e.z,this._out[3]=e.w,this._out}},{key:"_onSensorError",value:function(t){this.errors.push(t.error),"NotAllowedError"===t.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===t.error.name?console.error("Sensor could not be read"):console.error(t.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),t}(),bt="";function Et(){this.loadIcon_();var t=document.createElement("div");(o=t.style).position="fixed",o.top=0,o.right=0,o.bottom=0,o.left=0,o.backgroundColor="gray",o.fontFamily="sans-serif",o.zIndex=1e6;var e=document.createElement("img");e.src=this.icon,(o=e.style).marginLeft="25%",o.marginTop="25%",o.width="50%",t.appendChild(e);var n=document.createElement("div");(o=n.style).textAlign="center",o.fontSize="16px",o.lineHeight="24px",o.margin="24px 25%",o.width="50%",n.innerHTML="Place your phone into your Cardboard viewer.",t.appendChild(n);var i=document.createElement("div");(o=i.style).backgroundColor="#CFD8DC",o.position="fixed",o.bottom=0,o.width="100%",o.height="48px",o.padding="14px 24px",o.boxSizing="border-box",o.color="#656A6B",t.appendChild(i);var r=document.createElement("div");r.style.float="left",r.innerHTML="No Cardboard viewer?";var o,a=document.createElement("a");a.href="https://www.google.com/get/cardboard/get-cardboard/",a.innerHTML="get one",a.target="_blank",(o=a.style).float="right",o.fontWeight=600,o.textTransform="uppercase",o.borderLeft="1px solid gray",o.paddingLeft="24px",o.textDecoration="none",o.color="#656A6B",i.appendChild(r),i.appendChild(a),this.overlay=t,this.text=n,this.hide()}Et.prototype.show=function(t){t||this.overlay.parentElement?t&&(this.overlay.parentElement&&this.overlay.parentElement!=t&&this.overlay.parentElement.removeChild(this.overlay),t.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var e=this.overlay.querySelector("img").style;g()?(e.width="20%",e.marginLeft="40%",e.marginTop="3%"):(e.width="50%",e.marginLeft="25%",e.marginTop="25%")},Et.prototype.hide=function(){this.overlay.style.display="none"},Et.prototype.showTemporarily=function(t,e){this.show(e),this.timer=setTimeout(this.hide.bind(this),t)},Et.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},Et.prototype.update=function(){this.disableShowTemporarily(),!g()&&C()?this.show():this.hide()},Et.prototype.loadIcon_=function(){this.icon=a("image/svg+xml",bt)};var wt="CardboardV1",Mt="WEBVR_CARDBOARD_VIEWER",Ct="webvr-polyfill-viewer-selector";function St(t){try{this.selectedKey=localStorage.getItem(Mt)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=t||wt),this.dialog=this.createDialog_(lt.Viewers),this.root=null,this.onChangeCallbacks_=[]}function Tt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Rt(t,e){return t(e={exports:{}},e.exports),e.exports}St.prototype.show=function(t){this.root=t,t.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},St.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},St.prototype.getCurrentViewer=function(){return lt.Viewers[this.selectedKey]},St.prototype.getSelectedKey_=function(){var t=this.dialog.querySelector("input[name=field]:checked");return t?t.id:null},St.prototype.onChange=function(t){this.onChangeCallbacks_.push(t)},St.prototype.fireOnChange_=function(t){for(var e=0;e.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return i(t,[{key:"enable",value:function(){a?(this.disable(),this.noSleepTimer=window.setInterval((function(){window.location.href="/",window.setTimeout(window.stop,0)}),15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){a?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),t}();t.exports=s},function(t,e,n){t.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="}])}))})),Lt=Tt(It),Bt=1e3,Pt=[0,0,.5,1],Dt=[.5,0,.5,1],Ot=window.requestAnimationFrame,Nt=window.cancelAnimationFrame;function kt(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function Ut(t){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:t.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:t.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:t.canPresent},maxLayers:{writable:!1,enumerable:!0,value:t.maxLayers},hasOrientation:{enumerable:!0,get:function(){return D("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),t.hasOrientation}}})}function Ft(t){var e=!("wakelock"in(t=t||{}))||t.wakelock;this.isPolyfilled=!0,this.displayId=Bt++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return D("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new Ut({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,e&&C()&&(this.wakelock_=new Lt)}Ft.prototype.getFrameData=function(t){return R(t,this._getPose(),this)},Ft.prototype.getPose=function(){return D("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},Ft.prototype.resetPose=function(){return D("VRDisplay.prototype.resetPose"),this._resetPose()},Ft.prototype.getImmediatePose=function(){return D("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},Ft.prototype.requestAnimationFrame=function(t){return Ot(t)},Ft.prototype.cancelAnimationFrame=function(t){return Nt(t)},Ft.prototype.wrapForFullscreen=function(t){if(l())return t;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var e=["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",e.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==t)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=t,this.originalParent_=t.parentElement,this.originalParent_||document.body.appendChild(t),!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 t=["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",t.join("; ")+";")}}return r(),this.fullscreenWrapper_},Ft.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var t=this.fullscreenElement_;this.fullscreenElementCachedStyle_?t.setAttribute("style",this.fullscreenElementCachedStyle_):t.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var e=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(t),this.originalParent_===e?e.insertBefore(t,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(t),e.removeChild(this.fullscreenWrapper_),t}},Ft.prototype.requestPresent=function(t){var e=this.isPresenting,n=this;return t instanceof Array||(D("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),t=[t]),new Promise((function(i,r){if(n.capabilities.canPresent)if(0==t.length||t.length>n.capabilities.maxLayers)r(new Error("Invalid number of layers."));else{var o=t[0];if(o.source){var a=o.leftBounds||Pt,s=o.rightBounds||Dt;if(e){var h=n.layer_;h.source!==o.source&&(h.source=o.source);for(var u=0;u<4;u++)h.leftBounds[u]=a[u],h.rightBounds[u]=s[u];return n.wrapForFullscreen(n.layer_.source),n.updatePresent_(),void i()}if(n.layer_={predistorted:o.predistorted,source:o.source,leftBounds:a.slice(0),rightBounds:s.slice(0)},n.waitingForPresent_=!1,n.layer_&&n.layer_.source){var d=n.wrapForFullscreen(n.layer_.source),p=function(){var t=b();n.isPresenting=d===t,n.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch((function(t){console.error("screen.orientation.lock() failed due to",t.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_()},f=function(){n.waitingForPresent_&&(n.removeFullscreenWrapper(),n.removeFullscreenListeners_(),n.disableWakeLock(),n.waitingForPresent_=!1,n.isPresenting=!1,r(new Error("Unable to present.")))};n.addFullscreenListeners_(d,p,f),_(d)?(n.enableWakeLock(),n.waitingForPresent_=!0):(l()||c())&&(n.enableWakeLock(),n.isPresenting=!0,n.beginPresent_(),n.fireVRDisplayPresentChange_(),i())}n.waitingForPresent_||l()||(x(),r(new Error("Unable to present.")))}else i()}else r(new Error("VRDisplay is not capable of presenting."))}))},Ft.prototype.exitPresent=function(){var t=this.isPresenting,e=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise((function(n,i){t?(!x()&&l()&&(e.endPresent_(),e.fireVRDisplayPresentChange_()),c()&&(e.removeFullscreenWrapper(),e.removeFullscreenListeners_(),e.endPresent_(),e.fireVRDisplayPresentChange_()),n()):i(new Error("Was not presenting to VRDisplay."))}))},Ft.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},Ft.prototype.fireVRDisplayPresentChange_=function(){var t=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(t)},Ft.prototype.fireVRDisplayConnect_=function(){var t=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(t)},Ft.prototype.addFullscreenListeners_=function(t,e,n){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=t,this.fullscreenChangeHandler_=e,this.fullscreenErrorHandler_=n,e&&(document.fullscreenEnabled?t.addEventListener("fullscreenchange",e,!1):document.webkitFullscreenEnabled?t.addEventListener("webkitfullscreenchange",e,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",e,!1):document.msFullscreenEnabled&&t.addEventListener("msfullscreenchange",e,!1)),n&&(document.fullscreenEnabled?t.addEventListener("fullscreenerror",n,!1):document.webkitFullscreenEnabled?t.addEventListener("webkitfullscreenerror",n,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",n,!1):document.msFullscreenEnabled&&t.addEventListener("msfullscreenerror",n,!1))},Ft.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var t=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var e=this.fullscreenChangeHandler_;t.removeEventListener("fullscreenchange",e,!1),t.removeEventListener("webkitfullscreenchange",e,!1),document.removeEventListener("mozfullscreenchange",e,!1),t.removeEventListener("msfullscreenchange",e,!1)}if(this.fullscreenErrorHandler_){var n=this.fullscreenErrorHandler_;t.removeEventListener("fullscreenerror",n,!1),t.removeEventListener("webkitfullscreenerror",n,!1),document.removeEventListener("mozfullscreenerror",n,!1),t.removeEventListener("msfullscreenerror",n,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},Ft.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},Ft.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},Ft.prototype.beginPresent_=function(){},Ft.prototype.endPresent_=function(){},Ft.prototype.submitFrame=function(t){},Ft.prototype.getEyeParameters=function(t){return null};var zt={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},Vt={LEFT:"left",RIGHT:"right"};function Ht(t){var e=S({},zt);t=S(e,t||{}),Ft.call(this,{wakelock:t.MOBILE_WAKE_LOCK}),this.config=t,this.displayName="Cardboard VRDisplay",this.capabilities=new Ut({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new xt(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new ut(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new lt(this.dpdb_.getDeviceParams(),t.ADDITIONAL_VIEWERS),this.viewerSelector_=new St(t.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new Et),l()&&window.addEventListener("resize",this.onResize_.bind(this))}return Ht.prototype=Object.create(Ft.prototype),Ht.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},Ht.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},Ht.prototype._getFieldOfView=function(t){var e;if(t==Vt.LEFT)e=this.deviceInfo_.getFieldOfViewLeftEye();else{if(t!=Vt.RIGHT)return console.error("Invalid eye provided: %s",t),null;e=this.deviceInfo_.getFieldOfViewRightEye()}return e},Ht.prototype._getEyeOffset=function(t){var e;if(t==Vt.LEFT)e=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(t!=Vt.RIGHT)return console.error("Invalid eye provided: %s",t),null;e=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return e},Ht.prototype.getEyeParameters=function(t){var e=this._getEyeOffset(t),n=this._getFieldOfView(t),i={offset:e,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 D("VRFieldOfView","VRFrameData's projection matrices"),n}}),i},Ht.prototype.onDeviceParamsUpdated_=function(t){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(t),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},Ht.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},Ht.prototype.beginPresent_=function(){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2")),t&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(t.canvas.width=A()*this.bufferScale_,t.canvas.height=y()*this.bufferScale_,this.cardboardUI_=new Z(t)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new Z(t)),this.distorter_=new F(t,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(t){this.viewerSelector_.show(this.layer_.source.parentElement),t.stopPropagation(),t.preventDefault()}.bind(this),function(t){this.exitPresent(),t.stopPropagation(),t.preventDefault()}.bind(this)),this.rotateInstructions_&&(g()&&C()?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_())},Ht.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)},Ht.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},Ht.prototype.submitFrame=function(t){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2"));var n=e.canvas;n.width==this.lastWidth&&n.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=n.width,this.lastHeight=n.height,this.cardboardUI_.render()}},Ht.prototype.onOrientationChange_=function(t){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},Ht.prototype.onResize_=function(t){if(this.layer_){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=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"];e.canvas.setAttribute("style",n.join("; ")+";"),T(e.canvas)}},Ht.prototype.onViewerChanged_=function(t){this.deviceInfo_.setViewer(t),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},Ht.prototype.fireVRDisplayDeviceParamsChange_=function(){var t=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(t)},Ht.VRFrameData=kt,Ht.VRDisplay=Ft,Ht}))})),l=e(s),c="0.10.12",h={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 u(t){this.config=a(a({},h),t),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&&r())&&(this.enable(),this.getVRDisplays().then((function(t){t&&t[0]&&t[0].fireVRDisplayConnect_&&t[0].fireVRDisplayConnect_()})))}u.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(r()){var t=new l({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(t)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},u.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var t=this.native.VRFrameData,e=new this.native.VRFrameData,n=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(i){i instanceof t?n.call(this,i):(n.call(this,e),i.pose=e.pose,o(e.leftProjectionMatrix,i.leftProjectionMatrix),o(e.rightProjectionMatrix,i.rightProjectionMatrix),o(e.leftViewMatrix,i.leftViewMatrix),o(e.rightViewMatrix,i.rightViewMatrix))}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=l.VRDisplay,window.VRFrameData=l.VRFrameData},u.prototype.getVRDisplays=function(){var t=this;return this.config,this.hasNative?this.native.getVRDisplays.call(navigator).then((function(e){return e.length>0?e:t.getPolyfillDisplays()})):Promise.resolve(this.getPolyfillDisplays())},u.version=c,u.VRFrameData=l.VRFrameData,u.VRDisplay=l.VRDisplay;var d=Object.freeze({default:u}),p=d&&u||d;return"undefined"!==typeof t&&t.window&&(t.document||(t.document=t.window.document),t.navigator||(t.navigator=t.window.navigator)),p}()},"./node_modules/word-wrapper/index.js":t=>{var e=/\n/,n="\n",i=/\s/;function r(t,e,n,i){var r=t.indexOf(e,n);return-1===r||r>i?i:r}function o(t){return i.test(t)}function a(t,e,n,i){return{start:e,end:e+Math.min(i,n-e)}}t.exports=function(e,n){return t.exports.lines(e,n).map((function(t){return e.substring(t.start,t.end)})).join("\n")},t.exports.lines=function(t,i){if(0===(i=i||{}).width&&"nowrap"!==i.mode)return[];t=t||"";var s="number"===typeof i.width?i.width:Number.MAX_VALUE,l=Math.max(0,i.start||0),c="number"===typeof i.end?i.end:t.length,h=i.mode,u=i.measure||a;return"pre"===h?function(t,n,i,r,o){for(var a=[],s=i,l=i;li&&!o(e.charAt(p));)p--;if(p===i)f>i+1&&f--,p=f;else for(f=p;p>i&&o(e.charAt(p-1));)p--}if(p>=i){var m=t(e,i,p,h);c.push(m)}i=f}return c}(u,t,l,c,s,h)}},"./node_modules/xhr/index.js":(t,e,n)=>{"use strict";var i=n("./node_modules/global/window.js"),r=n("./node_modules/is-function/index.js"),o=n("./node_modules/parse-headers/parse-headers.js"),a=n("./node_modules/xtend/immutable.js");function s(t,e,n){var i=t;return r(e)?(n=e,"string"===typeof t&&(i={uri:t})):i=a(e,{uri:t}),i.callback=n,i}function l(t,e,n){return c(e=s(t,e,n))}function c(t){if("undefined"===typeof t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,i,r){e||(e=!0,t.callback(n,i,r))};function i(){var t=void 0;if(t=h.response?h.response:h.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(n){}return null}(h),v)try{t=JSON.parse(t)}catch(e){}return t}function r(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,A)}function a(){if(!c){var e;clearTimeout(u),e=t.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=A,a=null;return 0!==e?(r={body:i(),statusCode:e,method:p,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(r.headers=o(h.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),n(a,r,r.body)}}var s,c,h=t.xhr||null;h||(h=t.cors||t.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var u,d=h.url=t.uri||t.url,p=h.method=t.method||"GET",f=t.body||t.data,m=h.headers=t.headers||{},g=!!t.sync,v=!1,A={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:h};if("json"in t&&!1!==t.json&&(v=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),f=JSON.stringify(!0===t.json?f:t.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(a,0)},h.onload=a,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,d,!g,t.username,t.password),g||(h.withCredentials=!!t.withCredentials),!g&&t.timeout>0&&(u=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}}),t.timeout)),h.setRequestHeader)for(s in m)m.hasOwnProperty(s)&&h.setRequestHeader(s,m[s]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(h.responseType=t.responseType),"beforeSend"in t&&"function"===typeof t.beforeSend&&t.beforeSend(h),h.send(f||null),h}t.exports=l,t.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(t,e){for(var n=0;n{t.exports="undefined"!==typeof self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:"undefined"!==typeof self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}},"./node_modules/xtend/immutable.js":t=>{t.exports=function(){for(var t={},n=0;n{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/index.js").debug("components:anchored:warn");t.exports.Component=i("anchored",{schema:{persistent:{default:!1}},init:function(){var t=this.el.sceneEl.getAttribute("webxr"),e=t.optionalFeatures;-1===e.indexOf("anchors")&&(e.push("anchors"),this.el.sceneEl.setAttribute("webxr",t)),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 t,e,n,i=this.el.sceneEl,r=i.renderer.xr,o=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&&(t=i.frame,e=r.getReferenceSpace(),n=t.getPose(this.anchor.anchorSpace,e),o.matrix.elements=n.transform.matrix,o.matrix.decompose(o.position,o.rotation,o.scale)))},createAnchor:async function(t,e){var n,i,o,a,s=this.el.sceneEl,l=s.renderer.xr,c=this.el.object3D;t=t||c.position,e=e||this.auxQuaternion.setFromEuler(c.rotation),function(t){var e=t.renderer.xr,n=e.getSession();return n&&n.restorePersistentAnchor}(s)?(this.anchor&&this.deleteAnchor(),n=s.frame,i=l.getReferenceSpace(),o=new XRRigidTransform({x:t.x,y:t.y,z:t.z},{x:e.x,y:e.y,z:e.z,w:e.w}),this.requestAnchorPending=!1,a=await n.createAnchor(o,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await a.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):r("The anchor won't be persisted because the entity has no assigned id.")),s.object3D.attach(this.el.object3D),this.anchor=a):r("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var t,e=this.el.sceneEl.renderer.xr.getSession(),n=e.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){t=localStorage.getItem(this.el.id);for(var i=0;i{var i=n("./node_modules/super-animejs/lib/anime.es.js").default,r=n("./src/core/component.js").components,o=n("./src/core/component.js").registerComponent,a=n("./src/lib/three.js"),s=n("./src/utils/index.js"),l=new a.Color,c=new a.Color,h=s.entity.getComponentProperty,u=s.entity.setComponentProperty,d={},p="color",f="rotation",m="components";function g(t){t.x=a.MathUtils.degToRad(t.x),t.y=a.MathUtils.degToRad(t.y),t.z=a.MathUtils.degToRad(t.z)}function v(t,e,n){var i;for(i=0;i=1),b(r)?_(o,r.property,i,r.type):u(o,r.property,i))}}())},updateConfigForVector:function(){var t,e,n,i=this.config,r=this.data,o=this.el;for(t in e=""!==r.from?s.coordinates.parse(r.from):h(o,r.property),n=s.coordinates.parse(r.to),r.property===f&&(g(e),g(n)),this.targetsArray.length=0,this.targetsArray.push(e),i.targets=this.targetsArray,n)i[t]=n[t];"position"!==r.property&&r.property!==f&&"scale"!==r.property?i.update=function(){var t={};return function(e){var n=e.animatables[0].target;n.x===t.x&&n.y===t.y&&n.z===t.z||(t.x=n.x,t.y=n.y,t.z=n.z,u(o,r.property,n))}}():i.update=function(){var t={};return function(e){var n=e.animatables[0].target;n.x===t.x&&n.y===t.y&&n.z===t.z||(t.x=n.x,t.y=n.y,t.z=n.z,o.object3D[r.property].set(n.x,n.y,n.z))}}()},updateConfig:function(){var t;t=function(t,e){var n,i,o,a;return o=e.split("."),i=o[0],a=o[1],(n=t.components[i]||r[i])?a&&!n.schema[a]?null:a?n.schema[a].type:n.schema.type:null}(this.el,this.data.property),b(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===t||"vec3"===t||"vec4"===t?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(t){var e,n=this.data,r=this.el,o=this;return""===n.from&&!!n.property.startsWith(m)&&(e=x(n.property)[1],!r.components[e]&&(r.addEventListener("componentinitialized",(function n(a){a.detail.name===e&&(t(),o.animation=i(o.config),r.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var t,e;for(e in this.el.components)t=this.el.components[e],e!==this.attrName&&"animation"===t.name&&t.animationIsPlaying&&t.data.property===this.data.property&&(t.animationIsPlaying=!1)},addEventListeners:function(){var t=this.data,e=this.el;v(e,t.startEvents,this.onStartEvent),v(e,t.pauseEvents,this.pauseAnimation),v(e,t.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var t=this.data,e=this.el;A(e,t.startEvents,this.onStartEvent),A(e,t.pauseEvents,this.pauseAnimation),A(e,t.resumeEvents,this.resumeAnimation)},setColorConfig:function(t,e){l.set(t),c.set(e),t=this.fromColor,e=this.toColor,t.r=l.r,t.g=l.g,t.b=l.b,e.r=c.r,e.g=c.g,e.b=c.b}})},"./src/components/camera.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js");t.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 t,e=this.el;t=this.camera=new r.PerspectiveCamera,e.setObject3D("camera",t)},update:function(t){var e=this.data,n=this.camera;n.aspect=e.aspect||window.innerWidth/window.innerHeight,n.far=e.far,n.fov=e.fov,n.near=e.near,n.zoom=e.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(t),this.updateSpectatorCamera(t)},updateActiveCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.active===e.active||e.spectator||(e.active&&i.activeCameraEl!==n?i.setActiveCamera(n):e.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.spectator===e.spectator||(e.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):e.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},"./src/components/cursor.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/index.js"),o="click",a="fusing",s="mouseenter",l="mousedown",c="mouseleave",h="mouseup",u="cursor-fusing",d="cursor-hovering",p="cursor-hovered",f={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},m={DOWN:["selectstart"],UP:["selectend"]},g="a-mouse-cursor-hover";t.exports.Component=i("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:r.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var t=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=r.debounce((function(){t.canvasBounds=t.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(t){this.data.rayOrigin!==t.rayOrigin&&this.updateMouseEventListeners()},tick:function(){var t=this.el.sceneEl.frame,e=this.activeXRInput;"xrselect"===this.data.rayOrigin&&t&&e&&this.onMouseMove({frame:t,inputSource:e,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var t=this.el;t.removeState(d),t.removeState(u),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(p),this.removeEventListeners()},addEventListeners:function(){var t,e=this.data,n=this.el,i=this;function r(){t=n.sceneEl.canvas,e.downEvents.length||e.upEvents.length||(f.DOWN.forEach((function(e){t.addEventListener(e,i.onCursorDown,{passive:!1})})),f.UP.forEach((function(e){t.addEventListener(e,i.onCursorUp,{passive:!1})})))}(t=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),e.downEvents.forEach((function(t){n.addEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.addEventListener(t,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 t,e=this.data,n=this.el,i=this;!(t=n.sceneEl.canvas)||e.downEvents.length||e.upEvents.length||(f.DOWN.forEach((function(e){t.removeEventListener(e,i.onCursorDown)})),f.UP.forEach((function(e){t.removeEventListener(e,i.onCursorUp)}))),e.downEvents.forEach((function(t){n.removeEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.removeEventListener(t,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchstart",this.onMouseMove),t.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 t,e=this.el;(t=e.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),e.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("touchmove",this.onMouseMove,{passive:!1}),e.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},onMouseMove:function(){var t=new THREE.Vector3,e=new THREE.Vector2,n=new THREE.Vector3,i={origin:n,direction:t};return function(r){var o,a,s,l,c,h,u,d=this.canvasBounds,p=this.el.sceneEl.camera;p.parent.updateMatrixWorld(),o=(a="touchmove"===r.type||"touchstart"===r.type?r.touches.item(0):r).clientX-d.left,s=a.clientY-d.top,e.x=o/d.width*2-1,e.y=-s/d.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==r.type&&"fakeselectevent"!==r.type?"fakeselectout"===r.type?(t.set(0,1,0),n.set(0,9999,0)):p&&p.isPerspectiveCamera?(n.setFromMatrixPosition(p.matrixWorld),t.set(e.x,e.y,.5).unproject(p).sub(n).normalize()):p&&p.isOrthographicCamera?(n.set(e.x,e.y,(p.near+p.far)/(p.near-p.far)).unproject(p),t.set(0,0,-1).transformDirection(p.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+p.type):(l=r.frame,c=r.inputSource,h=this.el.renderer.xr.getReferenceSpace(),u=l.getPose(c.targetRaySpace,h).transform,t.set(0,0,-1),t.applyQuaternion(u.orientation),n.copy(u.position)),this.el.setAttribute("raycaster",i),"touchmove"===r.type&&r.preventDefault()}}(),onCursorDown:function(t){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===t.type&&(this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),t.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===t.type&&(this.activeXRInput=t.inputSource,this.onMouseMove(t),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(l,t),this.cursorDownEl=this.intersectedEl},onCursorUp:function(t){if(this.isCursorDown){this.isCursorDown=!1;var e=this.data;this.twoWayEmit(h,t),!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(h,this.intersectedEventDetail)),e.fuse&&"mouse"!==e.rayOrigin&&"xrselect"!==e.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(o,t),"xrselect"===e.rayOrigin&&this.activeXRInput===t.inputSource&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===t.type&&t.preventDefault()}},onIntersection:function(t){var e,n,i,r,o=this.el;n=t.detail.els[0]===o?1:0,r=t.detail.intersections[n],(i=t.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(e=this.el.components.raycaster.getIntersection(this.intersectedEl))&&e.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(t){-1!==t.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0);var t=this.el.sceneEl.xrSession,e=this;t&&"mouse"!==this.data.rayOrigin&&(m.DOWN.forEach((function(n){t.addEventListener(n,e.onCursorDown)})),m.UP.forEach((function(n){t.addEventListener(n,e.onCursorUp)})))},setIntersection:function(t,e){var n=this.el,i=this.data,r=this;this.intersectedEl!==t&&(this.intersectedEl=t,n.addState(d),t.addState(p),this.twoWayEmit(s),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(u),this.twoWayEmit(a),this.fuseTimeout=setTimeout((function(){n.removeState(u),r.twoWayEmit(o)}),i.fuseTimeout)))},clearCurrentIntersection:function(t){var e,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(p),i.removeState(d),i.removeState(u),this.twoWayEmit(c),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(g),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==t&&0!==(n=this.el.components.raycaster.intersections).length&&(e=n[n[0].object.el===i?1:0])&&this.setIntersection(e.object.el,e))},twoWayEmit:function(t,e){var n,i=this.el,r=this.intersectedEl;function o(t,n){e instanceof MouseEvent?t.mouseEvent=e:"undefined"!==typeof TouchEvent&&e instanceof TouchEvent&&(t.touchEvent=e)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,o(this.eventDetail),i.emit(t,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,o(this.intersectedEventDetail),r.emit(t,this.intersectedEventDetail))}})},"./src/components/generic-tracked-controller-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=r.checkControllerPresentAndSetup,a=r.emitIfAxesChanged,s=r.onButtonEvent,l="generic";t.exports.Component=i("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},orientationOffset:{type:"vec3"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){s(e.detail.id,"down",t)},this.onButtonUp=function(e){s(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){s(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){s(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.lastControllerCheck=0,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(e){e.detail.name!==t.name&&(t.wasControllerConnected=!0,t.removeEventListeners(),t.removeControllersUpdateListener())}))},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e=t.hand?t.hand:void 0;o(this,l,{hand:e,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:l,orientationOffset:e.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(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){a(this,this.mapping.axes,t)},initDefaultModel:function(){var t=this.modelEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:.03}),t.setAttribute("material",{color:this.data.color}),this.el.appendChild(t),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}}})}})},"./src/components/geometry.js":(t,e,n)=>{var i=n("./src/core/geometry.js").geometries,r=n("./src/core/geometry.js").geometryNames,o=n("./src/core/component.js").registerComponent,a=n("./src/lib/three.js"),s=new a.BufferGeometry;t.exports.Component=o("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:r,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(t){var e,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(t),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(e=i.getObject3D("mesh"))?e.geometry=this.geometry:((e=new a.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(e.material=new a.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",e))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=s,this.geometry=null},updateSchema:function(t){var e=this.oldData&&this.oldData.primitive,n=t.primitive,r=i[n]&&i[n].schema;if(!r)throw new Error("Unknown geometry schema `"+n+"`");e&&e===n||this.extendSchema(r)}})},"./src/components/gltf-model.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/index.js").debug("components:gltf-model:warn");t.exports.Component=i("gltf-model",{schema:{type:"model"},init:function(){var t=this,e=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new r.GLTFLoader,e&&this.loader.setDRACOLoader(e),this.ready=n?n.then((function(e){t.loader.setMeshoptDecoder(e)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var t=this,e=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){t.loader.load(n,(function(n){t.model=n.scene||n.scenes[0],t.model.animations=n.animations,e.setObject3D("mesh",t.model),e.emit("model-loaded",{format:"gltf",model:t.model})}),void 0,(function(t){var i=t&&t.message?t.message:"Failed to load glTF model";o(i),e.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},"./src/components/grabbable.js":(t,e,n)=>{(0,n("./src/core/component.js").registerComponent)("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}})},"./src/components/hand-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/constants/index.js").AFRAME_CDN_ROOT,o={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"},a="Open",s="Point",l="Point + Thumb",c="Fist",h="Hold",u="Thumb Up",d={};function p(t,e){var n;if(t)return"grip"===(n=d[t])?n+(e?"close":"open"):"point"===n?n+(e?"up":"down"):"pointing"===n||"pistol"===n?n+(e?"start":"end"):void 0}d[c]="grip",d[u]="pistol",d[s]="pointing",t.exports.Component=i("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var t=this,e=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){t.handleButton("grip","down")},this.onGripUp=function(){t.handleButton("grip","up")},this.onTrackpadDown=function(){t.handleButton("trackpad","down")},this.onTrackpadUp=function(){t.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){t.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){t.handleButton("trackpad","touchend")},this.onTriggerDown=function(){t.handleButton("trigger","down")},this.onTriggerUp=function(){t.handleButton("trigger","up")},this.onTriggerTouchStart=function(){t.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){t.handleButton("trigger","touchend")},this.onGripTouchStart=function(){t.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){t.handleButton("grip","touchend")},this.onThumbstickDown=function(){t.handleButton("thumbstick","down")},this.onThumbstickUp=function(){t.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){t.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){t.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){t.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){t.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){t.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){t.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected),e.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(e/1e3)},onControllerConnected:function(){this.el.object3D.visible=!0},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var t=this.el;t.addEventListener("gripdown",this.onGripDown),t.addEventListener("gripup",this.onGripUp),t.addEventListener("trackpaddown",this.onTrackpadDown),t.addEventListener("trackpadup",this.onTrackpadUp),t.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.addEventListener("triggerdown",this.onTriggerDown),t.addEventListener("triggerup",this.onTriggerUp),t.addEventListener("triggertouchstart",this.onTriggerTouchStart),t.addEventListener("triggertouchend",this.onTriggerTouchEnd),t.addEventListener("griptouchstart",this.onGripTouchStart),t.addEventListener("griptouchend",this.onGripTouchEnd),t.addEventListener("thumbstickdown",this.onThumbstickDown),t.addEventListener("thumbstickup",this.onThumbstickUp),t.addEventListener("abuttontouchstart",this.onAorXTouchStart),t.addEventListener("abuttontouchend",this.onAorXTouchEnd),t.addEventListener("bbuttontouchstart",this.onBorYTouchStart),t.addEventListener("bbuttontouchend",this.onBorYTouchEnd),t.addEventListener("xbuttontouchstart",this.onAorXTouchStart),t.addEventListener("xbuttontouchend",this.onAorXTouchEnd),t.addEventListener("ybuttontouchstart",this.onBorYTouchStart),t.addEventListener("ybuttontouchend",this.onBorYTouchEnd),t.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var t=this.el;t.removeEventListener("gripdown",this.onGripDown),t.removeEventListener("gripup",this.onGripUp),t.removeEventListener("trackpaddown",this.onTrackpadDown),t.removeEventListener("trackpadup",this.onTrackpadUp),t.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.removeEventListener("triggerdown",this.onTriggerDown),t.removeEventListener("triggerup",this.onTriggerUp),t.removeEventListener("triggertouchstart",this.onTriggerTouchStart),t.removeEventListener("triggertouchend",this.onTriggerTouchEnd),t.removeEventListener("griptouchstart",this.onGripTouchStart),t.removeEventListener("griptouchend",this.onGripTouchEnd),t.removeEventListener("thumbstickdown",this.onThumbstickDown),t.removeEventListener("thumbstickup",this.onThumbstickUp),t.removeEventListener("abuttontouchstart",this.onAorXTouchStart),t.removeEventListener("abuttontouchend",this.onAorXTouchEnd),t.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),t.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),t.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),t.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),t.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),t.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),t.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(t){var e,n=this.el,i=this.data.hand,r=this.data.handModelStyle,a=this.data.color,s=this;if(e={hand:i,model:!1},i!==t){var l=o[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(l,(function(t){var r=t.scene.children[0],o="left"===i?Math.PI/2:-Math.PI/2,l=n.sceneEl.hasWebXR?-Math.PI/2:0;r.mixer=new THREE.AnimationMixer(r),s.clips=t.animations,n.setObject3D("mesh",r),r.traverse((function(t){t.isMesh&&(t.material.color=new THREE.Color(a))})),r.position.set(0,0,0),r.rotation.set(l,0,o),n.setAttribute("magicleap-controls",e),n.setAttribute("vive-controls",e),n.setAttribute("oculus-touch-controls",e),n.setAttribute("pico-controls",e),n.setAttribute("windows-motion-controls",e),n.setAttribute("hp-mixed-reality-controls",e)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(t,e){var n,i="down"===e,r="touchstart"===e;if(0===e.indexOf("touch")){if(r===this.touchedButtons[t])return;this.touchedButtons[t]=r}else{if(i===this.pressedButtons[t])return;this.pressedButtons[t]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var t,e=this.pressedButtons.grip,n=this.pressedButtons.surface||this.touchedButtons.surface,i=this.pressedButtons.trackpad||this.touchedButtons.trackpad,r=this.pressedButtons.trigger||this.touchedButtons.trigger,o=this.touchedButtons.AorX||this.touchedButtons.BorY;return function(t){var e=t&&t.controller,n=e&&(e.id&&0===e.id.indexOf("OpenVR ")||e.profiles&&e.profiles[0]&&"htc-vive"===e.profiles[0]);return n}(this.el.components["tracked-controls"])?e||r?t=c:i&&(t=s):e?t=n||o||i?r?c:s:r?u:l:r&&(t=h),t},getClip:function(t){var e,n;for(n=0;n{var i=n("./src/core/component.js").registerComponent,r=n("./src/core/a-entity.js").AEntity,o=n("./src/utils/tracked-controls.js").checkControllerPresentAndSetup,a=n("./src/constants/index.js").AFRAME_CDN_ROOT,s=a+"controllers/oculus-hands/v4/left.glb",l=a+"controllers/oculus-hands/v4/right.glb",c=["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"];t.exports.Component=i("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var t=0;tthis.pinchDistance+.1*this.pinchDistance&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{id:"",hand:e.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==t.getObject3D("mesh")&&t.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 t,e=this.el;this.checkIfControllerPresent(),t=e.components["tracked-controls"]&&e.components["tracked-controls"].controller,this.mesh&&t&&t.hand&&t.hand instanceof XRHand&&e.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var t=this.data;"dots"===t.modelStyle&&this.initDotsModel(),"mesh"===t.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var t=0;t{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js");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 t,e=this.el,n=this.data;t="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",e.setAttribute("hand-tracking-controls",{hand:n.hand}),e.setAttribute("obb-collider",{trackedObject3D:t,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 t,e=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("hide-on-enter-ar",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("ar-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}})},"./src/components/hide-on-enter-vr.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("hide-on-enter-vr",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("vr-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}})},"./src/components/hp-mixed-reality-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/tracked-controls.js"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c="hp-mixed-reality",h=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/hp/mixed-reality/",u={x:0,y:0,z:.06},d={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"};t.exports.Component=i("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 t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){l(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){l(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){l(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){l(e.detail.id,"touchstart",t,t.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;a(this,c,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:c,hand:e.hand,controller:this.controllerIndex,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h+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(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e=t.detail.model;this.data.model&&(e.position.copy(u),e.rotation.copy(d),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(t){s(this,this.mapping.axes,t)}})},"./src/components/index.js":(t,e,n)=>{n("./src/components/animation.js"),n("./src/components/anchored.js"),n("./src/components/camera.js"),n("./src/components/cursor.js"),n("./src/components/geometry.js"),n("./src/components/generic-tracked-controller-controls.js"),n("./src/components/gltf-model.js"),n("./src/components/grabbable.js"),n("./src/components/hand-tracking-controls.js"),n("./src/components/hand-tracking-grab-controls.js"),n("./src/components/hand-controls.js"),n("./src/components/hide-on-enter-ar.js"),n("./src/components/hide-on-enter-vr.js"),n("./src/components/hp-mixed-reality-controls.js"),n("./src/components/layer.js"),n("./src/components/laser-controls.js"),n("./src/components/light.js"),n("./src/components/line.js"),n("./src/components/link.js"),n("./src/components/look-controls.js"),n("./src/components/magicleap-controls.js"),n("./src/components/material.js"),n("./src/components/obb-collider.js"),n("./src/components/obj-model.js"),n("./src/components/oculus-go-controls.js"),n("./src/components/oculus-touch-controls.js"),n("./src/components/pico-controls.js"),n("./src/components/position.js"),n("./src/components/raycaster.js"),n("./src/components/rotation.js"),n("./src/components/scale.js"),n("./src/components/shadow.js"),n("./src/components/sound.js"),n("./src/components/text.js"),n("./src/components/tracked-controls.js"),n("./src/components/tracked-controls-webvr.js"),n("./src/components/tracked-controls-webxr.js"),n("./src/components/visible.js"),n("./src/components/valve-index-controls.js"),n("./src/components/vive-controls.js"),n("./src/components/vive-focus-controls.js"),n("./src/components/wasd-controls.js"),n("./src/components/windows-motion-controls.js"),n("./src/components/scene/ar-hit-test.js"),n("./src/components/scene/background.js"),n("./src/components/scene/debug.js"),n("./src/components/scene/device-orientation-permission-ui.js"),n("./src/components/scene/embedded.js"),n("./src/components/scene/inspector.js"),n("./src/components/scene/fog.js"),n("./src/components/scene/keyboard-shortcuts.js"),n("./src/components/scene/pool.js"),n("./src/components/scene/real-world-meshing.js"),n("./src/components/scene/reflection.js"),n("./src/components/scene/screenshot.js"),n("./src/components/scene/stats.js"),n("./src/components/scene/xr-mode-ui.js")},"./src/components/laser-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/index.js");i("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var t=this.config,e=this.data,n=this.el,i=this,o={hand:e.hand,model:e.model};function a(e){var o=t[e.detail.name];if(o){var a=r.extend({showLine:!0},o.raycaster||{});e.detail.rayOrigin&&(a.origin=e.detail.rayOrigin.origin,a.direction=e.detail.rayOrigin.direction,a.showLine=!0),e.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",a):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",r.extend({fuse:!1},o.cursor))}}n.setAttribute("hp-mixed-reality-controls",o),n.setAttribute("magicleap-controls",o),n.setAttribute("oculus-go-controls",o),n.setAttribute("oculus-touch-controls",o),n.setAttribute("pico-controls",o),n.setAttribute("valve-index-controls",o),n.setAttribute("vive-controls",o),n.setAttribute("vive-focus-controls",o),n.setAttribute("windows-motion-controls",o),n.setAttribute("generic-tracked-controller-controls",{hand:o.hand}),n.addEventListener("controllerconnected",a),n.addEventListener("controllerdisconnected",(function(e){t[e.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(t){a(t),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}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"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}}}})},"./src/components/layer.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/index.js").debug("components:layer:warn");t.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 t=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=t.createFramebuffer();var e=this.el.sceneEl.getAttribute("webxr"),n=e.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",e)),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(t){this.data.src!==t.src&&this.updateSrc()},updateSrc:function(){var t=this.data.type;this.texture=void 0,"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var t,e=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?(t=e.getSubImage(this.layer,n),this.loadCubeMapImage(t.colorTexture,i,0)):(t=e.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(t.colorTexture,i,0),t=e.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(t.colorTexture,i,6))))},loadQuadImage:function(){var t=this.data.src,e=this;this.el.sceneEl.systems.material.loadTexture(t,{src:t},(function(n){e.el.sceneEl.renderer.initTexture(n),e.texture=n,"VIDEO"===t.tagName&&setTimeout((function(){e.textureIsVideo=!0}),1e3),e.layer&&(e.layer.height=e.data.height/2||e.texture.image.height/1e3,e.layer.width=e.data.width/2||e.texture.image.width/1e3,e.needsRedraw=!0),e.updateQuadPanel()}))},preGenerateCubeMapTextures:function(t,e){"monocubemap"===this.data.type?this.generateCubeMapTextures(t,0,e):(this.generateCubeMapTextures(t,0,e),this.generateCubeMapTextures(t,6,e))},generateCubeMapTextures:function(t,e,n){for(var i,r,o=this.data,a=this.cubeFaceSize,s=Math.min(t.width,t.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=a;var u=h.getContext("2d");o.rotateCubemap&&(2!==c&&3!==c||(u.save(),u.translate(a,a),u.rotate(Math.PI))),u.drawImage(t,(c+e)*s,0,s,s,0,0,a,a),u.restore(),n&&n(),l.push(h)}return o.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(t,e,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,t),i=!e.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(e,n);var o=0;i.forEach((function(t,e){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,r.RGBA,r.UNSIGNED_BYTE,t),o=r.getError()})),0!==o&&console.log("renderingError, WebGL Error Code: "+o),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-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 t=this,e=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(e){t.visibilityChanged="hidden"!==e.session.visibilityState},"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var t=this.el.sceneEl,e=t.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(t.xrSession,e);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(),t.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var t=this.data.src,e=this.el.sceneEl,n=e.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(t.width,t.height)),o=this.xrGLFactory=new XRWebGLBinding(e.xrSession,n);this.layer=o.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),e.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var t=this.cubeFaceSize,e=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=t;var r=i.getContext("2d");i.width=i.height=t,r.fillStyle="black",r.fillRect(0,0,t,t),2!==n&&3!==n&&(r.translate(t,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",t/2,t/2)),e.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(t){this.layerEnabled=t,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var t=this.quadPanelEl;this.quadPanelEl||(t=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(t)),t.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),t.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 t=this.el.sceneEl,e=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,t.frame),i=t.renderer.properties.get(this.texture).__webglTexture,r=e.getParameter(e.FRAMEBUFFER_BINDING);e.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.colorTexture,0),function(t,e,n,i){var r=t.createFramebuffer(),o=n.viewport.x,a=n.viewport.y,s=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(t.bindTexture(t.TEXTURE_2D,e),t.texSubImage2D(t.TEXTURE_2D,0,0,0,i.width,i.height,t.RGB,t.UNSIGNED_BYTE,i)),t.bindFramebuffer(t.READ_FRAMEBUFFER,r),t.framebufferTexture2D(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),t.readBuffer(t.COLOR_ATTACHMENT0),t.blitFramebuffer(0,0,i.width,i.height,o,a,s,l,t.COLOR_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.deleteFramebuffer(r)}(e,i,n,this.data.src),e.bindFramebuffer(e.FRAMEBUFFER,r)},updateTransform:function(){var t=this.el,e=this.position,n=this.quaternion;t.object3D.updateMatrixWorld(),e.setFromMatrixPosition(t.object3D.matrixWorld),n.setFromRotationMatrix(t.object3D.matrixWorld),this.layerEnabled||e.set(0,0,1e8),this.layer.transform=new XRRigidTransform(e,n)},onEnterVR:function(){var t=this.el.sceneEl,e=t.xrSession;t.hasWebXR&&XRWebGLBinding&&e?(e.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),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(t){this.referenceSpace=t}})},"./src/components/light.js":(t,e,n)=>{var i=n("./src/utils/index.js"),r=i.diff,o=n("./src/utils/debug.js"),a=n("./src/core/component.js").registerComponent,s=n("./src/lib/three.js"),l=n("./src/utils/math.js"),c=s.MathUtils.degToRad,h=o("components:light:warn"),u=new s.CubeTextureLoader,d={};t.exports.Component=a("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 t=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(t)},update:function(t){var e=this.data,n=r(e,t),i=this.light,o=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var a=!1;Object.keys(n).forEach((function(t){var n=e[t];switch(t){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=c(n);break;case"target":null===n?"spot"!==e.type&&"directional"!==e.type||(i.target=o.defaultTarget):n.hasLoaded?o.onSetTarget(n,i):n.addEventListener("loaded",o.onSetTarget.bind(o,n,i));break;case"envMap":o.updateProbeMap(e,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":a||(o.updateShadow(),a=!0);break;case"shadowCameraAutomatic":e.shadowCameraAutomatic?o.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):o.shadowCameraAutomaticEls=[];break;default:i[t]=n}}))}},tick:function(){var t=new s.Box3,e=new s.Vector3,n=new s.Vector3,i=new s.Matrix4,r=new s.Sphere,o=new s.Vector3;return function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof s.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var a=this.light.shadow.camera;a.getWorldDirection(e),a.getWorldPosition(n),i.copy(a.matrixWorld),i.invert(),a.near=1,a.left=1e5,a.right=-1e5,a.top=-1e5,a.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(s){t.setFromObject(s.object3D),t.getBoundingSphere(r);var c=l.distanceOfPointFromPlane(n,e,r.center),h=l.nearestPointInPlane(n,e,r.center,o).applyMatrix4(i);a.near=Math.min(-c-r.radius-1,a.near),a.left=Math.min(-r.radius+h.x,a.left),a.right=Math.max(r.radius+h.x,a.right),a.top=Math.max(r.radius+h.y,a.top),a.bottom=Math.min(-r.radius+h.y,a.bottom)})),a.updateProjectionMatrix()}}}(),setLight:function(t){var e=this.el,n=this.getLight(t);n&&(this.light&&e.removeObject3D("light"),this.light=n,this.light.el=e,e.setObject3D("light",this.light),"spot"!==t.type&&"directional"!==t.type&&"hemisphere"!==t.type||e.getObject3D("light").translateY(-1),"spot"===t.type&&(e.setObject3D("light-target",this.defaultTarget),e.getObject3D("light-target").position.set(0,0,-1)),t.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var t=this.el,e=this.data,n=this.light;n.castShadow=e.castShadow;var i=t.getObject3D("cameraHelper");if(e.shadowCameraVisible&&!i?t.setObject3D("cameraHelper",new s.CameraHelper(n.shadow.camera)):!e.shadowCameraVisible&&i&&t.removeObject3D("cameraHelper"),!e.castShadow)return n;n.shadow.bias=e.shadowBias,n.shadow.radius=e.shadowRadius,n.shadow.mapSize.height=e.shadowMapHeight,n.shadow.mapSize.width=e.shadowMapWidth,n.shadow.camera.near=e.shadowCameraNear,n.shadow.camera.far=e.shadowCameraFar,n.shadow.camera instanceof s.OrthographicCamera?(n.shadow.camera.top=e.shadowCameraTop,n.shadow.camera.right=e.shadowCameraRight,n.shadow.camera.bottom=e.shadowCameraBottom,n.shadow.camera.left=e.shadowCameraLeft):n.shadow.camera.fov=e.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(t){var e=t.angle,n=new s.Color(t.color);n=n.getHex();var i=t.decay,r=t.distance,o=new s.Color(t.groundColor);o=o.getHex();var a=t.intensity,l=t.type,u=t.target,d=null;switch(l.toLowerCase()){case"ambient":return new s.AmbientLight(n,a);case"directional":return d=new s.DirectionalLight(n,a),this.defaultTarget=d.target,u&&(u.hasLoaded?this.onSetTarget(u,d):u.addEventListener("loaded",this.onSetTarget.bind(this,u,d))),d;case"hemisphere":return new s.HemisphereLight(n,o,a);case"point":return new s.PointLight(n,a,r,i);case"spot":return d=new s.SpotLight(n,a,r,c(e),t.penumbra,i),this.defaultTarget=d.target,u&&(u.hasLoaded?this.onSetTarget(u,d):u.addEventListener("loaded",this.onSetTarget.bind(this,u,d))),d;case"probe":return d=new s.LightProbe,this.updateProbeMap(t,d),d;default:h("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",l)}},updateProbeMap:function(t,e){t.envMap||e.copy(new s.LightProbe),d[t.envMap]instanceof window.Promise&&d[t.envMap].then((function(t){e.copy(t)})),d[t.envMap]instanceof s.LightProbe&&e.copy(d[t.envMap]),d[t.envMap]=new window.Promise((function(n){i.srcLoader.validateCubemapSrc(t.envMap,(function(n){u.load(n,(function(n){var i=s.LightProbeGenerator.fromCubeTexture(n);d[t.envMap]=i,e.copy(i)}))}))}))},onSetTarget:function(t,e){e.target=t.object3D},remove:function(){var t=this.el;t.removeObject3D("light"),t.getObject3D("cameraHelper")&&t.removeObject3D("cameraHelper")}})},"./src/components/line.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;function r(t,e){return!(!t||!e)&&t.x===e.x&&t.y===e.y&&t.z===e.z}t.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 t,e,n=this.data;e=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(t=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(t,e),this.el.setObject3D(this.attrName,this.line)},update:function(t){var e=this.data,n=this.geometry,i=!1,o=this.material,a=n.attributes.position.array;r(e.start,t.start)||(a[0]=e.start.x,a[1]=e.start.y,a[2]=e.start.z,i=!0),r(e.end,t.end)||(a[3]=e.end.x,a[4]=e.end.y,a[5]=e.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),o.color.setStyle(e.color),o.opacity=e.opacity,o.transparent=e.opacity<1,o.visible=e.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}})},"./src/components/link.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/core/shader.js").registerShader,o=n("./src/lib/three.js");t.exports.Component=i("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 o.Quaternion,this.hiddenEls=[]},update:function(t){var e,n,i=this.data,r=this.el;i.visualAspectEnabled&&(this.initVisualAspect(),e=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",e),r.setAttribute("material","strokeColor",n),i.on!==t.on&&this.updateEventListener(),void 0!==t.peekMode&&i.peekMode!==t.peekMode&&this.updatePeekMode(),i.image&&t.image!==i.image&&r.setAttribute("material","pano","string"===typeof i.image?i.image:i.image.src))},updatePeekMode:function(){var t=this.el,e=this.sphereEl;this.data.peekMode?(this.hideAll(),t.getObject3D("mesh").visible=!1,e.setAttribute("visible",!0)):(this.showAll(),t.getObject3D("mesh").visible=!0,e.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var t=this.el;t.isPlaying&&(this.removeEventListener(),t.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var t=this.data.on;t&&this.el.removeEventListener(t,this.navigate)},initVisualAspect:function(){var t,e,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),e=this.sphereEl=this.sphereEl||document.createElement("a-entity"),t=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),t.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),t.setAttribute("rotation","0 180 0"),t.setAttribute("position","0 0 0"),t.setAttribute("visible",!1),i.appendChild(t),e.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),e.setAttribute("visible",!1),i.appendChild(e),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:function(){var t=new o.Vector3,e=new o.Vector3,n=new o.Quaternion,i=new o.Vector3;return function(){var r,o,a=this.el,s=a.object3D,l=a.sceneEl.camera,c=this.textEl;if(this.data.visualAspectEnabled)if(s.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),s.matrix.decompose(e,n,i),e.setFromMatrixPosition(s.matrixWorld),t.setFromMatrixPosition(l.matrixWorld),(o=e.distanceTo(t))>20)this.previousQuaternion||(this.quaternionClone.copy(n),this.previousQuaternion=this.quaternionClone),s.lookAt(t);else{if(r=this.calculateCameraPortalOrientation(),o<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;c.setAttribute("text","width",1.5),r<=0?(c.setAttribute("position","0 0 0.75"),c.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(c.setAttribute("position","0 0 -0.75"),c.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),a.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=r}else r<=0?c.setAttribute("rotation","0 180 0"):c.setAttribute("rotation","0 0 0"),c.setAttribute("text","width",5),c.setAttribute("position","0 1.5 0"),a.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(s.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var t=this.el,e=this.hiddenEls,n=this;e.length>0||t.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==t.sceneEl.object3D&&i.el!==t&&i.el!==n.sphereEl&&i.el!==t.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),e.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(t){t.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:function(){var t=new o.Matrix4,e=new o.Vector3,n=new o.Vector3(0,0,1),i=new o.Vector3(0,0,0);return function(){var r=this.el,o=r.sceneEl.camera;return e.set(0,0,0),n.set(0,0,1),i.set(0,0,0),r.object3D.matrixWorld.extractRotation(t),n.applyMatrix4(t),r.object3D.updateMatrixWorld(),r.object3D.localToWorld(i),o.parent.parent.updateMatrixWorld(),o.parent.updateMatrixWorld(),o.updateMatrixWorld(),o.localToWorld(e),e.sub(i).normalize(),n.normalize(),Math.sign(n.dot(e))}}(),remove:function(){this.removeEventListener()}}),r("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")})},"./src/components/look-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/index.js"),a=Math.PI/2;t.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 t,e=this.data;(o.device.isMobile()||o.device.isMobileDeviceRequestingDesktopSite())&&(t=this.magicWindowControls=new r.DeviceOrientationControls(this.magicWindowObject),"undefined"!==typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(t.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?t.enabled=e.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){t.enabled=e.magicWindowTrackingEnabled}))))},update:function(t){var e=this.data;e.enabled!==t.enabled&&this.updateGrabCursor(e.enabled),t&&!e.magicWindowTrackingEnabled&&t.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=e.magicWindowTrackingEnabled),t&&!e.pointerLockEnabled!==t.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(t){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=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(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 t=this.el.sceneEl,e=t.canvas;e?(e.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),e.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),t.addEventListener("enter-vr",this.onEnterVR),t.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))):t.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var t=this.el.sceneEl,e=t&&t.canvas;e&&(e.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("enter-vr",this.onEnterVR),t.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 t=this.el.object3D,e=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),t.rotation.x=this.magicWindowDeltaEuler.x+e.rotation.x,t.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,t.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var t=this.magicWindowAbsoluteEuler,e=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),t.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===t.y||(this.previousMagicWindowYaw=t.y),this.previousMagicWindowYaw&&(e.x=t.x,e.y+=t.y-this.previousMagicWindowYaw,e.z=t.z,this.previousMagicWindowYaw=t.y))},onMouseMove:function(t){var e,n,i,r=this.pitchObject,o=this.previousMouseEvent,s=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=t.movementX||t.mozMovementX||0,i=t.movementY||t.mozMovementY||0):(n=t.screenX-o.screenX,i=t.screenY-o.screenY),this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,e=this.data.reverseMouseDrag?1:-1,s.rotation.y+=.002*n*e,r.rotation.x+=.002*i*e,r.rotation.x=Math.max(-a,Math.min(a,r.rotation.x)))},onMouseDown:function(t){var e=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!e.is("vr-mode")&&!e.is("ar-mode")||!e.checkHeadsetConnected())&&0===t.button){var n=e&&e.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.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(t){1!==t.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(t){var e,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(t.touches[0].pageX-this.touchStart.x)/i.clientWidth,e=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*e,this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var t=this.el.sceneEl;t.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),t.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(t){var e=this.el.sceneEl;function n(){e.canvas.classList.add("a-grab-cursor")}function i(){e.canvas.classList.remove("a-grab-cursor")}e.canvas?t?n():i():t?e.addEventListener("render-target-loaded",n):e.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var t=this.el;this.savedPose.position.copy(t.object3D.position),this.savedPose.rotation.copy(t.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var t=this.el,e=this.savedPose;this.hasSavedPose&&(t.object3D.position.copy(e.position),t.object3D.rotation.copy(e.rotation),this.hasSavedPose=!1)}})},"./src/components/magicleap-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=r.checkControllerPresentAndSetup,a=r.emitIfAxesChanged,s=r.onButtonEvent,l="magicleap-one",c=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/magicleap/magicleap-one-controller.glb";t.exports.Component=i("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 t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){s(e.detail.id,"down",t)},this.onButtonUp=function(e){s(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){s(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){s(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;o(this,l,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:l,hand:e.hand,controller:this.controllerIndex,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",c)},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(t){var e,n=this.mapping.buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(t){a(this,this.mapping.axes,t)},updateModel:function(t,e){},setButtonColor:function(t,e){}})},"./src/components/material.js":(t,e,n)=>{var i=n("./src/utils/index.js"),r=n("./src/core/component.js"),o=n("./src/lib/three.js"),a=n("./src/core/shader.js"),s=i.debug("components:material:error"),l=r.registerComponent,c=a.shaders,h=a.shaderNames;function u(t,e){t.dispose(),e.unregisterMaterial(t),Object.keys(t).filter((function(e){return t[e]&&t[e].isTexture})).forEach((function(e){t[e].dispose()}))}t.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(t){var e=this.data;this.shader&&e.shader===t.shader||this.updateShader(e.shader),this.shader.update(this.data),this.updateMaterial(t)},updateSchema:function(t){var e,n,i,r;n=t&&t.shader,e=this.oldData&&this.oldData.shader,(i=c[r=n||e]&&c[r].schema)||s("Unknown shader schema "+r),e&&n===e||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var t,e,n=this.el.sceneEl,i=this.schema,r=this;function o(t,n){var i;for(i in e)e[i]=t;r.shader.update(e)}for(t in this.tick=void 0,e={},i)"time"===i[t].type&&(this.tick=o,e[t]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(t){var e,n=this.data,i=c[t]&&c[t].Shader;if(!i)throw new Error("Unknown shader "+t);(e=this.shader=new i).el=this.el,e.init(n),this.setMaterial(e.material),this.updateSchema(n)},updateMaterial:function(t){var e,n=this.data,i=this.material;for(e 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(t){switch(t){case"back":return o.BackSide;case"double":return o.DoubleSide;default:return o.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(t){switch(t){case"none":return o.NoBlending;case"additive":return o.AdditiveBlending;case"subtractive":return o.SubtractiveBlending;case"multiply":return o.MultiplyBlending;default:return o.NormalBlending}}(n.blending),i.dithering=n.dithering,t)break;!e||t.alphaTest===n.alphaTest&&t.side===n.side&&t.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var t=new o.MeshBasicMaterial,e=this.material,n=this.el.getObject3D("mesh");n&&(n.material=t),u(e,this.system)},setMaterial:function(t){var e,n=this.el,i=this.system;this.material&&u(this.material,i),this.material=t,i.registerMaterial(t),(e=n.getObject3D("mesh"))?e.material=t:n.addEventListener("object3dset",(function e(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=t,n.removeEventListener("object3dset",e))}))}})},"./src/components/obb-collider.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js");i("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new r.Vector3).copy(this.el.object3D.scale),this.auxEuler=new r.Euler,this.boundingBox=new r.Box3,this.boundingBoxSize=new r.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 t,e=this.el,n=e.components["gltf-model"]&&e.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),t=(new r.Box3).setFromObject(n).getCenter(new r.Vector3),n.position.x+=n.position.x-t.x,n.position.y+=n.position.y-t.y,n.position.z+=n.position.z-t.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var t=this.el,e=this.boundingBoxSize,n=this.aabb=this.aabb||new r.OBB;this.obb=this.obb||new r.OBB,t.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(e).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):t.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var t=this.renderColliderMesh,e=this.boundingBoxSize;t?(t.geometry.dispose(),t.geometry=new r.BoxGeometry(e.x,e.y,e.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var t,e,n;t=this.boundingBoxSize,e=this.renderColliderGeometry=new r.BoxGeometry(t.x,t.y,t.z),(n=this.renderColliderMesh=new r.Mesh(e,new r.MeshLambertMaterial({color:65280,side:r.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:function(){var t=new r.Vector3,e=new r.Vector3,n=new r.Quaternion,i=new r.Quaternion,o=new r.Matrix4;return function(){var r=this.auxEuler,a=this.boundingBox,s=this.data.size,l=this.trackedObject3D||this.el.object3D,c=this.boundingBoxSize,h=this.data.minimumColliderDimension;if(s)return this.boundingBoxSize.x=s,this.boundingBoxSize.y=s,void(this.boundingBoxSize.z=s);r.copy(l.rotation),l.rotation.set(0,0,0),l.parent.matrixWorld.decompose(t,n,e),o.compose(t,i,e),l.parent.matrixWorld.copy(o),a.setFromObject(l,!0),a.getSize(c),c.x=c.x1e-4||Math.abs(e.y-this.previousScale.y)>1e-4||Math.abs(e.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(e),e.set(1,1,1),i.compose(t,n,e),o&&o.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()})},"./src/components/obj-model.js":(t,e,n)=>{var i=n("./src/utils/debug.js"),r=n("./src/core/component.js").registerComponent,o=n("./src/lib/three.js"),a=i("components:obj-model:warn");t.exports.Component=r("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var t=this;this.model=null,this.objLoader=new o.OBJLoader,this.mtlLoader=new o.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(e){t.model&&"material"===e.detail.name&&t.applyMaterial()}))},update:function(){var t=this.data;t.obj&&(this.resetMesh(),this.loadObj(t.obj,t.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(t,e){var n=this,i=this.el,r=this.mtlLoader,o=this.objLoader,s=this.el.sceneEl.systems.renderer,l=e.substr(0,e.lastIndexOf("/")+1);if(e)return i.hasAttribute("material")&&a("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(l),void r.load(e,(function(e){e.preload(),o.setMaterials(e),o.load(t,(function(t){n.model=t,n.model.traverse((function(t){if(t.isMesh){var e=t.material;e.map&&s.applyColorCorrection(e.map),e.emissiveMap&&s.applyColorCorrection(e.emissiveMap)}})),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))}));o.load(t,(function(t){n.model=t,n.applyMaterial(),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))},applyMaterial:function(){var t=this.el.components.material;t&&this.model.traverse((function(e){e instanceof o.Mesh&&(e.material=t.material)}))}})},"./src/components/oculus-go-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=r.checkControllerPresentAndSetup,a=r.emitIfAxesChanged,s=r.onButtonEvent,l=n("./src/utils/index.js").device.isWebXRAvailable,c=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/oculus/go/oculus-go-controller.gltf",h=l?"oculus-go":"Oculus Go",u=l?{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]};t.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:u,bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){s(e.detail.id,"down",t)},this.onButtonUp=function(e){s(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){s(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){s(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,h,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,hand:e.hand,idPrefix:h,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",c)},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(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),e.trackpad=n.getObjectByName("oculus_go_touchpad"),e.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){a(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes;if(n&&n[t]){var i;switch(e){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[t].material.color.set(i)}}})},"./src/components/oculus-touch-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/tracked-controls.js"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c=n("./src/utils/index.js").device.isWebXRAvailable,h="oculus-touch",u=c?h:"Oculus Touch",d=n("./src/constants/index.js").AFRAME_CDN_ROOT,p=d+"controllers/oculus/oculus-touch-controller-",f=d+"controllers/meta/",m={left:{modelUrl:p+"left.gltf",rayOrigin:{origin:{x:.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.003,-.055),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:p+"right.gltf",rayOrigin:{origin:{x:-.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.003,-.055),modelPivotRotation:new r.Euler(0,0,0)}},g={left:{modelUrl:p+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)},right:{modelUrl:p+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)}},v="oculus-touch",A={"oculus-touch":c?g:m,"oculus-touch-v2":{left:{modelUrl:p+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)},right:{modelUrl:p+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:p+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:p+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.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 r.Vector3(0,0,0),modelPivotRotation:new r.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 r.Vector3(0,0,0),modelPivotRotation:new r.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 r.Vector3(0,0,0),modelPivotRotation:new r.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 r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}}},y=c?{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 _(t){t.traverse((function(e){var n;"Mesh"===e.type&&(n=e.material.clone(),t.originalColor=e.material.color,e.material.dispose(),e.material=n)}))}t.exports.Component=i("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}}},after:["tracked-controls"],mapping:y,bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonDown=function(e){l(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){l(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchStart=function(e){l(e.detail.id,"touchstart",t,t.data.hand)},this.onButtonTouchEnd=function(e){l(e.detail.id,"touchend",t,t.data.hand)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new r.Euler},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){a(this,u,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(t){var e,n=this.data;if(n.model)if(this.controllerObject3D)this.el.setObject3D("mesh",this.controllerObject3D);else{if(this.displayModel=A[n.controllerType]||A[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=A["oculus-touch-v2"])}else{e=v;for(var o=Object.keys(A),a=0;a{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/tracked-controls.js"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c="pico-4",h=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/pico/pico4/";t.exports.Component=i("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 t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){l(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){l(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){l(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){l(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;a(this,c,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:c,hand:e.hand,controller:this.controllerIndex,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h+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(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)})},onAxisMoved:function(t){s(this,this.mapping.axes,t)}})},"./src/components/position.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var t=this.el.object3D,e=this.data;t.position.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},"./src/components/raycaster.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/index.js").debug("components:raycaster:warn"),a=/^[\w\s-.,[\]#]*$/,s={childList:!0,attributes:!0,subtree:!0},l="raycaster-intersected",c="raycaster-intersection",h="raycaster-intersected-cleared",u="raycaster-intersection-cleared",d="raycaster-closest-entity-changed";function p(t,e){var n;for(t.length=e.length,n=0;n0||m.length>0&&0===a.length||m.length&&a.length&&m[0]!==a[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=a,i.emit(d,this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var t,e=this.el,n=this.intersections;n.length&&(t=n[0].object.el===e&&n[1]?n[1].distance:n[0].distance),this.drawLine(t)},getIntersection:function(t){var e,n;for(e=0;e{var i=n("./src/lib/three.js").MathUtils.degToRad,r=n("./src/core/component.js").registerComponent;t.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var t=this.data;this.el.object3D.rotation.set(i(t.x),i(t.y),i(t.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}})},"./src/components/scale.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var t=this.data;this.el.object3D.scale.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}})},"./src/components/scene/ar-hit-test.js":(t,e,n)=>{var i,r=n("./src/core/component.js").registerComponent,o=n("./src/lib/three.js"),a=function(){var t=new o.Quaternion,e=new o.Vector3;return function(n,i,r){i.position.copy(n.transform.position),i.quaternion.copy(n.transform.orientation),e.copy(r),t.copy(n.transform.orientation),e.applyQuaternion(t),i.position.sub(e)}}();function s(t,e){this.renderer=t,this.xrHitTestSource=null,t.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),t.xr.addEventListener("sessionstart",function(){this.sessionStart(e)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(e)}function l(t){console.warn(t.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from ?')}a.tempFakePose={transform:{orientation:new o.Quaternion,position:new o.Vector3}},s.prototype.previousFrameAnchors=new Set,s.prototype.anchorToObject3D=new Map,s.prototype.sessionStart=function(t){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?t.space?this.session.requestHitTestSource(t).then(function(t){this.xrHitTestSource=t}.bind(this)).catch(l):t.profile&&this.session.requestHitTestSourceForTransientInput(t).then(function(t){this.xrHitTestSource=t,this.transient=!0}.bind(this)).catch(l):l({message:"No requestHitTestSource on the session."})},s.prototype.anchorFromLastHitTestResult=function(t,e){var n=this.lastHitTest;if(n){var i={object3D:t,offset:e};Array.from(this.anchorToObject3D.entries()).forEach(function(e){var n=e[1].object3D,i=e[0];n===t&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(t){this.anchorToObject3D.set(t,i)}.bind(this)).catch((function(t){console.warn(t.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from ?')}))}},s.prototype.doHit=function(t){if(this.renderer.xr.isPresenting){var e,n,i=this.renderer.xr.getReferenceSpace(),r=t.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(e=t.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=e[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(e=t.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=e[0],e[0].getPose(i)):void 0}},s.updateAnchorPoses=function(t,e){var n=t.trackedAnchors||s.prototype.previousFrameAnchors;s.prototype.previousFrameAnchors.forEach((function(t){n.has(t)||s.prototype.anchorToObject3D.delete(t)})),n.forEach((function(n){var i,r,o,l;try{i=t.getPose(n.anchorSpace,e)}catch(c){}if(i){if(!(r=s.prototype.anchorToObject3D.get(n)))return;o=r.offset,l=r.object3D,a(i,l,o)}}))},t.exports.Component=r("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}}},sceneOnly:!0,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 o.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new o.WebGLRenderTarget(512,512,{}),this.basicMaterial=new o.MeshBasicMaterial({color:0,side:o.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 o.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var t=this.el.getAttribute("webxr"),e=t.optionalFeatures;e.includes("hit-test")&&e.includes("anchors")||(e.push("hit-test"),e.push("anchors"),this.el.setAttribute("webxr",t)),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 t=this.el.sceneEl.renderer,e=this.session=t.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,i||(i=new Map),e.requestReferenceSpace("viewer").then(function(e){this.hitTest=new s(t,{space:e}),i.set(e,this.hitTest),this.el.emit("ar-hit-test-start")}.bind(this));var n="generic-touchscreen",r=new s(t,{profile:n});e.addEventListener("selectstart",function(e){if(!0===this.data.enabled){var o=e.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:o,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),o.profiles[0]===n?this.hitTest=r:(this.hitTest=i.get(o)||new s(t,{space:o.targetRaySpace}),i.set(o,this.hitTest)))}}.bind(this)),e.addEventListener("selectend",function(t){if(this.hitTest&&!0===this.data.enabled){var e,n=t.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(e=this.data.target.object3D)&&(a.tempFakePose.transform.position.copy(this.bboxMesh.position),a.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),a(a.tempFakePose,e,this.bboxOffset),e.visible=!0,this.hitTest.anchorFromLastHitTestResult(e,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 o.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(t){t.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var t=new o.PlaneGeometry(1,1),e=new o.MeshBasicMaterial({transparent:!0,color:16777215});t.rotateX(-Math.PI/2),t.rotateY(-Math.PI/2),this.bbox=new o.Box3,this.bboxMesh=new o.Mesh(t,e),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var t,e,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(),e=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(e),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),t=this.context.getImageData(0,0,512,512);for(var o=0;o<262144;o++)0!==t.data[4*o+3]&&255!==t.data[4*o+3]&&(t.data[4*o+3]=128);this.context.putImageData(t,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var t,e,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&s.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?e=this.textureCache.get(this.data.src):(e=(new o.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,e)),this.bboxMesh.material.map=e,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&&(t=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(t.transform.position),this.bboxMesh.quaternion.copy(t.transform.orientation))}})},"./src/components/scene/background.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var t=this.data,e=this.el.object3D;t.transparent?e.background=null:e.background=new THREE.Color(t.color)},remove:function(){this.el.object3D.background=null}})},"./src/components/scene/debug.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("debug",{schema:{default:!0},sceneOnly:!0})},"./src/components/scene/device-orientation-permission-ui.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/constants/index.js"),o="a-dialog-buttons-container",a="a-dialog-button",s="a-dialog-allow-button",l="a-dialog-deny-button",c="a-dialog-ok-button";function h(t,e){var n,i,o,a;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(r.AFRAME_INJECTED,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(i),(o=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(o),(a=document.createElement("div")).classList.add("a-dialog-text"),a.innerHTML=t,o.appendChild(a),i.appendChild(e),n}t.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"}},sceneOnly:!0,init:function(){var t=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!==typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0})).catch((function(){t.devicePermissionDialogEl=function(t,e,n,i,c){var u,d,p;return(u=document.createElement("div")).classList.add(o),(d=document.createElement("button")).classList.add(a,l),d.setAttribute(r.AFRAME_INJECTED,""),d.innerHTML=t,u.appendChild(d),(p=document.createElement("button")).classList.add(a,s),p.setAttribute(r.AFRAME_INJECTED,""),p.innerHTML=e,u.appendChild(p),p.addEventListener("click",(function(t){t.stopPropagation(),i()})),d.addEventListener("click",(function(t){t.stopPropagation(),c()})),h(n,u)}(t.data.denyButtonText,t.data.allowButtonText,t.data.deviceMotionMessage,t.onDeviceMotionDialogAllowClicked,t.onDeviceMotionDialogDenyClicked),t.el.appendChild(t.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var t=this,e=function(t,e,n){var i,s;return(i=document.createElement("div")).classList.add(o),(s=document.createElement("button")).classList.add(a,c),s.setAttribute(r.AFRAME_INJECTED,""),s.innerHTML=t,i.appendChild(s),s.addEventListener("click",(function(t){t.stopPropagation(),n()})),h(e,i)}(t.data.cancelButtonText,t.data.httpsMessage,(function(){t.el.removeChild(e)}));this.el.appendChild(e)},onDeviceMotionDialogAllowClicked:function(){var t=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?(t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0):t.el.emit("deviceorientationpermissionrejected"),t.remove()})).catch(console.error)}})},"./src/components/scene/embedded.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var t=this.el,e=t.querySelector(".a-enter-vr");!0===this.data?(e&&e.classList.add("embedded"),t.removeFullScreenStyles()):(e&&e.classList.remove("embedded"),t.addFullScreenStyles())}})},"./src/components/scene/fog.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js");n("./src/utils/debug.js")("components:fog:warn"),t.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"]}},sceneOnly:!0,update:function(){var t=this.data,e=this.el,n=this.el.object3D.fog;n&&t.type===n.name?Object.keys(this.schema).forEach((function(e){var i=t[e];"color"===e&&(i=new r.Color(i)),n[e]=i})):e.object3D.fog=function(t){var e;return(e="exponential"===t.type?new r.FogExp2(t.color,t.density):new r.Fog(t.color,t.near,t.far)).name=t.type,e}(t)},remove:function(){var t=this.el;this.el.object3D.fog&&(t.object3D.fog=null)}})},"./src/components/scene/inspector.js":(t,e,n)=>{var i=n("./src/constants/index.js").AFRAME_INJECTED,r=n("./package.json"),o=n("./src/core/component.js").registerComponent,a=n("./src/utils/index.js"),s="https://unpkg.com/aframe-inspector@"+function(t){var e=t.split(".");return e[2]="x",e.join(".")}(r.version)+"/dist/aframe-inspector.min.js";t.exports.Component=o("inspector",{schema:{url:{default:s}},sceneOnly:!0,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 t;this.firstPlay&&"false"!==(t=a.getUrlParameter("inspector"))&&t&&(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(t){73===t.keyCode&&(t.ctrlKey&&t.altKey||t.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(t){"INJECT_AFRAME_INSPECTOR"===t.data&&this.openInspector()},openInspector:function(t){var e,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(t):(this.showLoader(),(e=document.createElement("script")).src=this.data.url,e.setAttribute("data-name","aframe-inspector"),e.setAttribute(i,""),e.onload=function(){AFRAME.INSPECTOR.open(t),n.hideLoader(),n.removeEventListeners()},e.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(e),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})},"./src/components/scene/keyboard-shortcuts.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/index.js").shouldCaptureKeyEvent;t.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},update:function(t){var e=this.data;this.enterVREnabled=e.enterVR},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(t){var e=this.el;r(t)&&(this.enterVREnabled&&70===t.keyCode&&e.enterVR(),this.enterVREnabled&&27===t.keyCode&&e.exitVR())}})},"./src/components/scene/pool.js":(t,e,n)=>{var i=n("./src/utils/debug.js"),r=n("./src/core/component.js").registerComponent,o=i("components:pool:warn");t.exports.Component=r("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var t;for(this.availableEls=[],this.usedEls=[],this.data.mixin||o("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||o("Container "+this.data.container+" not found.")),this.container=this.container||this.el,t=0;t{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js");t.exports.Component=i("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var t=this.el.getAttribute("webxr"),e=t.requiredFeatures;-1===e.indexOf("mesh-detection")&&(e.push("mesh-detection"),this.el.setAttribute("webxr",t)),-1===e.indexOf("plane-detection")&&(e.push("plane-detection"),this.el.setAttribute("webxr",t)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var t,e,n,i=this.data,r=this.el,o=(r.renderer.xr,this.meshEntities),a=!1,s=[],l=this.data.filterLabels;t=(n=r.frame).detectedMeshes,e=n.detectedPlanes;for(var c=0;c{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var t=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 e=this.el.getAttribute("webxr"),n=e.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",e)),this.el.addEventListener("enter-vr",(function(){t.el.is("ar-mode")&&t.el.renderer.xr.getSession().requestLightProbe&&t.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){t.xrLightProbe&&t.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 t=this.el.renderer,e=t.xr.getSession(),n=this,i=t.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(e.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(e,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),e.requestLightProbe().then((function(t){n.xrLightProbe=t,t.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(t){console.warn("Lighting estimation not supported: "+t.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from ?')}))},updateXRCubeMap:function(){var t=this.el.renderer,e=this.glBinding.getReflectionCubeMap(this.xrLightProbe);e&&(t.properties.get(this.lightingEstimationTexture).__webglTexture=e,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var t=this.el.object3D,e=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(t,e,n,i){var r=Math.max(t.primaryLightIntensity.x,Math.max(t.primaryLightIntensity.y,t.primaryLightIntensity.z));e.sh.fromArray(t.sphericalHarmonicsCoefficients),e.intensity=1,n&&(n.color.setRGB(t.primaryLightIntensity.x/r,t.primaryLightIntensity.y/r,t.primaryLightIntensity.z/r),n.intensity=r,i.copy(t.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&&(t.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(e,t),t.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)}})},"./src/components/scene/screenshot.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=["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"),a=["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");t.exports.Component=i("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var t=this.el;if(!this.canvas){var e=t.renderer.getContext();e&&(this.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new r.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:o,fragmentShader:a,side:r.DoubleSide}),this.quad=new r.Mesh(new r.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new r.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),t.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(t,e){return new r.WebGLRenderTarget(t,e,{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(t,e){this.quad.scale.set(t,e,1),this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix(),this.canvas.width=t,this.canvas.height=e},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(t){var e=83===t.keyCode&&t.ctrlKey&&t.altKey;if(this.data&&e){var n=t.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(t){var e,n,i,o,a=this.el;return"perspective"===t?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||a.camera,e={width:this.data.width,height:this.data.height}):(n=this.camera,o=new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:r.RGBFormat,generateMipmaps:!0,minFilter:r.LinearMipmapLinearFilter,colorSpace:r.SRGBColorSpace}),i=new r.CubeCamera(a.camera.near,a.camera.far,o),a.camera.getWorldPosition(i.position),a.camera.getWorldQuaternion(i.quaternion),i.update(a.renderer,a.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,e={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:e,projection:t}},capture:function(t){var e,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,e=this.setCapture(t),this.renderCapture(e.camera,e.size,e.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(t){var e=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(t);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=e,this.canvas},renderCapture:function(t,e,n){var i,r,o,a=this.el.renderer.autoClear,s=this.el,l=s.renderer;r=this.getRenderTarget(e.width,e.height),o=new Uint8Array(4*e.width*e.height),this.resize(e.width,e.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(s.object3D,t),l.autoClear=a,l.readRenderTargetPixels(r,0,0,e.width,e.height,o),l.setRenderTarget(null),"perspective"===n&&(o=this.flipPixelsVertically(o,e.width,e.height)),i=new ImageData(new Uint8ClampedArray(o),e.width,e.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(t,e,n){for(var i=t.slice(0),r=0;r{var i=n("./src/core/component.js").registerComponent,r=n("./vendor/rStats.js"),o=n("./src/utils/index.js");n("./vendor/rStats.extras.js"),n("./src/lib/rStatsAframe.js");var a=window.aframeStats,s="a-hidden",l=window.threeStats;t.exports.Component=i("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var t=this.el;"false"!==o.getUrlParameter("stats")&&(this.stats=function(t){var e=new l(t.renderer),n=new a(t),i=t.isMobile?[]:[e,n];return new r({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(t),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),t.addEventListener("enter-vr",this.hideBound),t.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 t=this.stats;t&&(t("rAF").tick(),t("FPS").frame(),t().update())},hide:function(){this.statsEl.classList.add(s)},show:function(){this.statsEl.classList.remove(s)}})},"./src/components/scene/xr-mode-ui.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/constants/index.js"),o=n("./src/utils/index.js"),a="a-enter-vr",s="a-enter-ar",l="a-enter-vr-button",c="a-enter-ar-button",h="a-hidden",u="a-orientation-modal";function d(t){t.addEventListener("touchstart",(function(){t.classList.remove("resethover")}),{passive:!0}),t.addEventListener("touchend",(function(){t.classList.add("resethover")}),{passive:!0})}t.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"]}},sceneOnly:!0,init:function(){var t=this,e=this.el;"false"!==o.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),e.addEventListener("enter-vr",this.updateEnterInterfaces),e.addEventListener("exit-vr",this.updateEnterInterfaces),e.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(e){"loaderReady"===e.data.type&&(t.insideLoader=!0,t.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var t=this.data,e=this.el;if(!t.enabled||this.insideLoader||"false"===o.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!t.enterVREnabled||"xr"!==t.XRMode&&"vr"!==t.XRMode||(t.enterVRButton?(this.enterVREl=document.querySelector(t.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=function(t){var e,n;return(n=document.createElement("div")).classList.add(a),n.setAttribute(r.AFRAME_INJECTED,""),(e=document.createElement("button")).className=l,e.setAttribute("title","Enter VR mode with a headset or fullscreen without"),e.setAttribute(r.AFRAME_INJECTED,""),o.device.isMobile()&&d(e),n.appendChild(e),e.addEventListener("click",(function(e){t(),e.stopPropagation()})),n}(this.onEnterVRButtonClick),e.appendChild(this.enterVREl))),this.enterAREl||!t.enterAREnabled||"xr"!==t.XRMode&&"ar"!==t.XRMode||(t.enterARButton?(this.enterAREl=document.querySelector(t.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(t,e){var n,i;return(i=document.createElement("div")).classList.add(s),e&&i.classList.add("xr"),i.setAttribute(r.AFRAME_INJECTED,""),(n=document.createElement("button")).className=c,n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(r.AFRAME_INJECTED,""),o.device.isMobile()&&d(n),i.appendChild(n),n.addEventListener("click",(function(e){t(),e.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===t.XRMode),e.appendChild(this.enterAREl))),this.orientationModalEl=function(t){var e=document.createElement("div");e.className=u,e.classList.add(h),e.setAttribute(r.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(r.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",t),e.appendChild(n),e}(this.onModalClick),e.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var t=this.el;this.enterVREl&&(t.is("vr-mode")||(t.isMobile||o.device.isMobileDeviceRequestingDesktopSite())&&!this.data.cardboardModeEnabled&&!o.device.checkVRSupport()?this.enterVREl.classList.add(h):(o.device.checkVRSupport()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(h),t.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var t=this.el;this.enterAREl&&(t.is("vr-mode")||!o.device.checkARSupport()?this.enterAREl.classList.add(h):(this.enterAREl.classList.remove(h),t.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var t=this.el,e=this.orientationModalEl;e&&t.isMobile&&(!o.device.isLandscape()&&t.is("vr-mode")?e.classList.remove(h):e.classList.add(h))}})},"./src/components/shadow.js":(t,e,n)=>{var i=n("./src/core/component.js"),r=n("./src/lib/three.js"),o=i.registerComponent;t.exports.Component=o("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var t=this.data;this.updateDescendants(t.cast,t.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(t,e){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof r.Mesh&&(i.castShadow=t,i.receiveShadow=e,n.hasLoaded&&i.material))for(var o=Array.isArray(i.material)?i.material:[i.material],a=0;a{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/debug.js"),o=n("./src/lib/three.js"),a=r("components:sound:warn");t.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 t=this;this.listener=null,this.audioLoader=new o.AudioLoader,this.pool=new o.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){t.playSound()}},update:function(t){var e,n,i=this.data,r=i.src!==t.src;if(r){if(!i.src)return;this.setupSound()}for(e=0;e0&&(this.stopSound(),n.removeObject3D("sound"));var a=this.listener=i.audioListener||new o.AudioListener;for(i.audioListener=a,i.camera&&i.camera.add(a),i.addEventListener("camera-set-active",(function(t){t.detail.cameraEl.getObject3D("camera").add(a)})),this.pool=new o.Group,t=0;t{var i=n("./node_modules/three-bmfont-text/index.js"),r=n("./node_modules/load-bmfont/browser.js"),o=n("./src/core/component.js").registerComponent,a=n("./src/core/shader.js"),s=n("./src/lib/three.js"),l=n("./src/utils/index.js"),c=l.debug("components:text:error"),h=a.shaders,u=l.debug("components:text:warn"),d=n("./src/constants/index.js").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"},f=["roboto"],m="roboto";t.exports.FONTS=p;var g=new function(){var t=this.cache={};this.get=function(e,n){return e in t||(t[e]=n()),t[e]}},v={},A={},y=/^\w+:/;function _(t,e,n){return t||(.5+e)*n}t.exports.Component=o("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:m},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(t){var e=this.data,n=this.currentFont;A[e.font]?this.texture=A[e.font]:(this.texture=A[e.font]=new s.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),t.font===e.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 t,e,n,i=this.data,r=this.material,o=this.shaderData;if(n=i.shader,-1!==f.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in p&&-1===f.indexOf(i.font)&&(n="sdf"),t=(this.shaderObject&&this.shaderObject.name)!==n,o.alphaTest=i.alphaTest,o.color=i.color,o.map=this.texture,o.opacity=i.opacity,o.side=function(t){switch(t){case"back":return s.FrontSide;case"double":return s.DoubleSide;default:return s.BackSide}}(i.side),o.transparent=i.transparent,o.negate=i.negate,!t)return this.shaderObject.update(o),r.transparent=o.transparent,void(r.side=o.side);e=function(t,e,n){var i,r;return(r=new h[e].Shader).el=t,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,o),this.material=e.material,this.shaderObject=e.shader,this.material.side=o.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var t,e=this.data,n=this.el,i=this.geometry,o=this;e.font||u("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),t=this.lookupFont(e.font||m)||e.font,g.get(t,(function(){return n=t,i=e.yOffset,new Promise((function(t,e){r(n,(function(r,o){if(r)return c("Error loading font",n),void e(r);n.indexOf("/Roboto-msdf.json")>=0&&(i=30),i&&o.chars.map((function(t){t.yoffset+=i})),t(o)}))}));var n,i})).then((function(r){var a;if(1!==r.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");v[t]||(r.widthFactor=v[r]=function(t){var e=0,n=0,i=0;return t.chars.map((function(t){e+=t.xadvance,t.id>=48&&t.id<=57&&(i++,n+=t.xadvance)})),i?n/i:e/t.chars.length}(r)),o.currentFont=r,a=o.getFontImageSrc(),g.get(a,(function(){return t=a,new Promise((function(e,n){(new s.ImageLoader).load(t,(function(t){e(t)}),void 0,(function(){c("Error loading font image",t),n(null)}))}));var t})).then((function(t){var a=o.texture;a&&(a.image=t,a.needsUpdate=!0,A[e.font]=a,o.texture=a,o.initMesh(),o.currentFont=r,o.updateGeometry(i,r),o.updateLayout(),o.mesh.visible=!0,n.emit("textfontset",{font:e.font,fontObj:r}))})).catch((function(t){c(t.message),c(t.stack)}))})).catch((function(t){c(t.message),c(t.stack)}))},initMesh:function(){this.mesh||(this.mesh=new s.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var t=this.lookupFont(this.data.font||m)||this.data.font,e=this.currentFont.pages[0];return e.match(y)&&0!==e.indexOf("http")?t.replace(/(\.fnt)|(\.json)/,".png"):s.LoaderUtils.extractUrlBase(t)+e},updateLayout:function(){var t,e,n,i,r,o,a,s,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(n=c.getAttribute("geometry"),i=(o=(a=h.width||n&&n.width||1)/_(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",a),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(t="align"===h.anchor?h.align:h.anchor))s=0;else if("right"===t)s=-1*r.width;else{if("center"!==t)throw new TypeError("Invalid text.anchor property value",t);s=-1*r.width/2}if("bottom"===(e=h.baseline))l=0;else if("top"===e)l=-1*r.height+r.ascender;else{if("center"!==e)throw new TypeError("Invalid text.baseline property value",e);l=-1*r.height/2}d.position.x=s*o+h.xOffset,d.position.y=l*o,d.position.z=h.zOffset,d.scale.set(o,-1*o,o)}},lookupFont:function(t){return p[t]},updateGeometry:function(){var t={},e={},n=/\\n/g,i=/\\t/g;return function(r,o){var a=this.data;e.font=o,e.lineHeight=a.lineHeight&&isFinite(a.lineHeight)?a.lineHeight:o.common.lineHeight,e.text=a.value.toString().replace(n,"\n").replace(i,"\t"),e.width=_(a.wrapPixels,a.wrapCount,o.widthFactor),r.update(l.extend(t,a,e))}}()})},"./src/components/tracked-controls-webvr.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=n("./src/constants/index.js").DEFAULT_CAMERA_HEIGHT,a=n("./src/lib/three.js"),s=n("./src/constants/index.js").DEFAULT_HANDEDNESS,l=.175,c=-.3,h=-.03,u=0,d=0,p=-.175,f={touches:[]},m="axismove",g="buttonchanged",v="buttondown",A="buttonup",y="touchstart",_="touchend";t.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 a.Vector3,this.controllerQuaternion=new a.Quaternion,this.controllerEuler=new a.Euler,this.updateGamepad(),this.buttonEventDetails={}},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.update&&n.update(e/1e3),this.updateGamepad(),this.updatePose(),this.updateButtons()},defaultUserHeight:function(){return o},getHeadElement:function(){return this.data.headElement||this.el.sceneEl.camera.el},updateGamepad:function(){var t=this.data,e=r.findMatchingControllerWebVR(this.system.controllers,t.id,t.idPrefix,t.hand,t.controller);this.controller=e,this.el.components["tracked-controls"].controller=e,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},applyArmModel:function(t){var e,n,i,r,o=this.controller,a=this.controllerEuler,f=this.controllerQuaternion,m=this.deltaControllerPosition;n=this.getHeadElement().object3D,r=this.defaultUserHeight(),i=o.pose,e=(o?o.hand:void 0)||s,t.copy(n.position),m.set(l*("left"===e?-1:"right"===e?1:0),c,h),m.multiplyScalar(r),m.applyAxisAngle(n.up,n.rotation.y),t.add(m),m.set(u,d,p),m.multiplyScalar(r),i.orientation?f.fromArray(i.orientation):f.copy(n.quaternion),a.setFromQuaternion(f),a.set(a.x,a.y,0),m.applyEuler(a),t.add(m)},updatePose:function(){var t,e,n=this.controller,i=this.data,r=this.el.object3D,o=this.system.vrDisplay;n&&((t=n.pose).position?r.position.fromArray(t.position):i.armModel&&this.applyArmModel(r.position),t.orientation&&r.quaternion.fromArray(t.orientation),o&&t.position&&(e=this.el.sceneEl.renderer.xr.getStandingMatrix(),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrix.multiplyMatrices(e,r.matrix),r.matrix.decompose(r.position,r.quaternion,r.scale)),r.rotateX(this.data.orientationOffset.x*a.MathUtils.DEG2RAD),r.rotateY(this.data.orientationOffset.y*a.MathUtils.DEG2RAD),r.rotateZ(this.data.orientationOffset.z*a.MathUtils.DEG2RAD))},updateButtons:function(){var t,e,n=this.controller;if(n){for(e=0;e{var i=n("./src/utils/tracked-controls.js"),r=n("./src/core/component.js").registerComponent,o="axismove",a="buttonchanged",s="buttondown",l="buttonup",c="touchstart",h="touchend";t.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 t=this.el.sceneEl;this.updateController(),t.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(t){return!(!this.controller||this.controller.gamepad)&&("none"===t.inputSource.handedness||t.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 t=this.el.sceneEl,e=this.controller,n=t.frame;e&&t.frame&&this.system.referenceSpace&&(e.hand||(this.pose=n.getPose(e[this.data.space],this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var t=this.el.object3D,e=this.pose;e&&(t.matrix.elements=e.transform.matrix,t.matrix.decompose(t.position,t.rotation,t.scale))},updateButtons:function(){var t,e,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,e=0;e{var i=n("./src/core/component.js").registerComponent;t.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"}},after:["tracked-controls-webvr","tracked-controls-webxr"],update:function(){var t=this.data,e=this.el;e.sceneEl.hasWebXR?e.setAttribute("tracked-controls-webxr",{id:t.id,hand:t.hand,index:t.controller,iterateControllerProfiles:t.iterateControllerProfiles,handTrackingEnabled:t.handTrackingEnabled,space:t.space}):e.setAttribute("tracked-controls-webvr",t)}})},"./src/components/valve-index-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/lib/three.js"),o=n("./src/utils/tracked-controls.js"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/valve/index/valve-index-",h={left:c+"left.glb",right:c+"right.glb"},u="valve",d=n("./src/utils/index.js").device.isWebXRAvailable,p={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},f=d?p:{left:{_x:.692295102620542,_y:-.0627618864318427,_z:-.06265893149611756,_order:"XYZ"},right:{_x:.6484021229942998,_y:-.032563619881892894,_z:-.1327973171917482,_order:"XYZ"}},m=d?{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}};t.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"}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){l(e.detail.id,"down",t)},this.onButtonUp=function(e){l(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){l(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){l(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e="right"===t.hand?0:"left"===t.hand?1:2;a(this,u,{index:e,iterateControllerProfiles:!0,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:u,controller:"right"===e.hand?1:"left"===e.hand?0:2,hand:e.hand,orientationOffset:e.orientationOffset}),this.loadModel()},loadModel:function(){var t=this.data;t.model&&this.el.setAttribute("gltf-model",""+h[t.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(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-e*(Math.PI/40))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=e.trigger.rotation.x,Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.copy(m[this.data.hand]),n.rotation.copy(f[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(t){s(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){}})},"./src/components/visible.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent;t.exports.Component=i("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}})},"./src/components/vive-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=r.checkControllerPresentAndSetup,a=r.emitIfAxesChanged,s=r.onButtonEvent,l=n("./src/constants/index.js").AFRAME_CDN_ROOT,c=l+"controllers/vive/vr_controller_vive.obj",h=l+"controllers/vive/vr_controller_vive.mtl",u=n("./src/utils/index.js").device.isWebXRAvailable,d=u?"htc-vive":"OpenVR ",p=u?{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger","grip","menu","system"]};t.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"}},after:["tracked-controls"],mapping:p,init:function(){var t=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){s(e.detail.id,"down",t)},this.onButtonUp=function(e){s(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){s(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){s(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;o(this,d,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:d,hand:e.hand,controller:this.controllerIndex,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:c,mtl: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(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-e*(Math.PI/12))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.touchpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(t){a(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){var n=this.buttonMeshes;if(n)return"grip"===t?(n.grip.left.material.color.set(e),void n.grip.right.material.color.set(e)):void n[t].material.color.set(e)}})},"./src/components/vive-focus-controls.js":(t,e,n)=>{var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=r.checkControllerPresentAndSetup,a=r.emitIfAxesChanged,s=r.onButtonEvent,l=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/vive/focus-controller/focus-controller.gltf",c=n("./src/utils/index.js").device.isWebXRAvailable,h=c?"htc-vive-focus":"HTC Vive Focus ",u=c?{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]};t.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}},after:["tracked-controls"],mapping:u,bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){s(e.detail.id,"down",t)},this.onButtonUp=function(e){s(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){s(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){s(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){o(this,h,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{armModel:e.armModel,idPrefix:h,orientationOffset:e.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",l)},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(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),e.triggerPressed=n.getObjectByName("BumperKey_Press"),e.triggerPressed&&(e.triggerPressed.visible=!1),e.trackpad=n.getObjectByName("TouchPad"),e.trackpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpadPressed&&(e.trackpadPressed.visible=!1))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){a(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes,i=t+"Pressed";if(n&&n[t]&&n[i]){var r;switch(e){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[t].visible=!r}}})},"./src/components/wasd-controls.js":(t,e,n)=>{var i=n("./src/constants/index.js").keyboardevent.KEYCODE_TO_CODE,r=n("./src/core/component.js").registerComponent,o=n("./src/lib/three.js"),a=n("./src/utils/index.js").shouldCaptureKeyEvent,s=1e-5,l=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];t.exports.Component=r("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}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new o.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(t,e){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(t){var e;for(e in t)return!1;return!0}(this.keys))&&(e/=1e3,this.updateVelocity(e),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(e)))},update:function(t){t.adAxis!==this.data.adAxis&&(this.velocity[t.adAxis]=0),t.wsAxis!==this.data.wsAxis&&(this.velocity[t.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(t){var e,n,i,r,o,a=this.data,l=this.keys,c=this.velocity;if(n=a.adAxis,r=a.wsAxis,t>.2)return c[n]=0,void(c[r]=0);var h=Math.pow(1/this.easing,60*t);0!==c[n]&&(c[n]=c[n]*h),0!==c[r]&&(c[r]=c[r]*h),Math.abs(c[n]){var i=n("./src/core/component.js").registerComponent,r=n("./src/utils/tracked-controls.js"),o=r.checkControllerPresentAndSetup,a=r.emitIfAxesChanged,s=r.onButtonEvent,l=n("./src/utils/index.js"),c=l.debug("components:windows-motion-controls:debug"),h=l.debug("components:windows-motion-controls:warn"),u=n("./src/constants/index.js").DEFAULT_HANDEDNESS,d=n("./src/constants/index.js").AFRAME_CDN_ROOT+"controllers/microsoft/",p={left:"left.glb",right:"right.glb",default:"universal.glb"},f=n("./src/utils/index.js").device.isWebXRAvailable,m=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,g=f?"windows-mixed-reality":"Spatial Controller (Spatial Interaction Source) ",v=f?{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"};t.exports.Component=i("windows-motion-controls",{schema:{hand:{default:u},pair:{default:0},model:{default:!0},hideDisconnected:{default:!0}},after:["tracked-controls"],mapping:v,bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this,e=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){s(e.detail.id,"down",t)},this.onButtonUp=function(e){s(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){s(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){s(e.detail.id,"touchend",t)},this.onControllerConnected=function(){t.setModelVisibility(!0)},this.onControllerDisconnected=function(){t.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},e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-error",this.onModelError),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-error",this.onModelError),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,g,{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 t=this.createControllerModelUrl();this.loadModel(t)}else this.modelReady()},createControllerModelUrl:function(t){var e=this.el.components["tracked-controls"],n=e?e.controller:null,i="default",r=this.data.hand;if(n&&!window.hasNativeWebXRImplementation&&(r=n.hand,!t)){var o=n.id.match(m);i=o&&o[0]||i}return d+i+"/"+(p[r]||p.default)},injectTrackedControls:function(){var t=this.data;this.el.setAttribute("tracked-controls",{idPrefix:g,controller:t.pair,hand:t.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(t){var e=this.createControllerModelUrl(!0);t.detail.src!==e?(h("Failed to load controller model for device, attempting to load default."),this.loadModel(e)):h("Failed to load default controller model.")},loadModel:function(t){this.el.setAttribute("gltf-model","url("+t+")")},onModelLoaded:function(t){var e,n,i,r,o=this.controllerModel=t.detail.model,a=this.loadedMeshInfo;if(t.target===this.el){if(c("Processing model"),a.buttonMeshes={},a.axisMeshes={},o){for(e=0;e{t.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("./src/constants/keyboardevent.js")}},"./src/constants/keyboardevent.js":t=>{t.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}}},"./src/core/a-assets.js":(t,e,n)=>{var i=n("./src/core/a-node.js").ANode,r=n("./src/utils/debug.js"),o=n("./src/lib/three.js"),a=new o.FileLoader,s=r("core:a-assets:warn");function l(t){if(t.hasAttribute("autoplay")||"auto"===t.getAttribute("preload"))return new Promise((function(e,n){if(4===t.readyState)return e();if(t.error)return n();function i(){for(var n=0,i=0;i=t.duration&&("VIDEO"===t.tagName&&o.Cache.add(t.getAttribute("src"),t),e())}t.addEventListener("loadeddata",i,!1),t.addEventListener("progress",i,!1),t.addEventListener("error",n,!1)}))}function c(t){var e=function(t){var e;if(t.hasAttribute("crossorigin"))return t;if(null!==(e=t.getAttribute("src"))){if(-1===e.indexOf("://"))return t;if(function(t){var e=t.indexOf("://")>-1?t.split("/")[2]:t.split("/")[0];return e.substring(0,e.indexOf(":"))}(e)===window.location.host)return t}return s('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., )',e),t.crossOrigin="anonymous",t.cloneNode(!0)}(t);return e.tagName&&"video"===e.tagName.toLowerCase()&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")),e!==t&&(t.parentNode.appendChild(e),t.parentNode.removeChild(t)),e}function h(t){var e=u(t),n=e.lastIndexOf(".");return n>=0&&".glb"===e.slice(n,t.search(/\?|#|$/))?"arraybuffer":"text"}function u(t){var e=document.createElement("a");e.href=t;var n=e.search.replace(/^\?/,""),i=t.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}doConnectedCallback(){var t,e,n,i,r,a,h=this,u=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error(" must be a child of a .");for(r=this.querySelectorAll("img"),t=0;t{var i=n("./src/utils/debug.js")("core:cubemap:warn");class r extends HTMLElement{constructor(t){return t=super(t)}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 t,e=this.querySelectorAll("[src]"),n=[];if(6===e.length){for(t=0;t did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",r)},"./src/core/a-entity.js":(t,e,n)=>{var i=n("./src/core/a-node.js").ANode,r=n("./src/core/component.js").components,o=n("./src/lib/three.js"),a=n("./src/utils/index.js"),s=a.debug("core:a-entity:debug"),l=a.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 o.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(t,e,n){var i=this.components[t];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(t,e,n)}doConnectedCallback(){var t,e,n=this;super.doConnectedCallback(),e=this.sceneEl,this.addToParent(),this.isScene||(e?!(t=e.querySelector("a-assets"))||t.hasLoaded?this.load():t.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var t;if(this.parentEl){for(t in this.components)this.removeComponent(t,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(t){return this.object3DMap[t]}setObject3D(t,e){var n,i=this;if(!(e instanceof o.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(t))&&this.object3D.remove(n),e.el=this,e.children.length&&e.traverse((function(t){t.el=i})),this.object3D.add(e),this.object3DMap[t]=e,this.emit("object3dset",{object:e,type:t})}removeObject3D(t){var e=this.getObject3D(t);e?(this.object3D.remove(e),delete this.object3DMap[t],this.emit("object3dremove",{type:t})):l("Tried to remove `Object3D` of type:",t,"which was not defined.")}getOrCreateObject3D(t,e){var n=this.getObject3D(t);return!n&&e&&(n=new e,this.setObject3D(t,n)),l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(t){if(!t.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(t.object3D),this.emit("child-attached",{el:t})}addToParent(){var t=this.parentEl=this.parentNode;t&&t.add&&!this.attachedToParent&&(t.add(this),this.attachedToParent=!0)}removeFromParent(){var t=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,t.emit("child-detached",{el:this})}load(){var t=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){t.parentEl&&(t.updateComponents(),(t.isScene||t.parentEl.isPlaying)&&t.play())}))}remove(t){t?this.object3D.remove(t.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var t=this.children,e=[],n=0;n2?l.slice(1).join("__"):l[1],r[h]&&(p(this,t)||void 0!==e||n)&&(t in this.components||(this.initComponentDependencies(h),i=new r[h].Component(this,e,o),this.isPlaying&&i.play(),this.hasAttribute(t)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,t,"")),s("Component initialized: %s",t)))}initComponentDependencies(t){var e,n;if(r[t]&&(e=r[t].dependencies))for(n=0;n0?t.substring(0,l):t,!r[s])return"mixin"===t&&this.mixinUpdate(e),void super.setAttribute.call(this,t,e);if(!this.components[t]&&this.hasAttribute(t)&&this.updateComponent(t,window.HTMLElement.prototype.getAttribute.call(this,t)),"undefined"!==typeof n&&"string"===typeof e&&e.length>0&&"string"===typeof a.styleParser.parse(e)){for(h in u)delete u[h];(i=u)[e]=n,o=!1}else i=e,o=!0===n;this.updateComponent(t,i,o),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[t].flushToDOM()}flushToDOM(t){var e,n,i,r=this.components,o=this.children;for(i in r)r[i].flushToDOM();if(t)for(n=0;n{var i=n("./src/core/a-node.js").ANode,r=n("./src/core/component.js").components,o=n("./src/utils/index.js"),a=o.styleParser;customElements.define("a-mixin",class extends i{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(t,e,n){super.attributeChangedCallback(),this.cacheAttribute(t,n),this.updateEntities()}setAttribute(t,e){window.HTMLElement.prototype.setAttribute.call(this,t,e),this.cacheAttribute(t,e)}cacheAttribute(t,e){var n,i;i=o.split(t,"__")[0],n=r[i],void 0===e&&(e=window.HTMLElement.prototype.getAttribute.call(this,t)),this.rawAttributeCache[t]=e,n&&(this.componentCache[t]=this.parseComponentAttrValue(n,e))}parseComponentAttrValue(t,e){var n;return"string"!==typeof e?e:(t.isSingleProperty?"string"===typeof(n=t.schema.parse(e))&&(n=e):n=a.parse(e),n)}getAttribute(t){return this.componentCache[t]||window.HTMLElement.prototype.getAttribute.call(this,t)}cacheAttributes(){var t,e,n=this.attributes;for(e=0;e{var i=n("./src/utils/index.js"),r=n("./src/core/readyState.js"),o=i.debug("core:a-node:warn"),a={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function s(t){return t.tagName.toLowerCase()in a||t.isNode}class l extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){r.canInitializeElements?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var t;this.sceneEl=this.closestScene(),this.sceneEl||o("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||(t=this.getAttribute("mixin"))&&this.updateMixins(t)}attributeChangedCallback(t,e,n){n!==this.computedMixinStr&&("mixin"!==t||this.isMixin||this.updateMixins(n,e))}closestScene(){for(var t=this;t&&!t.isScene;)t=t.parentElement;return t}closest(t){for(var e=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!e.call(n,t);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(t,e){var n,i=this;this.hasLoaded||(e=e||s,n=this.getChildren().filter(e).map((function(t){return new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(e){e.forEach((function(t){"rejected"===t.status&&o("Rendering scene with errors on node: ",t.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),t&&t(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var t=this;new MutationObserver((function(e){var n;for(n=0;n{var i=n("./src/core/schema.js"),r=n("./src/core/scene/scenes.js"),o=n("./src/core/system.js"),a=n("./src/utils/index.js"),s=t.exports.components={},l=i.parseProperty,c=i.process,h=i.isSingleProperty,u=i.stringifyProperties,d=i.stringifyProperty,p=a.styleParser,f=a.debug("core:component:warn"),m=document.currentScript,g=new RegExp("[A-Z]+"),v={},A=Object.freeze({}),y=[],_={get:function(t,e){return t.getComputedPropertyValue(e)},set:function(t,e,n){return e in t.schema?t.recomputeProperty(e,n):void 0!==n&&t.handleUnknownProperty(e,n),!0}},x=t.exports.Component=function(t,e,n){var i=this;if(this.sceneOnly&&!t.isScene)throw new Error("Component `"+this.name+"` can only be applied to ");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=t,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(t,e){var n;for(n in e)t.events[n]=e[n].bind(t)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),a.objectPool.removeUnusedKeys(this.data,this.schema),this.oldData=this.objectPool.use(),a.objectPool.removeUnusedKeys(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,_)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.silenceUnknownPropertyWarnings=!1,this.throttledEmitComponentChanged=a.throttleLeadingAndTrailing((function(){t.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(e,!0)};if(x.prototype={schema:{},init:function(){},events:{},update:function(t){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(t){var e=this.schema;return"string"===typeof t?t:this.isSingleProperty?d(t,e):(t=u(t,e),p.stringify(t))},flushToDOM:function(t){var e=t?this.data:this.attrValue;null!==e&&void 0!==e&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(e))},updateProperties:function(t,e){var n=this.el;this.updateData(t,e),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var t,e=this.el;e.initializingComponents[this.name]||(e.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete e.initializingComponents[this.name],t=this.isObjectBased?A:void 0,this.dataChanged=!1,this.storeOldData(),this.update(t),e.isPlaying&&this.play(),e.emit("componentinitialized",this.evtDetail,!1))},updateData:function(t,e){this.isSingleProperty?this.recomputeProperty(void 0,t):(e?(a.objectPool.clearObject(this.attrValue),this.recomputeData(t),this.schemaChangeRequired=!!this.updateSchema):"string"===typeof t?p.parse(t,this.attrValueProxy):a.extend(this.attrValueProxy,t),this.updateSchemaIfNeeded(t))},updateSchemaIfNeeded:function(t){if(this.schemaChangeRequired&&this.updateSchema)y.length=0,this.updateSchema(this.data),a.objectPool.removeUnusedKeys(this.data,this.schema),this.silenceUnknownPropertyWarnings=!0,this.recomputeData(t),this.silenceUnknownPropertyWarnings=!1,this.schemaChangeRequired=!1;else{for(var e=0;e=0;i--){var r=e[i].getAttribute(this.attrName);if(null!==r&&(!t||t in r))return t?r[t]:r}return t?this.schema[t].default:this.schema.default},recomputeProperty:function(t,e){var n=t?this.schema[t]:this.schema;if(void 0!==e&&null!==e){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=t?this.attrValue[t]:this.attrValue;"string"===typeof(i=n.isCacheable?l(e,n,i):e)&&(i=""===e?void 0:e),t?this.attrValue[t]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),a.objectPool.removeUnusedKeys(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=t?this.oldData[t]:this.oldData,o=t?this.data[t]:this.data,s=l(this.getComputedPropertyValue(t),n,o);return"array"!==n.type||t||(s=a.clone(s)),n.equals(s,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),t?this.data[t]=s:this.data=s,s},handleUnknownProperty:function(t,e){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[t]=e,this.silenceUnknownPropertyWarnings||(this.deferUnknownPropertyWarnings?y.push(t):this.silenceUnknownPropertyWarnings||f("Unknown property `"+t+"` for component `"+this.name+"`."))},storeOldData:function(){var t;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=l(this.data,this.schema,this.oldData);else for(t in this.schema)void 0!==this.data[t]&&(this.data[t]&&"object"===typeof this.data[t]?this.oldData[t]=l(this.data[t],this.schema[t],this.oldData[t]):this.oldData[t]=this.data[t]);else this.oldData=this.data},recomputeData:function(t){var e;if(this.isSingleProperty)this.recomputeProperty(void 0,t);else{if(t&&"object"===typeof t)for(e in this.schema)this.attrValueProxy[e]=t[e];else for(e in this.schema)this.attrValueProxy[e]=void 0;for(e in"string"===typeof t&&p.parse(t,this.attrValueProxy),this.attrValue)void 0!==this.attrValue[e]&&-1!==y.indexOf(e)&&(e in this.schema||f("Unknown property `"+e+"` for component `"+this.name+"`."))}},eventsAttach:function(){var t;for(t in this.eventsDetach(),this.events)this.el.addEventListener(t,this.events[t])},eventsDetach:function(){var t;for(t in this.events)this.el.removeEventListener(t,this.events[t])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}},window.debug)var b=t.exports.registrationOrderWarnings={};function E(t){return t.tick||t.tock}function w(t){return t&&t.constructor===Object&&!(t instanceof window.HTMLElement)}t.exports.registerComponent=function(t,e){var n,i,u,d,p,A={};if(document.currentScript&&document.currentScript!==m&&r.forEach((function(e){e.hasLoaded||document.currentScript.compareDocumentPosition(e)!==Node.DOCUMENT_POSITION_FOLLOWING&&(f("The component `"+t+"` was registered in a